aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorRichard Brooksby2012-09-05 23:45:31 +0100
committerRichard Brooksby2012-09-05 23:45:31 +0100
commit27c6706791b24c09800f76e37f76817c62df7425 (patch)
tree44af05e5f3b72122dc6f5bc52d9f3d892ac02786 /mps/code
parentdda987d8648efafba3be06d1c56e6b14c6a654b7 (diff)
parentd1e7efe7b6de7914395153db36500645652cc5f2 (diff)
downloademacs-27c6706791b24c09800f76e37f76817c62df7425.tar.gz
emacs-27c6706791b24c09800f76e37f76817c62df7425.zip
Merging branch/2012-08-21/diagnostic-telemetry.
Copied from Perforce Change: 179289 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/arena.c17
-rw-r--r--mps/code/arenacl.c2
-rw-r--r--mps/code/arenavm.c12
-rw-r--r--mps/code/buffer.c18
-rw-r--r--mps/code/cbs.c2
-rw-r--r--mps/code/comm.gmk8
-rw-r--r--mps/code/commpost.nmk7
-rw-r--r--mps/code/commpre.nmk3
-rw-r--r--mps/code/config.h33
-rw-r--r--mps/code/dumper.c196
-rw-r--r--mps/code/event.c338
-rw-r--r--mps/code/event.h159
-rw-r--r--mps/code/eventcnv.c297
-rw-r--r--mps/code/eventcom.h288
-rw-r--r--mps/code/eventdef.h695
-rw-r--r--mps/code/eventgen.h1051
-rw-r--r--mps/code/eventgen.pl220
-rw-r--r--mps/code/eventpro.c166
-rw-r--r--mps/code/eventpro.h12
-rw-r--r--mps/code/eventrep.c4
-rw-r--r--mps/code/global.c5
-rw-r--r--mps/code/locus.c1
-rw-r--r--mps/code/meter.c4
-rw-r--r--mps/code/misc.h2
-rw-r--r--mps/code/mpm.h2
-rw-r--r--mps/code/mpsi.c2
-rw-r--r--mps/code/mpsliban.c4
-rw-r--r--mps/code/pool.c6
-rw-r--r--mps/code/poolamc.c32
-rw-r--r--mps/code/poolams.c2
-rw-r--r--mps/code/poolawl.c2
-rw-r--r--mps/code/poollo.c2
-rw-r--r--mps/code/poolmfs.c2
-rw-r--r--mps/code/poolmrg.c2
-rw-r--r--mps/code/poolmv.c2
-rw-r--r--mps/code/poolmv2.c2
-rw-r--r--mps/code/poolmvff.c2
-rw-r--r--mps/code/pooln.c2
-rw-r--r--mps/code/poolsnc.c2
-rw-r--r--mps/code/replay.c9
-rw-r--r--mps/code/reserv.c4
-rw-r--r--mps/code/root.c2
-rw-r--r--mps/code/seg.c12
-rw-r--r--mps/code/trace.c46
-rw-r--r--mps/code/vman.c8
-rw-r--r--mps/code/vmix.c8
-rw-r--r--mps/code/vmw3.c8
47 files changed, 1482 insertions, 2221 deletions
diff --git a/mps/code/arena.c b/mps/code/arena.c
index c3fe88ebf19..e17cc3970ef 100644
--- a/mps/code/arena.c
+++ b/mps/code/arena.c
@@ -219,6 +219,11 @@ Res ArenaCreateV(Arena *arenaReturn, ArenaClass class, va_list args)
219 AVER(arenaReturn != NULL); 219 AVER(arenaReturn != NULL);
220 AVERT(ArenaClass, class); 220 AVERT(ArenaClass, class);
221 221
222 /* We must initialise the event subsystem very early, because event logging
223 will start as soon as anything interesting happens and expect to write
224 to the EventLast pointers. */
225 EventInit();
226
222 /* Do initialization. This will call ArenaInit (see .init.caller). */ 227 /* Do initialization. This will call ArenaInit (see .init.caller). */
223 res = (*class->init)(&arena, class, args); 228 res = (*class->init)(&arena, class, args);
224 if (res != ResOK) 229 if (res != ResOK)
@@ -529,7 +534,7 @@ Res ArenaAlloc(Addr *baseReturn, SegPref pref, Size size, Pool pool,
529 if (res == ResOK) 534 if (res == ResOK)
530 goto goodAlloc; 535 goto goodAlloc;
531 } 536 }
532 EVENT_PWP(ArenaAllocFail, arena, size, pool); 537 EVENT3(ArenaAllocFail, arena, size, pool);
533 return res; 538 return res;
534 539
535goodAlloc: 540goodAlloc:
@@ -537,7 +542,7 @@ goodAlloc:
537 arena->lastTract = baseTract; 542 arena->lastTract = baseTract;
538 arena->lastTractBase = base; 543 arena->lastTractBase = base;
539 544
540 EVENT_PPAWP(ArenaAlloc, arena, baseTract, base, size, pool); 545 EVENT5(ArenaAlloc, arena, baseTract, base, size, pool);
541 *baseReturn = base; 546 *baseReturn = base;
542 return ResOK; 547 return ResOK;
543} 548}
@@ -577,7 +582,7 @@ void ArenaFree(Addr base, Size size, Pool pool)
577 ReservoirDeposit(reservoir, base, size); 582 ReservoirDeposit(reservoir, base, size);
578 } 583 }
579 584
580 EVENT_PAW(ArenaFree, arena, base, size); 585 EVENT3(ArenaFree, arena, base, size);
581 return; 586 return;
582} 587}
583 588
@@ -616,7 +621,7 @@ void ArenaSetSpareCommitLimit(Arena arena, Size limit)
616 arena->class->spareCommitExceeded(arena); 621 arena->class->spareCommitExceeded(arena);
617 } 622 }
618 623
619 EVENT_PW(SpareCommitLimitSet, arena, limit); 624 EVENT2(SpareCommitLimitSet, arena, limit);
620 return; 625 return;
621} 626}
622 627
@@ -658,7 +663,7 @@ Res ArenaSetCommitLimit(Arena arena, Size limit)
658 arena->commitLimit = limit; 663 arena->commitLimit = limit;
659 res = ResOK; 664 res = ResOK;
660 } 665 }
661 EVENT_PWU(CommitLimitSet, arena, limit, (res == ResOK)); 666 EVENT3(CommitLimitSet, arena, limit, (res == ResOK));
662 return res; 667 return res;
663} 668}
664 669
@@ -690,7 +695,7 @@ Res ArenaExtend(Arena arena, Addr base, Size size)
690 if (res != ResOK) 695 if (res != ResOK)
691 return res; 696 return res;
692 697
693 EVENT_PAW(ArenaExtend, arena, base, size); 698 EVENT3(ArenaExtend, arena, base, size);
694 return ResOK; 699 return ResOK;
695} 700}
696 701
diff --git a/mps/code/arenacl.c b/mps/code/arenacl.c
index 2238dddb4f6..d76a6d9a485 100644
--- a/mps/code/arenacl.c
+++ b/mps/code/arenacl.c
@@ -236,7 +236,7 @@ static Res ClientArenaInit(Arena *arenaReturn, ArenaClass class,
236 /* arena if the size is not a power of 2. */ 236 /* arena if the size is not a power of 2. */
237 arena->zoneShift = SizeFloorLog2(size >> MPS_WORD_SHIFT); 237 arena->zoneShift = SizeFloorLog2(size >> MPS_WORD_SHIFT);
238 238
239 EVENT_PWA(ArenaCreateCL, arena, size, base); 239 EVENT3(ArenaCreateCL, arena, size, base);
240 AVERT(ClientArena, clientArena); 240 AVERT(ClientArena, clientArena);
241 *arenaReturn = arena; 241 *arenaReturn = arena;
242 return ResOK; 242 return ResOK;
diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c
index 0f6f3ab47b2..ca2188c04b1 100644
--- a/mps/code/arenavm.c
+++ b/mps/code/arenavm.c
@@ -529,9 +529,9 @@ static Res VMArenaInit(Arena *arenaReturn, ArenaClass class, va_list args)
529 529
530 AVERT(VMArena, vmArena); 530 AVERT(VMArena, vmArena);
531 if ((ArenaClass)mps_arena_class_vm() == class) 531 if ((ArenaClass)mps_arena_class_vm() == class)
532 EVENT_PWW(ArenaCreateVM, arena, userSize, chunkSize); 532 EVENT3(ArenaCreateVM, arena, userSize, chunkSize);
533 else 533 else
534 EVENT_PWW(ArenaCreateVMNZ, arena, userSize, chunkSize); 534 EVENT3(ArenaCreateVMNZ, arena, userSize, chunkSize);
535 *arenaReturn = arena; 535 *arenaReturn = arena;
536 return ResOK; 536 return ResOK;
537 537
@@ -573,7 +573,7 @@ static void VMArenaFinish(Arena arena)
573 573
574 VMUnmap(arenaVM, VMBase(arenaVM), VMLimit(arenaVM)); 574 VMUnmap(arenaVM, VMBase(arenaVM), VMLimit(arenaVM));
575 VMDestroy(arenaVM); 575 VMDestroy(arenaVM);
576 EVENT_P(ArenaDestroy, vmArena); 576 EVENT1(ArenaDestroy, vmArena);
577} 577}
578 578
579 579
@@ -1102,7 +1102,8 @@ static Res vmArenaExtend(VMArena vmArena, Size size)
1102 break; 1102 break;
1103 } while(0); 1103 } while(0);
1104 1104
1105 1105 EVENT3(vmArenaExtendStart, size, chunkSize,
1106 VMArenaReserved(VMArena2Arena(vmArena)));
1106 DIAG_SINGLEF(( "vmArenaExtend_Start", 1107 DIAG_SINGLEF(( "vmArenaExtend_Start",
1107 "to accommodate size $W, try chunkSize $W", (WriteFW)size, (WriteFW)chunkSize, 1108 "to accommodate size $W, try chunkSize $W", (WriteFW)size, (WriteFW)chunkSize,
1108 " (VMArenaReserved currently $W bytes)\n", 1109 " (VMArenaReserved currently $W bytes)\n",
@@ -1129,6 +1130,8 @@ static Res vmArenaExtend(VMArena vmArena, Size size)
1129 /* remove slices, down to chunkHalf but no further */ 1130 /* remove slices, down to chunkHalf but no further */
1130 for(; chunkSize > chunkHalf; chunkSize -= sliceSize) { 1131 for(; chunkSize > chunkHalf; chunkSize -= sliceSize) {
1131 if(chunkSize < chunkMin) { 1132 if(chunkSize < chunkMin) {
1133 EVENT2(vmArenaExtendFail, chunkMin,
1134 VMArenaReserved(VMArena2Arena(vmArena)));
1132 DIAG_SINGLEF(( "vmArenaExtend_FailMin", 1135 DIAG_SINGLEF(( "vmArenaExtend_FailMin",
1133 "no remaining address-space chunk >= min($W)", (WriteFW)chunkMin, 1136 "no remaining address-space chunk >= min($W)", (WriteFW)chunkMin,
1134 " (so VMArenaReserved remains $W bytes)\n", 1137 " (so VMArenaReserved remains $W bytes)\n",
@@ -1145,6 +1148,7 @@ static Res vmArenaExtend(VMArena vmArena, Size size)
1145 1148
1146vmArenaExtend_Done: 1149vmArenaExtend_Done:
1147 1150
1151 EVENT2(vmArenaExtendDone, chunkSize, VMArenaReserved(VMArena2Arena(vmArena)));
1148 DIAG_SINGLEF(( "vmArenaExtend_Done", 1152 DIAG_SINGLEF(( "vmArenaExtend_Done",
1149 "Request for new chunk of VM $W bytes succeeded", (WriteFW)chunkSize, 1153 "Request for new chunk of VM $W bytes succeeded", (WriteFW)chunkSize,
1150 " (VMArenaReserved now $W bytes)\n", 1154 " (VMArenaReserved now $W bytes)\n",
diff --git a/mps/code/buffer.c b/mps/code/buffer.c
index c7dc6edd82e..f446ab5b9a0 100644
--- a/mps/code/buffer.c
+++ b/mps/code/buffer.c
@@ -361,7 +361,7 @@ void BufferDetach(Buffer buffer, Pool pool)
361 ~(BufferModeATTACHED|BufferModeFLIPPED|BufferModeTRANSITION); 361 ~(BufferModeATTACHED|BufferModeFLIPPED|BufferModeTRANSITION);
362 BufferFrameSetState(buffer, BufferFrameDISABLED); 362 BufferFrameSetState(buffer, BufferFrameDISABLED);
363 363
364 EVENT_PW(BufferEmpty, buffer, spare); 364 EVENT2(BufferEmpty, buffer, spare);
365 } 365 }
366} 366}
367 367
@@ -416,7 +416,7 @@ void BufferFinish(Buffer buffer)
416 /* Finish off the generic buffer fields. */ 416 /* Finish off the generic buffer fields. */
417 RingFinish(&buffer->poolRing); 417 RingFinish(&buffer->poolRing);
418 418
419 EVENT_P(BufferFinish, buffer); 419 EVENT1(BufferFinish, buffer);
420} 420}
421 421
422 422
@@ -682,7 +682,7 @@ void BufferAttach(Buffer buffer, Addr base, Addr limit,
682 buffer->class->attach(buffer, base, limit, init, size); 682 buffer->class->attach(buffer, base, limit, init, size);
683 683
684 AVERT(Buffer, buffer); 684 AVERT(Buffer, buffer);
685 EVENT_PWAW(BufferFill, buffer, size, base, filled); 685 EVENT4(BufferFill, buffer, size, base, filled);
686} 686}
687 687
688 688
@@ -727,7 +727,7 @@ Res BufferFill(Addr *pReturn, Buffer buffer, Size size,
727 next <= buffer->poolLimit) { 727 next <= buffer->poolLimit) {
728 buffer->apStruct.alloc = next; 728 buffer->apStruct.alloc = next;
729 if (buffer->mode & BufferModeLOGGED) { 729 if (buffer->mode & BufferModeLOGGED) {
730 EVENT_PAW(BufferReserve, buffer, buffer->apStruct.init, size); 730 EVENT3(BufferReserve, buffer, buffer->apStruct.init, size);
731 } 731 }
732 *pReturn = buffer->apStruct.init; 732 *pReturn = buffer->apStruct.init;
733 return ResOK; 733 return ResOK;
@@ -752,7 +752,7 @@ Res BufferFill(Addr *pReturn, Buffer buffer, Size size,
752 BufferAttach(buffer, base, limit, base, size); 752 BufferAttach(buffer, base, limit, base, size);
753 753
754 if (buffer->mode & BufferModeLOGGED) { 754 if (buffer->mode & BufferModeLOGGED) {
755 EVENT_PAW(BufferReserve, buffer, buffer->apStruct.init, size); 755 EVENT3(BufferReserve, buffer, buffer->apStruct.init, size);
756 } 756 }
757 757
758 *pReturn = base; 758 *pReturn = base;
@@ -869,7 +869,7 @@ Bool BufferTrip(Buffer buffer, Addr p, Size size)
869 } else { 869 } else {
870 clientClass = (Addr)0; 870 clientClass = (Addr)0;
871 } 871 }
872 EVENT_PAWA(BufferCommit, buffer, p, size, clientClass); 872 EVENT4(BufferCommit, buffer, p, size, clientClass);
873 /* Of course, it's not _really_ unused unless you're not */ 873 /* Of course, it's not _really_ unused unless you're not */
874 /* using telemetry. This is a HACK @@@@. It should be */ 874 /* using telemetry. This is a HACK @@@@. It should be */
875 /* removed when telemetry is fixed to use its arguments. */ 875 /* removed when telemetry is fixed to use its arguments. */
@@ -1089,7 +1089,7 @@ static Res bufferTrivInit (Buffer buffer, Pool pool, va_list args)
1089 AVERT(Buffer, buffer); 1089 AVERT(Buffer, buffer);
1090 AVERT(Pool, pool); 1090 AVERT(Pool, pool);
1091 UNUSED(args); 1091 UNUSED(args);
1092 EVENT_PPU(BufferInit, buffer, pool, buffer->isMutator); 1092 EVENT3(BufferInit, buffer, pool, buffer->isMutator);
1093 return ResOK; 1093 return ResOK;
1094} 1094}
1095 1095
@@ -1299,7 +1299,7 @@ static Res segBufInit (Buffer buffer, Pool pool, va_list args)
1299 segbuf->rankSet = RankSetEMPTY; 1299 segbuf->rankSet = RankSetEMPTY;
1300 1300
1301 AVERT(SegBuf, segbuf); 1301 AVERT(SegBuf, segbuf);
1302 EVENT_PPU(BufferInitSeg, buffer, pool, buffer->isMutator); 1302 EVENT3(BufferInitSeg, buffer, pool, buffer->isMutator);
1303 return ResOK; 1303 return ResOK;
1304} 1304}
1305 1305
@@ -1513,7 +1513,7 @@ static Res rankBufInit (Buffer buffer, Pool pool, va_list args)
1513 BufferSetRankSet(buffer, RankSetSingle(rank)); 1513 BufferSetRankSet(buffer, RankSetSingle(rank));
1514 1514
1515 /* There's nothing to check that the superclass doesn't, so no AVERT. */ 1515 /* There's nothing to check that the superclass doesn't, so no AVERT. */
1516 EVENT_PPUU(BufferInitRank, buffer, pool, buffer->isMutator, rank); 1516 EVENT4(BufferInitRank, buffer, pool, buffer->isMutator, rank);
1517 return ResOK; 1517 return ResOK;
1518} 1518}
1519 1519
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index c2cda567b7f..d5958990c08 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -313,7 +313,7 @@ Res CBSInit(Arena arena, CBS cbs, void *owner,
313 cbs->sig = CBSSig; 313 cbs->sig = CBSSig;
314 314
315 AVERT(CBS, cbs); 315 AVERT(CBS, cbs);
316 EVENT_PP(CBSInit, cbs, owner); 316 EVENT2(CBSInit, cbs, owner);
317 UNUSED(owner); /* @@@@ hack: unused in non-event varieties */ 317 UNUSED(owner); /* @@@@ hack: unused in non-event varieties */
318 CBSLeave(cbs); 318 CBSLeave(cbs);
319 return ResOK; 319 return ResOK;
diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk
index bdb37556c9c..7eb233f8be3 100644
--- a/mps/code/comm.gmk
+++ b/mps/code/comm.gmk
@@ -101,7 +101,6 @@ CFRASH = -DCONFIG_VAR_RASH -DNDEBUG $(CFLAGSOPT)
101CFHOT = -DCONFIG_VAR_HOT -DNDEBUG $(CFLAGSOPT) 101CFHOT = -DCONFIG_VAR_HOT -DNDEBUG $(CFLAGSOPT)
102CFDIAG = -DCONFIG_VAR_DIAG -DNDEBUG $(CFLAGSOPT) 102CFDIAG = -DCONFIG_VAR_DIAG -DNDEBUG $(CFLAGSOPT)
103CFCOOL = -DCONFIG_VAR_COOL $(CFLAGSDEBUG) 103CFCOOL = -DCONFIG_VAR_COOL $(CFLAGSDEBUG)
104CFTI = -DCONFIG_VAR_TI $(CFLAGSDEBUG)
105 104
106# Bind CFLAGS to the appropriate set of flags for the variety. 105# Bind CFLAGS to the appropriate set of flags for the variety.
107# %%VARIETY: Add a test for the variety and set CFLAGS here. 106# %%VARIETY: Add a test for the variety and set CFLAGS here.
@@ -117,10 +116,6 @@ else
117ifeq ($(VARIETY),cool) 116ifeq ($(VARIETY),cool)
118CFLAGS=$(CFLAGSCOMMON) $(CFCOOL) 117CFLAGS=$(CFLAGSCOMMON) $(CFCOOL)
119else 118else
120ifeq ($(VARIETY),ti)
121CFLAGS=$(CFLAGSCOMMON) $(CFTI)
122else
123endif
124endif 119endif
125endif 120endif
126endif 121endif
@@ -300,9 +295,6 @@ $(PFM)/diag/mps.a: \
300$(PFM)/cool/mps.a: \ 295$(PFM)/cool/mps.a: \
301 $(MPMOBJ) $(AMCOBJ) $(AMSOBJ) $(AWLOBJ) $(LOOBJ) $(SNCOBJ) \ 296 $(MPMOBJ) $(AMCOBJ) $(AMSOBJ) $(AWLOBJ) $(LOOBJ) $(SNCOBJ) \
302 $(MVFFOBJ) $(PLINTHOBJ) $(POOLNOBJ) 297 $(MVFFOBJ) $(PLINTHOBJ) $(POOLNOBJ)
303$(PFM)/ti/mps.a: \
304 $(MPMOBJ) $(AMCOBJ) $(AMSOBJ) $(AWLOBJ) $(LOOBJ) $(SNCOBJ) \
305 $(MVFFOBJ) $(PLINTHOBJ) $(POOLNOBJ)
306 298
307 299
308# OTHER GENUINE TARGETS 300# OTHER GENUINE TARGETS
diff --git a/mps/code/commpost.nmk b/mps/code/commpost.nmk
index 568b914b8fe..8d3ae7fe13e 100644
--- a/mps/code/commpost.nmk
+++ b/mps/code/commpost.nmk
@@ -118,13 +118,6 @@ $(PFM)\di\mps.lib: \
118 cl /c $(CFLAGS) /Fd$(PFM)\$(VARIETY)\ /Fo$(PFM)\$(VARIETY)\version.o version.c 118 cl /c $(CFLAGS) /Fd$(PFM)\$(VARIETY)\ /Fo$(PFM)\$(VARIETY)\version.o version.c
119 $(LIBMAN) $(LIBFLAGS) /OUT:$@ $** $(PFM)\$(VARIETY)\version.o 119 $(LIBMAN) $(LIBFLAGS) /OUT:$@ $** $(PFM)\$(VARIETY)\version.o
120 120
121$(PFM)\ti\mps.lib: \
122 $(MPMOBJ) $(AMCOBJ) $(AMSOBJ) $(AWLOBJ) $(LOOBJ) $(SNCOBJ) \
123 $(MVFFOBJ) $(PLINTHOBJ) $(POOLNOBJ)
124 $(ECHO) $@
125 cl /c $(CFLAGS) /Fd$(PFM)\$(VARIETY)\ /Fo$(PFM)\$(VARIETY)\version.o version.c
126 $(LIBMAN) $(LIBFLAGS) /OUT:$@ $** $(PFM)\$(VARIETY)\version.o
127
128 121
129# OTHER GENUINE TARGETS 122# OTHER GENUINE TARGETS
130# 123#
diff --git a/mps/code/commpre.nmk b/mps/code/commpre.nmk
index 08a3d02587d..9b0d7d08db5 100644
--- a/mps/code/commpre.nmk
+++ b/mps/code/commpre.nmk
@@ -117,7 +117,6 @@ CFRASH = /DCONFIG_VAR_RASH $(CRTFLAGSHOT) $(CFLAGSHOT) $(CFLAGSEXTERNAL)
117CFHOT = /DCONFIG_VAR_HOT $(CRTFLAGSHOT) $(CFLAGSHOT) $(CFLAGSEXTERNAL) 117CFHOT = /DCONFIG_VAR_HOT $(CRTFLAGSHOT) $(CFLAGSHOT) $(CFLAGSEXTERNAL)
118CFDIAG = /DCONFIG_VAR_DIAG $(CRTFLAGSHOT) $(CFLAGSHOT) $(CFLAGSINTERNAL) 118CFDIAG = /DCONFIG_VAR_DIAG $(CRTFLAGSHOT) $(CFLAGSHOT) $(CFLAGSINTERNAL)
119CFCOOL = /DCONFIG_VAR_COOL $(CRTFLAGSCOOL) $(CFLAGSCOOL) $(CFLAGSINTERNAL) 119CFCOOL = /DCONFIG_VAR_COOL $(CRTFLAGSCOOL) $(CFLAGSCOOL) $(CFLAGSINTERNAL)
120CFTI = /DCONFIG_VAR_TI $(CRTFLAGSCOOL) $(CFLAGSCOOL) $(CFLAGSINTERNAL)
121 120
122# Microsoft documentation is not very clear on the point of using both 121# Microsoft documentation is not very clear on the point of using both
123# optimization and debug information 122# optimization and debug information
@@ -134,7 +133,6 @@ LFRASH = $(LINKFLAGSHOT) $(LINKFLAGSEXTERNAL)
134LFHOT = $(LINKFLAGSHOT) $(LINKFLAGSEXTERNAL) 133LFHOT = $(LINKFLAGSHOT) $(LINKFLAGSEXTERNAL)
135LFDIAG = $(LINKFLAGSHOT) $(LINKFLAGSINTERNAL) 134LFDIAG = $(LINKFLAGSHOT) $(LINKFLAGSINTERNAL)
136LFCOOL = $(LINKFLAGSCOOL) $(LINKFLAGSINTERNAL) 135LFCOOL = $(LINKFLAGSCOOL) $(LINKFLAGSINTERNAL)
137LFTI = $(LINKFLAGSCOOL) $(LINKFLAGSINTERNAL)
138 136
139#LFCV = /PROFILE /DEBUG:full /DEBUGTYPE:cv 137#LFCV = /PROFILE /DEBUG:full /DEBUGTYPE:cv
140 138
@@ -147,7 +145,6 @@ LIBFLAGSRASH =
147LIBFLAGSHOT = 145LIBFLAGSHOT =
148LIBFLAGSDIAG = 146LIBFLAGSDIAG =
149LIBFLAGSCOOL = 147LIBFLAGSCOOL =
150LIBFLAGSTI =
151 148
152# Browser database manager [not used at present] 149# Browser database manager [not used at present]
153#BSC = bscmake 150#BSC = bscmake
diff --git a/mps/code/config.h b/mps/code/config.h
index 552ee2987fb..24e89da6d34 100644
--- a/mps/code/config.h
+++ b/mps/code/config.h
@@ -58,7 +58,7 @@
58 */ 58 */
59#define DIAG_WITH_STREAM_AND_WRITEF 59#define DIAG_WITH_STREAM_AND_WRITEF
60/* #define DIAG_WITH_PRINTF */ 60/* #define DIAG_WITH_PRINTF */
61/* no telemetry log events */ 61#define CONFIG_LOG
62 62
63 63
64/* CONFIG_VAR_COOL -- cool variety 64/* CONFIG_VAR_COOL -- cool variety
@@ -76,24 +76,8 @@
76#ifndef CHECKLEVEL 76#ifndef CHECKLEVEL
77#define CHECKLEVEL CheckLevelSHALLOW 77#define CHECKLEVEL CheckLevelSHALLOW
78#endif 78#endif
79/* no telemetry log events */
80
81
82/* CONFIG_VAR_TI -- telemetry variety
83 *
84 * Deprecated. This is the variety with event logging to a telemetry stream.
85 * Currently being reworked to retain event logging with negligible overhead
86 * on all other varieties. RB 2012-08-31
87 */
88
89#elif defined(CONFIG_VAR_TI) /* Telemetry, Internal; variety.ti */
90#define CONFIG_ASSERT
91#define CONFIG_ASSERT_ALL
92#ifndef CHECKLEVEL
93#define CHECKLEVEL CheckLevelSHALLOW
94#endif
95#define CONFIG_STATS
96#define CONFIG_LOG 79#define CONFIG_LOG
80#define CONFIG_LOG_ALL
97 81
98 82
99#else /* CONFIG_VAR_* */ 83#else /* CONFIG_VAR_* */
@@ -111,7 +95,7 @@
111#define CHECKLEVEL CheckLevelMINIMAL 95#define CHECKLEVEL CheckLevelMINIMAL
112#endif 96#endif
113/* no statistic meters */ 97/* no statistic meters */
114/* no telemetry log events */ 98#define CONFIG_LOG
115 99
116#endif /* CONFIG_VAR_* */ 100#endif /* CONFIG_VAR_* */
117 101
@@ -154,11 +138,17 @@
154#if defined(CONFIG_LOG) 138#if defined(CONFIG_LOG)
155/* TELEMETRY = LOG = EVENTs */ 139/* TELEMETRY = LOG = EVENTs */
156#define EVENT 140#define EVENT
141#if defined(CONFIG_LOG_ALL)
142#define EVENT_ALL 1 /* log events on critical path */
143#define MPS_LOG_STRING "logtastic"
144#else /* CONFIG_LOG_ALL, not */
145#define EVENT_ALL 0 /* don't log events on critical path */
157#define MPS_LOG_STRING "logging" 146#define MPS_LOG_STRING "logging"
158#else 147#endif /* CONFIG_LOG_ALL */
148#else /* CONFIG_LOG, not */
159#define EVENT_NONE 149#define EVENT_NONE
160#define MPS_LOG_STRING "nonlogging" 150#define MPS_LOG_STRING "nonlogging"
161#endif 151#endif /* CONFIG_LOG */
162 152
163 153
164/* CONFIG_PLINTH_NONE -- exclude the ANSI plinth 154/* CONFIG_PLINTH_NONE -- exclude the ANSI plinth
@@ -335,7 +325,6 @@
335#define RememberedSummaryBLOCK 15 325#define RememberedSummaryBLOCK 15
336 326
337 327
338
339/* Events 328/* Events
340 * 329 *
341 * EventBufferSIZE is the number of words in the global event buffer. 330 * EventBufferSIZE is the number of words in the global event buffer.
diff --git a/mps/code/dumper.c b/mps/code/dumper.c
deleted file mode 100644
index 2c87a5d9b53..00000000000
--- a/mps/code/dumper.c
+++ /dev/null
@@ -1,196 +0,0 @@
1/* dumper.c: Simple Event Dumper
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 *
6 * .readership: MM developers.
7 *
8 * .purpose: This is a simple tool to dump events as text.
9 *
10 * .trans: As a tool, it's allowed to depend on the ANSI C library.
11 */
12
13#include <stdio.h>
14#include <stddef.h>
15#include <stdlib.h>
16#include <stdarg.h>
17#include <assert.h>
18#include "mpstd.h"
19
20typedef MPS_T_WORD Word;
21typedef struct AddrStruct *Addr;
22
23#include "eventcom.h"
24
25
26#ifdef MPS_PF_W3I6MV
27#define PRIuLONGEST "llu"
28#define PRIXPTR "016llX"
29typedef unsigned long long ulongest_t;
30#else
31#define PRIuLONGEST "lu"
32#define PRIXPTR "08lX"
33typedef unsigned long ulongest_t;
34#endif
35
36
37#define RELATION(type, code, always, kind, format) \
38 case Event ## type: \
39 readEvent(#type, #format, header[0], header[1], header[2]); \
40 break;
41
42
43#define AVER(test) \
44 if(test) do {} while(0); else error("AVER: " #test)
45
46
47static char *prog;
48static FILE *progin;
49
50
51static void error (const char *format, ...) {
52 va_list args;
53 fprintf(stderr, "%s: Error: ", prog);
54 va_start(args, format);
55 vfprintf(stderr, format, args);
56 fputc('\n', stderr);
57 va_end(args);
58 exit(EXIT_FAILURE);
59 assert(0);
60}
61
62
63#define PROCESS(ch, type, _length, printfFormat, cast) \
64 case ch: { \
65 type v; \
66 size_t n = fread(&v, (_length), 1, progin); \
67 if(n < 1) \
68 error("Can't read data for format code >%c<", ch); \
69 printf(printfFormat " ", (cast)v); \
70 length -= (_length) / sizeof(Word); \
71 } break;
72
73
74static void readEvent(char *type, char *format, Word code, Word length,
75 Word cpuTime) {
76 AVER(type != NULL);
77 AVER(format != NULL);
78
79 printf("%-20s ", type);
80
81 for(; *format != '\0'; format++) {
82 switch(*format) {
83 PROCESS('A', Addr, sizeof(Addr), "0x%"PRIXPTR, ulongest_t)
84 PROCESS('P', void *, sizeof(void *), "0x%"PRIXPTR, ulongest_t)
85 PROCESS('U', unsigned, sizeof(unsigned),"%u", unsigned)
86 PROCESS('W', Word, sizeof(Word), "%"PRIuLONGEST, ulongest_t)
87 PROCESS('D', double, sizeof(double), "%f", double)
88 case 'S': {
89 size_t n;
90 char *v;
91 AVER(length > 0);
92 v = malloc(length * sizeof(Word));
93 if(v == NULL)
94 error("Can't allocate string space %u", (unsigned)length);
95 n = fread((void *)v, sizeof(Word), length, progin);
96 if(n < 1)
97 error("Can't read data for string");
98 printf("%s ", v);
99 length = 0;
100 } break;
101 case '0': break;
102 default:
103 error("Unknown format >%c<", *format);
104 break;
105 }
106 }
107 putc('\n', stdout);
108
109 AVER(length == 0);
110}
111
112
113int main(int argc, char *argv[]) {
114 Word header[3];
115 size_t arg = 1;
116
117 prog = (argc >= 1 ? argv[0] : "unknown");
118
119 /* parse options here [there aren't any] */
120
121 do {
122 if(argc <= 1) {
123 progin = stdin;
124 } else {
125 char *filename = argv[arg];
126 assert(filename != NULL);
127 progin = fopen(filename, "rb");
128 /* fopen returns NULL in error (ISO C 7.9.5.3) */
129 if(progin == NULL) {
130 error("Failed to open \"%s\".\n", filename);
131 }
132 ++arg;
133 }
134 while(!feof(progin)) {
135 size_t n;
136 n = fread(header, sizeof(Word), 3, progin);
137 if(n < 3) {
138 if(feof(progin))
139 continue;
140 error("Can't read from input");
141 }
142
143 switch(header[0]) {
144#include "eventdef.h"
145 default:
146 error("Unknown event code %"PRIXPTR, (ulongest_t)header[0]);
147 }
148 }
149 } while(arg < argc);
150
151 return(0);
152}
153
154
155
156
157/* C. COPYRIGHT AND LICENSE
158 *
159 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
160 * All rights reserved. This is an open source license. Contact
161 * Ravenbrook for commercial licensing options.
162 *
163 * Redistribution and use in source and binary forms, with or without
164 * modification, are permitted provided that the following conditions are
165 * met:
166 *
167 * 1. Redistributions of source code must retain the above copyright
168 * notice, this list of conditions and the following disclaimer.
169 *
170 * 2. Redistributions in binary form must reproduce the above copyright
171 * notice, this list of conditions and the following disclaimer in the
172 * documentation and/or other materials provided with the distribution.
173 *
174 * 3. Redistributions in any form must be accompanied by information on how
175 * to obtain complete source code for this software and any accompanying
176 * software that uses this software. The source code must either be
177 * included in the distribution or be available for no more than the cost
178 * of distribution plus a nominal fee, and must be freely redistributable
179 * under reasonable conditions. For an executable file, complete source
180 * code means the source code for all modules it contains. It does not
181 * include source code for modules or files that typically accompany the
182 * major components of the operating system on which the executable file
183 * runs.
184 *
185 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
186 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
187 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
188 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
189 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
190 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
191 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
192 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
193 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
194 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
195 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
196 */
diff --git a/mps/code/event.c b/mps/code/event.c
index 19e387abcfc..b3ef71fec2e 100644
--- a/mps/code/event.c
+++ b/mps/code/event.c
@@ -32,42 +32,84 @@ SRCID(event, "$Id$");
32 32
33 33
34static Bool eventInited = FALSE; 34static Bool eventInited = FALSE;
35static Bool eventIOInited = FALSE;
35static mps_io_t eventIO; 36static mps_io_t eventIO;
36static char eventBuffer[EventBufferSIZE];
37static Count eventUserCount; 37static Count eventUserCount;
38static Serial EventInternSerial; 38static Serial EventInternSerial;
39 39
40EventUnion EventMould; /* Used by macros in <code/event.h> */ 40/* Buffers in which events are recorded, from the top down. */
41char *EventNext, *EventLimit; /* Used by macros in <code/event.h> */ 41char EventBuffer[EventKindLIMIT][EventBufferSIZE];
42Word EventKindControl; /* Bit set used to control output. */ 42
43/* Pointers to last written event in each buffer. */
44char *EventLast[EventKindLIMIT];
45
46EventControlSet EventKindControl; /* Bit set used to control output. */
43 47
44 48
45/* EventFlush -- flush event buffer to the event stream */ 49/* EventFlush -- flush event buffer to the event stream */
46 50
47Res EventFlush(void) 51Res EventFlush(EventKind kind)
48{ 52{
49 Res res; 53 Res res;
50 54 size_t size;
55
51 AVER(eventInited); 56 AVER(eventInited);
57 AVER(0 <= kind && kind < EventKindLIMIT);
52 58
53 res = (Res)mps_io_write(eventIO, (void *)eventBuffer, 59 AVER(EventBuffer[kind] <= EventLast[kind]);
54 EventNext - eventBuffer); 60 AVER(EventLast[kind] <= EventBuffer[kind] + EventBufferSIZE);
55 EventNext = eventBuffer;
56 if (res != ResOK) return res;
57 61
58 return ResOK; 62 /* Is event logging enabled for this kind of event, or are or are we just
63 writing to the buffer for backtraces, cores, and other debugging? */
64 if (BS_IS_MEMBER(EventKindControl, kind)) {
65
66 size = (size_t)(EventBuffer[kind] + EventBufferSIZE - EventLast[kind]);
67
68 /* Checking the size avoids creating the event stream when the arena is
69 destroyed and no events have been logged. */
70 if (size == 0)
71 return ResOK;
72
73 /* Ensure the IO stream is open. We do this late so that no stream is
74 created if no events are enabled by telemetry control. */
75 if (!eventIOInited) {
76 res = (Res)mps_io_create(&eventIO);
77 if(res != ResOK)
78 goto failCreate;
79 eventIOInited = TRUE;
80 }
81
82 /* Writing might be faster if the size is aligned to a multiple of the
83 C library or kernel's buffer size. We could pad out the buffer with
84 a marker for this purpose. */
85
86 res = (Res)mps_io_write(eventIO, (void *)EventLast[kind], size);
87 if (res != ResOK)
88 goto failWrite;
89
90 }
91
92 res = ResOK;
93
94failWrite:
95failCreate:
96
97 /* Flush the in-memory buffer whether or not we succeeded, so that we can
98 record recent events there. */
99 EventLast[kind] = EventBuffer[kind] + EventBufferSIZE;
100
101 return res;
59} 102}
60 103
61 104
62/* EventSync -- synchronize the event stream with the buffers */ 105/* EventSync -- synchronize the event stream with the buffers */
63 106
64Res EventSync(void) 107void EventSync(void)
65{ 108{
66 Res resEv, resIO; 109 EventKind kind;
67 110 for (kind = 0; kind < EventKindLIMIT; ++kind)
68 resEv = EventFlush(); 111 (void)EventFlush(kind);
69 resIO = mps_io_flush(eventIO); 112 (void)mps_io_flush(eventIO);
70 return (resEv != ResOK) ? resEv : resIO;
71} 113}
72 114
73 115
@@ -75,16 +117,62 @@ Res EventSync(void)
75 117
76Res EventInit(void) 118Res EventInit(void)
77{ 119{
78 Res res; 120 /* Make local enums for all event params in order to check that the indexes
121 in the parameter definition macros are in order, and that parameter
122 idents are unique. */
123
124#define EVENT_CHECK_ENUM_PARAM(name, index, sort, ident) \
125 Event##name##Param##ident,
126
127#define EVENT_CHECK_ENUM(X, name, code, always, kind) \
128 enum Event##name##ParamEnum { \
129 EVENT_##name##_PARAMS(EVENT_CHECK_ENUM_PARAM, name) \
130 Event##name##ParamLIMIT \
131 };
132
133 EVENT_LIST(EVENT_CHECK_ENUM, X)
134
135 /* Check consistency of the event definitions. These are all compile-time
136 checks and should get optimised away. */
137
138#define EVENT_PARAM_CHECK_P(name, index, ident)
139#define EVENT_PARAM_CHECK_A(name, index, ident)
140#define EVENT_PARAM_CHECK_W(name, index, ident)
141#define EVENT_PARAM_CHECK_U(name, index, ident)
142#define EVENT_PARAM_CHECK_D(name, index, ident)
143#define EVENT_PARAM_CHECK_B(name, index, ident)
144#define EVENT_PARAM_CHECK_S(name, index, ident) \
145 AVER(index + 1 == Event##name##ParamLIMIT); /* strings must come last */
146
147#define EVENT_PARAM_CHECK(name, index, sort, ident) \
148 AVER(index == Event##name##Param##ident); \
149 AVER(sizeof(EventF##sort) >= 0); /* check existence of type */ \
150 EVENT_PARAM_CHECK_##sort(name, index, ident)
151
152#define EVENT_CHECK(X, name, code, always, kind) \
153 AVER(size_tAlignUp(sizeof(Event##name##Struct), MPS_PF_ALIGN) \
154 <= EventSizeMAX); \
155 AVER(Event##name##Code == code); \
156 AVER(0 <= code && code <= EventCodeMAX); \
157 AVER(sizeof(#name) - 1 <= EventNameMAX); \
158 AVER((Bool)Event##name##Always == always); \
159 AVERT(Bool, always); \
160 AVER(0 <= Event##name##Kind); \
161 AVER((EventKind)Event##name##Kind < EventKindLIMIT); \
162 EVENT_##name##_PARAMS(EVENT_PARAM_CHECK, name)
163
164 EVENT_LIST(EVENT_CHECK, X)
165
166 /* Ensure that no event can be larger than the maximum event size. */
167 AVER(EventBufferSIZE <= EventSizeMAX);
79 168
80 /* Only if this is the first call. */ 169 /* Only if this is the first call. */
81 if(!eventInited) { /* See .trans.log */ 170 if(!eventInited) { /* See .trans.log */
82 AVER(EventNext == 0); 171 EventKind kind;
83 AVER(EventLimit == 0); 172 for (kind = 0; kind < EventKindLIMIT; ++kind) {
84 res = (Res)mps_io_create(&eventIO); 173 AVER(EventLast[kind] == NULL);
85 if(res != ResOK) return res; 174 EventLast[kind] = EventBuffer[kind] + EventBufferSIZE;
86 EventNext = eventBuffer; 175 }
87 EventLimit = &eventBuffer[EventBufferSIZE];
88 eventUserCount = (Count)1; 176 eventUserCount = (Count)1;
89 eventInited = TRUE; 177 eventInited = TRUE;
90 EventKindControl = (Word)mps_lib_telemetry_control(); 178 EventKindControl = (Word)mps_lib_telemetry_control();
@@ -105,7 +193,7 @@ void EventFinish(void)
105 AVER(eventInited); 193 AVER(eventInited);
106 AVER(eventUserCount > 0); 194 AVER(eventUserCount > 0);
107 195
108 (void)EventSync(); 196 EventSync();
109 197
110 --eventUserCount; 198 --eventUserCount;
111} 199}
@@ -121,11 +209,14 @@ void EventFinish(void)
121 * Reset(M) EventControl(M,0) 209 * Reset(M) EventControl(M,0)
122 * Flip(M) EventControl(0,M) 210 * Flip(M) EventControl(0,M)
123 * Read() EventControl(0,0) 211 * Read() EventControl(0,0)
212 *
213 * TODO: Candy-machine interface is a transgression.
124 */ 214 */
125 215
126Word EventControl(Word resetMask, Word flipMask) 216EventControlSet EventControl(EventControlSet resetMask,
217 EventControlSet flipMask)
127{ 218{
128 Word oldValue = EventKindControl; 219 EventControlSet oldValue = EventKindControl;
129 220
130 /* EventKindControl = (EventKindControl & ~resetMask) ^ flipMask */ 221 /* EventKindControl = (EventKindControl & ~resetMask) ^ flipMask */
131 EventKindControl = 222 EventKindControl =
@@ -137,56 +228,173 @@ Word EventControl(Word resetMask, Word flipMask)
137 228
138/* EventInternString -- emit an Intern event on the (null-term) string given */ 229/* EventInternString -- emit an Intern event on the (null-term) string given */
139 230
140Word EventInternString(const char *label) 231EventStringId EventInternString(const char *label)
141{ 232{
142 Word id;
143
144 AVER(label != NULL); 233 AVER(label != NULL);
145 234 return EventInternGenString(StringLength(label), label);
146 id = (Word)EventInternSerial;
147 ++EventInternSerial;
148 EVENT_WS(Intern, id, StringLength(label), label);
149 return id;
150} 235}
151 236
152 237
153/* EventInternGenString -- emit an Intern event on the string given */ 238/* EventInternGenString -- emit an Intern event on the string given */
154 239
155Word EventInternGenString(size_t len, const char *label) 240EventStringId EventInternGenString(size_t len, const char *label)
156{ 241{
157 Word id; 242 EventStringId id;
158 243
159 AVER(label != NULL); 244 AVER(label != NULL);
160 245
161 id = (Word)EventInternSerial; 246 id = EventInternSerial;
162 ++EventInternSerial; 247 ++EventInternSerial;
163 EVENT_WS(Intern, id, len, label); 248
249 EVENT2S(Intern, id, len, label);
250
164 return id; 251 return id;
165} 252}
166 253
167 254
168/* EventLabelAddr -- emit event to label address with the given id */ 255/* EventLabelAddr -- emit event to label address with the given id */
169 256
170void EventLabelAddr(Addr addr, Word id) 257void EventLabelAddr(Addr addr, EventStringId id)
171{ 258{
172 AVER((Serial)id < EventInternSerial); 259 AVER((Serial)id < EventInternSerial);
173 260
174 EVENT_AW(Label, addr, id); 261 EVENT2(Label, addr, id);
262}
263
264
265/* Convert event parameter sort to WriteF arguments */
266
267#define EVENT_WRITE_PARAM_MOST(name, index, sort, ident) \
268 " $"#sort, (WriteF##sort)event->name.f##index,
269#define EVENT_WRITE_PARAM_A EVENT_WRITE_PARAM_MOST
270#define EVENT_WRITE_PARAM_P EVENT_WRITE_PARAM_MOST
271#define EVENT_WRITE_PARAM_U EVENT_WRITE_PARAM_MOST
272#define EVENT_WRITE_PARAM_W EVENT_WRITE_PARAM_MOST
273#define EVENT_WRITE_PARAM_D EVENT_WRITE_PARAM_MOST
274#define EVENT_WRITE_PARAM_S EVENT_WRITE_PARAM_MOST
275#define EVENT_WRITE_PARAM_B(name, index, sort, ident) \
276 " $U", (WriteFU)event->name.f##index,
277
278
279Res EventDescribe(Event event, mps_lib_FILE *stream)
280{
281 Res res;
282
283 /* TODO: Some sort of EventCheck would be good */
284 if (event == NULL)
285 return ResFAIL;
286 if (stream == NULL)
287 return ResFAIL;
288
289 res = WriteF(stream,
290 "Event $P {\n", (WriteFP)event,
291 " code $U\n", (WriteFU)event->any.code,
292 " clock ", NULL);
293 if (res != ResOK) return res;
294 res = EVENT_CLOCK_WRITE(stream, event->any.clock);
295 if (res != ResOK) return res;
296 res = WriteF(stream, "\n size $U\n", (WriteFU)event->any.size, NULL);
297 if (res != ResOK) return res;
298
299 switch (event->any.code) {
300
301#define EVENT_DESC_PARAM(name, index, sort, ident) \
302 "\n $S", (WriteFS)#ident, \
303 EVENT_WRITE_PARAM_##sort(name, index, sort, ident)
304
305#define EVENT_DESC(X, name, _code, always, kind) \
306 case _code: \
307 res = WriteF(stream, \
308 " event \"$S\"", (WriteFS)#name, \
309 EVENT_##name##_PARAMS(EVENT_DESC_PARAM, name) \
310 NULL); \
311 if (res != ResOK) return res; \
312 break;
313
314 EVENT_LIST(EVENT_DESC, X)
315
316 default:
317 res = WriteF(stream, " event type unknown", NULL);
318 if (res != ResOK) return res;
319 /* TODO: Hexdump unknown event contents. */
320 break;
321 }
322
323 res = WriteF(stream,
324 "\n} Event $P\n", (WriteFP)event,
325 NULL);
326 return res;
327}
328
329
330Res EventWrite(Event event, mps_lib_FILE *stream)
331{
332 Res res;
333
334 if (event == NULL) return ResFAIL;
335 if (stream == NULL) return ResFAIL;
336
337 res = EVENT_CLOCK_WRITE(stream, event->any.clock);
338 if (res != ResOK)
339 return res;
340
341 switch (event->any.code) {
342
343#define EVENT_WRITE_PARAM(name, index, sort, ident) \
344 EVENT_WRITE_PARAM_##sort(name, index, sort, ident)
345
346#define EVENT_WRITE(X, name, code, always, kind) \
347 case code: \
348 res = WriteF(stream, " $S", #name, \
349 EVENT_##name##_PARAMS(EVENT_WRITE_PARAM, name) \
350 NULL); \
351 if (res != ResOK) return res; \
352 break;
353 EVENT_LIST(EVENT_WRITE, X)
354
355 default:
356 res = WriteF(stream, " <unknown code $U>", event->any.code, NULL);
357 if (res != ResOK) return res;
358 /* TODO: Hexdump unknown event contents. */
359 break;
360 }
361
362 return ResOK;
363}
364
365
366void EventDump(mps_lib_FILE *stream)
367{
368 Event event;
369 EventKind kind;
370
371 AVER(stream != NULL);
372
373 for (kind = 0; kind < EventKindLIMIT; ++kind) {
374 for (event = (Event)EventLast[kind];
375 event < (Event)(EventBuffer[kind] + EventBufferSIZE);
376 event = (Event)((char *)event + event->any.size)) {
377 /* Try to keep going even if there's an error, because this is used as a
378 backtrace and we'll take what we can get. */
379 (void)EventWrite(event, stream);
380 (void)WriteF(stream, "\n", NULL);
381 }
382 }
175} 383}
176 384
177 385
178#else /* EVENT, not */ 386#else /* EVENT, not */
179 387
180 388
181Res (EventSync)(void) 389void (EventSync)(void)
182{ 390{
183 return(ResOK); 391 NOOP;
184} 392}
185 393
186 394
187Res (EventInit)(void) 395Res (EventInit)(void)
188{ 396{
189 return(ResOK); 397 return ResOK;
190} 398}
191 399
192 400
@@ -196,28 +404,30 @@ void (EventFinish)(void)
196} 404}
197 405
198 406
199Word (EventControl)(Word resetMask, Word flipMask) 407EventControlSet (EventControl)(EventControlSet resetMask,
408 EventControlSet flipMask)
200{ 409{
201 UNUSED(resetMask); 410 UNUSED(resetMask);
202 UNUSED(flipMask); 411 UNUSED(flipMask);
203 412 return BS_EMPTY(EventControlSet);
204 return (Word)0;
205} 413}
206 414
207 415
208Word (EventInternString)(const char *label) 416EventStringId (EventInternString)(const char *label)
209{ 417{
210 UNUSED(label); 418 UNUSED(label);
211 419 /* EventInternString is reached in varieties without events, but the result
212 return (Word)0; 420 is not used for anything. */
421 return (EventStringId)0x9024EAC8;
213} 422}
214 423
215 424
216Word (EventInternGenString)(size_t len, const char *label) 425Word (EventInternGenString)(size_t len, const char *label)
217{ 426{
218 UNUSED(len); UNUSED(label); 427 UNUSED(len); UNUSED(label);
219 428 /* EventInternGenString is reached in varieties without events, but
220 return (Word)0; 429 the result is not used for anything. */
430 return (EventStringId)0x9024EAC8;
221} 431}
222 432
223 433
@@ -225,6 +435,30 @@ void (EventLabelAddr)(Addr addr, Word id)
225{ 435{
226 UNUSED(addr); 436 UNUSED(addr);
227 UNUSED(id); 437 UNUSED(id);
438 /* EventLabelAddr is reached in varieties without events, but doesn't have
439 to do anything. */
440}
441
442
443Res EventDescribe(Event event, mps_lib_FILE *stream)
444{
445 UNUSED(event);
446 UNUSED(stream);
447 return ResUNIMPL;
448}
449
450
451Res EventWrite(Event event, mps_lib_FILE *stream)
452{
453 UNUSED(event);
454 UNUSED(stream);
455 return ResUNIMPL;
456}
457
458
459extern void EventDump(mps_lib_FILE *stream)
460{
461 UNUSED(stream);
228} 462}
229 463
230 464
diff --git a/mps/code/event.h b/mps/code/event.h
index a8bd82e3979..81899ae34e6 100644
--- a/mps/code/event.h
+++ b/mps/code/event.h
@@ -17,96 +17,123 @@
17 17
18#include "eventcom.h" 18#include "eventcom.h"
19#include "mpm.h" 19#include "mpm.h"
20#include "eventdef.h"
21#include "mpslib.h"
22
20 23
24typedef Word EventStringId;
25typedef Word EventControlSet;
21 26
22extern Res EventSync(void); 27extern void EventSync(void);
23extern Res EventInit(void); 28extern Res EventInit(void);
24extern void EventFinish(void); 29extern void EventFinish(void);
25extern Word EventControl(Word, Word); 30extern EventControlSet EventControl(EventControlSet resetMask,
26extern Word EventInternString(const char *); 31 EventControlSet flipMask);
27extern Word EventInternGenString(size_t, const char *); 32extern EventStringId EventInternString(const char *label);
28extern void EventLabelAddr(Addr, Word); 33extern EventStringId EventInternGenString(size_t, const char *label);
34extern void EventLabelAddr(Addr addr, Word id);
35extern Res EventFlush(EventKind kind);
36extern Res EventDescribe(Event event, mps_lib_FILE *stream);
37extern Res EventWrite(Event event, mps_lib_FILE *stream);
38extern void EventDump(mps_lib_FILE *stream);
29 39
30 40
31#ifdef EVENT 41#ifdef EVENT
32 42
43/* Event writing support */
33 44
34extern Res EventFlush(void); 45extern char EventBuffer[EventKindLIMIT][EventBufferSIZE];
35 46extern char *EventLast[EventKindLIMIT];
47extern Word EventKindControl;
36 48
37/* Event Kinds --- see <design/telemetry/>
38 *
39 * All events are classified as being of one event type.
40 * They are small enough to be able to be used as shifts within a word.
41 */
42 49
43#define EventKindArena ((EventKind)0) /* Per space or arena */ 50/* Events are written into the buffer from the top down, so that a backtrace
44#define EventKindPool ((EventKind)1) /* Per pool */ 51 can find them all starting at EventNext. */
45#define EventKindTrace ((EventKind)2) /* Per trace or scan */
46#define EventKindSeg ((EventKind)3) /* Per seg */
47#define EventKindRef ((EventKind)4) /* Per ref or fix */
48#define EventKindObject ((EventKind)5) /* Per alloc or object */
49#define EventKindUser ((EventKind)6) /* User-invoked */
50 52
51#define EventKindNumber ((Count)7) /* Number of event kinds */ 53#define EVENT_BEGIN(name, structSize) \
54 BEGIN \
55 if(EVENT_ALL || Event##name##Always) { /* see config.h */ \
56 Event##name##Struct *_event; \
57 size_t _size = size_tAlignUp(structSize, MPS_PF_ALIGN); \
58 if (_size > (size_t)(EventLast[Event##name##Kind] \
59 - EventBuffer[Event##name##Kind])) \
60 EventFlush(Event##name##Kind); \
61 AVER(_size <= (size_t)(EventLast[Event##name##Kind] \
62 - EventBuffer[Event##name##Kind])); \
63 _event = (void *)(EventLast[Event##name##Kind] - _size); \
64 _event->code = Event##name##Code; \
65 _event->size = (EventSize)_size; \
66 EVENT_CLOCK(_event->clock);
67
68#define EVENT_END(name, size) \
69 EventLast[Event##name##Kind] -= _size; \
70 } \
71 END
52 72
53 73
54/* Event type definitions 74/* EVENTn -- event emitting macros
55 * 75 *
56 * Define various constants for each event type to describe them. 76 * The macros EVENT0, EVENT1, etc. are used throughout the MPS to emit an
77 * event with parameters. They work by appending the event parameters to
78 * an event buffer, which is flushed to the telemetry output stream when
79 * full. EVENT2S is a special case that takes a variable length string.
57 */ 80 */
58 81
59/* Note that enum values can be up to fifteen bits long portably. */ 82#define EVENT2S(name, p0, length, string) \
60#define RELATION(type, code, always, kind, format) \
61 enum { \
62 Event##type##High = ((code >> 8) & 0xFF), \
63 Event##type##Low = (code & 0xFF), \
64 Event##type##Always = always, \
65 Event##type##Kind = EventKind##kind, \
66 Event##type##Format = EventFormat##format \
67 };
68
69#include "eventdef.h"
70
71#undef RELATION
72
73
74/* Event writing support */
75
76extern EventUnion EventMould;
77extern char *EventNext, *EventLimit;
78extern Word EventKindControl;
79
80#define EVENT_BEGIN(type) \
81 BEGIN \ 83 BEGIN \
82 if(BS_IS_MEMBER(EventKindControl, ((Index)Event##type##Kind))) { \ 84 size_t _string_len = (length); \
83 size_t _length; 85 size_t size; \
84 86 AVER(_string_len <= EventStringLengthMAX); \
85#define EVENT_END(type, format, length) \ 87 size = offsetof(Event##name##Struct, f1) + _string_len + sizeof('\0'); \
86 AVER(EventFormat##format == Event##type##Format); \ 88 EVENT_BEGIN(name, size) \
87 /* @@@@ As an interim measure, send the old event codes */ \ 89 _event->f0 = (p0); \
88 EventMould.any.code = Event##type; \ 90 mps_lib_memcpy(_event->f1, (string), _string_len); \
89 EventMould.any.clock = mps_clock(); \ 91 _event->f1[_string_len] = '\0'; \
90 AVER(EventNext <= EventLimit); \ 92 EVENT_END(name, size); \
91 _length = size_tAlignUp(length, sizeof(Word)); \
92 if(_length > (size_t)(EventLimit - EventNext)) \
93 EventFlush(); /* @@@@ should pass length */ \
94 AVER(_length <= (size_t)(EventLimit - EventNext)); \
95 mps_lib_memcpy(EventNext, &EventMould, _length); \
96 EventNext += _length; \
97 } \
98 END 93 END
99 94
100 95
96#define EVENT0(name) EVENT_BEGIN(name, sizeof(EventAnyStruct)) EVENT_END(name, sizeof(EventAnyStruct))
97/* The following lines were generated with
98 python -c 'for i in range(1,15): print "#define EVENT%d(name, %s) EVENT_BEGIN(name, sizeof(Event##name##Struct)) %s EVENT_END(name, sizeof(Event##name##Struct))" % (i, ", ".join(["p%d" % j for j in range(0, i)]), " ".join(["_event->f%d = (p%d);" % (j, j) for j in range(0, i)]))'
99 */
100#define EVENT1(name, p0) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); EVENT_END(name, sizeof(Event##name##Struct))
101#define EVENT2(name, p0, p1) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); EVENT_END(name, sizeof(Event##name##Struct))
102#define EVENT3(name, p0, p1, p2) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); EVENT_END(name, sizeof(Event##name##Struct))
103#define EVENT4(name, p0, p1, p2, p3) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); EVENT_END(name, sizeof(Event##name##Struct))
104#define EVENT5(name, p0, p1, p2, p3, p4) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); EVENT_END(name, sizeof(Event##name##Struct))
105#define EVENT6(name, p0, p1, p2, p3, p4, p5) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); EVENT_END(name, sizeof(Event##name##Struct))
106#define EVENT7(name, p0, p1, p2, p3, p4, p5, p6) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); _event->f6 = (p6); EVENT_END(name, sizeof(Event##name##Struct))
107#define EVENT8(name, p0, p1, p2, p3, p4, p5, p6, p7) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); _event->f6 = (p6); _event->f7 = (p7); EVENT_END(name, sizeof(Event##name##Struct))
108#define EVENT9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); _event->f6 = (p6); _event->f7 = (p7); _event->f8 = (p8); EVENT_END(name, sizeof(Event##name##Struct))
109#define EVENT10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); _event->f6 = (p6); _event->f7 = (p7); _event->f8 = (p8); _event->f9 = (p9); EVENT_END(name, sizeof(Event##name##Struct))
110#define EVENT11(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); _event->f6 = (p6); _event->f7 = (p7); _event->f8 = (p8); _event->f9 = (p9); _event->f10 = (p10); EVENT_END(name, sizeof(Event##name##Struct))
111#define EVENT12(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); _event->f6 = (p6); _event->f7 = (p7); _event->f8 = (p8); _event->f9 = (p9); _event->f10 = (p10); _event->f11 = (p11); EVENT_END(name, sizeof(Event##name##Struct))
112#define EVENT13(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); _event->f6 = (p6); _event->f7 = (p7); _event->f8 = (p8); _event->f9 = (p9); _event->f10 = (p10); _event->f11 = (p11); _event->f12 = (p12); EVENT_END(name, sizeof(Event##name##Struct))
113#define EVENT14(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) EVENT_BEGIN(name, sizeof(Event##name##Struct)) _event->f0 = (p0); _event->f1 = (p1); _event->f2 = (p2); _event->f3 = (p3); _event->f4 = (p4); _event->f5 = (p5); _event->f6 = (p6); _event->f7 = (p7); _event->f8 = (p8); _event->f9 = (p9); _event->f10 = (p10); _event->f11 = (p11); _event->f12 = (p12); _event->f13 = (p13); EVENT_END(name, sizeof(Event##name##Struct))
114
115
101#else /* EVENT not */ 116#else /* EVENT not */
102 117
103 118
104#define EventInit() NOOP 119#define EVENT0(name) NOOP
105#define EventFinish() NOOP 120/* The following lines were generated with
106#define EventControl(r, f) (UNUSED(r), UNUSED(f), (Word)0) 121 python -c 'for i in range(1,15): print "#define EVENT%d(name, %s) NOOP" % (i, ", ".join(["p%d" % j for j in range(0, i)]))'
107#define EventInternString(s) (UNUSED(s), (Word)0) 122 */
108#define EventInternGenString(l, s) (UNUSED(l), UNUSED(s), (Word)0) 123#define EVENT1(name, p0) NOOP
109#define EventLabelAddr(a, i) BEGIN UNUSED(a); UNUSED(i); END 124#define EVENT2(name, p0, p1) NOOP
125#define EVENT3(name, p0, p1, p2) NOOP
126#define EVENT4(name, p0, p1, p2, p3) NOOP
127#define EVENT5(name, p0, p1, p2, p3, p4) NOOP
128#define EVENT6(name, p0, p1, p2, p3, p4, p5) NOOP
129#define EVENT7(name, p0, p1, p2, p3, p4, p5, p6) NOOP
130#define EVENT8(name, p0, p1, p2, p3, p4, p5, p6, p7) NOOP
131#define EVENT9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8) NOOP
132#define EVENT10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) NOOP
133#define EVENT11(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) NOOP
134#define EVENT12(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) NOOP
135#define EVENT13(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) NOOP
136#define EVENT14(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) NOOP
110 137
111 138
112#endif /* EVENT */ 139#endif /* EVENT */
diff --git a/mps/code/eventcnv.c b/mps/code/eventcnv.c
index 6ea83810985..8e1ba9aecb2 100644
--- a/mps/code/eventcnv.c
+++ b/mps/code/eventcnv.c
@@ -1,13 +1,29 @@
1/* eventcnv.c: Simple event log converter 1/* eventcnv.c: Simple event log converter
2 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. 2 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
3 * 3 *
4 * This is a command-line tool that converts a binary format telemetry output
5 * stream from the MPS into several textual formats.
6 *
7 * The default MPS library will write a telemetry stream to a file called
8 * "mpsio.log" when the environment variable MPS_TELEMETRY_CONTROL is set
9 * to an integer whose bits select event kinds. For example:
10 *
11 * MPS_TELEMETRY_CONTROL=7 amcss
12 *
13 * will run the amcss test program and emit a file with event kinds 0, 1, 2.
14 * The file can then be converted into text format with a command like:
15 *
16 * eventcnv -v | sort
17 *
18 * Note that the eventcnv program can only read streams that come from an
19 * MPS compiled on the same platform.
20 *
4 * $Id$ 21 * $Id$
5 */ 22 */
6 23
7#include "config.h" 24#include "config.h"
8/* override variety setting for EVENT */
9#define EVENT
10 25
26#include "eventdef.h"
11#include "eventcom.h" 27#include "eventcom.h"
12#include "eventpro.h" 28#include "eventpro.h"
13#include "mpmtypes.h" 29#include "mpmtypes.h"
@@ -34,7 +50,7 @@ typedef unsigned int uint;
34typedef unsigned long ulong; 50typedef unsigned long ulong;
35 51
36 52
37static Word eventTime; /* current event time */ 53static EventClock eventTime; /* current event time */
38 54
39 55
40/* event counters */ 56/* event counters */
@@ -54,7 +70,6 @@ static Bool verbose = FALSE;
54static char style = '\0'; 70static char style = '\0';
55static Bool reportEvents = FALSE; 71static Bool reportEvents = FALSE;
56static Bool eventEnabled[EventCodeMAX+1]; 72static Bool eventEnabled[EventCodeMAX+1];
57static Bool partialLog = FALSE;
58static Word bucketSize = 0; 73static Word bucketSize = 0;
59 74
60 75
@@ -80,7 +95,7 @@ static void usage(void)
80{ 95{
81 fprintf(stderr, 96 fprintf(stderr,
82 "Usage: %s [-f logfile] [-p] [-v] [-e events] [-b size]" 97 "Usage: %s [-f logfile] [-p] [-v] [-e events] [-b size]"
83 " [-S[LC]] [-?]\nSee guide.mps.telemetry for instructions.", 98 " [-S[LC]] [-?]\nSee guide.mps.telemetry for instructions.\n",
84 prog); 99 prog);
85} 100}
86 101
@@ -146,9 +161,6 @@ static char *parseArgs(int argc, char *argv[])
146 else 161 else
147 name = argv[i]; 162 name = argv[i];
148 break; 163 break;
149 case 'p': /* partial log */
150 partialLog = TRUE;
151 break;
152 case 'v': /* verbosity */ 164 case 'v': /* verbosity */
153 verbose = TRUE; 165 verbose = TRUE;
154 break; 166 break;
@@ -189,7 +201,7 @@ static char *parseArgs(int argc, char *argv[])
189 201
190/* processEvent -- process event */ 202/* processEvent -- process event */
191 203
192static void processEvent(EventProc proc, Event event, Word etime) 204static void processEvent(EventProc proc, Event event, EventClock etime)
193{ 205{
194 Res res; 206 Res res;
195 207
@@ -208,14 +220,13 @@ static void processEvent(EventProc proc, Event event, Word etime)
208 220
209/* printStr -- print an EventString */ 221/* printStr -- print an EventString */
210 222
211static void printStr(EventString str, Bool quotes) 223static void printStr(const char *str, Bool quotes)
212{ 224{
213 size_t i, len; 225 size_t i;
214 226
215 if (quotes) putchar('"'); 227 if (quotes) putchar('"');
216 len = str->len; 228 for (i = 0; str[i] != '\0'; ++i) {
217 for (i = 0; i < len; ++ i) { 229 char c = str[i];
218 char c = str->str[i];
219 if (quotes && (c == '"' || c == '\\')) putchar('\\'); 230 if (quotes && (c == '"' || c == '\\')) putchar('\\');
220 putchar(c); 231 putchar(c);
221 } 232 }
@@ -232,7 +243,7 @@ static void printAddr(EventProc proc, Addr addr)
232 label = AddrLabel(proc, addr); 243 label = AddrLabel(proc, addr);
233 if (label != 0 && addr != 0) { 244 if (label != 0 && addr != 0) {
234 /* We assume labelling zero is meant to record a point in time */ 245 /* We assume labelling zero is meant to record a point in time */
235 EventString sym = LabelText(proc, label); 246 const char *sym = LabelText(proc, label);
236 if (sym != NULL) { 247 if (sym != NULL) {
237 putchar(' '); 248 putchar(' ');
238 printStr(sym, (style == 'C')); 249 printStr(sym, (style == 'C'));
@@ -288,17 +299,19 @@ static void reportEventResults(eventCountArray eventCounts)
288 299
289/* reportBucketResults -- report results of the current bucket */ 300/* reportBucketResults -- report results of the current bucket */
290 301
291static void reportBucketResults(Word bucketLimit) 302static void reportBucketResults(EventClock bucketLimit)
292{ 303{
293 switch (style) { 304 switch (style) {
294 case '\0': 305 case '\0':
295 printf("%8"PRIuLONGEST":", (ulongest_t)bucketLimit); 306 EVENT_CLOCK_PRINT(stdout, bucketLimit);
307 putchar(':');
296 break; 308 break;
297 case 'L': 309 case 'L':
298 printf("(%"PRIXLONGEST, (ulongest_t)bucketLimit); 310 putchar('(');
311 EVENT_CLOCK_PRINT(stdout, bucketLimit);
299 break; 312 break;
300 case 'C': 313 case 'C':
301 printf("%"PRIuLONGEST, (ulongest_t)bucketLimit); 314 EVENT_CLOCK_PRINT(stdout, bucketLimit);
302 break; 315 break;
303 } 316 }
304 if (reportEvents) { 317 if (reportEvents) {
@@ -327,51 +340,62 @@ static void clearBucket(void)
327 * some event types that are handled specially. 340 * some event types that are handled specially.
328 */ 341 */
329 342
330static void printArg(EventProc proc, 343static void printParamA(EventProc proc, char *styleConv, Addr addr)
331 void *arg, char argType, char *styleConv)
332{ 344{
333 switch (argType) { 345 if (style != 'L') {
334 case 'A': {
335 if (style != 'L') {
336 if (style == 'C') putchar(',');
337 printAddr(proc, *(Addr *)arg);
338 } else
339 printf(styleConv, (ulongest_t)*(Addr *)arg);
340 } break;
341 case 'P': {
342 printf(styleConv, (ulongest_t)*(void **)arg);
343 } break;
344 case 'U': {
345 printf(styleConv, (ulongest_t)*(unsigned *)arg);
346 } break;
347 case 'W': {
348 printf(styleConv, (ulongest_t)*(Word *)arg);
349 } break;
350 case 'D': {
351 switch (style) {
352 case '\0':
353 printf(" %#8.3g", *(double *)arg); break;
354 case 'C':
355 printf(", %.10G", *(double *)arg); break;
356 case 'L':
357 printf(" %#.10G", *(double *)arg); break;
358 }
359 } break;
360 case 'S': {
361 if (style == 'C') putchar(','); 346 if (style == 'C') putchar(',');
362 putchar(' '); 347 printAddr(proc, addr);
363 printStr((EventStringStruct *)arg, (style == 'C' || style == 'L')); 348 } else
364 } break; 349 printf(styleConv, (ulongest_t)addr);
365 default: everror("Can't print format >%c<", argType); 350}
351
352static void printParamP(EventProc proc, char *styleConv, void *p)
353{
354 UNUSED(proc);
355 printf(styleConv, (ulongest_t)p);
356}
357
358static void printParamU(EventProc proc, char *styleConv, unsigned u)
359{
360 UNUSED(proc);
361 printf(styleConv, (ulongest_t)u);
362}
363
364static void printParamW(EventProc proc, char *styleConv, Word w)
365{
366 UNUSED(proc);
367 printf(styleConv, (ulongest_t)w);
368}
369
370static void printParamD(EventProc proc, char *styleConv, double d)
371{
372 UNUSED(proc);
373 UNUSED(styleConv);
374 switch (style) {
375 case '\0':
376 printf(" %#8.3g", d); break;
377 case 'C':
378 printf(", %.10G", d); break;
379 case 'L':
380 printf(" %#.10G", d); break;
366 } 381 }
367} 382}
368 383
384static void printParamS(EventProc proc, char *styleConv, const char *s)
385{
386 UNUSED(proc);
387 UNUSED(styleConv);
388 if (style == 'C') putchar(',');
389 putchar(' ');
390 printStr(s, (style == 'C' || style == 'L'));
391}
369 392
370#define RELATION(name, code, always, kind, format) \ 393static void printParamB(EventProc proc, char *styleConv, Bool b)
371 case code: { \ 394{
372 printArg(proc, EVENT_##format##_FIELD_PTR(event, i), \ 395 UNUSED(proc);
373 eventFormat[i], styleConv); \ 396 UNUSED(proc);
374 } break; 397 printf(styleConv, (ulongest_t)b);
398}
375 399
376 400
377static void readLog(EventProc proc) 401static void readLog(EventProc proc)
@@ -409,8 +433,6 @@ static void readLog(EventProc proc)
409 } 433 }
410 434
411 while (TRUE) { /* loop for each event */ 435 while (TRUE) { /* loop for each event */
412 char *eventFormat;
413 size_t argCount, i;
414 Event event; 436 Event event;
415 EventCode code; 437 EventCode code;
416 Res res; 438 Res res;
@@ -420,7 +442,7 @@ static void readLog(EventProc proc)
420 if (res == ResFAIL) break; /* eof */ 442 if (res == ResFAIL) break; /* eof */
421 if (res != ResOK) everror("Truncated log"); 443 if (res != ResOK) everror("Truncated log");
422 eventTime = event->any.clock; 444 eventTime = event->any.clock;
423 code = EventGetCode(event); 445 code = event->any.code;
424 446
425 /* Output bucket, if necessary, and update counters */ 447 /* Output bucket, if necessary, and update counters */
426 if (bucketSize != 0 && eventTime >= bucketLimit) { 448 if (bucketSize != 0 && eventTime >= bucketLimit) {
@@ -437,108 +459,115 @@ static void readLog(EventProc proc)
437 459
438 /* Output event. */ 460 /* Output event. */
439 if (verbose) { 461 if (verbose) {
440 eventFormat = EventCode2Format(code);
441 argCount = strlen(eventFormat);
442 if (eventFormat[0] == '0') argCount = 0;
443
444 if (style == 'L') putchar('('); 462 if (style == 'L') putchar('(');
445 463
446 switch (style) { 464 switch (style) {
465 case '\0': case 'L':
466 EVENT_CLOCK_PRINT(stdout, eventTime);
467 putchar(' ');
468 break;
469 case 'C':
470 EVENT_CLOCK_PRINT(stdout, eventTime);
471 fputs(", ", stdout);
472 break;
473 }
474
475 switch (style) {
447 case '\0': case 'L': { 476 case '\0': case 'L': {
448 printf("%-19s", EventCode2Name(code)); 477 printf("%-19s ", EventCode2Name(code));
449 } break; 478 } break;
450 case 'C': 479 case 'C':
451 printf("%u", (unsigned)code); 480 printf("%u", (unsigned)code);
452 break; 481 break;
453 } 482 }
454 483
455 switch (style) {
456 case '\0':
457 printf(" %8"PRIuLONGEST, (ulongest_t)eventTime); break;
458 case 'C':
459 printf(", %"PRIuLONGEST, (ulongest_t)eventTime); break;
460 case 'L':
461 printf(" %"PRIXLONGEST, (ulongest_t)eventTime); break;
462 }
463
464 switch (event->any.code) { 484 switch (event->any.code) {
465 case EventLabel: { 485
486 case EventLabelCode:
466 switch (style) { 487 switch (style) {
467 case '\0': case 'C': { 488 case '\0': case 'C':
468 EventString sym = LabelText(proc, event->aw.w1); 489 {
469 printf(style == '\0' ? 490 const char *sym = LabelText(proc, event->Label.f1);
470 " %08"PRIXLONGEST" " :
471 ", %"PRIuLONGEST", ",
472 (ulongest_t)event->aw.a0);
473 if (sym != NULL) {
474 printStr(sym, (style == 'C'));
475 } else {
476 printf(style == '\0' ? 491 printf(style == '\0' ?
477 "sym %05"PRIXLONGEST : 492 " %08"PRIXLONGEST" " :
478 "sym %"PRIXLONGEST"\"", 493 ", %"PRIuLONGEST", ",
479 (ulongest_t)event->aw.w1); 494 (ulongest_t)event->Label.f0);
495 if (sym != NULL) {
496 printStr(sym, (style == 'C'));
497 } else {
498 printf(style == '\0' ?
499 "sym %05"PRIXLONGEST :
500 "sym %"PRIXLONGEST"\"",
501 (ulongest_t)event->Label.f1);
502 }
480 } 503 }
481 } break; 504 break;
482 case 'L': { 505 case 'L':
483 printf(" %"PRIXLONGEST" %"PRIXLONGEST, 506 printf(" %"PRIXLONGEST" %"PRIXLONGEST,
484 (ulongest_t)event->aw.a0, 507 (ulongest_t)event->Label.f0,
485 (ulongest_t)event->aw.w1); 508 (ulongest_t)event->Label.f1);
486 } break; 509 break;
487 } 510 }
488 } break; 511 break;
489 case EventMeterValues: { 512
513 case EventMeterValuesCode:
490 switch (style) { 514 switch (style) {
491 case '\0': { 515 case '\0':
492 if (event->pddwww.w3 == 0) { 516 if (event->MeterValues.f3 == 0) {
493 printf(" %08"PRIXLONGEST" 0 N/A N/A N/A N/A", 517 printf(" %08"PRIXLONGEST" 0 N/A N/A N/A N/A",
494 (ulongest_t)event->pddwww.p0); 518 (ulongest_t)event->MeterValues.f0);
495 } else { 519 } else {
496 double mean = event->pddwww.d1 / (double)event->pddwww.w3; 520 double mean = event->MeterValues.f1 / (double)event->MeterValues.f3;
497 /* .stddev: stddev = sqrt(meanSquared - mean^2), but see */ 521 /* .stddev: stddev = sqrt(meanSquared - mean^2), but see */
498 /* <code/meter.c#limitation.variance>. */ 522 /* <code/meter.c#limitation.variance>. */
499 double stddev = sqrt(fabs(event->pddwww.d2 523 double stddev = sqrt(fabs(event->MeterValues.f2
500 - (mean * mean))); 524 - (mean * mean)));
501 printf(" %08"PRIXLONGEST" %8u %8u %8u %#8.3g %#8.3g", 525 printf(" %08"PRIXLONGEST" %8u %8u %8u %#8.3g %#8.3g",
502 (ulongest_t)event->pddwww.p0, (uint)event->pddwww.w3, 526 (ulongest_t)event->MeterValues.f0, (uint)event->MeterValues.f3,
503 (uint)event->pddwww.w4, (uint)event->pddwww.w5, 527 (uint)event->MeterValues.f4, (uint)event->MeterValues.f5,
504 mean, stddev); 528 mean, stddev);
505 } 529 }
506 printAddr(proc, (Addr)event->pddwww.p0); 530 printAddr(proc, (Addr)event->MeterValues.f0);
507 } break; 531 break;
508 case 'C': { 532
533 case 'C':
509 putchar(','); 534 putchar(',');
510 printAddr(proc, (Addr)event->pddwww.p0); 535 printAddr(proc, (Addr)event->MeterValues.f0);
511 printf(", %.10G, %.10G, %u, %u, %u", 536 printf(", %.10G, %.10G, %u, %u, %u",
512 event->pddwww.d1, event->pddwww.d2, 537 event->MeterValues.f1, event->MeterValues.f2,
513 (uint)event->pddwww.w3, (uint)event->pddwww.w4, 538 (uint)event->MeterValues.f3, (uint)event->MeterValues.f4,
514 (uint)event->pddwww.w5); 539 (uint)event->MeterValues.f5);
515 } break; 540 break;
516 case 'L': { 541
542 case 'L':
517 printf(" %"PRIXLONGEST" %#.10G %#.10G %X %X %X", 543 printf(" %"PRIXLONGEST" %#.10G %#.10G %X %X %X",
518 (ulongest_t)event->pddwww.p0, 544 (ulongest_t)event->MeterValues.f0,
519 event->pddwww.d1, event->pddwww.d2, 545 event->MeterValues.f1, event->MeterValues.f2,
520 (uint)event->pddwww.w3, (uint)event->pddwww.w4, 546 (uint)event->MeterValues.f3, (uint)event->MeterValues.f4,
521 (uint)event->pddwww.w5); 547 (uint)event->MeterValues.f5);
522 } break; 548 break;
523 } 549 }
524 } break; 550 break;
525 case EventPoolInit: { /* pool, arena, class */ 551
526 printf(styleConv, (ulongest_t)event->ppp.p0); 552 case EventPoolInitCode: /* pool, arena, class */
527 printf(styleConv, (ulongest_t)event->ppp.p1); 553 printf(styleConv, (ulongest_t)event->PoolInit.f0);
554 printf(styleConv, (ulongest_t)event->PoolInit.f1);
528 /* class is a Pointer, but we label them, so call printAddr */ 555 /* class is a Pointer, but we label them, so call printAddr */
529 if (style != 'L') { 556 if (style != 'L') {
530 if (style == 'C') putchar(','); 557 if (style == 'C') putchar(',');
531 printAddr(proc, (Addr)event->ppp.p2); 558 printAddr(proc, (Addr)event->PoolInit.f2);
532 } else 559 } else
533 printf(styleConv, (ulongest_t)event->ppp.p2); 560 printf(styleConv, (ulongest_t)event->PoolInit.f2);
534 } break; 561 break;
562
535 default: 563 default:
536 for (i = 0; i < argCount; ++i) { 564#define EVENT_PARAM_PRINT(name, index, sort, ident) \
537 switch(code) { 565 printParam##sort(proc, styleConv, event->name.f##index);
538#include "eventdef.h" 566#define EVENT_PRINT(X, name, code, always, kind) \
539#undef RELATION 567 case code: \
540 } 568 EVENT_##name##_PARAMS(EVENT_PARAM_PRINT, name) \
541 } 569 break;
570 switch (event->any.code) { EVENT_LIST(EVENT_PRINT, X) }
542 } 571 }
543 572
544 if (style == 'L') putchar(')'); 573 if (style == 'L') putchar(')');
@@ -563,7 +592,7 @@ static void readLog(EventProc proc)
563 printf("(t"); 592 printf("(t");
564 } break; 593 } break;
565 case 'C': { 594 case 'C': {
566 printf("%lu", eventTime+1); 595 EVENT_CLOCK_PRINT(stdout, eventTime+1);
567 } break; 596 } break;
568 } 597 }
569 reportEventResults(totalEventCount); 598 reportEventResults(totalEventCount);
@@ -575,7 +604,9 @@ static void readLog(EventProc proc)
575 if (eventEnabled[c]) 604 if (eventEnabled[c])
576 printf(" %04X %s\n", (unsigned)c, EventCode2Name(c)); 605 printf(" %04X %s\n", (unsigned)c, EventCode2Name(c));
577 if (bucketSize == 0) 606 if (bucketSize == 0)
578 printf("\nevent clock stopped at %"PRIuLONGEST"\n", (ulongest_t)eventTime); 607 printf("\nevent clock stopped at ");
608 EVENT_CLOCK_PRINT(stdout, eventTime);
609 printf("\n");
579 } 610 }
580 } 611 }
581} 612}
@@ -611,7 +642,7 @@ int main(int argc, char *argv[])
611 assert(CHECKCONV(ulongest_t, Word)); 642 assert(CHECKCONV(ulongest_t, Word));
612 assert(CHECKCONV(ulongest_t, Addr)); 643 assert(CHECKCONV(ulongest_t, Addr));
613 assert(CHECKCONV(ulongest_t, void *)); 644 assert(CHECKCONV(ulongest_t, void *));
614 assert(CHECKCONV(unsigned, EventCode)); 645 assert(CHECKCONV(ulongest_t, EventCode));
615 assert(CHECKCONV(Addr, void *)); /* for labelled pointers */ 646 assert(CHECKCONV(Addr, void *)); /* for labelled pointers */
616 647
617 filename = parseArgs(argc, argv); 648 filename = parseArgs(argc, argv);
@@ -624,7 +655,7 @@ int main(int argc, char *argv[])
624 everror("unable to open \"%s\"\n", filename); 655 everror("unable to open \"%s\"\n", filename);
625 } 656 }
626 657
627 res = EventProcCreate(&proc, partialLog, logReader, (void *)input); 658 res = EventProcCreate(&proc, logReader, (void *)input);
628 if (res != ResOK) 659 if (res != ResOK)
629 everror("Can't init EventProc module: error %d.", res); 660 everror("Can't init EventProc module: error %d.", res);
630 661
diff --git a/mps/code/eventcom.h b/mps/code/eventcom.h
index aa0dbb80882..c0eca4b7b15 100644
--- a/mps/code/eventcom.h
+++ b/mps/code/eventcom.h
@@ -9,142 +9,202 @@
9#ifndef eventcom_h 9#ifndef eventcom_h
10#define eventcom_h 10#define eventcom_h
11 11
12/* #include "eventgen.h" later in the file */ 12#include <limits.h>
13#include "mpmtypes.h" /* for Word */ 13#include "mpmtypes.h" /* for Word */
14#include "eventdef.h"
14 15
15 16
16/* Types for event fields */ 17/* EVENT_CLOCK -- fast event timestamp clock
18 *
19 * On platforms that support it, we want to stamp events with a very cheap
20 * and fast high-resolution timer.
21 */
22
23/* TODO: Clang supposedly provides a cross-platform builtin for a fast
24 timer, but it doesn't seem to be present on Mac OS X 10.8. We should
25 use it if it ever appears.
26 <http://clang.llvm.org/docs/LanguageExtensions.html#builtins> */
27#if defined(MPS_BUILD_LL)
28
29#if __has_builtin(__builtin_readcyclecounter)
30#error "__builtin_readcyclecounter is available but not used"
31#endif /* __has_builtin(__builtin_readcyclecounter) */
32
33#endif
34
35/* Microsoft C provides an intrinsic for the Intel rdtsc instruction.
36 <http://msdn.microsoft.com/en-US/library/twchhe95%28v=vs.100%29.aspx> */
37#if (defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && defined(MPS_BUILD_MV)
17 38
39#pragma intrinsic(__rdtsc)
18 40
19typedef Word EventType; 41typedef unsigned __int64 EventClock;
20typedef size_t EventCode;
21typedef Index EventKind;
22 42
23typedef Byte EventStringLen; 43#define EVENT_CLOCK(lvalue) \
44 BEGIN \
45 (lvalue) = __rdtsc(); \
46 END
24 47
25typedef struct { 48#define EVENT_CLOCK_PRINT(stream, clock) fprintf(stream, "%llX", clock)
26 EventStringLen len;
27 char str[EventStringLengthMAX];
28} EventStringStruct;
29 49
30typedef EventStringStruct *EventString; 50#if defined(MPS_ARCH_I3)
51#define EVENT_CLOCK_WRITE(stream, clock) \
52 WriteF(stream, "$W$W", (WriteFW)((clock) >> 32), (WriteFW)clock, NULL)
53#elif defined(MPS_ARCH_I6)
54#define EVENT_CLOCK_WRITE(stream, clock) \
55 WriteF(stream, "$W", (WriteFW)(clock), NULL)
56#endif
57
58#endif /* Microsoft C on Intel */
59
60/* If we have GCC or Clang, assemble the rdtsc instruction */
61#if !defined(EVENT_CLOCK) && \
62 (defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && \
63 (defined(MPS_BUILD_GC) || defined(MPS_BUILD_LL))
64
65/* Use __extension__ to enable use of a 64-bit type on 32-bit pedantic GCC */
66__extension__ typedef unsigned long long EventClock;
31 67
68#define EVENT_CLOCK(lvalue) \
69 BEGIN \
70 unsigned _l, _h; \
71 __asm__ __volatile__("rdtsc" : "=a"(_l), "=d"(_h)); \
72 (lvalue) = ((EventClock)_h << 32) | _l; \
73 END
32 74
33#define EventNameMAX ((size_t)19) 75/* The __extension__ keyword doesn't work on printf formats, so we
34#define EventCodeMAX ((EventCode)0x0069) 76 concatenate two 32-bit hex numbers to print the 64-bit value. */
77#define EVENT_CLOCK_PRINT(stream, clock) \
78 fprintf(stream, "%08lX%08lX", \
79 (unsigned long)((clock) >> 32), \
80 (unsigned long)(clock))
35 81
82#define EVENT_CLOCK_WRITE(stream, clock) \
83 WriteF(stream, "$W$W", (WriteFW)((clock) >> 32), (WriteFW)clock, NULL)
36 84
37/* eventgen.h is just the automatically generated part of this file */ 85#endif /* Intel, GCC or Clang */
38#include "eventgen.h"
39 86
87/* no fast clock, use plinth, probably from the C library */
88#ifndef EVENT_CLOCK
40 89
41#ifdef EVENT 90typedef mps_clock_t EventClock;
42 91
43typedef EventUnion *Event; 92#define EVENT_CLOCK(lvalue) \
93 BEGIN \
94 (lvalue) = mps_clock(); \
95 END
96
97#define EVENT_CLOCK_PRINT(stream, clock) \
98 fprintf(stream, "%lu", (unsigned long)clock)
99
100#define EVENT_CLOCK_WRITE(stream, clock) \
101 WriteF(stream, "$W", (WriteFW)clock, NULL)
44 102
45#endif 103#endif
46 104
47 105
48/* Event types -- see <design/telemetry/> 106/* Event Kinds --- see <design/telemetry/>
107 *
108 * All events are classified as being of one event type.
109 * They are small enough to be able to be used as members of a bit set.
110 */
111
112enum EventKindEnum {
113 EventKindArena, /* Per space or arena */
114 EventKindPool, /* Per pool */
115 EventKindTrace, /* Per trace or scan */
116 EventKindSeg, /* Per seg */
117 EventKindRef, /* Per ref or fix */
118 EventKindObject, /* Per alloc or object */
119 EventKindUser, /* User-invoked */
120 EventKindLIMIT
121};
122
123
124/* Event type definitions
125 *
126 * Various constants for each event type to describe them, so that they
127 * can easily be looked up from macros by name.
128 */
129
130/* Note that enum values can be up to fifteen bits long portably. */
131#define EVENT_ENUM(X, name, code, always, kind) \
132 Event##name##Code = code, \
133 Event##name##Always = always, \
134 Event##name##Kind = EventKind##kind,
135
136enum EventDefinitionsEnum {
137 EVENT_LIST(EVENT_ENUM, X)
138 EventEnumWarningSuppressor
139};
140
141
142/* Event*Struct -- Event Structures
49 * 143 *
50 * These names are intended to be mnemonic. They are derived from 144 * Declare the structures that are used to encode events in the internal event
51 * selected letters as indicated, using the transliteration in 145 * buffers and on the binary telemetry output stream.
52 * guide.hex.trans. 146 */
147
148/* Types for common event fields */
149typedef unsigned short EventCode;
150typedef unsigned EventKind;
151typedef unsigned short EventSize;
152#define EventSizeMAX USHRT_MAX
153
154/* Common prefix for all event structures. The size field allows an event
155 reader to skip over events whose codes it does not recognise. */
156#define EVENT_ANY_FIELDS \
157 EventCode code; /* encoding of the event type */ \
158 EventSize size; /* allows reader to skip events of unknown code */ \
159 EventClock clock; /* when the event occurred */
160typedef struct EventAnyStruct {
161 EVENT_ANY_FIELDS
162} EventAnyStruct;
163
164/* Event field types, for indexing by macro on the event parameter sort */
165typedef void *EventFP; /* pointer to C object */
166typedef Addr EventFA; /* address on the heap */
167typedef Word EventFW; /* word */
168typedef unsigned EventFU; /* unsigned integer */
169typedef char EventFS[EventStringLengthMAX + sizeof('\0')]; /* string */
170typedef double EventFD; /* double */
171typedef int EventFB; /* boolean */
172
173/* Event packing bitfield specifiers */
174#define EventFP_BITFIELD
175#define EventFA_BITFIELD
176#define EventFW_BITFIELD
177#define EventFU_BITFIELD
178#define EventFS_BITFIELD
179#define EventFD_BITFIELD
180#define EventFB_BITFIELD : 1
181
182#define EVENT_STRUCT_FIELD(X, index, sort, ident) \
183 EventF##sort f##index EventF##sort##_BITFIELD;
184
185#define EVENT_STRUCT(X, name, _code, always, kind) \
186 typedef struct Event##name##Struct { \
187 EVENT_ANY_FIELDS \
188 EVENT_##name##_PARAMS(EVENT_STRUCT_FIELD, X) \
189 } Event##name##Struct;
190
191EVENT_LIST(EVENT_STRUCT, X)
192
193
194/* Event -- event union type
53 * 195 *
54 * These definitions will be unnecessary when the event codes are 196 * Event is the type of a pointer to EventUnion, which is a union of all
55 * changed to 16-bit. See <code/eventdef.h>. 197 * event structures. This can be used as the type of any event, decoded
198 * by examining event->any.code.
56 */ 199 */
57 /* EVent ... */ 200
58#define EventEventTime ((EventType)0xEF213E99) /* TIME */ 201#define EVENT_UNION_MEMBER(X, name, code, always, kind) \
59#define EventPoolInit ((EventType)0xEFB07141) /* POoL INIt */ 202 Event##name##Struct name;
60#define EventPoolFinish ((EventType)0xEFB07F14) /* POoL FINish */ 203
61#define EventPoolAlloc ((EventType)0xEFB07A77) /* POoL ALLoc */ 204typedef union EventUnion {
62#define EventPoolFree ((EventType)0xEFB07F6E) /* POoL FREe */ 205 EventAnyStruct any;
63#define EventArenaCreateVM ((EventType)0xEFA64CF3) /* AReNa Create VM */ 206 EVENT_LIST(EVENT_UNION_MEMBER, X)
64#define EventArenaCreateVMNZ ((EventType)0xEFA64CF2) /* AReNa Create VmnZ */ 207} EventUnion, *Event;
65#define EventArenaCreateCL ((EventType)0xEFA64CC7) /* AReNa Create CL */
66#define EventArenaDestroy ((EventType)0xEFA64DE5) /* AReNa DEStroy */
67#define EventArenaAlloc ((EventType)0xEFA64A77) /* AReNa ALLoc */
68#define EventArenaFree ((EventType)0xEFA64F6E) /* AReNa FREe */
69#define EventSegAlloc ((EventType)0xEF5E9A77) /* SEG ALLoc */
70#define EventSegFree ((EventType)0xEF5E9F6E) /* SEG FREe */
71#define EventSegMerge ((EventType)0xEF5E93E6) /* SEG MERge */
72#define EventSegSplit ((EventType)0xEF5E95B7) /* SEG SPLit */
73#define EventAMCGenCreate ((EventType)0xEFA3C94C) /* AMC GeN Create */
74#define EventAMCGenDestroy ((EventType)0xEFA3C94D) /* AMC GeN Destroy */
75#define EventAMCInit ((EventType)0xEFA3C141) /* AMC INIt */
76#define EventAMCFinish ((EventType)0xEFA3CF14) /* AMC FINish */
77#define EventAMCTraceBegin ((EventType)0xEFA3C26B) /* AMC TRace Begin */
78#define EventAMCScanBegin ((EventType)0xEFA3C5CB) /* AMC SCan Begin */
79#define EventAMCScanEnd ((EventType)0xEFA3C5CE) /* AMC SCan End */
80#define EventAMCFix ((EventType)0xEFA3CF18) /* AMC FIX */
81#define EventAMCFixInPlace ((EventType)0xEFA3CF8A) /* AMC FiX Ambig */
82#define EventAMCFixForward ((EventType)0xEFA3CF8F) /* AMC FiX Forward */
83#define EventAMCReclaim ((EventType)0xEFA3C6EC) /* AMC REClaim */
84#define EventTraceStart ((EventType)0xEF26AC52) /* TRACe STart */
85#define EventTraceCreate ((EventType)0xEF26ACC6) /* TRACe CReate */
86#define EventTraceDestroy ((EventType)0xEF26ACDE) /* TRACe DEstroy */
87#define EventSegSetGrey ((EventType)0xEF59596A) /* SeG Set GRAy */
88#define EventTraceFlipBegin ((EventType)0xEF26AF7B) /* TRAce FLip Begin */
89#define EventTraceFlipEnd ((EventType)0xEF26AF7E) /* TRAce FLip End */
90#define EventTraceReclaim ((EventType)0xEF26A6EC) /* TRAce REClaim */
91#define EventTraceScanSeg ((EventType)0xEF26A559) /* TRAce ScanSeG */
92#define EventTraceScanSingleRef \
93 ((EventType)0xEF26A556) /* TRAce ScanSingleRef */
94#define EventTraceAccess ((EventType)0xEF26AACC) /* TRAce ACCess */
95#define EventTracePoll ((EventType)0xEF26AB01) /* TRAce POLl */
96#define EventTraceStep ((EventType)0xEF26A52B) /* TRAce STeP */
97#define EventTraceFix ((EventType)0xEF26AF18) /* TRAce FIX */
98#define EventTraceFixSeg ((EventType)0xEF26AF85) /* TRAce FiX Seg */
99#define EventTraceFixWhite ((EventType)0xEF26AF83) /* TRAce FiX White */
100#define EventTraceScanArea ((EventType)0xEF26A5CA) /* TRAce SCan Area */
101#define EventTraceScanAreaTagged ((EventType)0xEF26A5C2) /* TRAce SCan area Tagged */
102#define EventVMCreate ((EventType)0xEFF3C6EA) /* VM CREAte */
103#define EventVMDestroy ((EventType)0xEFF3DE52) /* VM DESTroy */
104#define EventVMMap ((EventType)0xEFF33AB9) /* VM MAP */
105#define EventVMUnmap ((EventType)0xEFF3043B) /* VM UNMaP */
106#define EventIntern ((EventType)0xEF142E64) /* INTERN */
107#define EventArenaExtend ((EventType)0xEFA64E82) /* AReNa EXTend */
108#define EventArenaRetract ((EventType)0xEFA646E2) /* AReNa RETract */
109#define EventRootScan ((EventType)0xEF625CA4) /* RooT SCAN */
110#define EventLabel ((EventType)0xEF7ABE79) /* LABEL */
111#define EventTraceSegGreyen ((EventType)0xEF26A599) /* TRAce SeG Greyen */
112#define EventBufferReserve ((EventType)0xEFB0FF6E) /* BUFFer REserve */
113#define EventBufferCommit ((EventType)0xEFB0FFC0) /* BUFFer COmmit */
114#define EventBufferInit ((EventType)0xEFB0FF14) /* BUFFer INit */
115#define EventBufferInitSeg ((EventType)0xEFB0F15E) /* BUFFer Init SEg */
116#define EventBufferInitRank ((EventType)0xEFB0F16A) /* BUFFer Init RAnk */
117#define EventBufferInitEPVM ((EventType)0xEFB0F1EF) /* BUFfer Init EpVm */
118#define EventBufferFinish ((EventType)0xEFB0FFF1) /* BUFFer FInish */
119#define EventBufferFill ((EventType)0xEFB0FFF7) /* BUFFer FilL */
120#define EventBufferEmpty ((EventType)0xEFB0FFE3) /* BUFFer EMpty */
121#define EventArenaAllocFail ((EventType)0xEFA64A7F) /* AReNa ALloc Fail */
122#define EventSegAllocFail ((EventType)0xEF5E9A7F) /* SEG ALloc Fail */
123#define EventMeterInit ((EventType)0xEF3E2141) /* METer INIt */
124#define EventMeterValues ((EventType)0xEF3E2FA7) /* METer VALues */
125#define EventCBSInit ((EventType)0xEFCB5141) /* CBS INIt */
126#define EventTraceStatCondemn ((EventType)0xEF26A5C0) /* TRAce Stat COndemn */
127#define EventTraceStatScan ((EventType)0xEF26A55C) /* TRAce Stat SCan */
128#define EventTraceStatFix ((EventType)0xEF26A5F8) /* TRAce Stat FiX */
129#define EventTraceStatReclaim ((EventType)0xEF26A56E) /* TRAce Stat REclaim */
130#define EventArenaWriteFaults ((EventType)0xEFA6436F) /* AReNa WRite Faults */
131#define EventPoolInitMV ((EventType)0xEFB0713F) /* POoL Init MV */
132#define EventPoolInitMVFF ((EventType)0xEFB071FF) /* POoL Init mvFF */
133#define EventPoolInitMFS ((EventType)0xEFB07135) /* POoL Init MfS */
134#define EventPoolInitEPVM ((EventType)0xEFB071EF) /* POoL Init EpVm */
135#define EventPoolInitEPDL ((EventType)0xEFB071E7) /* POoL Init EpdL */
136#define EventPoolInitAMS ((EventType)0xEFB071A5) /* POoL Init AmS */
137#define EventPoolInitAMC ((EventType)0xEFB071AC) /* POoL Init AmC */
138#define EventPoolInitAMCZ ((EventType)0xEFB071A2) /* POoL Init AmcZ */
139#define EventPoolInitAWL ((EventType)0xEFB071A3) /* POoL Init AWl */
140#define EventPoolInitLO ((EventType)0xEFB07170) /* POoL Init LO */
141#define EventPoolInitSNC ((EventType)0xEFB07154) /* POoL Init SNc */
142#define EventPoolInitMVT ((EventType)0xEFB07132) /* POoL Init MvT */
143#define EventPoolPush ((EventType)0xEFB07B58) /* POoL PuSH */
144#define EventPoolPop ((EventType)0xEFB07B0B) /* POoL POP */
145#define EventReservoirLimitSet ((EventType)0xEF6E5713) /* REServoir LIMit set */
146#define EventCommitLimitSet ((EventType)0xEFC03713) /* COMmit LIMit set */
147#define EventSpareCommitLimitSet ((EventType)0xEF5BC713) /* SPare Commit LIMit set */
148 208
149 209
150#endif /* eventcom_h */ 210#endif /* eventcom_h */
diff --git a/mps/code/eventdef.h b/mps/code/eventdef.h
index c8c1d41495d..83c7a3850f8 100644
--- a/mps/code/eventdef.h
+++ b/mps/code/eventdef.h
@@ -5,18 +5,11 @@
5 * 5 *
6 * .source: <design/telemetry/> 6 * .source: <design/telemetry/>
7 * 7 *
8 * .desc: This file declares relationships that define the various 8 * .desc: This file declares macros that define the types of events and their
9 * event types. It is intended to be used with clever definitions 9 * properties.
10 * of the RELATION macro.
11 * 10 *
12 * TRANSGRESSIONS 11 * TRANSGRESSIONS
13 * 12 *
14 * .trans.nocppguard: This file has no #ifdef guard around the entire file.
15 * This is so that the file can be included multiple times. This is
16 * useful because each inclusion can use a different definition of
17 * RELATION. However this may be slightly shot by having the version
18 * defined here.
19 *
20 * .kind.abuse: A few events have a kind which is not obvious from the 13 * .kind.abuse: A few events have a kind which is not obvious from the
21 * type of the objects that the event relates to. They are given the 14 * type of the objects that the event relates to. They are given the
22 * kind that that have on the grounds of expected use. The kinds are 15 * kind that that have on the grounds of expected use. The kinds are
@@ -28,7 +21,8 @@
28 * amount of data). 21 * amount of data).
29 */ 22 */
30 23
31/* No #ifndef eventdef_h, see .trans.nocppguard. */ 24#ifndef eventdef_h
25#define eventdef_h
32 26
33 27
34/* EVENT_VERSION_* -- three part version number 28/* EVENT_VERSION_* -- three part version number
@@ -38,137 +32,580 @@
38 * and the major version when changing the format of the event file. 32 * and the major version when changing the format of the event file.
39 */ 33 */
40 34
41#define EVENT_VERSION_MAJOR ((unsigned)0) 35#define EVENT_VERSION_MAJOR ((unsigned)1)
42#define EVENT_VERSION_MEDIAN ((unsigned)0) 36#define EVENT_VERSION_MEDIAN ((unsigned)0)
43#define EVENT_VERSION_MINOR ((unsigned)0) 37#define EVENT_VERSION_MINOR ((unsigned)0)
44 38
45 39
46/* Relations -- Generic definitions of events 40/* EVENT_LIST -- list of event types and general properties
47 * 41 *
48 * These specify: 42 * These specify:
49 * - Type: The name of the event type, without the leading "Event"; 43 * - Type: The name of the event type, without the leading "Event";
50 * - Code: The unique 16-bit code associated with this event type, 44 * - Code: The unique 16-bit code associated with this event type;
51 * not currently used (see <code/eventcom.h>); 45 * - Always: Whether this event type should appear in "hot" varieties,
52 * - Always: Whether this event type should appear in optimised
53 * varieties, not currently used;
54 * - Kind: Category into which this event falls, without the 46 * - Kind: Category into which this event falls, without the
55 * leading "EventKind"; 47 * leading "EventKind";
56 * - Format: Character sequence indicating the format of the event 48 *
57 * parameters, similar to writef (Pointer, Addr, Word, Unsigned, 49 * When you retire an event type, don't delete it from the list -- comment
58 * String, Double). 50 * it out. This serves as documentation for what the event code means
51 * in older logs, and prevents the codes being re-used. See
52 * <design/telemetry/#.reg.code>.
53 *
54 * When you add an event type, you must also add an EVENT_*_PARAMS macro
55 * specify its parameters below.
56 *
57 * TODO: Add a doc string to each event type.
58 *
59 * See also EVENT_*_PARAMS for definition of event parameters.
59 */ 60 */
61
62#define EventNameMAX ((size_t)19)
63#define EventCodeMAX ((EventCode)0x0071)
64
65#define EVENT_LIST(EVENT, X) \
66 /* 0123456789012345678 <- don't exceed without changing EventNameMAX */ \
67 EVENT(X, AMCGenCreate , 0x0001, TRUE, Pool) \
68 EVENT(X, AMCGenDestroy , 0x0002, TRUE, Pool) \
69 EVENT(X, AMCInit , 0x0003, TRUE, Pool) \
70 EVENT(X, AMCFinish , 0x0004, TRUE, Pool) \
71 EVENT(X, ArenaCreateVM , 0x0005, TRUE, Arena) \
72 EVENT(X, ArenaCreateVMNZ , 0x0006, TRUE, Arena) \
73 EVENT(X, ArenaWriteFaults , 0x0007, TRUE, Trace) \
74 EVENT(X, MeterInit , 0x0008, TRUE, Pool) \
75 EVENT(X, MeterValues , 0x0009, TRUE, Pool) \
76 EVENT(X, AMCScanBegin , 0x000a, TRUE, Seg) \
77 EVENT(X, AMCScanEnd , 0x000b, TRUE, Seg) \
78 EVENT(X, AMCFix , 0x000c, FALSE, Ref) \
79 EVENT(X, AMCFixInPlace , 0x000d, FALSE, Ref) \
80 EVENT(X, AMCFixForward , 0x000e, FALSE, Ref) \
81 EVENT(X, AMCReclaim , 0x000f, TRUE, Seg) \
82 /* EVENT(X, AMCTraceEnd , 0x0010, TRUE, Trace) */ \
83 EVENT(X, ArenaCreateCL , 0x0011, TRUE, Arena) \
84 EVENT(X, ArenaDestroy , 0x0012, TRUE, Arena) \
85 EVENT(X, SegAlloc , 0x0013, TRUE, Seg) \
86 EVENT(X, SegFree , 0x0014, TRUE, Seg) \
87 EVENT(X, PoolInit , 0x0015, TRUE, Pool) \
88 EVENT(X, PoolFinish , 0x0016, TRUE, Pool) \
89 EVENT(X, PoolAlloc , 0x0017, TRUE, Object) \
90 EVENT(X, PoolFree , 0x0018, TRUE, Object) \
91 EVENT(X, CBSInit , 0x0019, TRUE, Pool) \
92 EVENT(X, Intern , 0x001a, TRUE, User) \
93 EVENT(X, Label , 0x001b, TRUE, User) \
94 /* EVENT(X, TraceStart , 0x001c, TRUE, Trace) */ \
95 /* EVENT(X, TraceCreate , 0x001d, TRUE, Trace) */ \
96 EVENT(X, TraceDestroy , 0x001e, TRUE, Trace) \
97 EVENT(X, SegSetGrey , 0x001f, TRUE, Seg) \
98 EVENT(X, TraceFlipBegin , 0x0020, TRUE, Trace) \
99 EVENT(X, TraceFlipEnd , 0x0021, TRUE, Trace) \
100 EVENT(X, TraceReclaim , 0x0022, TRUE, Seg) \
101 /* EVENT(X, TraceScan , 0x0023, TRUE, Seg) */ \
102 EVENT(X, TraceAccess , 0x0024, TRUE, Seg) \
103 /* TracePoll's kind isn't really Trace, but then it isn't Seg either */ \
104 /* EVENT(X, TracePoll , 0x0025, TRUE, Trace) */ \
105 EVENT(X, TraceFix , 0x0026, FALSE, Ref) \
106 EVENT(X, TraceFixSeg , 0x0027, FALSE, Ref) \
107 EVENT(X, TraceFixWhite , 0x0028, FALSE, Ref) \
108 /* TraceScanArea{Tagged} abuses kind, see .kind.abuse */ \
109 EVENT(X, TraceScanArea , 0x0029, TRUE, Seg) \
110 EVENT(X, TraceScanAreaTagged, 0x002a, TRUE, Seg) \
111 EVENT(X, VMCreate , 0x002b, TRUE, Arena) \
112 EVENT(X, VMDestroy , 0x002c, TRUE, Arena) \
113 EVENT(X, VMMap , 0x002d, TRUE, Seg) \
114 EVENT(X, VMUnmap , 0x002e, TRUE, Seg) \
115 EVENT(X, ArenaExtend , 0x002f, TRUE, Arena) \
116 /* EVENT(X, ArenaRetract , 0x0030, TRUE, Arena) */ \
117 /* EVENT(X, TraceSegGreyen , 0x0031, TRUE, Seg) */ \
118 /* RootScanned abuses kind, see .kind.abuse */ \
119 EVENT(X, RootScan , 0x0032, TRUE, Seg) \
120 /* TraceStep abuses kind, see .kind.abuse */ \
121 /* EVENT(X, TraceStep , 0x0033, TRUE, Seg) */ \
122 EVENT(X, BufferReserve , 0x0034, TRUE, Object) \
123 EVENT(X, BufferCommit , 0x0035, TRUE, Object) \
124 /* BufferInit/Finish abuse kind, see .kind.abuse */ \
125 EVENT(X, BufferInit , 0x0036, TRUE, Pool) \
126 EVENT(X, BufferFinish , 0x0037, TRUE, Pool) \
127 /* EVENT(X, MVTFinish , 0x0038, TRUE, Pool) */ \
128 EVENT(X, BufferFill , 0x0039, TRUE, Seg) \
129 EVENT(X, BufferEmpty , 0x003A, TRUE, Seg) \
130 EVENT(X, SegAllocFail , 0x003B, TRUE, Seg) \
131 EVENT(X, TraceScanSeg , 0x003C, TRUE, Seg) \
132 /* TraceScanSingleRef abuses kind, see .kind.abuse */ \
133 EVENT(X, TraceScanSingleRef , 0x003D, TRUE, Seg) \
134 EVENT(X, TraceStatCondemn , 0x003E, TRUE, Trace) \
135 EVENT(X, TraceStatScan , 0x003F, TRUE, Trace) \
136 EVENT(X, TraceStatFix , 0x0040, TRUE, Trace) \
137 EVENT(X, TraceStatReclaim , 0x0041, TRUE, Trace) \
138 EVENT(X, PoolInitMVFF , 0x0042, TRUE, Pool) \
139 EVENT(X, PoolInitMV , 0x0043, TRUE, Pool) \
140 EVENT(X, PoolInitMFS , 0x0044, TRUE, Pool) \
141 /* EVENT(X, PoolInitEPVM , 0x0045, TRUE, Pool) */ \
142 /* EVENT(X, PoolInitEPDL , 0x0046, TRUE, Pool) */ \
143 EVENT(X, PoolInitAMS , 0x0047, TRUE, Pool) \
144 EVENT(X, PoolInitAMC , 0x0048, TRUE, Pool) \
145 EVENT(X, PoolInitAMCZ , 0x0049, TRUE, Pool) \
146 EVENT(X, PoolInitAWL , 0x004A, TRUE, Pool) \
147 EVENT(X, PoolInitLO , 0x004B, TRUE, Pool) \
148 EVENT(X, PoolInitSNC , 0x004C, TRUE, Pool) \
149 EVENT(X, PoolInitMVT , 0x004D, TRUE, Pool) \
150 /* EVENT(X, BufferInitEPVM , 0x0050, TRUE, Pool) */ \
151 EVENT(X, BufferInitSeg , 0x0051, TRUE, Pool) \
152 EVENT(X, BufferInitRank , 0x0052, TRUE, Pool) \
153 /* PoolPush/Pop go under Object, because they're user ops. */ \
154 /* EVENT(X, PoolPush , 0x0060, TRUE, Object) */ \
155 /* EVENT(X, PoolPop , 0x0061, TRUE, Object) */ \
156 EVENT(X, ReservoirLimitSet , 0x0062, TRUE, Arena) \
157 EVENT(X, CommitLimitSet , 0x0063, TRUE, Arena) \
158 EVENT(X, SpareCommitLimitSet, 0x0064, TRUE, Arena) \
159 EVENT(X, ArenaAlloc , 0x0065, TRUE, Arena) \
160 EVENT(X, ArenaFree , 0x0066, TRUE, Arena) \
161 EVENT(X, ArenaAllocFail , 0x0067, TRUE, Arena) \
162 EVENT(X, SegMerge , 0x0068, TRUE, Seg) \
163 EVENT(X, SegSplit , 0x0069, TRUE, Seg) \
164 /* Events converted from RHSK's diagnostics */ \
165 EVENT(X, vmArenaExtendStart , 0x006A, TRUE, Arena) \
166 EVENT(X, vmArenaExtendFail , 0x006B, TRUE, Arena) \
167 EVENT(X, vmArenaExtendDone , 0x006C, TRUE, Arena) \
168 EVENT(X, MessagesDropped , 0x006D, TRUE, Arena) \
169 EVENT(X, MessagesExist , 0x006E, TRUE, Arena) \
170 EVENT(X, ChainCondemnAuto , 0x006F, TRUE, Trace) \
171 EVENT(X, TraceFindGrey , 0x0070, TRUE, Trace) \
172 EVENT(X, TraceBandAdvance , 0x0071, TRUE, Trace)
173
174
175/* Remember to update EventNameMAX and EventCodeMAX in eventcom.h!
176 (These are checked in EventInit.) */
177
178
179/* EVENT_*_PARAMS -- definition of event parameters
180 *
181 * For each event type in EVENT_LIST, these macros list the parameters of
182 * the event. THe columns are:
183 * - the positional index of the parameter in the list, used to define
184 * numeric field names using the C preprocessor
185 * - the parameter sort, similar to writef (Pointer, Addr, Word, Unsigned,
186 * String, Double, Bool)
187 * - a parameter identifier for display or use in code
188 *
189 * TODO: Add a doc string to each parameter.
190 */
191
192#define EVENT_AMCGenCreate_PARAMS(PARAM, X) \
193 PARAM(X, 0, P, amc) \
194 PARAM(X, 1, P, gen)
195
196#define EVENT_AMCGenDestroy_PARAMS(PARAM, X) \
197 PARAM(X, 0, P, gen)
198
199#define EVENT_AMCInit_PARAMS(PARAM, X) \
200 PARAM(X, 0, P, pool) \
201 PARAM(X, 1, P, amc)
202
203#define EVENT_AMCFinish_PARAMS(PARAM, X) \
204 PARAM(X, 0, P, amc)
205
206#define EVENT_AMCFix_PARAMS(PARAM, X)
207
208#define EVENT_ArenaCreateVM_PARAMS(PARAM, X) \
209 PARAM(X, 0, P, arena) \
210 PARAM(X, 1, W, userSize) \
211 PARAM(X, 2, W, chunkSize)
212
213#define EVENT_ArenaCreateVMNZ_PARAMS(PARAM, X) \
214 PARAM(X, 0, P, arena) \
215 PARAM(X, 1, W, userSize) \
216 PARAM(X, 2, W, chunkSize)
217
218#define EVENT_ArenaWriteFaults_PARAMS(PARAM, X) \
219 PARAM(X, 0, P, arena) \
220 PARAM(X, 1, W, writeBarrierHitCount)
221
222#define EVENT_MeterInit_PARAMS(PARAM, X) \
223 PARAM(X, 0, P, meter) \
224 PARAM(X, 1, P, owner)
225
226#define EVENT_MeterValues_PARAMS(PARAM, X) \
227 PARAM(X, 0, P, meter) \
228 PARAM(X, 1, D, total) \
229 PARAM(X, 2, D, meanSquared) \
230 PARAM(X, 3, W, count) \
231 PARAM(X, 4, W, max) \
232 PARAM(X, 5, W, min)
233
234#define EVENT_AMCScanBegin_PARAMS(PARAM, X) \
235 PARAM(X, 0, P, amc) \
236 PARAM(X, 1, P, seg) \
237 PARAM(X, 2, P, ss)
238
239#define EVENT_AMCScanEnd_PARAMS(PARAM, X) \
240 PARAM(X, 0, P, amc) \
241 PARAM(X, 1, P, seg) \
242 PARAM(X, 2, P, ss)
243
244#define EVENT_AMCFix_PARAMS(PARAM, X)
245
246#define EVENT_AMCFixInPlace_PARAMS(PARAM, X)
247
248#define EVENT_AMCFixForward_PARAMS(PARAM, X) \
249 PARAM(X, 0, A, newRef)
250
251#define EVENT_AMCReclaim_PARAMS(PARAM, X) \
252 PARAM(X, 0, P, gen) \
253 PARAM(X, 1, P, trace) \
254 PARAM(X, 2, P, seg)
255
256#define EVENT_ArenaCreateCL_PARAMS(PARAM, X) \
257 PARAM(X, 0, P, arena) \
258 PARAM(X, 1, W, size) \
259 PARAM(X, 2, A, base)
260
261#define EVENT_ArenaDestroy_PARAMS(PARAM, X) \
262 PARAM(X, 0, P, arena)
263
264#define EVENT_SegAlloc_PARAMS(PARAM, X) \
265 PARAM(X, 0, P, arena) \
266 PARAM(X, 1, P, seg) \
267 PARAM(X, 2, A, base) \
268 PARAM(X, 3, W, size) \
269 PARAM(X, 4, P, pool)
270
271#define EVENT_SegFree_PARAMS(PARAM, X) \
272 PARAM(X, 0, P, arena) \
273 PARAM(X, 1, P, seg)
274
275#define EVENT_PoolInit_PARAMS(PARAM, X) \
276 PARAM(X, 0, P, pool) \
277 PARAM(X, 1, P, arena) \
278 PARAM(X, 2, P, poolClass)
279
280#define EVENT_PoolFinish_PARAMS(PARAM, X) \
281 PARAM(X, 0, P, pool)
282
283#define EVENT_PoolAlloc_PARAMS(PARAM, X) \
284 PARAM(X, 0, P, pool) \
285 PARAM(X, 1, A, pReturn) \
286 PARAM(X, 2, W, size)
287
288#define EVENT_PoolFree_PARAMS(PARAM, X) \
289 PARAM(X, 0, P, pool) \
290 PARAM(X, 1, A, old) \
291 PARAM(X, 2, W, size)
292
293#define EVENT_CBSInit_PARAMS(PARAM, X) \
294 PARAM(X, 0, P, cbs) \
295 PARAM(X, 1, P, owner)
296
297#define EVENT_Intern_PARAMS(PARAM, X) \
298 PARAM(X, 0, W, stringId) \
299 PARAM(X, 1, S, string)
300
301#define EVENT_Label_PARAMS(PARAM, X) \
302 PARAM(X, 0, A, address) \
303 PARAM(X, 1, W, stringId)
304
305#define EVENT_TraceDestroy_PARAMS(PARAM, X) \
306 PARAM(X, 0, P, trace)
307
308#define EVENT_SegSetGrey_PARAMS(PARAM, X) \
309 PARAM(X, 0, P, arena) \
310 PARAM(X, 1, P, seg) \
311 PARAM(X, 2, U, grey)
312
313#define EVENT_TraceFlipBegin_PARAMS(PARAM, X) \
314 PARAM(X, 0, P, trace) \
315 PARAM(X, 1, P, arena)
316
317#define EVENT_TraceFlipEnd_PARAMS(PARAM, X) \
318 PARAM(X, 0, P, trace) \
319 PARAM(X, 1, P, arena)
320
321#define EVENT_TraceReclaim_PARAMS(PARAM, X) \
322 PARAM(X, 0, P, trace)
323
324#define EVENT_TraceAccess_PARAMS(PARAM, X) \
325 PARAM(X, 0, P, arena) \
326 PARAM(X, 1, P, seg) \
327 PARAM(X, 2, U, mode)
328
329#define EVENT_TraceFix_PARAMS(PARAM, X) \
330 PARAM(X, 0, P, ss) \
331 PARAM(X, 1, P, refIO) \
332 PARAM(X, 2, A, ref) \
333 PARAM(X, 3, U, rank)
334
335#define EVENT_TraceFixSeg_PARAMS(PARAM, X) \
336 PARAM(X, 0, P, seg)
337
338#define EVENT_TraceFixWhite_PARAMS(PARAM, X)
339
340#define EVENT_TraceScanArea_PARAMS(PARAM, X) \
341 PARAM(X, 0, P, ss) \
342 PARAM(X, 1, P, base) \
343 PARAM(X, 2, P, limit)
344
345#define EVENT_TraceScanAreaTagged_PARAMS(PARAM, X) \
346 PARAM(X, 0, P, ss) \
347 PARAM(X, 1, P, base) \
348 PARAM(X, 2, P, limit)
349
350#define EVENT_VMCreate_PARAMS(PARAM, X) \
351 PARAM(X, 0, P, vm) \
352 PARAM(X, 1, A, base) \
353 PARAM(X, 2, A, limit)
354
355#define EVENT_VMDestroy_PARAMS(PARAM, X) \
356 PARAM(X, 0, P, vm)
357
358#define EVENT_VMMap_PARAMS(PARAM, X) \
359 PARAM(X, 0, P, vm) \
360 PARAM(X, 1, A, base) \
361 PARAM(X, 2, A, limit)
362
363#define EVENT_VMUnmap_PARAMS(PARAM, X) \
364 PARAM(X, 0, P, vm) \
365 PARAM(X, 1, A, base) \
366 PARAM(X, 2, A, limit)
367
368#define EVENT_ArenaExtend_PARAMS(PARAM, X) \
369 PARAM(X, 0, P, arena) \
370 PARAM(X, 1, A, base) \
371 PARAM(X, 2, W, size)
372
373#define EVENT_RootScan_PARAMS(PARAM, X) \
374 PARAM(X, 0, P, root) \
375 PARAM(X, 1, W, ts) \
376 PARAM(X, 2, W, summary)
377
378#define EVENT_BufferReserve_PARAMS(PARAM, X) \
379 PARAM(X, 0, P, buffer) \
380 PARAM(X, 1, A, init) \
381 PARAM(X, 2, W, size)
382
383#define EVENT_BufferCommit_PARAMS(PARAM, X) \
384 PARAM(X, 0, P, buffer) \
385 PARAM(X, 1, A, p) \
386 PARAM(X, 2, W, size) \
387 PARAM(X, 3, A, clientClass)
388
389#define EVENT_BufferInit_PARAMS(PARAM, X) \
390 PARAM(X, 0, P, buffer) \
391 PARAM(X, 1, P, pool) \
392 PARAM(X, 2, B, isMutator)
393
394#define EVENT_BufferFinish_PARAMS(PARAM, X) \
395 PARAM(X, 0, P, buffer)
396
397#define EVENT_BufferFill_PARAMS(PARAM, X) \
398 PARAM(X, 0, P, buffer) \
399 PARAM(X, 1, W, size) \
400 PARAM(X, 2, A, base) \
401 PARAM(X, 3, W, filled)
402
403#define EVENT_BufferEmpty_PARAMS(PARAM, X) \
404 PARAM(X, 0, P, buffer) \
405 PARAM(X, 1, W, spare)
406
407#define EVENT_SegAllocFail_PARAMS(PARAM, X) \
408 PARAM(X, 0, P, arena) \
409 PARAM(X, 1, W, size) \
410 PARAM(X, 2, P, pool)
411
412#define EVENT_TraceScanSeg_PARAMS(PARAM, X) \
413 PARAM(X, 0, U, ts) \
414 PARAM(X, 1, U, rank) \
415 PARAM(X, 2, P, arena) \
416 PARAM(X, 3, P, seg)
417
418#define EVENT_TraceScanSingleRef_PARAMS(PARAM, X) \
419 PARAM(X, 0, U, ts) \
420 PARAM(X, 1, U, rank) \
421 PARAM(X, 2, P, arena) \
422 PARAM(X, 3, A, refIO)
423
424#define EVENT_TraceStatCondemn_PARAMS(PARAM, X) \
425 PARAM(X, 0, P, trace) \
426 PARAM(X, 1, W, condemned) \
427 PARAM(X, 2, W, notCondemned) \
428 PARAM(X, 3, W, foundation) \
429 PARAM(X, 4, W, rate) \
430 PARAM(X, 5, D, mortality) \
431 PARAM(X, 6, D, finishingTime)
432
433#define EVENT_TraceStatScan_PARAMS(PARAM, X) \
434 PARAM(X, 0, P, trace) \
435 PARAM(X, 1, W, rootScanCount) \
436 PARAM(X, 2, W, rootScanSize) \
437 PARAM(X, 3, W, rootCopiedSize) \
438 PARAM(X, 4, W, segScanCount) \
439 PARAM(X, 5, W, segScanSize) \
440 PARAM(X, 6, W, segCopiedSize) \
441 PARAM(X, 7, W, singleScanCount) \
442 PARAM(X, 8, W, singleScanSize) \
443 PARAM(X, 9, W, singleCopiedSize) \
444 PARAM(X, 10, W, readBarrierHitCount) \
445 PARAM(X, 11, W, greySegMax) \
446 PARAM(X, 12, W, pointlessScanCount)
447
448#define EVENT_TraceStatFix_PARAMS(PARAM, X) \
449 PARAM(X, 0, P, trace) \
450 PARAM(X, 1, W, fixRefCount) \
451 PARAM(X, 2, W, segRefCount) \
452 PARAM(X, 3, W, whiteSegRefCount) \
453 PARAM(X, 4, W, nailCount) \
454 PARAM(X, 5, W, snapCount) \
455 PARAM(X, 6, W, forwardedCount) \
456 PARAM(X, 7, W, forwardedSize) \
457 PARAM(X, 8, W, preservedInPlaceCount) \
458 PARAM(X, 9, W, preservedInPlaceSize)
459
460#define EVENT_TraceStatReclaim_PARAMS(PARAM, X) \
461 PARAM(X, 0, P, trace) \
462 PARAM(X, 1, W, reclaimCount) \
463 PARAM(X, 2, W, reclaimSize)
464
465#define EVENT_PoolInitMVFF_PARAMS(PARAM, X) \
466 PARAM(X, 0, P, pool) \
467 PARAM(X, 1, P, arena) \
468 PARAM(X, 2, W, extendBy) \
469 PARAM(X, 3, W, avgSize) \
470 PARAM(X, 4, W, align) \
471 PARAM(X, 5, B, slotHigh) \
472 PARAM(X, 6, B, arenaHigh) \
473 PARAM(X, 7, B, firstFit)
474
475#define EVENT_PoolInitMV_PARAMS(PARAM, X) \
476 PARAM(X, 0, P, pool) \
477 PARAM(X, 1, P, arena) \
478 PARAM(X, 2, W, extendBy) \
479 PARAM(X, 3, W, avgSize) \
480 PARAM(X, 4, W, maxSize)
481
482#define EVENT_PoolInitMFS_PARAMS(PARAM, X) \
483 PARAM(X, 0, P, pool) \
484 PARAM(X, 1, P, arena) \
485 PARAM(X, 2, W, extendBy) \
486 PARAM(X, 3, W, unitSize)
487
488#define EVENT_PoolInitAMS_PARAMS(PARAM, X) \
489 PARAM(X, 0, P, pool) \
490 PARAM(X, 1, P, arena) \
491 PARAM(X, 2, P, format)
492
493#define EVENT_PoolInitAMC_PARAMS(PARAM, X) \
494 PARAM(X, 0, P, pool) \
495 PARAM(X, 1, P, format)
496
497#define EVENT_PoolInitAMCZ_PARAMS(PARAM, X) \
498 PARAM(X, 0, P, pool) \
499 PARAM(X, 1, P, format)
500
501#define EVENT_PoolInitAWL_PARAMS(PARAM, X) \
502 PARAM(X, 0, P, pool) \
503 PARAM(X, 1, P, format)
504
505#define EVENT_PoolInitLO_PARAMS(PARAM, X) \
506 PARAM(X, 0, P, pool) \
507 PARAM(X, 1, P, format)
508
509#define EVENT_PoolInitSNC_PARAMS(PARAM, X) \
510 PARAM(X, 0, P, pool) \
511 PARAM(X, 1, P, format)
512
513#define EVENT_PoolInitMVT_PARAMS(PARAM, X) \
514 PARAM(X, 0, P, pool) \
515 PARAM(X, 1, W, minSize) \
516 PARAM(X, 2, W, meanSize) \
517 PARAM(X, 3, W, maxSize) \
518 PARAM(X, 4, W, reserveDepth) \
519 PARAM(X, 5, W, fragLimig)
520
521#define EVENT_BufferInitSeg_PARAMS(PARAM, X) \
522 PARAM(X, 0, P, buffer) \
523 PARAM(X, 1, P, pool) \
524 PARAM(X, 2, B, isMutator)
525
526#define EVENT_BufferInitRank_PARAMS(PARAM, X) \
527 PARAM(X, 0, P, buffer) \
528 PARAM(X, 1, P, pool) \
529 PARAM(X, 2, B, isMutator) \
530 PARAM(X, 3, U, rank)
531
532#define EVENT_ReservoirLimitSet_PARAMS(PARAM, X) \
533 PARAM(X, 0, P, arena) \
534 PARAM(X, 1, W, size)
535
536#define EVENT_CommitLimitSet_PARAMS(PARAM, X) \
537 PARAM(X, 0, P, arena) \
538 PARAM(X, 1, W, limit) \
539 PARAM(X, 2, U, OK)
540
541#define EVENT_SpareCommitLimitSet_PARAMS(PARAM, X) \
542 PARAM(X, 0, P, arena) \
543 PARAM(X, 1, W, limit)
544
545#define EVENT_ArenaAlloc_PARAMS(PARAM, X) \
546 PARAM(X, 0, P, arena) \
547 PARAM(X, 1, P, baseTract) \
548 PARAM(X, 2, A, base) \
549 PARAM(X, 3, W, size) \
550 PARAM(X, 4, P, pool)
551
552#define EVENT_ArenaFree_PARAMS(PARAM, X) \
553 PARAM(X, 0, P, arena) \
554 PARAM(X, 1, A, base) \
555 PARAM(X, 2, W, size)
556
557#define EVENT_ArenaAllocFail_PARAMS(PARAM, X) \
558 PARAM(X, 0, P, arena) \
559 PARAM(X, 1, W, size) \
560 PARAM(X, 2, P, pool)
561
562#define EVENT_SegMerge_PARAMS(PARAM, X) \
563 PARAM(X, 0, P, segLo) \
564 PARAM(X, 1, P, segHi) \
565 PARAM(X, 2, B, withReservoirPermit)
566
567#define EVENT_SegSplit_PARAMS(PARAM, X) \
568 PARAM(X, 0, P, seg) \
569 PARAM(X, 1, P, segLo) \
570 PARAM(X, 2, P, segHi) \
571 PARAM(X, 3, A, at)
572
573#define EVENT_vmArenaExtendStart_PARAMS(PARAM, X) \
574 PARAM(X, 0, W, size) /* size to accommodate */ \
575 PARAM(X, 1, W, chunkSize) /* chunkSize to try */ \
576 PARAM(X, 2, W, reserved) /* current VMArenaReserved */
577
578#define EVENT_vmArenaExtendFail_PARAMS(PARAM, X) \
579 PARAM(X, 0, W, chunkMin) /* no remaining address space chunk >= chunkMin */ \
580 PARAM(X, 1, W, reserved) /* current VMArenaReserved */
581
582#define EVENT_vmArenaExtendDone_PARAMS(PARAM, X) \
583 PARAM(X, 0, W, chunkSize) /* request succeeded for chunkSize bytes */ \
584 PARAM(X, 1, W, reserved) /* new VMArenaReserved */
585
586#define EVENT_MessagesDropped_PARAMS(PARAM, X) \
587 PARAM(X, 0, W, count) /* count of messages dropped */
588
589#define EVENT_MessagesExist_PARAMS(PARAM, X)
590
591#define EVENT_ChainCondemnAuto_PARAMS(PARAM, X) \
592 PARAM(X, 0, P, chain) /* chain with gens being condemned */ \
593 PARAM(X, 1, W, topCondemnedGenSerial) /* condemned gens [0..this] */ \
594 PARAM(X, 2, W, genCount) /* total gens in chain */
595
596#define EVENT_TraceFindGrey_PARAMS(PARAM, X) \
597 PARAM(X, 0, P, arena) \
598 PARAM(X, 1, W, ti) \
599 PARAM(X, 2, P, seg) \
600 PARAM(X, 3, W, rank)
601
602#define EVENT_TraceBandAdvance_PARAMS(PARAM, X) \
603 PARAM(X, 0, P, arena) \
604 PARAM(X, 1, W, ti) \
605 PARAM(X, 2, W, rank)
60 606
61RELATION(AMCGenCreate , 0x0001, TRUE, Pool, PP)
62RELATION(AMCGenDestroy , 0x0002, TRUE, Pool, P)
63RELATION(AMCInit , 0x0003, TRUE, Pool, PP)
64RELATION(AMCFinish , 0x0004, TRUE, Pool, P)
65RELATION(ArenaCreateVM , 0x0005, TRUE, Arena, PWW)
66RELATION(ArenaCreateVMNZ , 0x0006, TRUE, Arena, PWW)
67RELATION(ArenaWriteFaults , 0x0007, TRUE, Trace, PW)
68RELATION(MeterInit , 0x0008, TRUE, Pool, PP)
69RELATION(MeterValues , 0x0009, TRUE, Pool, PDDWWW)
70RELATION(AMCScanBegin , 0x000a, TRUE, Seg, PPP)
71RELATION(AMCScanEnd , 0x000b, TRUE, Seg, PPP)
72RELATION(AMCFix , 0x000c, TRUE, Ref, 0)
73RELATION(AMCFixInPlace , 0x000d, TRUE, Ref, 0)
74RELATION(AMCFixForward , 0x000e, TRUE, Ref, A)
75RELATION(AMCReclaim , 0x000f, TRUE, Seg, PPP)
76#if 0 /* Not in use */
77RELATION(AMCTraceEnd , 0x0010, TRUE, Trace, PPP)
78#endif
79RELATION(ArenaCreateCL , 0x0011, TRUE, Arena, PWA)
80RELATION(ArenaDestroy , 0x0012, TRUE, Arena, P)
81RELATION(SegAlloc , 0x0013, TRUE, Seg, PPAWP)
82RELATION(SegFree , 0x0014, TRUE, Seg, PP)
83RELATION(PoolInit , 0x0015, TRUE, Pool, PPP)
84RELATION(PoolFinish , 0x0016, TRUE, Pool, P)
85RELATION(PoolAlloc , 0x0017, TRUE, Object, PAW)
86RELATION(PoolFree , 0x0018, TRUE, Object, PAW)
87RELATION(CBSInit , 0x0019, TRUE, Pool, PP)
88RELATION(Intern , 0x001a, TRUE, User, WS)
89RELATION(Label , 0x001b, TRUE, User, AW)
90RELATION(TraceStart , 0x001c, TRUE, Trace, PPP)
91#if 0 /* Not in use */
92RELATION(TraceCreate , 0x001d, TRUE, Trace, PPPU)
93#endif
94RELATION(TraceDestroy , 0x001e, TRUE, Trace, P)
95RELATION(SegSetGrey , 0x001f, TRUE, Seg, PPU)
96RELATION(TraceFlipBegin , 0x0020, TRUE, Trace, PP)
97RELATION(TraceFlipEnd , 0x0021, TRUE, Trace, PP)
98RELATION(TraceReclaim , 0x0022, TRUE, Seg, P)
99#if 0 /* not in use */
100RELATION(TraceScan , 0x0023, TRUE, Seg, UUPPP)
101#endif
102RELATION(TraceAccess , 0x0024, TRUE, Seg, PPU)
103/* TracePoll's kind isn't really Trace, but then it isn't Seg either */
104RELATION(TracePoll , 0x0025, TRUE, Trace, PP)
105RELATION(TraceFix , 0x0026, TRUE, Ref, PPAU)
106RELATION(TraceFixSeg , 0x0027, TRUE, Ref, P)
107RELATION(TraceFixWhite , 0x0028, TRUE, Ref, 0)
108/* TraceScanArea{Tagged} abuses kind, see .kind.abuse */
109RELATION(TraceScanArea , 0x0029, TRUE, Seg, PPP)
110RELATION(TraceScanAreaTagged , 0x002a, TRUE, Seg, PPP)
111RELATION(VMCreate , 0x002b, TRUE, Arena, PAA)
112RELATION(VMDestroy , 0x002c, TRUE, Arena, P)
113RELATION(VMMap , 0x002d, TRUE, Seg, PAA)
114RELATION(VMUnmap , 0x002e, TRUE, Seg, PAA)
115RELATION(ArenaExtend , 0x002f, TRUE, Arena, PAW)
116RELATION(ArenaRetract , 0x0030, TRUE, Arena, PAW)
117RELATION(TraceSegGreyen , 0x0031, TRUE, Seg, PPU)
118/* RootScanned abuses kind, see .kind.abuse */
119RELATION(RootScan , 0x0032, TRUE, Seg, PWW)
120/* TraceStep abuses kind, see .kind.abuse */
121RELATION(TraceStep , 0x0033, TRUE, Seg, PP)
122RELATION(BufferReserve , 0x0034, TRUE, Object, PAW)
123RELATION(BufferCommit , 0x0035, TRUE, Object, PAWA)
124/* BufferInit/Finish abuse kind, see .kind.abuse */
125RELATION(BufferInit , 0x0036, TRUE, Pool, PPU)
126RELATION(BufferFinish , 0x0037, TRUE, Pool, P)
127#if 0 /* not in use */
128RELATION(MVTFinish , 0x0038, TRUE, Pool, P)
129#endif
130RELATION(BufferFill , 0x0039, TRUE, Seg, PWAW)
131RELATION(BufferEmpty , 0x003A, TRUE, Seg, PW)
132RELATION(SegAllocFail , 0x003B, TRUE, Seg, PWP)
133RELATION(TraceScanSeg , 0x003C, TRUE, Seg, UUPP)
134/* TraceScanSingleRef abuses kind, see .kind.abuse */
135RELATION(TraceScanSingleRef , 0x003D, TRUE, Seg, UUPA)
136RELATION(TraceStatCondemn , 0x003E, TRUE, Trace, PWWWWDD)
137RELATION(TraceStatScan , 0x003F, TRUE, Trace, PWWWWWWWWWWWW)
138RELATION(TraceStatFix , 0x0040, TRUE, Trace, PWWWWWWWWW)
139RELATION(TraceStatReclaim , 0x0041, TRUE, Trace, PWW)
140
141RELATION(PoolInitMVFF , 0x0042, TRUE, Pool, PPWWWUUU)
142RELATION(PoolInitMV , 0x0043, TRUE, Pool, PPWWW)
143RELATION(PoolInitMFS , 0x0044, TRUE, Pool, PPWW)
144RELATION(PoolInitEPVM , 0x0045, TRUE, Pool, PPPUU)
145RELATION(PoolInitEPDL , 0x0046, TRUE, Pool, PPUWWW)
146RELATION(PoolInitAMS , 0x0047, TRUE, Pool, PPP)
147RELATION(PoolInitAMC , 0x0048, TRUE, Pool, PP)
148RELATION(PoolInitAMCZ , 0x0049, TRUE, Pool, PP)
149RELATION(PoolInitAWL , 0x004A, TRUE, Pool, PP)
150RELATION(PoolInitLO , 0x004B, TRUE, Pool, PP)
151RELATION(PoolInitSNC , 0x004C, TRUE, Pool, PP)
152RELATION(PoolInitMVT , 0x004D, TRUE, Pool, PWWWWW)
153
154RELATION(BufferInitEPVM , 0x0050, TRUE, Pool, PPU)
155RELATION(BufferInitSeg , 0x0051, TRUE, Pool, PPU)
156RELATION(BufferInitRank , 0x0052, TRUE, Pool, PPUU)
157
158/* PoolPush/Pop go under Object, because they're user ops. */
159RELATION(PoolPush , 0x0060, TRUE, Object, P)
160RELATION(PoolPop , 0x0061, TRUE, Object, PU)
161RELATION(ReservoirLimitSet , 0x0062, TRUE, Arena, PW)
162RELATION(CommitLimitSet , 0x0063, TRUE, Arena, PWU)
163RELATION(SpareCommitLimitSet , 0x0064, TRUE, Arena, PW)
164RELATION(ArenaAlloc , 0x0065, TRUE, Arena, PPAWP)
165RELATION(ArenaFree , 0x0066, TRUE, Arena, PAW)
166RELATION(ArenaAllocFail , 0x0067, TRUE, Arena, PWP)
167RELATION(SegMerge , 0x0068, TRUE, Seg, PPP)
168RELATION(SegSplit , 0x0069, TRUE, Seg, PPPA)
169
170/* Remember to update EventNameMAX and EventCodeMAX in eventcom.h! */
171 607
608#endif /* eventdef_h */
172 609
173/* C. COPYRIGHT AND LICENSE 610/* C. COPYRIGHT AND LICENSE
174 * 611 *
diff --git a/mps/code/eventgen.h b/mps/code/eventgen.h
deleted file mode 100644
index 354673cde13..00000000000
--- a/mps/code/eventgen.h
+++ /dev/null
@@ -1,1051 +0,0 @@
1/* <code/eventgen.h> -- Automatic event header
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 *
6 * DO NOT EDIT THIS FILE!
7 * This file was generated by //info.ravenbrook.com/project/mps/master/code/eventgen.pl#6
8 */
9
10#ifdef EVENT
11
12typedef struct {
13 Word code;
14 Word clock;
15} Event0Struct;
16
17#define EVENT_0_FIELD_PTR(event, i) \
18 (NULL)
19
20typedef struct {
21 Word code;
22 Word clock;
23 Addr a0;
24} EventAStruct;
25
26#define EVENT_A_FIELD_PTR(event, i) \
27 (((i) == 0) ? (void *)&((event)->a.a0) \
28 : NULL)
29
30typedef struct {
31 Word code;
32 Word clock;
33 Addr a0;
34 Word w1;
35} EventAWStruct;
36
37#define EVENT_AW_FIELD_PTR(event, i) \
38 (((i) == 0) ? (void *)&((event)->aw.a0) \
39 : ((i) == 1) ? (void *)&((event)->aw.w1) \
40 : NULL)
41
42typedef struct {
43 Word code;
44 Word clock;
45 void * p0;
46} EventPStruct;
47
48#define EVENT_P_FIELD_PTR(event, i) \
49 (((i) == 0) ? (void *)&((event)->p.p0) \
50 : NULL)
51
52typedef struct {
53 Word code;
54 Word clock;
55 void * p0;
56 Addr a1;
57 Addr a2;
58} EventPAAStruct;
59
60#define EVENT_PAA_FIELD_PTR(event, i) \
61 (((i) == 0) ? (void *)&((event)->paa.p0) \
62 : ((i) == 1) ? (void *)&((event)->paa.a1) \
63 : ((i) == 2) ? (void *)&((event)->paa.a2) \
64 : NULL)
65
66typedef struct {
67 Word code;
68 Word clock;
69 void * p0;
70 Addr a1;
71 Word w2;
72} EventPAWStruct;
73
74#define EVENT_PAW_FIELD_PTR(event, i) \
75 (((i) == 0) ? (void *)&((event)->paw.p0) \
76 : ((i) == 1) ? (void *)&((event)->paw.a1) \
77 : ((i) == 2) ? (void *)&((event)->paw.w2) \
78 : NULL)
79
80typedef struct {
81 Word code;
82 Word clock;
83 void * p0;
84 Addr a1;
85 Word w2;
86 Addr a3;
87} EventPAWAStruct;
88
89#define EVENT_PAWA_FIELD_PTR(event, i) \
90 (((i) == 0) ? (void *)&((event)->pawa.p0) \
91 : ((i) == 1) ? (void *)&((event)->pawa.a1) \
92 : ((i) == 2) ? (void *)&((event)->pawa.w2) \
93 : ((i) == 3) ? (void *)&((event)->pawa.a3) \
94 : NULL)
95
96typedef struct {
97 Word code;
98 Word clock;
99 void * p0;
100 double d1;
101 double d2;
102 Word w3;
103 Word w4;
104 Word w5;
105} EventPDDWWWStruct;
106
107#define EVENT_PDDWWW_FIELD_PTR(event, i) \
108 (((i) == 0) ? (void *)&((event)->pddwww.p0) \
109 : ((i) == 1) ? (void *)&((event)->pddwww.d1) \
110 : ((i) == 2) ? (void *)&((event)->pddwww.d2) \
111 : ((i) == 3) ? (void *)&((event)->pddwww.w3) \
112 : ((i) == 4) ? (void *)&((event)->pddwww.w4) \
113 : ((i) == 5) ? (void *)&((event)->pddwww.w5) \
114 : NULL)
115
116typedef struct {
117 Word code;
118 Word clock;
119 void * p0;
120 void * p1;
121} EventPPStruct;
122
123#define EVENT_PP_FIELD_PTR(event, i) \
124 (((i) == 0) ? (void *)&((event)->pp.p0) \
125 : ((i) == 1) ? (void *)&((event)->pp.p1) \
126 : NULL)
127
128typedef struct {
129 Word code;
130 Word clock;
131 void * p0;
132 void * p1;
133 Addr a2;
134 unsigned u3;
135} EventPPAUStruct;
136
137#define EVENT_PPAU_FIELD_PTR(event, i) \
138 (((i) == 0) ? (void *)&((event)->ppau.p0) \
139 : ((i) == 1) ? (void *)&((event)->ppau.p1) \
140 : ((i) == 2) ? (void *)&((event)->ppau.a2) \
141 : ((i) == 3) ? (void *)&((event)->ppau.u3) \
142 : NULL)
143
144typedef struct {
145 Word code;
146 Word clock;
147 void * p0;
148 void * p1;
149 Addr a2;
150 Word w3;
151 void * p4;
152} EventPPAWPStruct;
153
154#define EVENT_PPAWP_FIELD_PTR(event, i) \
155 (((i) == 0) ? (void *)&((event)->ppawp.p0) \
156 : ((i) == 1) ? (void *)&((event)->ppawp.p1) \
157 : ((i) == 2) ? (void *)&((event)->ppawp.a2) \
158 : ((i) == 3) ? (void *)&((event)->ppawp.w3) \
159 : ((i) == 4) ? (void *)&((event)->ppawp.p4) \
160 : NULL)
161
162typedef struct {
163 Word code;
164 Word clock;
165 void * p0;
166 void * p1;
167 void * p2;
168} EventPPPStruct;
169
170#define EVENT_PPP_FIELD_PTR(event, i) \
171 (((i) == 0) ? (void *)&((event)->ppp.p0) \
172 : ((i) == 1) ? (void *)&((event)->ppp.p1) \
173 : ((i) == 2) ? (void *)&((event)->ppp.p2) \
174 : NULL)
175
176typedef struct {
177 Word code;
178 Word clock;
179 void * p0;
180 void * p1;
181 void * p2;
182 Addr a3;
183} EventPPPAStruct;
184
185#define EVENT_PPPA_FIELD_PTR(event, i) \
186 (((i) == 0) ? (void *)&((event)->pppa.p0) \
187 : ((i) == 1) ? (void *)&((event)->pppa.p1) \
188 : ((i) == 2) ? (void *)&((event)->pppa.p2) \
189 : ((i) == 3) ? (void *)&((event)->pppa.a3) \
190 : NULL)
191
192typedef struct {
193 Word code;
194 Word clock;
195 void * p0;
196 void * p1;
197 void * p2;
198 unsigned u3;
199} EventPPPUStruct;
200
201#define EVENT_PPPU_FIELD_PTR(event, i) \
202 (((i) == 0) ? (void *)&((event)->pppu.p0) \
203 : ((i) == 1) ? (void *)&((event)->pppu.p1) \
204 : ((i) == 2) ? (void *)&((event)->pppu.p2) \
205 : ((i) == 3) ? (void *)&((event)->pppu.u3) \
206 : NULL)
207
208typedef struct {
209 Word code;
210 Word clock;
211 void * p0;
212 void * p1;
213 void * p2;
214 unsigned u3;
215 unsigned u4;
216} EventPPPUUStruct;
217
218#define EVENT_PPPUU_FIELD_PTR(event, i) \
219 (((i) == 0) ? (void *)&((event)->pppuu.p0) \
220 : ((i) == 1) ? (void *)&((event)->pppuu.p1) \
221 : ((i) == 2) ? (void *)&((event)->pppuu.p2) \
222 : ((i) == 3) ? (void *)&((event)->pppuu.u3) \
223 : ((i) == 4) ? (void *)&((event)->pppuu.u4) \
224 : NULL)
225
226typedef struct {
227 Word code;
228 Word clock;
229 void * p0;
230 void * p1;
231 unsigned u2;
232} EventPPUStruct;
233
234#define EVENT_PPU_FIELD_PTR(event, i) \
235 (((i) == 0) ? (void *)&((event)->ppu.p0) \
236 : ((i) == 1) ? (void *)&((event)->ppu.p1) \
237 : ((i) == 2) ? (void *)&((event)->ppu.u2) \
238 : NULL)
239
240typedef struct {
241 Word code;
242 Word clock;
243 void * p0;
244 void * p1;
245 unsigned u2;
246 unsigned u3;
247} EventPPUUStruct;
248
249#define EVENT_PPUU_FIELD_PTR(event, i) \
250 (((i) == 0) ? (void *)&((event)->ppuu.p0) \
251 : ((i) == 1) ? (void *)&((event)->ppuu.p1) \
252 : ((i) == 2) ? (void *)&((event)->ppuu.u2) \
253 : ((i) == 3) ? (void *)&((event)->ppuu.u3) \
254 : NULL)
255
256typedef struct {
257 Word code;
258 Word clock;
259 void * p0;
260 void * p1;
261 unsigned u2;
262 Word w3;
263 Word w4;
264 Word w5;
265} EventPPUWWWStruct;
266
267#define EVENT_PPUWWW_FIELD_PTR(event, i) \
268 (((i) == 0) ? (void *)&((event)->ppuwww.p0) \
269 : ((i) == 1) ? (void *)&((event)->ppuwww.p1) \
270 : ((i) == 2) ? (void *)&((event)->ppuwww.u2) \
271 : ((i) == 3) ? (void *)&((event)->ppuwww.w3) \
272 : ((i) == 4) ? (void *)&((event)->ppuwww.w4) \
273 : ((i) == 5) ? (void *)&((event)->ppuwww.w5) \
274 : NULL)
275
276typedef struct {
277 Word code;
278 Word clock;
279 void * p0;
280 void * p1;
281 Word w2;
282 Word w3;
283} EventPPWWStruct;
284
285#define EVENT_PPWW_FIELD_PTR(event, i) \
286 (((i) == 0) ? (void *)&((event)->ppww.p0) \
287 : ((i) == 1) ? (void *)&((event)->ppww.p1) \
288 : ((i) == 2) ? (void *)&((event)->ppww.w2) \
289 : ((i) == 3) ? (void *)&((event)->ppww.w3) \
290 : NULL)
291
292typedef struct {
293 Word code;
294 Word clock;
295 void * p0;
296 void * p1;
297 Word w2;
298 Word w3;
299 Word w4;
300} EventPPWWWStruct;
301
302#define EVENT_PPWWW_FIELD_PTR(event, i) \
303 (((i) == 0) ? (void *)&((event)->ppwww.p0) \
304 : ((i) == 1) ? (void *)&((event)->ppwww.p1) \
305 : ((i) == 2) ? (void *)&((event)->ppwww.w2) \
306 : ((i) == 3) ? (void *)&((event)->ppwww.w3) \
307 : ((i) == 4) ? (void *)&((event)->ppwww.w4) \
308 : NULL)
309
310typedef struct {
311 Word code;
312 Word clock;
313 void * p0;
314 void * p1;
315 Word w2;
316 Word w3;
317 Word w4;
318 unsigned u5;
319 unsigned u6;
320 unsigned u7;
321} EventPPWWWUUUStruct;
322
323#define EVENT_PPWWWUUU_FIELD_PTR(event, i) \
324 (((i) == 0) ? (void *)&((event)->ppwwwuuu.p0) \
325 : ((i) == 1) ? (void *)&((event)->ppwwwuuu.p1) \
326 : ((i) == 2) ? (void *)&((event)->ppwwwuuu.w2) \
327 : ((i) == 3) ? (void *)&((event)->ppwwwuuu.w3) \
328 : ((i) == 4) ? (void *)&((event)->ppwwwuuu.w4) \
329 : ((i) == 5) ? (void *)&((event)->ppwwwuuu.u5) \
330 : ((i) == 6) ? (void *)&((event)->ppwwwuuu.u6) \
331 : ((i) == 7) ? (void *)&((event)->ppwwwuuu.u7) \
332 : NULL)
333
334typedef struct {
335 Word code;
336 Word clock;
337 void * p0;
338 unsigned u1;
339} EventPUStruct;
340
341#define EVENT_PU_FIELD_PTR(event, i) \
342 (((i) == 0) ? (void *)&((event)->pu.p0) \
343 : ((i) == 1) ? (void *)&((event)->pu.u1) \
344 : NULL)
345
346typedef struct {
347 Word code;
348 Word clock;
349 void * p0;
350 Word w1;
351} EventPWStruct;
352
353#define EVENT_PW_FIELD_PTR(event, i) \
354 (((i) == 0) ? (void *)&((event)->pw.p0) \
355 : ((i) == 1) ? (void *)&((event)->pw.w1) \
356 : NULL)
357
358typedef struct {
359 Word code;
360 Word clock;
361 void * p0;
362 Word w1;
363 Addr a2;
364} EventPWAStruct;
365
366#define EVENT_PWA_FIELD_PTR(event, i) \
367 (((i) == 0) ? (void *)&((event)->pwa.p0) \
368 : ((i) == 1) ? (void *)&((event)->pwa.w1) \
369 : ((i) == 2) ? (void *)&((event)->pwa.a2) \
370 : NULL)
371
372typedef struct {
373 Word code;
374 Word clock;
375 void * p0;
376 Word w1;
377 Addr a2;
378 Word w3;
379} EventPWAWStruct;
380
381#define EVENT_PWAW_FIELD_PTR(event, i) \
382 (((i) == 0) ? (void *)&((event)->pwaw.p0) \
383 : ((i) == 1) ? (void *)&((event)->pwaw.w1) \
384 : ((i) == 2) ? (void *)&((event)->pwaw.a2) \
385 : ((i) == 3) ? (void *)&((event)->pwaw.w3) \
386 : NULL)
387
388typedef struct {
389 Word code;
390 Word clock;
391 void * p0;
392 Word w1;
393 void * p2;
394} EventPWPStruct;
395
396#define EVENT_PWP_FIELD_PTR(event, i) \
397 (((i) == 0) ? (void *)&((event)->pwp.p0) \
398 : ((i) == 1) ? (void *)&((event)->pwp.w1) \
399 : ((i) == 2) ? (void *)&((event)->pwp.p2) \
400 : NULL)
401
402typedef struct {
403 Word code;
404 Word clock;
405 void * p0;
406 Word w1;
407 unsigned u2;
408} EventPWUStruct;
409
410#define EVENT_PWU_FIELD_PTR(event, i) \
411 (((i) == 0) ? (void *)&((event)->pwu.p0) \
412 : ((i) == 1) ? (void *)&((event)->pwu.w1) \
413 : ((i) == 2) ? (void *)&((event)->pwu.u2) \
414 : NULL)
415
416typedef struct {
417 Word code;
418 Word clock;
419 void * p0;
420 Word w1;
421 Word w2;
422} EventPWWStruct;
423
424#define EVENT_PWW_FIELD_PTR(event, i) \
425 (((i) == 0) ? (void *)&((event)->pww.p0) \
426 : ((i) == 1) ? (void *)&((event)->pww.w1) \
427 : ((i) == 2) ? (void *)&((event)->pww.w2) \
428 : NULL)
429
430typedef struct {
431 Word code;
432 Word clock;
433 void * p0;
434 Word w1;
435 Word w2;
436 Word w3;
437 Word w4;
438 double d5;
439 double d6;
440} EventPWWWWDDStruct;
441
442#define EVENT_PWWWWDD_FIELD_PTR(event, i) \
443 (((i) == 0) ? (void *)&((event)->pwwwwdd.p0) \
444 : ((i) == 1) ? (void *)&((event)->pwwwwdd.w1) \
445 : ((i) == 2) ? (void *)&((event)->pwwwwdd.w2) \
446 : ((i) == 3) ? (void *)&((event)->pwwwwdd.w3) \
447 : ((i) == 4) ? (void *)&((event)->pwwwwdd.w4) \
448 : ((i) == 5) ? (void *)&((event)->pwwwwdd.d5) \
449 : ((i) == 6) ? (void *)&((event)->pwwwwdd.d6) \
450 : NULL)
451
452typedef struct {
453 Word code;
454 Word clock;
455 void * p0;
456 Word w1;
457 Word w2;
458 Word w3;
459 Word w4;
460 Word w5;
461} EventPWWWWWStruct;
462
463#define EVENT_PWWWWW_FIELD_PTR(event, i) \
464 (((i) == 0) ? (void *)&((event)->pwwwww.p0) \
465 : ((i) == 1) ? (void *)&((event)->pwwwww.w1) \
466 : ((i) == 2) ? (void *)&((event)->pwwwww.w2) \
467 : ((i) == 3) ? (void *)&((event)->pwwwww.w3) \
468 : ((i) == 4) ? (void *)&((event)->pwwwww.w4) \
469 : ((i) == 5) ? (void *)&((event)->pwwwww.w5) \
470 : NULL)
471
472typedef struct {
473 Word code;
474 Word clock;
475 void * p0;
476 Word w1;
477 Word w2;
478 Word w3;
479 Word w4;
480 Word w5;
481 Word w6;
482 Word w7;
483 Word w8;
484 Word w9;
485} EventPWWWWWWWWWStruct;
486
487#define EVENT_PWWWWWWWWW_FIELD_PTR(event, i) \
488 (((i) == 0) ? (void *)&((event)->pwwwwwwwww.p0) \
489 : ((i) == 1) ? (void *)&((event)->pwwwwwwwww.w1) \
490 : ((i) == 2) ? (void *)&((event)->pwwwwwwwww.w2) \
491 : ((i) == 3) ? (void *)&((event)->pwwwwwwwww.w3) \
492 : ((i) == 4) ? (void *)&((event)->pwwwwwwwww.w4) \
493 : ((i) == 5) ? (void *)&((event)->pwwwwwwwww.w5) \
494 : ((i) == 6) ? (void *)&((event)->pwwwwwwwww.w6) \
495 : ((i) == 7) ? (void *)&((event)->pwwwwwwwww.w7) \
496 : ((i) == 8) ? (void *)&((event)->pwwwwwwwww.w8) \
497 : ((i) == 9) ? (void *)&((event)->pwwwwwwwww.w9) \
498 : NULL)
499
500typedef struct {
501 Word code;
502 Word clock;
503 void * p0;
504 Word w1;
505 Word w2;
506 Word w3;
507 Word w4;
508 Word w5;
509 Word w6;
510 Word w7;
511 Word w8;
512 Word w9;
513 Word w10;
514 Word w11;
515 Word w12;
516} EventPWWWWWWWWWWWWStruct;
517
518#define EVENT_PWWWWWWWWWWWW_FIELD_PTR(event, i) \
519 (((i) == 0) ? (void *)&((event)->pwwwwwwwwwwww.p0) \
520 : ((i) == 1) ? (void *)&((event)->pwwwwwwwwwwww.w1) \
521 : ((i) == 2) ? (void *)&((event)->pwwwwwwwwwwww.w2) \
522 : ((i) == 3) ? (void *)&((event)->pwwwwwwwwwwww.w3) \
523 : ((i) == 4) ? (void *)&((event)->pwwwwwwwwwwww.w4) \
524 : ((i) == 5) ? (void *)&((event)->pwwwwwwwwwwww.w5) \
525 : ((i) == 6) ? (void *)&((event)->pwwwwwwwwwwww.w6) \
526 : ((i) == 7) ? (void *)&((event)->pwwwwwwwwwwww.w7) \
527 : ((i) == 8) ? (void *)&((event)->pwwwwwwwwwwww.w8) \
528 : ((i) == 9) ? (void *)&((event)->pwwwwwwwwwwww.w9) \
529 : ((i) == 10) ? (void *)&((event)->pwwwwwwwwwwww.w10) \
530 : ((i) == 11) ? (void *)&((event)->pwwwwwwwwwwww.w11) \
531 : ((i) == 12) ? (void *)&((event)->pwwwwwwwwwwww.w12) \
532 : NULL)
533
534typedef struct {
535 Word code;
536 Word clock;
537 unsigned u0;
538 unsigned u1;
539 void * p2;
540 Addr a3;
541} EventUUPAStruct;
542
543#define EVENT_UUPA_FIELD_PTR(event, i) \
544 (((i) == 0) ? (void *)&((event)->uupa.u0) \
545 : ((i) == 1) ? (void *)&((event)->uupa.u1) \
546 : ((i) == 2) ? (void *)&((event)->uupa.p2) \
547 : ((i) == 3) ? (void *)&((event)->uupa.a3) \
548 : NULL)
549
550typedef struct {
551 Word code;
552 Word clock;
553 unsigned u0;
554 unsigned u1;
555 void * p2;
556 void * p3;
557} EventUUPPStruct;
558
559#define EVENT_UUPP_FIELD_PTR(event, i) \
560 (((i) == 0) ? (void *)&((event)->uupp.u0) \
561 : ((i) == 1) ? (void *)&((event)->uupp.u1) \
562 : ((i) == 2) ? (void *)&((event)->uupp.p2) \
563 : ((i) == 3) ? (void *)&((event)->uupp.p3) \
564 : NULL)
565
566typedef struct {
567 Word code;
568 Word clock;
569 unsigned u0;
570 unsigned u1;
571 void * p2;
572 void * p3;
573 void * p4;
574} EventUUPPPStruct;
575
576#define EVENT_UUPPP_FIELD_PTR(event, i) \
577 (((i) == 0) ? (void *)&((event)->uuppp.u0) \
578 : ((i) == 1) ? (void *)&((event)->uuppp.u1) \
579 : ((i) == 2) ? (void *)&((event)->uuppp.p2) \
580 : ((i) == 3) ? (void *)&((event)->uuppp.p3) \
581 : ((i) == 4) ? (void *)&((event)->uuppp.p4) \
582 : NULL)
583
584typedef struct {
585 Word code;
586 Word clock;
587 Word w0;
588 EventStringStruct s1;
589} EventWSStruct;
590
591#define EVENT_WS_FIELD_PTR(event, i) \
592 (((i) == 0) ? (void *)&((event)->ws.w0) \
593 : ((i) == 1) ? (void *)&((event)->ws.s1) \
594 : NULL)
595
596
597typedef union {
598 Event0Struct any;
599 EventAStruct a;
600 EventAWStruct aw;
601 EventPStruct p;
602 EventPAAStruct paa;
603 EventPAWStruct paw;
604 EventPAWAStruct pawa;
605 EventPDDWWWStruct pddwww;
606 EventPPStruct pp;
607 EventPPAUStruct ppau;
608 EventPPAWPStruct ppawp;
609 EventPPPStruct ppp;
610 EventPPPAStruct pppa;
611 EventPPPUStruct pppu;
612 EventPPPUUStruct pppuu;
613 EventPPUStruct ppu;
614 EventPPUUStruct ppuu;
615 EventPPUWWWStruct ppuwww;
616 EventPPWWStruct ppww;
617 EventPPWWWStruct ppwww;
618 EventPPWWWUUUStruct ppwwwuuu;
619 EventPUStruct pu;
620 EventPWStruct pw;
621 EventPWAStruct pwa;
622 EventPWAWStruct pwaw;
623 EventPWPStruct pwp;
624 EventPWUStruct pwu;
625 EventPWWStruct pww;
626 EventPWWWWDDStruct pwwwwdd;
627 EventPWWWWWStruct pwwwww;
628 EventPWWWWWWWWWStruct pwwwwwwwww;
629 EventPWWWWWWWWWWWWStruct pwwwwwwwwwwww;
630 EventUUPAStruct uupa;
631 EventUUPPStruct uupp;
632 EventUUPPPStruct uuppp;
633 EventWSStruct ws;
634} EventUnion;
635
636
637#define EVENT_0(type) \
638 EVENT_BEGIN(type) \
639 EVENT_END(type, 0, sizeof(Event0Struct))
640
641#define EVENT_A(type, _a0) \
642 EVENT_BEGIN(type) \
643 EventMould.a.a0 = (_a0); \
644 EVENT_END(type, A, sizeof(EventAStruct))
645
646#define EVENT_AW(type, _a0, _w1) \
647 EVENT_BEGIN(type) \
648 EventMould.aw.a0 = (_a0); \
649 EventMould.aw.w1 = (_w1); \
650 EVENT_END(type, AW, sizeof(EventAWStruct))
651
652#define EVENT_P(type, _p0) \
653 EVENT_BEGIN(type) \
654 EventMould.p.p0 = (_p0); \
655 EVENT_END(type, P, sizeof(EventPStruct))
656
657#define EVENT_PAA(type, _p0, _a1, _a2) \
658 EVENT_BEGIN(type) \
659 EventMould.paa.p0 = (_p0); \
660 EventMould.paa.a1 = (_a1); \
661 EventMould.paa.a2 = (_a2); \
662 EVENT_END(type, PAA, sizeof(EventPAAStruct))
663
664#define EVENT_PAW(type, _p0, _a1, _w2) \
665 EVENT_BEGIN(type) \
666 EventMould.paw.p0 = (_p0); \
667 EventMould.paw.a1 = (_a1); \
668 EventMould.paw.w2 = (_w2); \
669 EVENT_END(type, PAW, sizeof(EventPAWStruct))
670
671#define EVENT_PAWA(type, _p0, _a1, _w2, _a3) \
672 EVENT_BEGIN(type) \
673 EventMould.pawa.p0 = (_p0); \
674 EventMould.pawa.a1 = (_a1); \
675 EventMould.pawa.w2 = (_w2); \
676 EventMould.pawa.a3 = (_a3); \
677 EVENT_END(type, PAWA, sizeof(EventPAWAStruct))
678
679#define EVENT_PDDWWW(type, _p0, _d1, _d2, _w3, _w4, _w5) \
680 EVENT_BEGIN(type) \
681 EventMould.pddwww.p0 = (_p0); \
682 EventMould.pddwww.d1 = (_d1); \
683 EventMould.pddwww.d2 = (_d2); \
684 EventMould.pddwww.w3 = (_w3); \
685 EventMould.pddwww.w4 = (_w4); \
686 EventMould.pddwww.w5 = (_w5); \
687 EVENT_END(type, PDDWWW, sizeof(EventPDDWWWStruct))
688
689#define EVENT_PP(type, _p0, _p1) \
690 EVENT_BEGIN(type) \
691 EventMould.pp.p0 = (_p0); \
692 EventMould.pp.p1 = (_p1); \
693 EVENT_END(type, PP, sizeof(EventPPStruct))
694
695#define EVENT_PPAU(type, _p0, _p1, _a2, _u3) \
696 EVENT_BEGIN(type) \
697 EventMould.ppau.p0 = (_p0); \
698 EventMould.ppau.p1 = (_p1); \
699 EventMould.ppau.a2 = (_a2); \
700 EventMould.ppau.u3 = (_u3); \
701 EVENT_END(type, PPAU, sizeof(EventPPAUStruct))
702
703#define EVENT_PPAWP(type, _p0, _p1, _a2, _w3, _p4) \
704 EVENT_BEGIN(type) \
705 EventMould.ppawp.p0 = (_p0); \
706 EventMould.ppawp.p1 = (_p1); \
707 EventMould.ppawp.a2 = (_a2); \
708 EventMould.ppawp.w3 = (_w3); \
709 EventMould.ppawp.p4 = (_p4); \
710 EVENT_END(type, PPAWP, sizeof(EventPPAWPStruct))
711
712#define EVENT_PPP(type, _p0, _p1, _p2) \
713 EVENT_BEGIN(type) \
714 EventMould.ppp.p0 = (_p0); \
715 EventMould.ppp.p1 = (_p1); \
716 EventMould.ppp.p2 = (_p2); \
717 EVENT_END(type, PPP, sizeof(EventPPPStruct))
718
719#define EVENT_PPPA(type, _p0, _p1, _p2, _a3) \
720 EVENT_BEGIN(type) \
721 EventMould.pppa.p0 = (_p0); \
722 EventMould.pppa.p1 = (_p1); \
723 EventMould.pppa.p2 = (_p2); \
724 EventMould.pppa.a3 = (_a3); \
725 EVENT_END(type, PPPA, sizeof(EventPPPAStruct))
726
727#define EVENT_PPPU(type, _p0, _p1, _p2, _u3) \
728 EVENT_BEGIN(type) \
729 EventMould.pppu.p0 = (_p0); \
730 EventMould.pppu.p1 = (_p1); \
731 EventMould.pppu.p2 = (_p2); \
732 EventMould.pppu.u3 = (_u3); \
733 EVENT_END(type, PPPU, sizeof(EventPPPUStruct))
734
735#define EVENT_PPPUU(type, _p0, _p1, _p2, _u3, _u4) \
736 EVENT_BEGIN(type) \
737 EventMould.pppuu.p0 = (_p0); \
738 EventMould.pppuu.p1 = (_p1); \
739 EventMould.pppuu.p2 = (_p2); \
740 EventMould.pppuu.u3 = (_u3); \
741 EventMould.pppuu.u4 = (_u4); \
742 EVENT_END(type, PPPUU, sizeof(EventPPPUUStruct))
743
744#define EVENT_PPU(type, _p0, _p1, _u2) \
745 EVENT_BEGIN(type) \
746 EventMould.ppu.p0 = (_p0); \
747 EventMould.ppu.p1 = (_p1); \
748 EventMould.ppu.u2 = (_u2); \
749 EVENT_END(type, PPU, sizeof(EventPPUStruct))
750
751#define EVENT_PPUU(type, _p0, _p1, _u2, _u3) \
752 EVENT_BEGIN(type) \
753 EventMould.ppuu.p0 = (_p0); \
754 EventMould.ppuu.p1 = (_p1); \
755 EventMould.ppuu.u2 = (_u2); \
756 EventMould.ppuu.u3 = (_u3); \
757 EVENT_END(type, PPUU, sizeof(EventPPUUStruct))
758
759#define EVENT_PPUWWW(type, _p0, _p1, _u2, _w3, _w4, _w5) \
760 EVENT_BEGIN(type) \
761 EventMould.ppuwww.p0 = (_p0); \
762 EventMould.ppuwww.p1 = (_p1); \
763 EventMould.ppuwww.u2 = (_u2); \
764 EventMould.ppuwww.w3 = (_w3); \
765 EventMould.ppuwww.w4 = (_w4); \
766 EventMould.ppuwww.w5 = (_w5); \
767 EVENT_END(type, PPUWWW, sizeof(EventPPUWWWStruct))
768
769#define EVENT_PPWW(type, _p0, _p1, _w2, _w3) \
770 EVENT_BEGIN(type) \
771 EventMould.ppww.p0 = (_p0); \
772 EventMould.ppww.p1 = (_p1); \
773 EventMould.ppww.w2 = (_w2); \
774 EventMould.ppww.w3 = (_w3); \
775 EVENT_END(type, PPWW, sizeof(EventPPWWStruct))
776
777#define EVENT_PPWWW(type, _p0, _p1, _w2, _w3, _w4) \
778 EVENT_BEGIN(type) \
779 EventMould.ppwww.p0 = (_p0); \
780 EventMould.ppwww.p1 = (_p1); \
781 EventMould.ppwww.w2 = (_w2); \
782 EventMould.ppwww.w3 = (_w3); \
783 EventMould.ppwww.w4 = (_w4); \
784 EVENT_END(type, PPWWW, sizeof(EventPPWWWStruct))
785
786#define EVENT_PPWWWUUU(type, _p0, _p1, _w2, _w3, _w4, _u5, _u6, _u7) \
787 EVENT_BEGIN(type) \
788 EventMould.ppwwwuuu.p0 = (_p0); \
789 EventMould.ppwwwuuu.p1 = (_p1); \
790 EventMould.ppwwwuuu.w2 = (_w2); \
791 EventMould.ppwwwuuu.w3 = (_w3); \
792 EventMould.ppwwwuuu.w4 = (_w4); \
793 EventMould.ppwwwuuu.u5 = (_u5); \
794 EventMould.ppwwwuuu.u6 = (_u6); \
795 EventMould.ppwwwuuu.u7 = (_u7); \
796 EVENT_END(type, PPWWWUUU, sizeof(EventPPWWWUUUStruct))
797
798#define EVENT_PU(type, _p0, _u1) \
799 EVENT_BEGIN(type) \
800 EventMould.pu.p0 = (_p0); \
801 EventMould.pu.u1 = (_u1); \
802 EVENT_END(type, PU, sizeof(EventPUStruct))
803
804#define EVENT_PW(type, _p0, _w1) \
805 EVENT_BEGIN(type) \
806 EventMould.pw.p0 = (_p0); \
807 EventMould.pw.w1 = (_w1); \
808 EVENT_END(type, PW, sizeof(EventPWStruct))
809
810#define EVENT_PWA(type, _p0, _w1, _a2) \
811 EVENT_BEGIN(type) \
812 EventMould.pwa.p0 = (_p0); \
813 EventMould.pwa.w1 = (_w1); \
814 EventMould.pwa.a2 = (_a2); \
815 EVENT_END(type, PWA, sizeof(EventPWAStruct))
816
817#define EVENT_PWAW(type, _p0, _w1, _a2, _w3) \
818 EVENT_BEGIN(type) \
819 EventMould.pwaw.p0 = (_p0); \
820 EventMould.pwaw.w1 = (_w1); \
821 EventMould.pwaw.a2 = (_a2); \
822 EventMould.pwaw.w3 = (_w3); \
823 EVENT_END(type, PWAW, sizeof(EventPWAWStruct))
824
825#define EVENT_PWP(type, _p0, _w1, _p2) \
826 EVENT_BEGIN(type) \
827 EventMould.pwp.p0 = (_p0); \
828 EventMould.pwp.w1 = (_w1); \
829 EventMould.pwp.p2 = (_p2); \
830 EVENT_END(type, PWP, sizeof(EventPWPStruct))
831
832#define EVENT_PWU(type, _p0, _w1, _u2) \
833 EVENT_BEGIN(type) \
834 EventMould.pwu.p0 = (_p0); \
835 EventMould.pwu.w1 = (_w1); \
836 EventMould.pwu.u2 = (_u2); \
837 EVENT_END(type, PWU, sizeof(EventPWUStruct))
838
839#define EVENT_PWW(type, _p0, _w1, _w2) \
840 EVENT_BEGIN(type) \
841 EventMould.pww.p0 = (_p0); \
842 EventMould.pww.w1 = (_w1); \
843 EventMould.pww.w2 = (_w2); \
844 EVENT_END(type, PWW, sizeof(EventPWWStruct))
845
846#define EVENT_PWWWWDD(type, _p0, _w1, _w2, _w3, _w4, _d5, _d6) \
847 EVENT_BEGIN(type) \
848 EventMould.pwwwwdd.p0 = (_p0); \
849 EventMould.pwwwwdd.w1 = (_w1); \
850 EventMould.pwwwwdd.w2 = (_w2); \
851 EventMould.pwwwwdd.w3 = (_w3); \
852 EventMould.pwwwwdd.w4 = (_w4); \
853 EventMould.pwwwwdd.d5 = (_d5); \
854 EventMould.pwwwwdd.d6 = (_d6); \
855 EVENT_END(type, PWWWWDD, sizeof(EventPWWWWDDStruct))
856
857#define EVENT_PWWWWW(type, _p0, _w1, _w2, _w3, _w4, _w5) \
858 EVENT_BEGIN(type) \
859 EventMould.pwwwww.p0 = (_p0); \
860 EventMould.pwwwww.w1 = (_w1); \
861 EventMould.pwwwww.w2 = (_w2); \
862 EventMould.pwwwww.w3 = (_w3); \
863 EventMould.pwwwww.w4 = (_w4); \
864 EventMould.pwwwww.w5 = (_w5); \
865 EVENT_END(type, PWWWWW, sizeof(EventPWWWWWStruct))
866
867#define EVENT_PWWWWWWWWW(type, _p0, _w1, _w2, _w3, _w4, _w5, _w6, _w7, _w8, _w9) \
868 EVENT_BEGIN(type) \
869 EventMould.pwwwwwwwww.p0 = (_p0); \
870 EventMould.pwwwwwwwww.w1 = (_w1); \
871 EventMould.pwwwwwwwww.w2 = (_w2); \
872 EventMould.pwwwwwwwww.w3 = (_w3); \
873 EventMould.pwwwwwwwww.w4 = (_w4); \
874 EventMould.pwwwwwwwww.w5 = (_w5); \
875 EventMould.pwwwwwwwww.w6 = (_w6); \
876 EventMould.pwwwwwwwww.w7 = (_w7); \
877 EventMould.pwwwwwwwww.w8 = (_w8); \
878 EventMould.pwwwwwwwww.w9 = (_w9); \
879 EVENT_END(type, PWWWWWWWWW, sizeof(EventPWWWWWWWWWStruct))
880
881#define EVENT_PWWWWWWWWWWWW(type, _p0, _w1, _w2, _w3, _w4, _w5, _w6, _w7, _w8, _w9, _w10, _w11, _w12) \
882 EVENT_BEGIN(type) \
883 EventMould.pwwwwwwwwwwww.p0 = (_p0); \
884 EventMould.pwwwwwwwwwwww.w1 = (_w1); \
885 EventMould.pwwwwwwwwwwww.w2 = (_w2); \
886 EventMould.pwwwwwwwwwwww.w3 = (_w3); \
887 EventMould.pwwwwwwwwwwww.w4 = (_w4); \
888 EventMould.pwwwwwwwwwwww.w5 = (_w5); \
889 EventMould.pwwwwwwwwwwww.w6 = (_w6); \
890 EventMould.pwwwwwwwwwwww.w7 = (_w7); \
891 EventMould.pwwwwwwwwwwww.w8 = (_w8); \
892 EventMould.pwwwwwwwwwwww.w9 = (_w9); \
893 EventMould.pwwwwwwwwwwww.w10 = (_w10); \
894 EventMould.pwwwwwwwwwwww.w11 = (_w11); \
895 EventMould.pwwwwwwwwwwww.w12 = (_w12); \
896 EVENT_END(type, PWWWWWWWWWWWW, sizeof(EventPWWWWWWWWWWWWStruct))
897
898#define EVENT_UUPA(type, _u0, _u1, _p2, _a3) \
899 EVENT_BEGIN(type) \
900 EventMould.uupa.u0 = (_u0); \
901 EventMould.uupa.u1 = (_u1); \
902 EventMould.uupa.p2 = (_p2); \
903 EventMould.uupa.a3 = (_a3); \
904 EVENT_END(type, UUPA, sizeof(EventUUPAStruct))
905
906#define EVENT_UUPP(type, _u0, _u1, _p2, _p3) \
907 EVENT_BEGIN(type) \
908 EventMould.uupp.u0 = (_u0); \
909 EventMould.uupp.u1 = (_u1); \
910 EventMould.uupp.p2 = (_p2); \
911 EventMould.uupp.p3 = (_p3); \
912 EVENT_END(type, UUPP, sizeof(EventUUPPStruct))
913
914#define EVENT_UUPPP(type, _u0, _u1, _p2, _p3, _p4) \
915 EVENT_BEGIN(type) \
916 EventMould.uuppp.u0 = (_u0); \
917 EventMould.uuppp.u1 = (_u1); \
918 EventMould.uuppp.p2 = (_p2); \
919 EventMould.uuppp.p3 = (_p3); \
920 EventMould.uuppp.p4 = (_p4); \
921 EVENT_END(type, UUPPP, sizeof(EventUUPPPStruct))
922
923#define EVENT_WS(type, _w0, _l1, _s1) \
924 EVENT_BEGIN(type) \
925 size_t _string_len; \
926 EventMould.ws.w0 = (_w0); \
927 _string_len = (_l1); \
928 AVER(_string_len < EventStringLengthMAX); \
929 EventMould.ws.s1.len = (EventStringLen)_string_len; \
930 mps_lib_memcpy(EventMould.ws.s1.str, _s1, _string_len); \
931 EVENT_END(type, WS, offsetof(EventWSStruct, s1.str) + _string_len)
932
933#define EventFormat0 0
934#define EventFormatA 1
935#define EventFormatAW 2
936#define EventFormatP 3
937#define EventFormatPAA 4
938#define EventFormatPAW 5
939#define EventFormatPAWA 6
940#define EventFormatPDDWWW 7
941#define EventFormatPP 8
942#define EventFormatPPAU 9
943#define EventFormatPPAWP 10
944#define EventFormatPPP 11
945#define EventFormatPPPA 12
946#define EventFormatPPPU 13
947#define EventFormatPPPUU 14
948#define EventFormatPPU 15
949#define EventFormatPPUU 16
950#define EventFormatPPUWWW 17
951#define EventFormatPPWW 18
952#define EventFormatPPWWW 19
953#define EventFormatPPWWWUUU 20
954#define EventFormatPU 21
955#define EventFormatPW 22
956#define EventFormatPWA 23
957#define EventFormatPWAW 24
958#define EventFormatPWP 25
959#define EventFormatPWU 26
960#define EventFormatPWW 27
961#define EventFormatPWWWWDD 28
962#define EventFormatPWWWWW 29
963#define EventFormatPWWWWWWWWW 30
964#define EventFormatPWWWWWWWWWWWW 31
965#define EventFormatUUPA 32
966#define EventFormatUUPP 33
967#define EventFormatUUPPP 34
968#define EventFormatWS 35
969
970#else /* EVENT not */
971
972#define EVENT_0(type) NOOP
973#define EVENT_A(type, p0) NOOP
974#define EVENT_AW(type, p0, p1) NOOP
975#define EVENT_P(type, p0) NOOP
976#define EVENT_PAA(type, p0, p1, p2) NOOP
977#define EVENT_PAW(type, p0, p1, p2) NOOP
978#define EVENT_PAWA(type, p0, p1, p2, p3) NOOP
979#define EVENT_PDDWWW(type, p0, p1, p2, p3, p4, p5) NOOP
980#define EVENT_PP(type, p0, p1) NOOP
981#define EVENT_PPAU(type, p0, p1, p2, p3) NOOP
982#define EVENT_PPAWP(type, p0, p1, p2, p3, p4) NOOP
983#define EVENT_PPP(type, p0, p1, p2) NOOP
984#define EVENT_PPPA(type, p0, p1, p2, p3) NOOP
985#define EVENT_PPPU(type, p0, p1, p2, p3) NOOP
986#define EVENT_PPPUU(type, p0, p1, p2, p3, p4) NOOP
987#define EVENT_PPU(type, p0, p1, p2) NOOP
988#define EVENT_PPUU(type, p0, p1, p2, p3) NOOP
989#define EVENT_PPUWWW(type, p0, p1, p2, p3, p4, p5) NOOP
990#define EVENT_PPWW(type, p0, p1, p2, p3) NOOP
991#define EVENT_PPWWW(type, p0, p1, p2, p3, p4) NOOP
992#define EVENT_PPWWWUUU(type, p0, p1, p2, p3, p4, p5, p6, p7) NOOP
993#define EVENT_PU(type, p0, p1) NOOP
994#define EVENT_PW(type, p0, p1) NOOP
995#define EVENT_PWA(type, p0, p1, p2) NOOP
996#define EVENT_PWAW(type, p0, p1, p2, p3) NOOP
997#define EVENT_PWP(type, p0, p1, p2) NOOP
998#define EVENT_PWU(type, p0, p1, p2) NOOP
999#define EVENT_PWW(type, p0, p1, p2) NOOP
1000#define EVENT_PWWWWDD(type, p0, p1, p2, p3, p4, p5, p6) NOOP
1001#define EVENT_PWWWWW(type, p0, p1, p2, p3, p4, p5) NOOP
1002#define EVENT_PWWWWWWWWW(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) NOOP
1003#define EVENT_PWWWWWWWWWWWW(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) NOOP
1004#define EVENT_UUPA(type, p0, p1, p2, p3) NOOP
1005#define EVENT_UUPP(type, p0, p1, p2, p3) NOOP
1006#define EVENT_UUPPP(type, p0, p1, p2, p3, p4) NOOP
1007#define EVENT_WS(type, p0, p1, l1) NOOP
1008
1009#endif /* EVENT */
1010
1011
1012/* C. COPYRIGHT AND LICENSE
1013 *
1014 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
1015 * All rights reserved. This is an open source license. Contact
1016 * Ravenbrook for commercial licensing options.
1017 *
1018 * Redistribution and use in source and binary forms, with or without
1019 * modification, are permitted provided that the following conditions are
1020 * met:
1021 *
1022 * 1. Redistributions of source code must retain the above copyright
1023 * notice, this list of conditions and the following disclaimer.
1024 *
1025 * 2. Redistributions in binary form must reproduce the above copyright
1026 * notice, this list of conditions and the following disclaimer in the
1027 * documentation and/or other materials provided with the distribution.
1028 *
1029 * 3. Redistributions in any form must be accompanied by information on how
1030 * to obtain complete source code for this software and any accompanying
1031 * software that uses this software. The source code must either be
1032 * included in the distribution or be available for no more than the cost
1033 * of distribution plus a nominal fee, and must be freely redistributable
1034 * under reasonable conditions. For an executable file, complete source
1035 * code means the source code for all modules it contains. It does not
1036 * include source code for modules or files that typically accompany the
1037 * major components of the operating system on which the executable file
1038 * runs.
1039 *
1040 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
1041 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1042 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
1043 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
1044 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1045 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1046 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
1047 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1048 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1049 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1050 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1051 */
diff --git a/mps/code/eventgen.pl b/mps/code/eventgen.pl
deleted file mode 100644
index 82a71de500e..00000000000
--- a/mps/code/eventgen.pl
+++ /dev/null
@@ -1,220 +0,0 @@
1#!/usr/local/bin/perl -w
2# impl.pl.eventgen: GENERATOR FOR <code/eventgen.h>
3#
4# $Id$
5# Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
6#
7# .how: Invoke this script in the src directory. It works by scanning
8# eventdef.h and then creating a file eventgen.h that includes the
9# necessary types and macros.
10#
11# You will need to have eventgen.h claimed, and you should
12# remember to check it in afterwards.
13
14$ID = substr(q$Id$, 4, -1);
15
16%Formats = ();
17
18%Types = (
19 "D", "double",
20 "S", "EventStringStruct",
21 "U", "unsigned",
22 "W", "Word",
23 "A", "Addr",
24 "P", "void *",
25 );
26
27
28#### Discover formats
29
30
31open(C, "<eventdef.h") || die "Can't open $_";
32while(<C>) {
33 if(/RELATION\([^,]*,[^,]*,[^,]*,[^,]*, ([A-Z]+)\)/) {
34 $Formats{$1} = 1 if(!defined($Formats{$1}));
35 }
36}
37close(C);
38
39
40#### Generate eventgen.h
41
42
43open(H, ">eventgen.h") || die "Can't open eventgen.h for output";
44
45print H "/* <code/eventgen.h> -- Automatic event header
46 *
47 * \$Id\$
48 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
49 *
50 * DO NOT EDIT THIS FILE!
51 * This file was generated by $ID
52 */\n\n";
53
54
55print H "#ifdef EVENT\n\n";
56
57
58#### Generate structure definitions and accessors
59
60
61foreach $format ("", sort(keys(%Formats))) {
62 $fmt = ($format eq "") ? "0" : $format;
63 print H "typedef struct {\n";
64 print H " Word code;\n Word clock;\n";
65 for($i = 0; $i < length($format); $i++) {
66 $c = substr($format, $i, 1);
67 if($c eq "S") {
68 die "String must be at end of format" if($i+1 != length($format));
69 }
70 if(!defined($Types{$c})) {
71 die "Can't find type for format code >$c<.";
72 } else {
73 print H " ", $Types{$c}, " \l$c$i;\n";
74 }
75 }
76 print H "} Event${fmt}Struct;\n\n";
77
78 print H "#define EVENT_${fmt}_FIELD_PTR(event, i) \\\n (";
79 for($i = 0; $i < length($format); $i++) {
80 $c = substr($format, $i, 1);
81 print H "((i) == $i) ? (void *)&((event)->\L$fmt.$c\E$i) \\\n : ";
82 }
83 print H "NULL)\n\n";
84}
85
86
87#### Generate union type
88
89
90print H "\ntypedef union {\n Event0Struct any;\n";
91
92foreach $format (sort(keys(%Formats))) {
93 print H " Event${format}Struct \L$format;\n";
94}
95print H "} EventUnion;\n\n\n";
96
97
98#### Generate writer macros
99
100
101foreach $format ("", sort(keys(%Formats))) {
102 $fmt = ($format eq "") ? "0" : $format;
103
104 print H "#define EVENT_$fmt(type";
105 for($i = 0; $i < length($format); $i++) {
106 $c = substr($format, $i, 1);
107 if($c eq "S") {
108 print H ", _l$i, _s$i";
109 } else {
110 print H ", _\l$c$i";
111 }
112 }
113 print H ") \\\n";
114
115 print H " EVENT_BEGIN(type) \\\n";
116
117 if(($i = index($format, "S")) != -1) {
118 print H " size_t _string_len; \\\n";
119 }
120
121 for($i = 0; $i < length($format); $i++) {
122 $c = substr($format, $i, 1);
123 if($c eq "S") {
124 print H " _string_len = (_l$i); \\\n";
125 print H " AVER(_string_len < EventStringLengthMAX); \\\n";
126 print H " EventMould.\L$fmt.s$i.len = "
127 . "(EventStringLen)_string_len; \\\n";
128 print H " mps_lib_memcpy(EventMould.\L$fmt.s$i.str, "
129 . "_s$i, _string_len); \\\n";
130 } else {
131 print H " EventMould.\L$fmt.$c$i = (_$c$i); \\\n";
132 }
133 }
134
135 if(($i = index($format, "S")) != -1) {
136 print H " EVENT_END(type, $fmt, "
137 . "offsetof(Event${fmt}Struct, s$i.str) "
138 . "+ _string_len)\n\n";
139 } else {
140 print H " EVENT_END(type, $fmt, "
141 . "sizeof(Event${fmt}Struct))\n\n";
142 }
143}
144
145
146#### Generate format codes
147
148
149$C = 0;
150foreach $format ("0", sort(keys(%Formats))) {
151 print H "#define EventFormat$format $C\n";
152 $C++;
153}
154
155
156#### Generate dummies for non-event varieties
157
158
159print H "\n#else /* EVENT not */\n\n";
160
161
162print H "#define EVENT_0(type) NOOP\n";
163
164foreach $format (sort(keys(%Formats))) {
165 print H "#define EVENT_$format(type";
166 for($i = 0; $i < length($format); $i++) {
167 print H ", p$i";
168 }
169 if(($i = index($format, "S")) != -1) {
170 print H ", l$i";
171 }
172 print H ") NOOP\n";
173}
174
175
176print H "\n#endif /* EVENT */\n";
177
178
179close(H);
180
181
182# C. COPYRIGHT AND LICENSE
183#
184# Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
185# All rights reserved. This is an open source license. Contact
186# Ravenbrook for commercial licensing options.
187#
188# Redistribution and use in source and binary forms, with or without
189# modification, are permitted provided that the following conditions are
190# met:
191#
192# 1. Redistributions of source code must retain the above copyright
193# notice, this list of conditions and the following disclaimer.
194#
195# 2. Redistributions in binary form must reproduce the above copyright
196# notice, this list of conditions and the following disclaimer in the
197# documentation and/or other materials provided with the distribution.
198#
199# 3. Redistributions in any form must be accompanied by information on how
200# to obtain complete source code for this software and any accompanying
201# software that uses this software. The source code must either be
202# included in the distribution or be available for no more than the cost
203# of distribution plus a nominal fee, and must be freely redistributable
204# under reasonable conditions. For an executable file, complete source
205# code means the source code for all modules it contains. It does not
206# include source code for modules or files that typically accompany the
207# major components of the operating system on which the executable file
208# runs.
209#
210# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
211# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
212# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
213# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
214# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
215# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
216# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
217# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
218# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
219# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
220# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/mps/code/eventpro.c b/mps/code/eventpro.c
index 16cbf41d3c9..52d913a19dd 100644
--- a/mps/code/eventpro.c
+++ b/mps/code/eventpro.c
@@ -5,11 +5,8 @@
5 */ 5 */
6 6
7#include "config.h" 7#include "config.h"
8/* override variety setting for EVENT */
9#define EVENT
10
11#include "table.h" 8#include "table.h"
12 9#include "eventdef.h"
13#include "eventcom.h" 10#include "eventcom.h"
14#include "eventpro.h" 11#include "eventpro.h"
15#include "misc.h" 12#include "misc.h"
@@ -21,7 +18,6 @@
21#include <string.h> /* strcmp */ 18#include <string.h> /* strcmp */
22 19
23struct EventProcStruct { 20struct EventProcStruct {
24 Bool partialLog; /* Is this a partial log? */
25 EventProcReader reader; /* reader fn */ 21 EventProcReader reader; /* reader fn */
26 void *readerP; /* closure pointer for reader fn */ 22 void *readerP; /* closure pointer for reader fn */
27 Table internTable; /* dictionary of intern ids to symbols */ 23 Table internTable; /* dictionary of intern ids to symbols */
@@ -57,7 +53,10 @@ struct EventProcStruct {
57 * of the structure. This has to agree with the writing (EVENT_END). 53 * of the structure. This has to agree with the writing (EVENT_END).
58 */ 54 */
59 55
60#define EventSizeAlign(size) sizeAlignUp(size, sizeof(Word)) 56/* TODO: Should read this and other layout information from an event file
57 header in order to be able to process events from other architectures. */
58
59#define EventSizeAlign(size) sizeAlignUp(size, MPS_PF_ALIGN)
61 60
62 61
63 62
@@ -67,37 +66,33 @@ struct EventProcStruct {
67/* eventTypes -- an array containing info about the event types */ 66/* eventTypes -- an array containing info about the event types */
68 67
69typedef struct { 68typedef struct {
70 EventType type; 69 char *name; /* Event name e.g. "TraceStart" */
71 char *name; 70 EventCode code;
72 size_t code; 71 size_t size; /* event record size, rounded up from structure */
73 size_t length; 72 Count count; /* Parameter count */
74 char *format; 73 char *format; /* string format, e.g. "PPW" */
75} eventRecord; 74} eventRecord;
76 75
77static eventRecord eventTypes[] = { 76#define EVENT_COUNT_PARAM(X, index, sort, ident) + 1
78 {0, "(unused)", 0, 0, "0"},
79#define RELATION(name, code, always, kind, format) \
80 {Event##name, #name, code, \
81 EventSizeAlign(sizeof(Event##format##Struct)), #format},
82#include "eventdef.h"
83#undef RELATION
84};
85 77
86#define eventTypeCount (sizeof(eventTypes) / sizeof(eventRecord)) 78#define EVENT_FORMAT_PARAM(X, index, sort, ident) #sort
87 79
80#define EVENT_OFFSETS_PARAM(name, index, sort, ident) \
81 offsetof(Event##name##Struct, f##index),
88 82
89/* eventType2Index -- find index in eventTypes for the given type */ 83#define EVENT_INIT(X, name, code, always, kind) \
84 {#name, \
85 code, \
86 EventSizeAlign(sizeof(Event##name##Struct)), \
87 0 EVENT_##name##_PARAMS(EVENT_COUNT_PARAM, X), \
88 "" EVENT_##name##_PARAMS(EVENT_FORMAT_PARAM, X)},
90 89
91static size_t eventType2Index(EventType type) 90static eventRecord eventTypes[] = {
92{ 91 {"(unused)", 0, 0, 0, ""},
93 size_t i; 92 EVENT_LIST(EVENT_INIT, X)
93};
94 94
95 for(i = 0; i < eventTypeCount; ++i) 95#define eventTypeCount (sizeof(eventTypes) / sizeof(eventRecord))
96 if (eventTypes[i].type == type)
97 return i;
98 error("Unknown event type %0"PRIwWORD PRIXLONGEST, (ulongest_t)type);
99 return 0;
100}
101 96
102 97
103/* eventcode2Index -- find index in eventTypes for the given code */ 98/* eventcode2Index -- find index in eventTypes for the given code */
@@ -147,16 +142,6 @@ char *EventCode2Format(EventCode code)
147} 142}
148 143
149 144
150/* EventGetCode -- get event code of the given event */
151
152EventCode EventGetCode(Event event)
153{
154 size_t i = eventType2Index(event->any.code);
155 assert(eventTypes[i].code <= EventCodeMAX);
156 return eventTypes[i].code;
157}
158
159
160Bool EventCodeIsValid(EventCode code) 145Bool EventCodeIsValid(EventCode code)
161{ 146{
162 return (eventCode2Index(code, FALSE) != 0); 147 return (eventCode2Index(code, FALSE) != 0);
@@ -166,28 +151,23 @@ Bool EventCodeIsValid(EventCode code)
166/* EventStrings */ 151/* EventStrings */
167 152
168 153
169/* EventStringEmpty -- an empty event string */
170
171EventStringStruct EventStringEmpty = {0, ""};
172
173
174/* eventStringCopy -- copy an event string */ 154/* eventStringCopy -- copy an event string */
175 155
176static Res eventStringCopy(EventString *str_o, EventString str) 156static Res stringCopy(char **str_o, char *str)
177{ 157{
178 EventString newStr; 158 char *newStr;
159 size_t len;
179 160
180 newStr = (EventString)malloc(offsetof(EventStringStruct, str) 161 len = strlen(str);
181 + str->len); 162 newStr = (char *)malloc(len + sizeof('\0'));
182 if (newStr == NULL) return ResMEMORY; 163 if (newStr == NULL) return ResMEMORY;
183 newStr->len = str->len; 164 memcpy(newStr, str, len + sizeof('\0'));
184 memcpy(&(newStr->str), &(str->str), str->len);
185 *str_o = newStr; 165 *str_o = newStr;
186 return ResOK; 166 return ResOK;
187} 167}
188 168
189 169
190static void eventStringDestroy(EventString str) 170static void eventStringDestroy(char *str)
191{ 171{
192 free(str); 172 free(str);
193} 173}
@@ -200,7 +180,7 @@ static void eventStringDestroy(EventString str)
200 180
201typedef struct symbolStruct { 181typedef struct symbolStruct {
202 Word id; 182 Word id;
203 EventString name; 183 char *name;
204} symbolStruct; 184} symbolStruct;
205typedef struct symbolStruct *Symbol; 185typedef struct symbolStruct *Symbol;
206 186
@@ -209,7 +189,7 @@ typedef struct symbolStruct *Symbol;
209 189
210typedef struct labelStruct { 190typedef struct labelStruct {
211 Word id; 191 Word id;
212 Word time; 192 EventClock time;
213 Addr addr; 193 Addr addr;
214} labelStruct; 194} labelStruct;
215typedef struct labelStruct *Label; 195typedef struct labelStruct *Label;
@@ -230,7 +210,7 @@ Word AddrLabel(EventProc proc, Addr addr)
230 210
231/* LabelText -- return text for given intern id (or NULL if none) */ 211/* LabelText -- return text for given intern id (or NULL if none) */
232 212
233EventString LabelText(EventProc proc, Word id) 213char *LabelText(EventProc proc, Word id)
234{ 214{
235 void *entry; 215 void *entry;
236 216
@@ -246,48 +226,35 @@ EventString LabelText(EventProc proc, Word id)
246 226
247/* EventRead -- read one event from the file and allocate descriptor */ 227/* EventRead -- read one event from the file and allocate descriptor */
248 228
249#define internStrOffset (offsetof(EventWSStruct, s1.str)) 229#define internStrOffset (offsetof(EventInternStruct, f1.str))
250 230
251Res EventRead(Event *eventReturn, EventProc proc) 231Res EventRead(Event *eventReturn, EventProc proc)
252{ 232{
253 size_t eventIndex, length;
254 Res res; 233 Res res;
255 EventType type; 234 EventAnyStruct anyStruct;
256 Event event; 235 Event event;
257 void *restOfEvent; 236
258 237 res = proc->reader(proc->readerP, &anyStruct, sizeof(anyStruct));
259 res = proc->reader(proc->readerP, &type, sizeof(EventType)); 238 if (res != ResOK)
260 if (res != ResOK) return res; 239 return res;
261 240
262 eventIndex = eventType2Index(type);
263 length = eventTypes[eventIndex].length;
264 if (proc->cachedEvent != NULL) { 241 if (proc->cachedEvent != NULL) {
265 event = proc->cachedEvent; 242 event = proc->cachedEvent;
266 proc->cachedEvent = NULL; 243 proc->cachedEvent = NULL;
267 } else { 244 } else {
268 /* This is too long for most events, but never mind. */ 245 /* This is too long for most events, but never mind. */
269 event = (Event)malloc(sizeof(EventUnion)); 246 event = (Event)malloc(sizeof(EventUnion));
270 if (event == NULL) return ResMEMORY; 247 if (event == NULL)
248 return ResMEMORY;
271 } 249 }
272 250
273 event->any.code = type; 251 event->any = anyStruct;
274 restOfEvent = PointerAdd(event, sizeof(EventType)); 252 res = proc->reader(proc->readerP,
275 if (type == EventIntern) { /* the only string event */ 253 PointerAdd(event, sizeof(anyStruct)),
276 /* read enough to get the length */ 254 anyStruct.size - sizeof(anyStruct));
277 res = proc->reader(proc->readerP, restOfEvent, 255 if (res != ResOK)
278 internStrOffset - sizeof(EventType)); 256 return res;
279 if (res != ResOK) return res; 257
280 /* read the rest */
281 res = proc->reader(proc->readerP, &(event->ws.s1.str),
282 /* Length must agree with EVENT_WS. */
283 EventSizeAlign(internStrOffset + event->ws.s1.len)
284 - internStrOffset);
285 if (res != ResOK) return res;
286 } else {
287 res = proc->reader(proc->readerP, restOfEvent,
288 length - sizeof(EventType));
289 if (res != ResOK) return res;
290 }
291 *eventReturn = event; 258 *eventReturn = event;
292 return ResOK; 259 return ResOK;
293} 260}
@@ -299,34 +266,33 @@ Res EventRead(Event *eventReturn, EventProc proc)
299 * stuff in the future. 266 * stuff in the future.
300 */ 267 */
301 268
302Res EventRecord(EventProc proc, Event event, Word etime) 269Res EventRecord(EventProc proc, Event event, EventClock etime)
303{ 270{
304 Res res; 271 Res res;
305 272
306 switch(event->any.code) { 273 switch(event->any.code) {
307 case EventIntern: { /* id, label */ 274 case EventInternCode: { /* id, label */
308 Symbol sym = malloc(sizeof(symbolStruct)); 275 Symbol sym = malloc(sizeof(symbolStruct));
309 276
310 if (sym == NULL) return ResMEMORY; 277 if (sym == NULL) return ResMEMORY;
311 sym->id = event->ws.w0; 278 sym->id = event->Intern.f0;
312 res = eventStringCopy(&(sym->name), &(event->ws.s1)); 279 res = stringCopy(&sym->name, event->Intern.f1);
313 if (res != ResOK) { 280 if (res != ResOK) {
314 free(sym); 281 free(sym);
315 return res; 282 return res;
316 } 283 }
317 res = TableDefine(proc->internTable, sym->id, sym); 284 res = TableDefine(proc->internTable, sym->id, sym);
318 } break; 285 } break;
319 case EventLabel: { /* addr, id */ 286 case EventLabelCode: { /* addr, id */
320 Label label = malloc(sizeof(labelStruct)); 287 Label label = malloc(sizeof(labelStruct));
321 void *entry; 288 void *entry;
322 289
323 if (label == NULL) return ResMEMORY; 290 if (label == NULL) return ResMEMORY;
324 label->id = event->aw.w1; 291 label->id = event->Label.f1;
325 if (!proc->partialLog) { 292 /* If events were in time order we'd be able to assert that
326 assert(TableLookup(&entry, proc->internTable, label->id)); 293 TableLookup(&entry, proc->internTable, label->id) */
327 }
328 label->time = etime; 294 label->time = etime;
329 label->addr = event->aw.a0; 295 label->addr = event->Label.f0;
330 if (TableLookup(&entry, proc->labelTable, (Word)label->addr)) 296 if (TableLookup(&entry, proc->labelTable, (Word)label->addr))
331 res = TableRedefine(proc->labelTable, (Word)label->addr, label); 297 res = TableRedefine(proc->labelTable, (Word)label->addr, label);
332 else 298 else
@@ -374,8 +340,9 @@ void EventDestroy(EventProc proc, Event event)
374 340
375/* EventProcCreate -- initialize the module */ 341/* EventProcCreate -- initialize the module */
376 342
377Res EventProcCreate(EventProc *procReturn, Bool partial, 343Res EventProcCreate(EventProc *procReturn,
378 EventProcReader reader, void *readerP) 344 EventProcReader reader,
345 void *readerP)
379{ 346{
380 Res res; 347 Res res;
381 EventProc proc = malloc(sizeof(struct EventProcStruct)); 348 EventProc proc = malloc(sizeof(struct EventProcStruct));
@@ -383,16 +350,11 @@ Res EventProcCreate(EventProc *procReturn, Bool partial,
383 if (proc == NULL) return ResMEMORY; 350 if (proc == NULL) return ResMEMORY;
384 351
385 /* check event struct access */ 352 /* check event struct access */
386 assert(COMPATFIELD(EventUnion, any.code, EventWSStruct, code)); 353 assert(COMPATFIELD(EventUnion, any.code, EventInternStruct, code));
387 assert(COMPATFIELD(EventUnion, any.clock, EventWSStruct, clock)); 354 assert(COMPATFIELD(EventUnion, any.clock, EventInternStruct, clock));
388 /* check use of labelTable */ 355 /* check use of labelTable */
389#if !defined(MPS_OS_FR)
390 /* GCC -ansi -pedantic -Werror on FreeBSD will fail here
391 * with the warning "statement with no effect". */
392 assert(sizeof(Word) >= sizeof(Addr)); 356 assert(sizeof(Word) >= sizeof(Addr));
393#endif
394 357
395 proc->partialLog = partial;
396 proc->reader = reader; proc->readerP = readerP; 358 proc->reader = reader; proc->readerP = readerP;
397 res = TableCreate(&proc->internTable, (size_t)1<<4); 359 res = TableCreate(&proc->internTable, (size_t)1<<4);
398 if (res != ResOK) goto failIntern; 360 if (res != ResOK) goto failIntern;
diff --git a/mps/code/eventpro.h b/mps/code/eventpro.h
index db5d23d40a1..ff671523d46 100644
--- a/mps/code/eventpro.h
+++ b/mps/code/eventpro.h
@@ -8,8 +8,6 @@
8#define eventpro_h 8#define eventpro_h
9 9
10#include "config.h" 10#include "config.h"
11/* override variety setting for EVENT */
12#define EVENT
13 11
14#include "eventcom.h" 12#include "eventcom.h"
15#include "mpmtypes.h" 13#include "mpmtypes.h"
@@ -21,20 +19,20 @@ typedef Res (*EventProcReader)(void *, void *, size_t);
21 19
22extern EventCode EventName2Code(char *name); 20extern EventCode EventName2Code(char *name);
23extern char *EventCode2Name(EventCode code); 21extern char *EventCode2Name(EventCode code);
24extern EventCode EventGetCode(Event event);
25extern char *EventCode2Format(EventCode code); 22extern char *EventCode2Format(EventCode code);
26extern Bool EventCodeIsValid(EventCode code); 23extern Bool EventCodeIsValid(EventCode code);
27 24
28extern Word AddrLabel(EventProc proc, Addr addr); 25extern Word AddrLabel(EventProc proc, Addr addr);
29extern EventString LabelText(EventProc proc, Word label); 26extern char *LabelText(EventProc proc, Word label);
30 27
31extern Res EventRead(Event *eventReturn, EventProc proc); 28extern Res EventRead(Event *eventReturn, EventProc proc);
32extern void EventDestroy(EventProc proc, Event event); 29extern void EventDestroy(EventProc proc, Event event);
33 30
34extern Res EventRecord(EventProc proc, Event event, Word etime); 31extern Res EventRecord(EventProc proc, Event event, EventClock etime);
35 32
36extern Res EventProcCreate(EventProc *procReturn, Bool partial, 33extern Res EventProcCreate(EventProc *procReturn,
37 EventProcReader reader, void *readerP); 34 EventProcReader reader,
35 void *readerP);
38extern void EventProcDestroy(EventProc proc); 36extern void EventProcDestroy(EventProc proc);
39 37
40 38
diff --git a/mps/code/eventrep.c b/mps/code/eventrep.c
index 75437f532b4..c2f611f7070 100644
--- a/mps/code/eventrep.c
+++ b/mps/code/eventrep.c
@@ -51,7 +51,6 @@ static ulong totalEvents; /* count of events */
51static ulong discardedEvents; /* count of ignored events */ 51static ulong discardedEvents; /* count of ignored events */
52static ulong unknownEvents; /* count of unknown events */ 52static ulong unknownEvents; /* count of unknown events */
53 53
54static Bool partialLog;
55static Word eventTime; 54static Word eventTime;
56 55
57/* Dictionaries for translating from log to replay values */ 56/* Dictionaries for translating from log to replay values */
@@ -698,7 +697,7 @@ void EventReplay(Event event, Word etime)
698 697
699/* EventRepInit -- initialize the module */ 698/* EventRepInit -- initialize the module */
700 699
701Res EventRepInit(Bool partial) 700Res EventRepInit(void)
702{ 701{
703 Res res; 702 Res res;
704 703
@@ -711,7 +710,6 @@ Res EventRepInit(Bool partial)
711 /* by the MPS functions is justified by the reverse conversion */ 710 /* by the MPS functions is justified by the reverse conversion */
712 /* being acceptable (which is upto the event log generator). */ 711 /* being acceptable (which is upto the event log generator). */
713 712
714 partialLog = partial;
715 totalEvents = 0; discardedEvents = 0; unknownEvents = 0; 713 totalEvents = 0; discardedEvents = 0; unknownEvents = 0;
716 714
717 res = TableCreate(&arenaTable, (size_t)1); 715 res = TableCreate(&arenaTable, (size_t)1);
diff --git a/mps/code/global.c b/mps/code/global.c
index db0e6800dea..0dccbb5b914 100644
--- a/mps/code/global.c
+++ b/mps/code/global.c
@@ -239,7 +239,6 @@ Res GlobalsInit(Globals arenaGlobals)
239 RingInit(&arenaRing); 239 RingInit(&arenaRing);
240 ProtSetup(); 240 ProtSetup();
241 } 241 }
242 EventInit();
243 arenaReleaseRingLock(); 242 arenaReleaseRingLock();
244 243
245 arena = GlobalsArena(arenaGlobals); 244 arena = GlobalsArena(arenaGlobals);
@@ -370,7 +369,7 @@ void GlobalsFinish(Globals arenaGlobals)
370 AVERT(Globals, arenaGlobals); 369 AVERT(Globals, arenaGlobals);
371 arena = GlobalsArena(arenaGlobals); 370 arena = GlobalsArena(arenaGlobals);
372 371
373 STATISTIC_STAT(EVENT_PW(ArenaWriteFaults, arena, 372 STATISTIC_STAT(EVENT2(ArenaWriteFaults, arena,
374 arena->writeBarrierHitCount)); 373 arena->writeBarrierHitCount));
375 374
376 arenaGlobals->sig = SigInvalid; 375 arenaGlobals->sig = SigInvalid;
@@ -415,6 +414,7 @@ void GlobalsPrepareToDestroy(Globals arenaGlobals)
415 414
416 /* report dropped messages (currently in diagnostic varieties only) */ 415 /* report dropped messages (currently in diagnostic varieties only) */
417 if(arena->droppedMessages > 0) { 416 if(arena->droppedMessages > 0) {
417 EVENT1(MessagesDropped, arena->droppedMessages);
418 DIAG_SINGLEF(( "GlobalsPrepareToDestroy_dropped", 418 DIAG_SINGLEF(( "GlobalsPrepareToDestroy_dropped",
419 "arena->droppedMessages = $U", (WriteFU)arena->droppedMessages, 419 "arena->droppedMessages = $U", (WriteFU)arena->droppedMessages,
420 NULL )); 420 NULL ));
@@ -426,6 +426,7 @@ void GlobalsPrepareToDestroy(Globals arenaGlobals)
426 /* the message queue would have dangling pointers to messages */ 426 /* the message queue would have dangling pointers to messages */
427 /* whose memory has been unmapped. */ 427 /* whose memory has been unmapped. */
428 if(MessagePoll(arena)) { 428 if(MessagePoll(arena)) {
429 EVENT0(MessagesExist);
429 DIAG_SINGLEF(( "GlobalsPrepareToDestroy_queue", 430 DIAG_SINGLEF(( "GlobalsPrepareToDestroy_queue",
430 "Message queue not empty", NULL )); 431 "Message queue not empty", NULL ));
431 } 432 }
diff --git a/mps/code/locus.c b/mps/code/locus.c
index 22473026dc6..6ea5127ee12 100644
--- a/mps/code/locus.c
+++ b/mps/code/locus.c
@@ -295,6 +295,7 @@ Res ChainCondemnAuto(double *mortalityReturn, Chain chain, Trace trace)
295 genNewSize = GenDescNewSize(gen); 295 genNewSize = GenDescNewSize(gen);
296 } while (genNewSize >= gen->capacity * (Size)1024); 296 } while (genNewSize >= gen->capacity * (Size)1024);
297 297
298 EVENT3(ChainCondemnAuto, chain, topCondemnedGenSerial, chain->genCount);
298 DIAG_SINGLEF(( "ChainCondemnAuto", 299 DIAG_SINGLEF(( "ChainCondemnAuto",
299 "condemn gens [0..$U]", (WriteFU)topCondemnedGenSerial, 300 "condemn gens [0..$U]", (WriteFU)topCondemnedGenSerial,
300 " (of $U)", (WriteFU)chain->genCount, 301 " (of $U)", (WriteFU)chain->genCount,
diff --git a/mps/code/meter.c b/mps/code/meter.c
index a5369091eb4..48f7abeb425 100644
--- a/mps/code/meter.c
+++ b/mps/code/meter.c
@@ -31,7 +31,7 @@ void MeterInit(Meter meter, char *name, void *owner)
31 31
32 sym = EventInternString(name); 32 sym = EventInternString(name);
33 EventLabelAddr((Addr)meter, sym); /* see .trans.label */ 33 EventLabelAddr((Addr)meter, sym); /* see .trans.label */
34 EVENT_PP(MeterInit, meter, owner); 34 EVENT2(MeterInit, meter, owner);
35 UNUSED(owner); /* @@@@ hack */ 35 UNUSED(owner); /* @@@@ hack */
36} 36}
37 37
@@ -98,7 +98,7 @@ Res MeterWrite(Meter meter, mps_lib_FILE *stream)
98 98
99void MeterEmit(Meter meter) 99void MeterEmit(Meter meter)
100{ 100{
101 EVENT_PDDWWW(MeterValues, meter, meter->total, meter->meanSquared, 101 EVENT6(MeterValues, meter, meter->total, meter->meanSquared,
102 meter->count, meter->max, meter->min); 102 meter->count, meter->max, meter->min);
103 UNUSED(meter); /* @@@@ hack */ 103 UNUSED(meter); /* @@@@ hack */
104} 104}
diff --git a/mps/code/misc.h b/mps/code/misc.h
index 68f7a33da9e..0557c9af6fc 100644
--- a/mps/code/misc.h
+++ b/mps/code/misc.h
@@ -17,7 +17,7 @@
17 17
18 18
19typedef int Bool; /* <design/type/#bool> */ 19typedef int Bool; /* <design/type/#bool> */
20enum { 20enum BoolEnum {
21 FALSE = 0, 21 FALSE = 0,
22 TRUE = 1 22 TRUE = 1
23}; 23};
diff --git a/mps/code/mpm.h b/mps/code/mpm.h
index d9e379a3537..f653e643d8a 100644
--- a/mps/code/mpm.h
+++ b/mps/code/mpm.h
@@ -980,7 +980,7 @@ extern void StackProbe(Size depth);
980#elif defined(STATISTICS_NONE) 980#elif defined(STATISTICS_NONE)
981 981
982#define STATISTIC(gather) DISCARD(((gather), 0)) 982#define STATISTIC(gather) DISCARD(((gather), 0))
983#define STATISTIC_STAT(gather) DISCARD_STAT(gather) 983#define STATISTIC_STAT DISCARD_STAT
984#define STATISTIC_WRITE(format, arg) 984#define STATISTIC_WRITE(format, arg)
985 985
986#else 986#else
diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c
index aa60a7ed70b..c97826e7c98 100644
--- a/mps/code/mpsi.c
+++ b/mps/code/mpsi.c
@@ -1895,7 +1895,7 @@ void mps_telemetry_label(mps_addr_t addr, mps_word_t intern_id)
1895void mps_telemetry_flush(void) 1895void mps_telemetry_flush(void)
1896{ 1896{
1897 /* Telemetry does its own concurrency control, so none here. */ 1897 /* Telemetry does its own concurrency control, so none here. */
1898 (void)EventSync(); 1898 EventSync();
1899} 1899}
1900 1900
1901 1901
diff --git a/mps/code/mpsliban.c b/mps/code/mpsliban.c
index 8b44f684a8c..d56073976e9 100644
--- a/mps/code/mpsliban.c
+++ b/mps/code/mpsliban.c
@@ -25,6 +25,7 @@
25#include "mpslib.h" 25#include "mpslib.h"
26 26
27#include "mpstd.h" 27#include "mpstd.h"
28#include "event.h"
28 29
29#ifdef MPS_OS_XC 30#ifdef MPS_OS_XC
30#include "osxc.h" 31#include "osxc.h"
@@ -66,7 +67,8 @@ int mps_lib_fputs(const char *s, mps_lib_FILE *stream)
66void mps_lib_assert_fail(const char *message) 67void mps_lib_assert_fail(const char *message)
67{ 68{
68 fflush(stdout); /* synchronize */ 69 fflush(stdout); /* synchronize */
69 fprintf(stderr, "\nMPS ASSERTION FAILURE: %s\n", message); 70 fprintf(stderr, "\nMPS ASSERTION FAILURE: %s\n\nRECENT EVENTS:\n", message);
71 EventDump((mps_lib_FILE *)stderr);
70 fflush(stderr); /* make sure the message is output */ 72 fflush(stderr); /* make sure the message is output */
71 abort(); 73 abort();
72} 74}
diff --git a/mps/code/pool.c b/mps/code/pool.c
index 1b90864cb31..0635bf012b3 100644
--- a/mps/code/pool.c
+++ b/mps/code/pool.c
@@ -250,7 +250,7 @@ void PoolFinish(Pool pool)
250 RingFinish(&pool->bufferRing); 250 RingFinish(&pool->bufferRing);
251 RingFinish(&pool->arenaRing); 251 RingFinish(&pool->arenaRing);
252 252
253 EVENT_P(PoolFinish, pool); 253 EVENT1(PoolFinish, pool);
254} 254}
255 255
256 256
@@ -313,7 +313,7 @@ Res PoolAlloc(Addr *pReturn, Pool pool, Size size,
313 pool->fillMutatorSize += size; 313 pool->fillMutatorSize += size;
314 ArenaGlobals(PoolArena(pool))->fillMutatorSize += size; 314 ArenaGlobals(PoolArena(pool))->fillMutatorSize += size;
315 315
316 EVENT_PAW(PoolAlloc, pool, *pReturn, size); 316 EVENT3(PoolAlloc, pool, *pReturn, size);
317 317
318 return ResOK; 318 return ResOK;
319} 319}
@@ -330,7 +330,7 @@ void PoolFree(Pool pool, Addr old, Size size)
330 AVER(size > 0); 330 AVER(size > 0);
331 (*pool->class->free)(pool, old, size); 331 (*pool->class->free)(pool, old, size);
332 332
333 EVENT_PAW(PoolFree, pool, old, size); 333 EVENT3(PoolFree, pool, old, size);
334} 334}
335 335
336 336
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c
index 3698f328b90..8c9934d43ca 100644
--- a/mps/code/poolamc.c
+++ b/mps/code/poolamc.c
@@ -705,7 +705,7 @@ static Res amcGenCreate(amcGen *genReturn, AMC amc, Serial genNr)
705 AVERT(amcGen, gen); 705 AVERT(amcGen, gen);
706 706
707 RingAppend(&amc->genRing, &gen->amcRing); 707 RingAppend(&amc->genRing, &gen->amcRing);
708 EVENT_PP(AMCGenCreate, amc, gen); 708 EVENT2(AMCGenCreate, amc, gen);
709 *genReturn = gen; 709 *genReturn = gen;
710 return ResOK; 710 return ResOK;
711 711
@@ -728,7 +728,7 @@ static void amcGenDestroy(amcGen gen)
728 AVER(gen->segs == 0); 728 AVER(gen->segs == 0);
729 AVER(gen->pgen.totalSize == 0); 729 AVER(gen->pgen.totalSize == 0);
730 730
731 EVENT_P(AMCGenDestroy, gen); 731 EVENT1(AMCGenDestroy, gen);
732 arena = PoolArena(amcGenPool(gen)); 732 arena = PoolArena(amcGenPool(gen));
733 gen->sig = SigInvalid; 733 gen->sig = SigInvalid;
734 RingRemove(&gen->amcRing); 734 RingRemove(&gen->amcRing);
@@ -1011,11 +1011,11 @@ static Res amcInitComm(Pool pool, RankSet rankSet, va_list arg)
1011 amc->gensBooted = TRUE; 1011 amc->gensBooted = TRUE;
1012 1012
1013 AVERT(AMC, amc); 1013 AVERT(AMC, amc);
1014 EVENT_PP(AMCInit, pool, amc); 1014 EVENT2(AMCInit, pool, amc);
1015 if(rankSet == RankSetEMPTY) 1015 if(rankSet == RankSetEMPTY)
1016 EVENT_PP(PoolInitAMCZ, pool, pool->format); 1016 EVENT2(PoolInitAMCZ, pool, pool->format);
1017 else 1017 else
1018 EVENT_PP(PoolInitAMC, pool, pool->format); 1018 EVENT2(PoolInitAMC, pool, pool->format);
1019 return ResOK; 1019 return ResOK;
1020 1020
1021failGenAlloc: 1021failGenAlloc:
@@ -1053,7 +1053,7 @@ static void AMCFinish(Pool pool)
1053 amc = Pool2AMC(pool); 1053 amc = Pool2AMC(pool);
1054 AVERT(AMC, amc); 1054 AVERT(AMC, amc);
1055 1055
1056 EVENT_P(AMCFinish, amc); 1056 EVENT1(AMCFinish, amc);
1057 1057
1058 /* @@@@ Make sure that segments aren't buffered by forwarding */ 1058 /* @@@@ Make sure that segments aren't buffered by forwarding */
1059 /* buffers. This is a hack which allows the pool to be destroyed */ 1059 /* buffers. This is a hack which allows the pool to be destroyed */
@@ -1436,7 +1436,7 @@ static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn,
1436 1436
1437 UNUSED(amc); /* Actually only unused when telemetry is off. @@@@ */ 1437 UNUSED(amc); /* Actually only unused when telemetry is off. @@@@ */
1438 1438
1439 EVENT_PPP(AMCScanBegin, amc, seg, ss); /* @@@@ use own event */ 1439 EVENT3(AMCScanBegin, amc, seg, ss); /* @@@@ use own event */
1440 1440
1441 format = pool->format; 1441 format = pool->format;
1442 amcSegNailboard(seg)->newMarks = FALSE; 1442 amcSegNailboard(seg)->newMarks = FALSE;
@@ -1491,7 +1491,7 @@ static Res amcScanNailedOnce(Bool *totalReturn, Bool *moreReturn,
1491 AVER(p == limit); 1491 AVER(p == limit);
1492 1492
1493returnGood: 1493returnGood:
1494 EVENT_PPP(AMCScanEnd, amc, seg, ss); /* @@@@ use own event */ 1494 EVENT3(AMCScanEnd, amc, seg, ss); /* @@@@ use own event */
1495 1495
1496 AVER(bytesScanned <= SegSize(seg)); 1496 AVER(bytesScanned <= SegSize(seg));
1497 ss->scannedSize += bytesScanned; 1497 ss->scannedSize += bytesScanned;
@@ -1601,7 +1601,7 @@ static Res AMCScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg)
1601 return amcScanNailed(totalReturn, ss, pool, seg, amc); 1601 return amcScanNailed(totalReturn, ss, pool, seg, amc);
1602 } 1602 }
1603 1603
1604 EVENT_PPP(AMCScanBegin, amc, seg, ss); 1604 EVENT3(AMCScanBegin, amc, seg, ss);
1605 1605
1606 base = AddrAdd(SegBase(seg), format->headerSize); 1606 base = AddrAdd(SegBase(seg), format->headerSize);
1607 /* <design/poolamc/#seg-scan.loop> */ 1607 /* <design/poolamc/#seg-scan.loop> */
@@ -1637,7 +1637,7 @@ static Res AMCScan(Bool *totalReturn, ScanState ss, Pool pool, Seg seg)
1637 } 1637 }
1638 1638
1639 ss->scannedSize += AddrOffset(base, limit); 1639 ss->scannedSize += AddrOffset(base, limit);
1640 EVENT_PPP(AMCScanEnd, amc, seg, ss); 1640 EVENT3(AMCScanEnd, amc, seg, ss);
1641 1641
1642 *totalReturn = TRUE; 1642 *totalReturn = TRUE;
1643 return ResOK; 1643 return ResOK;
@@ -1666,7 +1666,7 @@ static void amcFixInPlace(Pool pool, Seg seg, ScanState ss, Ref *refIO)
1666 /* segment. */ 1666 /* segment. */
1667 AVER(ref < SegLimit(seg)); 1667 AVER(ref < SegLimit(seg));
1668 1668
1669 EVENT_0(AMCFixInPlace); 1669 EVENT0(AMCFixInPlace);
1670 if(amcSegHasNailboard(seg)) { 1670 if(amcSegHasNailboard(seg)) {
1671 Bool wasMarked = amcNailGetAndSetMark(seg, ref); 1671 Bool wasMarked = amcNailGetAndSetMark(seg, ref);
1672 /* If there are no new marks (i.e., no new traces for which we */ 1672 /* If there are no new marks (i.e., no new traces for which we */
@@ -1751,7 +1751,7 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
1751 AVERT_CRITICAL(ScanState, ss); 1751 AVERT_CRITICAL(ScanState, ss);
1752 AVERT_CRITICAL(Seg, seg); 1752 AVERT_CRITICAL(Seg, seg);
1753 AVER_CRITICAL(refIO != NULL); 1753 AVER_CRITICAL(refIO != NULL);
1754 EVENT_0(AMCFix); 1754 EVENT0(AMCFix);
1755 1755
1756 /* For the moment, assume that the object was already marked. */ 1756 /* For the moment, assume that the object was already marked. */
1757 /* (See <design/fix/#protocol.was-marked>.) */ 1757 /* (See <design/fix/#protocol.was-marked>.) */
@@ -1814,7 +1814,7 @@ Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
1814 } 1814 }
1815 /* Object is not preserved yet (neither moved, nor nailed) */ 1815 /* Object is not preserved yet (neither moved, nor nailed) */
1816 /* so should be preserved by forwarding. */ 1816 /* so should be preserved by forwarding. */
1817 EVENT_A(AMCFixForward, newRef); 1817 EVENT1(AMCFixForward, newRef);
1818 /* <design/fix/#protocol.was-marked> */ 1818 /* <design/fix/#protocol.was-marked> */
1819 ss->wasMarked = FALSE; 1819 ss->wasMarked = FALSE;
1820 1820
@@ -1901,7 +1901,7 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
1901 AVERT_CRITICAL(ScanState, ss); 1901 AVERT_CRITICAL(ScanState, ss);
1902 AVERT_CRITICAL(Seg, seg); 1902 AVERT_CRITICAL(Seg, seg);
1903 AVER_CRITICAL(refIO != NULL); 1903 AVER_CRITICAL(refIO != NULL);
1904 EVENT_0(AMCFix); 1904 EVENT0(AMCFix);
1905 1905
1906 /* For the moment, assume that the object was already marked. */ 1906 /* For the moment, assume that the object was already marked. */
1907 /* (See <design/fix/#protocol.was-marked>.) */ 1907 /* (See <design/fix/#protocol.was-marked>.) */
@@ -1964,7 +1964,7 @@ static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO)
1964 } 1964 }
1965 /* object is not preserved yet (neither moved, nor nailed) */ 1965 /* object is not preserved yet (neither moved, nor nailed) */
1966 /* so should be preserved by forwarding */ 1966 /* so should be preserved by forwarding */
1967 EVENT_A(AMCFixForward, newRef); 1967 EVENT1(AMCFixForward, newRef);
1968 /* <design/fix/#protocol.was-marked> */ 1968 /* <design/fix/#protocol.was-marked> */
1969 ss->wasMarked = FALSE; 1969 ss->wasMarked = FALSE;
1970 1970
@@ -2166,7 +2166,7 @@ static void AMCReclaim(Pool pool, Trace trace, Seg seg)
2166 gen = amcSegGen(seg); 2166 gen = amcSegGen(seg);
2167 AVERT_CRITICAL(amcGen, gen); 2167 AVERT_CRITICAL(amcGen, gen);
2168 2168
2169 EVENT_PPP(AMCReclaim, gen, trace, seg); 2169 EVENT3(AMCReclaim, gen, trace, seg);
2170 2170
2171 /* This switching needs to be more complex for multiple traces. */ 2171 /* This switching needs to be more complex for multiple traces. */
2172 AVER_CRITICAL(TraceSetIsSingle(PoolArena(pool)->busyTraces)); 2172 AVER_CRITICAL(TraceSetIsSingle(PoolArena(pool)->busyTraces));
diff --git a/mps/code/poolams.c b/mps/code/poolams.c
index f1ae7478bc3..880e20f7bb0 100644
--- a/mps/code/poolams.c
+++ b/mps/code/poolams.c
@@ -749,7 +749,7 @@ static Res AMSInit(Pool pool, va_list args)
749 /* references, the alloc and white tables cannot be shared. */ 749 /* references, the alloc and white tables cannot be shared. */
750 res = AMSInitInternal(Pool2AMS(pool), format, chain, !supportAmbiguous); 750 res = AMSInitInternal(Pool2AMS(pool), format, chain, !supportAmbiguous);
751 if (res == ResOK) { 751 if (res == ResOK) {
752 EVENT_PPP(PoolInitAMS, pool, PoolArena(pool), format); 752 EVENT3(PoolInitAMS, pool, PoolArena(pool), format);
753 } 753 }
754 return res; 754 return res;
755} 755}
diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c
index bb010854a6a..e1fcbd94b4e 100644
--- a/mps/code/poolawl.c
+++ b/mps/code/poolawl.c
@@ -523,7 +523,7 @@ static Res AWLInit(Pool pool, va_list arg)
523 awl->sig = AWLSig; 523 awl->sig = AWLSig;
524 524
525 AVERT(AWL, awl); 525 AVERT(AWL, awl);
526 EVENT_PP(PoolInitAWL, pool, format); 526 EVENT2(PoolInitAWL, pool, format);
527 return ResOK; 527 return ResOK;
528 528
529failGenInit: 529failGenInit:
diff --git a/mps/code/poollo.c b/mps/code/poollo.c
index c4a5872af54..3ad825905a2 100644
--- a/mps/code/poollo.c
+++ b/mps/code/poollo.c
@@ -502,7 +502,7 @@ static Res LOInit(Pool pool, va_list arg)
502 502
503 lo->sig = LOSig; 503 lo->sig = LOSig;
504 AVERT(LO, lo); 504 AVERT(LO, lo);
505 EVENT_PP(PoolInitLO, pool, format); 505 EVENT2(PoolInitLO, pool, format);
506 return ResOK; 506 return ResOK;
507 507
508failGenInit: 508failGenInit:
diff --git a/mps/code/poolmfs.c b/mps/code/poolmfs.c
index 6ce145b2d42..82044e37589 100644
--- a/mps/code/poolmfs.c
+++ b/mps/code/poolmfs.c
@@ -106,7 +106,7 @@ static Res MFSInit(Pool pool, va_list arg)
106 mfs->sig = MFSSig; 106 mfs->sig = MFSSig;
107 107
108 AVERT(MFS, mfs); 108 AVERT(MFS, mfs);
109 EVENT_PPP(PoolInit, pool, arena, ClassOfPool(pool)); 109 EVENT4(PoolInitMFS, pool, arena, extendBy, unitSize);
110 return ResOK; 110 return ResOK;
111} 111}
112 112
diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c
index 397ba89b6db..203f87cec33 100644
--- a/mps/code/poolmrg.c
+++ b/mps/code/poolmrg.c
@@ -635,7 +635,7 @@ static Res MRGInit(Pool pool, va_list args)
635 DIAG_PRINTF(( "mrg->extendBy = %u, MRGGuardiansPerSeg = %u\n", 635 DIAG_PRINTF(( "mrg->extendBy = %u, MRGGuardiansPerSeg = %u\n",
636 (unsigned int) mrg->extendBy, 636 (unsigned int) mrg->extendBy,
637 (unsigned int) MRGGuardiansPerSeg(mrg) )); 637 (unsigned int) MRGGuardiansPerSeg(mrg) ));
638 EVENT_PPP(PoolInit, pool, PoolArena(pool), ClassOfPool(pool)); 638 EVENT3(PoolInit, pool, PoolArena(pool), ClassOfPool(pool));
639 return ResOK; 639 return ResOK;
640} 640}
641 641
diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c
index 6a682da6707..334f8a8fb43 100644
--- a/mps/code/poolmv.c
+++ b/mps/code/poolmv.c
@@ -235,7 +235,7 @@ static Res MVInit(Pool pool, va_list arg)
235 235
236 mv->sig = MVSig; 236 mv->sig = MVSig;
237 AVERT(MV, mv); 237 AVERT(MV, mv);
238 EVENT_PPWWW(PoolInitMV, pool, arena, extendBy, avgSize, maxSize); 238 EVENT5(PoolInitMV, pool, arena, extendBy, avgSize, maxSize);
239 return ResOK; 239 return ResOK;
240} 240}
241 241
diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c
index b67b236d1b4..9401f568b03 100644
--- a/mps/code/poolmv2.c
+++ b/mps/code/poolmv2.c
@@ -312,7 +312,7 @@ static Res MVTInit(Pool pool, va_list arg)
312 mvt->sig = MVTSig; 312 mvt->sig = MVTSig;
313 313
314 AVERT(MVT, mvt); 314 AVERT(MVT, mvt);
315 EVENT_PWWWWW(PoolInitMVT, pool, minSize, meanSize, maxSize, 315 EVENT6(PoolInitMVT, pool, minSize, meanSize, maxSize,
316 reserveDepth, fragLimit); 316 reserveDepth, fragLimit);
317 return ResOK; 317 return ResOK;
318 318
diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c
index b83b58243bb..a2647608187 100644
--- a/mps/code/poolmvff.c
+++ b/mps/code/poolmvff.c
@@ -473,7 +473,7 @@ static Res MVFFInit(Pool pool, va_list arg)
473 473
474 mvff->sig = MVFFSig; 474 mvff->sig = MVFFSig;
475 AVERT(MVFF, mvff); 475 AVERT(MVFF, mvff);
476 EVENT_PPWWWUUU(PoolInitMVFF, pool, arena, extendBy, avgSize, align, 476 EVENT8(PoolInitMVFF, pool, arena, extendBy, avgSize, align,
477 slotHigh, arenaHigh, firstFit); 477 slotHigh, arenaHigh, firstFit);
478 return ResOK; 478 return ResOK;
479 479
diff --git a/mps/code/pooln.c b/mps/code/pooln.c
index 08c1d19ce10..a22d81c23a2 100644
--- a/mps/code/pooln.c
+++ b/mps/code/pooln.c
@@ -39,7 +39,7 @@ static Res NInit(Pool pool, va_list args)
39 /* Initialize pool-specific structures. */ 39 /* Initialize pool-specific structures. */
40 40
41 AVERT(PoolN, poolN); 41 AVERT(PoolN, poolN);
42 EVENT_PPP(PoolInit, pool, PoolArena(pool), ClassOfPool(pool)); 42 EVENT3(PoolInit, pool, PoolArena(pool), ClassOfPool(pool));
43 return ResOK; 43 return ResOK;
44} 44}
45 45
diff --git a/mps/code/poolsnc.c b/mps/code/poolsnc.c
index eda496d450f..657c0f54843 100644
--- a/mps/code/poolsnc.c
+++ b/mps/code/poolsnc.c
@@ -382,7 +382,7 @@ static Res SNCInit(Pool pool, va_list arg)
382 snc->sig = SNCSig; 382 snc->sig = SNCSig;
383 383
384 AVERT(SNC, snc); 384 AVERT(SNC, snc);
385 EVENT_PP(PoolInitSNC, pool, format); 385 EVENT2(PoolInitSNC, pool, format);
386 return ResOK; 386 return ResOK;
387} 387}
388 388
diff --git a/mps/code/replay.c b/mps/code/replay.c
index 9dd34557d10..974ce5dcd07 100644
--- a/mps/code/replay.c
+++ b/mps/code/replay.c
@@ -37,8 +37,6 @@ typedef unsigned long ulong;
37 37
38/* command-line arguments */ 38/* command-line arguments */
39 39
40static Bool partialLog = FALSE;
41
42static char *prog; /* program name */ 40static char *prog; /* program name */
43 41
44 42
@@ -105,9 +103,6 @@ static char *parseArgs(int argc, char *argv[])
105 else 103 else
106 name = argv[i]; 104 name = argv[i];
107 break; 105 break;
108 case 'p': /* partial log */
109 partialLog = TRUE;
110 break;
111 case '?': case 'h': /* help */ 106 case '?': case 'h': /* help */
112 usage(); 107 usage();
113 break; 108 break;
@@ -172,11 +167,11 @@ int main(int argc, char *argv[])
172 error("unable to open \"%s\"\n", filename); 167 error("unable to open \"%s\"\n", filename);
173 } 168 }
174 169
175 res = EventProcCreate(&proc, partialLog, logReader, (void *)input); 170 res = EventProcCreate(&proc, logReader, (void *)input);
176 if (res != ResOK) 171 if (res != ResOK)
177 error("Can't init EventProc module: error %d.", res); 172 error("Can't init EventProc module: error %d.", res);
178 173
179 res = EventRepInit(partialLog); 174 res = EventRepInit();
180 if (res != ResOK) 175 if (res != ResOK)
181 error("Can't init EventRep module: error %d.", res); 176 error("Can't init EventRep module: error %d.", res);
182 177
diff --git a/mps/code/reserv.c b/mps/code/reserv.c
index cc739291e3c..d50e02b931f 100644
--- a/mps/code/reserv.c
+++ b/mps/code/reserv.c
@@ -41,7 +41,7 @@ static Res ResPoolInit(Pool pool, va_list arg)
41 41
42 UNUSED(arg); 42 UNUSED(arg);
43 /* Caller will set sig and AVERT. */ 43 /* Caller will set sig and AVERT. */
44 EVENT_PPP(PoolInit, pool, PoolArena(pool), ClassOfPool(pool)); 44 EVENT3(PoolInit, pool, PoolArena(pool), ClassOfPool(pool));
45 return ResOK; 45 return ResOK;
46} 46}
47 47
@@ -340,7 +340,7 @@ void ReservoirSetLimit(Reservoir reservoir, Size size)
340 340
341 AVER(SizeIsAligned(needed, ArenaAlign(arena))); 341 AVER(SizeIsAligned(needed, ArenaAlign(arena)));
342 /* Emit event now, so subsequent change can be ascribed to it. */ 342 /* Emit event now, so subsequent change can be ascribed to it. */
343 EVENT_PW(ReservoirLimitSet, arena, size); 343 EVENT2(ReservoirLimitSet, arena, size);
344 344
345 if (needed > reservoir->reservoirSize) { 345 if (needed > reservoir->reservoirSize) {
346 /* Try to grow the reservoir */ 346 /* Try to grow the reservoir */
diff --git a/mps/code/root.c b/mps/code/root.c
index e746d3c1b61..9484c4bfa36 100644
--- a/mps/code/root.c
+++ b/mps/code/root.c
@@ -506,7 +506,7 @@ Res RootScan(ScanState ss, Root root)
506 AVER(res == ResOK); 506 AVER(res == ResOK);
507 root->grey = TraceSetDiff(root->grey, ss->traces); 507 root->grey = TraceSetDiff(root->grey, ss->traces);
508 rootSetSummary(root, ScanStateSummary(ss)); 508 rootSetSummary(root, ScanStateSummary(ss));
509 EVENT_PWW(RootScan, root, ss->traces, ScanStateSummary(ss)); 509 EVENT3(RootScan, root, ss->traces, ScanStateSummary(ss));
510 510
511failScan: 511failScan:
512 if (root->pm != AccessSetEMPTY) { 512 if (root->pm != AccessSetEMPTY) {
diff --git a/mps/code/seg.c b/mps/code/seg.c
index 6c194881bb8..cc33582c7d6 100644
--- a/mps/code/seg.c
+++ b/mps/code/seg.c
@@ -91,7 +91,7 @@ Res SegAlloc(Seg *segReturn, SegClass class, SegPref pref,
91 if (res != ResOK) 91 if (res != ResOK)
92 goto failInit; 92 goto failInit;
93 93
94 EVENT_PPAWP(SegAlloc, arena, seg, SegBase(seg), size, pool); 94 EVENT5(SegAlloc, arena, seg, SegBase(seg), size, pool);
95 *segReturn = seg; 95 *segReturn = seg;
96 return ResOK; 96 return ResOK;
97 97
@@ -100,7 +100,7 @@ failInit:
100failControl: 100failControl:
101 ArenaFree(base, size, pool); 101 ArenaFree(base, size, pool);
102failArena: 102failArena:
103 EVENT_PWP(SegAllocFail, arena, size, pool); 103 EVENT3(SegAllocFail, arena, size, pool);
104 return res; 104 return res;
105} 105}
106 106
@@ -128,7 +128,7 @@ void SegFree(Seg seg)
128 ControlFree(arena, seg, class->size); 128 ControlFree(arena, seg, class->size);
129 ArenaFree(base, size, pool); 129 ArenaFree(base, size, pool);
130 130
131 EVENT_PP(SegFree, arena, seg); 131 EVENT2(SegFree, arena, seg);
132 return; 132 return;
133} 133}
134 134
@@ -526,7 +526,7 @@ Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi,
526 if (ResOK != res) 526 if (ResOK != res)
527 goto failMerge; 527 goto failMerge;
528 528
529 EVENT_PPP(SegMerge, segLo, segLo, segHi); 529 EVENT3(SegMerge, segLo, segHi, withReservoirPermit);
530 /* Deallocate segHi object */ 530 /* Deallocate segHi object */
531 ControlFree(arena, segHi, class->size); 531 ControlFree(arena, segHi, class->size);
532 AVERT(Seg, segLo); 532 AVERT(Seg, segLo);
@@ -585,7 +585,7 @@ Res SegSplit(Seg *segLoReturn, Seg *segHiReturn, Seg seg, Addr at,
585 if (ResOK != res) 585 if (ResOK != res)
586 goto failSplit; 586 goto failSplit;
587 587
588 EVENT_PPPA(SegSplit, seg, segNew, seg, at); 588 EVENT4(SegSplit, seg, segNew, seg, at);
589 AVERT(Seg, seg); 589 AVERT(Seg, seg);
590 AVERT(Seg, segNew); 590 AVERT(Seg, segNew);
591 *segLoReturn = seg; 591 *segLoReturn = seg;
@@ -1214,7 +1214,7 @@ static void gcSegSetGrey(Seg seg, TraceSet grey)
1214 ShieldLower(arena, seg, AccessREAD); 1214 ShieldLower(arena, seg, AccessREAD);
1215 } 1215 }
1216 1216
1217 EVENT_PPU(SegSetGrey, arena, seg, grey); 1217 EVENT3(SegSetGrey, arena, seg, grey);
1218} 1218}
1219 1219
1220 1220
diff --git a/mps/code/trace.c b/mps/code/trace.c
index 3fddaec8d33..8ff9bf8bdf1 100644
--- a/mps/code/trace.c
+++ b/mps/code/trace.c
@@ -220,6 +220,7 @@ Bool traceBandAdvance(Trace trace)
220 trace->band = RankAMBIG; 220 trace->band = RankAMBIG;
221 return FALSE; 221 return FALSE;
222 } 222 }
223 EVENT3(TraceBandAdvance, trace->arena, trace->ti, trace->band);
223 return TRUE; 224 return TRUE;
224} 225}
225 226
@@ -536,7 +537,7 @@ static void traceFlip(Trace trace)
536 AVER(trace->state == TraceUNFLIPPED); 537 AVER(trace->state == TraceUNFLIPPED);
537 AVER(!TraceSetIsMember(arena->flippedTraces, trace)); 538 AVER(!TraceSetIsMember(arena->flippedTraces, trace));
538 539
539 EVENT_PP(TraceFlipBegin, trace, arena); 540 EVENT2(TraceFlipBegin, trace, arena);
540 541
541 traceFlipBuffers(ArenaGlobals(arena)); 542 traceFlipBuffers(ArenaGlobals(arena));
542 543
@@ -591,7 +592,7 @@ static void traceFlip(Trace trace)
591 trace->state = TraceFLIPPED; 592 trace->state = TraceFLIPPED;
592 arena->flippedTraces = TraceSetAdd(arena->flippedTraces, trace); 593 arena->flippedTraces = TraceSetAdd(arena->flippedTraces, trace);
593 594
594 EVENT_PP(TraceFlipEnd, trace, arena); 595 EVENT2(TraceFlipEnd, trace, arena);
595 596
596 ShieldResume(arena); 597 ShieldResume(arena);
597 598
@@ -742,7 +743,7 @@ void TraceDestroy(Trace trace)
742 ChainEndGC(trace->chain, trace); 743 ChainEndGC(trace->chain, trace);
743 } 744 }
744 745
745 STATISTIC_STAT(EVENT_PWWWWWWWWWWWW 746 STATISTIC_STAT(EVENT13
746 (TraceStatScan, trace, 747 (TraceStatScan, trace,
747 trace->rootScanCount, trace->rootScanSize, 748 trace->rootScanCount, trace->rootScanSize,
748 trace->rootCopiedSize, 749 trace->rootCopiedSize,
@@ -752,7 +753,7 @@ void TraceDestroy(Trace trace)
752 trace->singleCopiedSize, 753 trace->singleCopiedSize,
753 trace->readBarrierHitCount, trace->greySegMax, 754 trace->readBarrierHitCount, trace->greySegMax,
754 trace->pointlessScanCount)); 755 trace->pointlessScanCount));
755 STATISTIC_STAT(EVENT_PWWWWWWWWW 756 STATISTIC_STAT(EVENT10
756 (TraceStatFix, trace, 757 (TraceStatFix, trace,
757 trace->fixRefCount, trace->segRefCount, 758 trace->fixRefCount, trace->segRefCount,
758 trace->whiteSegRefCount, 759 trace->whiteSegRefCount,
@@ -760,14 +761,14 @@ void TraceDestroy(Trace trace)
760 trace->forwardedCount, trace->forwardedSize, 761 trace->forwardedCount, trace->forwardedSize,
761 trace->preservedInPlaceCount, 762 trace->preservedInPlaceCount,
762 trace->preservedInPlaceSize)); 763 trace->preservedInPlaceSize));
763 STATISTIC_STAT(EVENT_PWW 764 STATISTIC_STAT(EVENT3
764 (TraceStatReclaim, trace, 765 (TraceStatReclaim, trace,
765 trace->reclaimCount, trace->reclaimSize)); 766 trace->reclaimCount, trace->reclaimSize));
766 767
767 trace->sig = SigInvalid; 768 trace->sig = SigInvalid;
768 trace->arena->busyTraces = TraceSetDel(trace->arena->busyTraces, trace); 769 trace->arena->busyTraces = TraceSetDel(trace->arena->busyTraces, trace);
769 trace->arena->flippedTraces = TraceSetDel(trace->arena->flippedTraces, trace); 770 trace->arena->flippedTraces = TraceSetDel(trace->arena->flippedTraces, trace);
770 EVENT_P(TraceDestroy, trace); 771 EVENT1(TraceDestroy, trace);
771} 772}
772 773
773 774
@@ -781,7 +782,7 @@ static void traceReclaim(Trace trace)
781 782
782 AVER(trace->state == TraceRECLAIM); 783 AVER(trace->state == TraceRECLAIM);
783 784
784 EVENT_P(TraceReclaim, trace); 785 EVENT1(TraceReclaim, trace);
785 arena = trace->arena; 786 arena = trace->arena;
786 if(SegFirst(&seg, arena)) { 787 if(SegFirst(&seg, arena)) {
787 Addr base; 788 Addr base;
@@ -982,6 +983,7 @@ static Bool traceFindGrey(Seg *segReturn, Rank *rankReturn,
982 } 983 }
983 *segReturn = seg; 984 *segReturn = seg;
984 *rankReturn = rank; 985 *rankReturn = rank;
986 EVENT4(TraceFindGrey, arena, ti, seg, rank);
985 DIAG( traceFindGrey_diag(TRUE, rank); ); 987 DIAG( traceFindGrey_diag(TRUE, rank); );
986 return TRUE; 988 return TRUE;
987 } 989 }
@@ -1111,7 +1113,7 @@ static Res traceScanSegRes(TraceSet ts, Rank rank, Arena arena, Seg seg)
1111 1113
1112 /* The reason for scanning a segment is that it's grey. */ 1114 /* The reason for scanning a segment is that it's grey. */
1113 AVER(TraceSetInter(ts, SegGrey(seg)) != TraceSetEMPTY); 1115 AVER(TraceSetInter(ts, SegGrey(seg)) != TraceSetEMPTY);
1114 EVENT_UUPP(TraceScanSeg, ts, rank, arena, seg); 1116 EVENT4(TraceScanSeg, ts, rank, arena, seg);
1115 1117
1116 white = traceSetWhiteUnion(ts, arena); 1118 white = traceSetWhiteUnion(ts, arena);
1117 1119
@@ -1215,7 +1217,7 @@ void TraceSegAccess(Arena arena, Seg seg, AccessSet mode)
1215 /* RefSetUNIV). */ 1217 /* RefSetUNIV). */
1216 AVER((mode & SegSM(seg) & AccessWRITE) == 0 || SegSummary(seg) != RefSetUNIV); 1218 AVER((mode & SegSM(seg) & AccessWRITE) == 0 || SegSummary(seg) != RefSetUNIV);
1217 1219
1218 EVENT_PPU(TraceAccess, arena, seg, mode); 1220 EVENT3(TraceAccess, arena, seg, mode);
1219 1221
1220 if((mode & SegSM(seg) & AccessREAD) != 0) { /* read barrier? */ 1222 if((mode & SegSM(seg) & AccessREAD) != 0) { /* read barrier? */
1221 Trace trace; 1223 Trace trace;
@@ -1267,7 +1269,7 @@ Res TraceFix(ScanState ss, Ref *refIO)
1267 ref = *refIO; 1269 ref = *refIO;
1268 1270
1269 STATISTIC(++ss->fixRefCount); 1271 STATISTIC(++ss->fixRefCount);
1270 EVENT_PPAU(TraceFix, ss, refIO, ref, ss->rank); 1272 EVENT4(TraceFix, ss, refIO, ref, ss->rank);
1271 1273
1272 TRACT_OF_ADDR(&tract, ss->arena, ref); 1274 TRACT_OF_ADDR(&tract, ss->arena, ref);
1273 if(tract) { 1275 if(tract) {
@@ -1277,8 +1279,8 @@ Res TraceFix(ScanState ss, Ref *refIO)
1277 Res res; 1279 Res res;
1278 STATISTIC(++ss->segRefCount); 1280 STATISTIC(++ss->segRefCount);
1279 STATISTIC(++ss->whiteSegRefCount); 1281 STATISTIC(++ss->whiteSegRefCount);
1280 EVENT_P(TraceFixSeg, seg); 1282 EVENT1(TraceFixSeg, seg);
1281 EVENT_0(TraceFixWhite); 1283 EVENT0(TraceFixWhite);
1282 pool = TractPool(tract); 1284 pool = TractPool(tract);
1283 /* Could move the rank switch here from the class-specific */ 1285 /* Could move the rank switch here from the class-specific */
1284 /* fix methods. */ 1286 /* fix methods. */
@@ -1303,7 +1305,7 @@ Res TraceFix(ScanState ss, Ref *refIO)
1303 Seg seg; 1305 Seg seg;
1304 if(TRACT_SEG(&seg, tract)) { 1306 if(TRACT_SEG(&seg, tract)) {
1305 ++ss->segRefCount; 1307 ++ss->segRefCount;
1306 EVENT_P(TraceFixSeg, seg); 1308 EVENT1(TraceFixSeg, seg);
1307 } 1309 }
1308 }); 1310 });
1309 } 1311 }
@@ -1334,7 +1336,7 @@ Res TraceFixEmergency(ScanState ss, Ref *refIO)
1334 ref = *refIO; 1336 ref = *refIO;
1335 1337
1336 STATISTIC(++ss->fixRefCount); 1338 STATISTIC(++ss->fixRefCount);
1337 EVENT_PPAU(TraceFix, ss, refIO, ref, ss->rank); 1339 EVENT4(TraceFix, ss, refIO, ref, ss->rank);
1338 1340
1339 TRACT_OF_ADDR(&tract, ss->arena, ref); 1341 TRACT_OF_ADDR(&tract, ss->arena, ref);
1340 if(tract) { 1342 if(tract) {
@@ -1343,8 +1345,8 @@ Res TraceFixEmergency(ScanState ss, Ref *refIO)
1343 if(TRACT_SEG(&seg, tract)) { 1345 if(TRACT_SEG(&seg, tract)) {
1344 STATISTIC(++ss->segRefCount); 1346 STATISTIC(++ss->segRefCount);
1345 STATISTIC(++ss->whiteSegRefCount); 1347 STATISTIC(++ss->whiteSegRefCount);
1346 EVENT_P(TraceFixSeg, seg); 1348 EVENT1(TraceFixSeg, seg);
1347 EVENT_0(TraceFixWhite); 1349 EVENT0(TraceFixWhite);
1348 pool = TractPool(tract); 1350 pool = TractPool(tract);
1349 PoolFixEmergency(pool, ss, seg, refIO); 1351 PoolFixEmergency(pool, ss, seg, refIO);
1350 } 1352 }
@@ -1356,7 +1358,7 @@ Res TraceFixEmergency(ScanState ss, Ref *refIO)
1356 Seg seg; 1358 Seg seg;
1357 if(TRACT_SEG(&seg, tract)) { 1359 if(TRACT_SEG(&seg, tract)) {
1358 ++ss->segRefCount; 1360 ++ss->segRefCount;
1359 EVENT_P(TraceFixSeg, seg); 1361 EVENT1(TraceFixSeg, seg);
1360 } 1362 }
1361 }); 1363 });
1362 } 1364 }
@@ -1383,7 +1385,7 @@ static Res traceScanSingleRefRes(TraceSet ts, Rank rank, Arena arena,
1383 Res res; 1385 Res res;
1384 ScanStateStruct ss; 1386 ScanStateStruct ss;
1385 1387
1386 EVENT_UUPA(TraceScanSingleRef, ts, rank, arena, (Addr)refIO); 1388 EVENT4(TraceScanSingleRef, ts, rank, arena, (Addr)refIO);
1387 1389
1388 white = traceSetWhiteUnion(ts, arena); 1390 white = traceSetWhiteUnion(ts, arena);
1389 if(ZoneSetInter(SegSummary(seg), white) == ZoneSetEMPTY) { 1391 if(ZoneSetInter(SegSummary(seg), white) == ZoneSetEMPTY) {
@@ -1454,7 +1456,7 @@ Res TraceScanArea(ScanState ss, Addr *base, Addr *limit)
1454 AVER(limit != NULL); 1456 AVER(limit != NULL);
1455 AVER(base < limit); 1457 AVER(base < limit);
1456 1458
1457 EVENT_PPP(TraceScanArea, ss, base, limit); 1459 EVENT3(TraceScanArea, ss, base, limit);
1458 1460
1459 TRACE_SCAN_BEGIN(ss) { 1461 TRACE_SCAN_BEGIN(ss) {
1460 p = base; 1462 p = base;
@@ -1527,7 +1529,7 @@ Res TraceScanAreaMasked(ScanState ss, Addr *base, Addr *limit, Word mask)
1527 AVER(limit != NULL); 1529 AVER(limit != NULL);
1528 AVER(base < limit); 1530 AVER(base < limit);
1529 1531
1530 EVENT_PPP(TraceScanAreaTagged, ss, base, limit); 1532 EVENT3(TraceScanAreaTagged, ss, base, limit);
1531 1533
1532 TRACE_SCAN_BEGIN(ss) { 1534 TRACE_SCAN_BEGIN(ss) {
1533 p = base; 1535 p = base;
@@ -1752,7 +1754,7 @@ void TraceStart(Trace trace, double mortality, double finishingTime)
1752 res = RootsIterate(ArenaGlobals(arena), rootGrey, (void *)trace); 1754 res = RootsIterate(ArenaGlobals(arena), rootGrey, (void *)trace);
1753 AVER(res == ResOK); 1755 AVER(res == ResOK);
1754 1756
1755 STATISTIC_STAT(EVENT_PW(ArenaWriteFaults, arena, arena->writeBarrierHitCount)); 1757 STATISTIC_STAT(EVENT2(ArenaWriteFaults, arena, arena->writeBarrierHitCount));
1756 1758
1757 /* Calculate the rate of scanning. */ 1759 /* Calculate the rate of scanning. */
1758 { 1760 {
@@ -1772,7 +1774,7 @@ void TraceStart(Trace trace, double mortality, double finishingTime)
1772 1774
1773 /* @@ DIAG for rate of scanning here. */ 1775 /* @@ DIAG for rate of scanning here. */
1774 1776
1775 STATISTIC_STAT(EVENT_PWWWWDD(TraceStatCondemn, trace, 1777 STATISTIC_STAT(EVENT7(TraceStatCondemn, trace,
1776 trace->condemned, trace->notCondemned, 1778 trace->condemned, trace->notCondemned,
1777 trace->foundation, trace->rate, 1779 trace->foundation, trace->rate,
1778 mortality, finishingTime)); 1780 mortality, finishingTime));
diff --git a/mps/code/vman.c b/mps/code/vman.c
index ef31935b91e..c4d4060f89a 100644
--- a/mps/code/vman.c
+++ b/mps/code/vman.c
@@ -93,7 +93,7 @@ Res VMCreate(VM *vmReturn, Size size)
93 93
94 AVERT(VM, vm); 94 AVERT(VM, vm);
95 95
96 EVENT_PAA(VMCreate, vm, vm->base, vm->limit); 96 EVENT3(VMCreate, vm, vm->base, vm->limit);
97 *vmReturn = vm; 97 *vmReturn = vm;
98 return ResOK; 98 return ResOK;
99} 99}
@@ -114,7 +114,7 @@ void VMDestroy(VM vm)
114 vm->sig = SigInvalid; 114 vm->sig = SigInvalid;
115 free(vm); 115 free(vm);
116 116
117 EVENT_P(VMDestroy, vm); 117 EVENT1(VMDestroy, vm);
118} 118}
119 119
120 120
@@ -176,7 +176,7 @@ Res VMMap(VM vm, Addr base, Addr limit)
176 176
177 vm->mapped += size; 177 vm->mapped += size;
178 178
179 EVENT_PAA(VMMap, vm, base, limit); 179 EVENT3(VMMap, vm, base, limit);
180 return ResOK; 180 return ResOK;
181} 181}
182 182
@@ -200,7 +200,7 @@ void VMUnmap(VM vm, Addr base, Addr limit)
200 AVER(vm->mapped >= size); 200 AVER(vm->mapped >= size);
201 vm->mapped -= size; 201 vm->mapped -= size;
202 202
203 EVENT_PAA(VMUnmap, vm, base, limit); 203 EVENT3(VMUnmap, vm, base, limit);
204} 204}
205 205
206 206
diff --git a/mps/code/vmix.c b/mps/code/vmix.c
index 0718dd982fa..bc26b647dc8 100644
--- a/mps/code/vmix.c
+++ b/mps/code/vmix.c
@@ -159,7 +159,7 @@ Res VMCreate(VM *vmReturn, Size size)
159 159
160 AVERT(VM, vm); 160 AVERT(VM, vm);
161 161
162 EVENT_PAA(VMCreate, vm, vm->base, vm->limit); 162 EVENT3(VMCreate, vm, vm->base, vm->limit);
163 DIAG_SINGLEF(( 163 DIAG_SINGLEF((
164 "VM_ix_Create_ok", 164 "VM_ix_Create_ok",
165 "[$W..<$W>..$W)", 165 "[$W..<$W>..$W)",
@@ -206,7 +206,7 @@ void VMDestroy(VM vm)
206 (size_t)SizeAlignUp(sizeof(VMStruct), vm->align)); 206 (size_t)SizeAlignUp(sizeof(VMStruct), vm->align));
207 AVER(r == 0); 207 AVER(r == 0);
208 208
209 EVENT_P(VMDestroy, vm); 209 EVENT1(VMDestroy, vm);
210} 210}
211 211
212 212
@@ -277,7 +277,7 @@ Res VMMap(VM vm, Addr base, Addr limit)
277 277
278 vm->mapped += size; 278 vm->mapped += size;
279 279
280 EVENT_PAA(VMMap, vm, base, limit); 280 EVENT3(VMMap, vm, base, limit);
281 return ResOK; 281 return ResOK;
282} 282}
283 283
@@ -306,7 +306,7 @@ void VMUnmap(VM vm, Addr base, Addr limit)
306 306
307 vm->mapped -= size; 307 vm->mapped -= size;
308 308
309 EVENT_PAA(VMUnmap, vm, base, limit); 309 EVENT3(VMUnmap, vm, base, limit);
310} 310}
311 311
312 312
diff --git a/mps/code/vmw3.c b/mps/code/vmw3.c
index e1e05b4ab2a..6bff4fe757a 100644
--- a/mps/code/vmw3.c
+++ b/mps/code/vmw3.c
@@ -140,7 +140,7 @@ Res VMCreate(VM *vmReturn, Size size)
140 vm->sig = VMSig; 140 vm->sig = VMSig;
141 AVERT(VM, vm); 141 AVERT(VM, vm);
142 142
143 EVENT_PAA(VMCreate, vm, vm->base, vm->limit); 143 EVENT3(VMCreate, vm, vm->base, vm->limit);
144 *vmReturn = vm; 144 *vmReturn = vm;
145 return ResOK; 145 return ResOK;
146 146
@@ -170,7 +170,7 @@ void VMDestroy(VM vm)
170 170
171 b = VirtualFree((LPVOID)vm, (SIZE_T)0, MEM_RELEASE); 171 b = VirtualFree((LPVOID)vm, (SIZE_T)0, MEM_RELEASE);
172 AVER(b != 0); 172 AVER(b != 0);
173 EVENT_P(VMDestroy, vm); 173 EVENT1(VMDestroy, vm);
174} 174}
175 175
176 176
@@ -240,7 +240,7 @@ Res VMMap(VM vm, Addr base, Addr limit)
240 240
241 vm->mapped += AddrOffset(base, limit); 241 vm->mapped += AddrOffset(base, limit);
242 242
243 EVENT_PAA(VMMap, vm, base, limit); 243 EVENT3(VMMap, vm, base, limit);
244 return ResOK; 244 return ResOK;
245} 245}
246 246
@@ -266,7 +266,7 @@ void VMUnmap(VM vm, Addr base, Addr limit)
266 AVER(b != 0); /* .assume.free.success */ 266 AVER(b != 0); /* .assume.free.success */
267 vm->mapped -= AddrOffset(base, limit); 267 vm->mapped -= AddrOffset(base, limit);
268 268
269 EVENT_PAA(VMUnmap, vm, base, limit); 269 EVENT3(VMUnmap, vm, base, limit);
270} 270}
271 271
272 272