diff options
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/global.c | 22 | ||||
| -rw-r--r-- | mps/code/message.c | 2 | ||||
| -rw-r--r-- | mps/code/mpm.h | 6 | ||||
| -rw-r--r-- | mps/code/mpmst.h | 4 |
4 files changed, 20 insertions, 14 deletions
diff --git a/mps/code/global.c b/mps/code/global.c index b86f9baaca9..d8fef857619 100644 --- a/mps/code/global.c +++ b/mps/code/global.c | |||
| @@ -193,7 +193,7 @@ Bool GlobalsCheck(Globals arenaGlobals) | |||
| 193 | 193 | ||
| 194 | CHECKL(arena->tracedSize >= 0.0); | 194 | CHECKL(arena->tracedSize >= 0.0); |
| 195 | CHECKL(arena->tracedTime >= 0.0); | 195 | CHECKL(arena->tracedTime >= 0.0); |
| 196 | CHECKL(arena->lastWorldCollect >= 0); | 196 | /* no check for arena->lastWorldCollect (Clock) */ |
| 197 | 197 | ||
| 198 | /* can't write a check for arena->epoch */ | 198 | /* can't write a check for arena->epoch */ |
| 199 | 199 | ||
| @@ -277,7 +277,7 @@ Res GlobalsInit(Globals arenaGlobals) | |||
| 277 | arena->flippedTraces = TraceSetEMPTY; /* <code/trace.c> */ | 277 | arena->flippedTraces = TraceSetEMPTY; /* <code/trace.c> */ |
| 278 | arena->tracedSize = 0.0; | 278 | arena->tracedSize = 0.0; |
| 279 | arena->tracedTime = 0.0; | 279 | arena->tracedTime = 0.0; |
| 280 | arena->lastWorldCollect = mps_clock(); | 280 | arena->lastWorldCollect = ClockNow(); |
| 281 | arena->insideShield = FALSE; /* <code/shield.c> */ | 281 | arena->insideShield = FALSE; /* <code/shield.c> */ |
| 282 | arena->shCacheI = (Size)0; | 282 | arena->shCacheI = (Size)0; |
| 283 | arena->shCacheLimit = (Size)1; | 283 | arena->shCacheLimit = (Size)1; |
| @@ -636,8 +636,8 @@ void ArenaPoll(Globals globals) | |||
| 636 | static Bool arenaShouldCollectWorld(Arena arena, | 636 | static Bool arenaShouldCollectWorld(Arena arena, |
| 637 | double interval, | 637 | double interval, |
| 638 | double multiplier, | 638 | double multiplier, |
| 639 | Word now, | 639 | Clock now, |
| 640 | Word clocks_per_sec) | 640 | Clock clocks_per_sec) |
| 641 | { | 641 | { |
| 642 | double scanRate; | 642 | double scanRate; |
| 643 | Size arenaSize; | 643 | Size arenaSize; |
| @@ -680,8 +680,8 @@ Bool ArenaStep(Globals globals, double interval, double multiplier) | |||
| 680 | double size; | 680 | double size; |
| 681 | Size scanned; | 681 | Size scanned; |
| 682 | Bool stepped; | 682 | Bool stepped; |
| 683 | Word start, end, now; | 683 | Clock start, end, now; |
| 684 | Word clocks_per_sec; | 684 | Clock clocks_per_sec; |
| 685 | Arena arena; | 685 | Arena arena; |
| 686 | 686 | ||
| 687 | AVERT(Globals, globals); | 687 | AVERT(Globals, globals); |
| @@ -689,10 +689,10 @@ Bool ArenaStep(Globals globals, double interval, double multiplier) | |||
| 689 | AVER(multiplier >= 0.0); | 689 | AVER(multiplier >= 0.0); |
| 690 | 690 | ||
| 691 | arena = GlobalsArena(globals); | 691 | arena = GlobalsArena(globals); |
| 692 | clocks_per_sec = mps_clocks_per_sec(); | 692 | clocks_per_sec = ClocksPerSec(); |
| 693 | 693 | ||
| 694 | start = mps_clock(); | 694 | start = ClockNow(); |
| 695 | end = start + (Word)(interval * clocks_per_sec); | 695 | end = start + (Clock)(interval * clocks_per_sec); |
| 696 | AVER(end >= start); | 696 | AVER(end >= start); |
| 697 | 697 | ||
| 698 | stepped = FALSE; | 698 | stepped = FALSE; |
| @@ -708,7 +708,7 @@ Bool ArenaStep(Globals globals, double interval, double multiplier) | |||
| 708 | /* loop while there is work to do and time on the clock. */ | 708 | /* loop while there is work to do and time on the clock. */ |
| 709 | do { | 709 | do { |
| 710 | scanned = TracePoll(globals); | 710 | scanned = TracePoll(globals); |
| 711 | now = mps_clock(); | 711 | now = ClockNow(); |
| 712 | if (scanned > 0) { | 712 | if (scanned > 0) { |
| 713 | stepped = TRUE; | 713 | stepped = TRUE; |
| 714 | arena->tracedSize += scanned; | 714 | arena->tracedSize += scanned; |
| @@ -968,7 +968,7 @@ Res GlobalsDescribe(Globals arenaGlobals, mps_lib_FILE *stream) | |||
| 968 | 968 | ||
| 969 | /* C. COPYRIGHT AND LICENSE | 969 | /* C. COPYRIGHT AND LICENSE |
| 970 | * | 970 | * |
| 971 | * Copyright (C) 2001-2003 Ravenbrook Limited <http://www.ravenbrook.com/>. | 971 | * Copyright (C) 2001-2003, 2008 Ravenbrook Limited <http://www.ravenbrook.com/>. |
| 972 | * All rights reserved. This is an open source license. Contact | 972 | * All rights reserved. This is an open source license. Contact |
| 973 | * Ravenbrook for commercial licensing options. | 973 | * Ravenbrook for commercial licensing options. |
| 974 | * | 974 | * |
diff --git a/mps/code/message.c b/mps/code/message.c index f92d8d571e4..a09cc02a536 100644 --- a/mps/code/message.c +++ b/mps/code/message.c | |||
| @@ -125,7 +125,7 @@ void MessagePost(Arena arena, Message message) | |||
| 125 | /* Setting clock involves mpslib call, so only do it for rare */ | 125 | /* Setting clock involves mpslib call, so only do it for rare */ |
| 126 | /* messages. Currently: all messages except finalization. */ | 126 | /* messages. Currently: all messages except finalization. */ |
| 127 | if(message->type != MessageTypeFINALIZATION) { | 127 | if(message->type != MessageTypeFINALIZATION) { |
| 128 | message->postedClock = mps_clock(); | 128 | message->postedClock = ClockNow(); |
| 129 | } | 129 | } |
| 130 | RingAppend(&arena->messageRing, &message->queueRing); | 130 | RingAppend(&arena->messageRing, &message->queueRing); |
| 131 | } else { | 131 | } else { |
diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 7fd53f15127..717eda1f9d9 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h | |||
| @@ -119,6 +119,12 @@ extern int (AddrComp)(Addr a, Addr b, Size size); | |||
| 119 | #define ADDR_PTR(type, addr) ((type *)(addr)) | 119 | #define ADDR_PTR(type, addr) ((type *)(addr)) |
| 120 | 120 | ||
| 121 | 121 | ||
| 122 | /* Clock */ | ||
| 123 | |||
| 124 | #define ClockNow() ((Clock)mps_clock()) | ||
| 125 | #define ClocksPerSec() ((Clock)mps_clocks_per_sec()) | ||
| 126 | |||
| 127 | |||
| 122 | /* Result codes */ | 128 | /* Result codes */ |
| 123 | 129 | ||
| 124 | extern Bool ResIsAllocFailure(Res res); | 130 | extern Bool ResIsAllocFailure(Res res); |
diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index 7cb111fc281..af5e2d89fd6 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h | |||
| @@ -709,7 +709,7 @@ typedef struct ArenaStruct { | |||
| 709 | /* policy fields */ | 709 | /* policy fields */ |
| 710 | double tracedSize; | 710 | double tracedSize; |
| 711 | double tracedTime; | 711 | double tracedTime; |
| 712 | Word lastWorldCollect; | 712 | Clock lastWorldCollect; |
| 713 | 713 | ||
| 714 | RingStruct greyRing[RankLIMIT]; /* ring of grey segments at each rank */ | 714 | RingStruct greyRing[RankLIMIT]; /* ring of grey segments at each rank */ |
| 715 | STATISTIC_DECL(Count writeBarrierHitCount); /* write barrier hits */ | 715 | STATISTIC_DECL(Count writeBarrierHitCount); /* write barrier hits */ |
| @@ -734,7 +734,7 @@ typedef struct AllocPatternStruct { | |||
| 734 | 734 | ||
| 735 | /* C. COPYRIGHT AND LICENSE | 735 | /* C. COPYRIGHT AND LICENSE |
| 736 | * | 736 | * |
| 737 | * Copyright (C) 2001-2003, 2006 Ravenbrook Limited <http://www.ravenbrook.com/>. | 737 | * Copyright (C) 2001-2003, 2006, 2008 Ravenbrook Limited <http://www.ravenbrook.com/>. |
| 738 | * All rights reserved. This is an open source license. Contact | 738 | * All rights reserved. This is an open source license. Contact |
| 739 | * Ravenbrook for commercial licensing options. | 739 | * Ravenbrook for commercial licensing options. |
| 740 | * | 740 | * |