Revision: 2828 Author: eliot Date: 2013-12-11 15:17:12 -0800 (Wed, 11 Dec 2013) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.558.
Implement Spur snapshot & fix freeChunk swizzlng on load.
Internal refactoring of snapshot preparation.
Modified Paths: -------------- branches/Cog/nscogsrc/vm/cointerp.c branches/Cog/nscogsrc/vm/cointerp.h branches/Cog/nscogsrc/vm/gcc3x-cointerp.c branches/Cog/nscogsrc/vm/interp.h branches/Cog/nscogsrc/vm/vmCallback.h branches/Cog/spursrc/vm/cointerp.c branches/Cog/spursrc/vm/cointerp.h branches/Cog/spursrc/vm/gcc3x-cointerp.c branches/Cog/spursrc/vm/interp.h branches/Cog/spursrc/vm/vmCallback.h branches/Cog/spurstacksrc/vm/gcc3x-interp.c branches/Cog/spurstacksrc/vm/interp.c branches/Cog/spurstacksrc/vm/interp.h branches/Cog/spurstacksrc/vm/vmCallback.h branches/Cog/src/vm/cointerp.c branches/Cog/src/vm/cointerp.h branches/Cog/src/vm/cointerpmt.c branches/Cog/src/vm/cointerpmt.h branches/Cog/src/vm/gcc3x-cointerp.c branches/Cog/src/vm/gcc3x-cointerpmt.c branches/Cog/src/vm/interp.h branches/Cog/src/vm/vmCallback.h branches/Cog/stacksrc/vm/gcc3x-interp.c branches/Cog/stacksrc/vm/interp.c branches/Cog/stacksrc/vm/interp.h branches/Cog/stacksrc/vm/vmCallback.h
Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2013-12-11 23:14:18 UTC (rev 2827) +++ branches/Cog/nscogsrc/vm/cointerp.c 2013-12-11 23:17:12 UTC (rev 2828) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 from - CoInterpreter VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CoInterpreter VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -1244,7 +1244,7 @@ static void verifyCleanHeaders(void); sqInt vmEndianness(void); static void voidLongRunningPrimitive(char *reason); -static sqInt voidVMStateForSnapshot(void); +static sqInt voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); static sqInt wakeHighestPriority(void); sqInt weakArrayFormat(void); sqInt withoutForwardingOnandsendToCogit(sqInt obj1, sqInt obj2, sqInt (*selector)(sqInt,sqInt)); @@ -1297,11 +1297,11 @@ _iss sqInt needGCFlag; _iss usqInt fwdTableNext; _iss sqInt longRunningPrimitiveCheckSemaphore; +_iss sqInt tempOop; _iss sqInt profileProcess; _iss sqInt profileSemaphore; _iss usqInt compStart; _iss sqInt extraRootCount; -_iss sqInt tempOop; _iss sqInt classNameIndex; _iss sqInt weakRootCount; _iss sqInt longRunningPrimitiveCheckMethod; @@ -2030,7 +2030,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.555"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.558"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -39148,7 +39148,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); assert((((stackValue(0)) == (nilObject())) && (GIV(longRunningPrimitiveCheckSemaphore) == null)) @@ -40919,7 +40919,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); assert((((stackValue(0)) == (nilObject())) && (GIV(profileSemaphore) == (nilObject()))) @@ -45501,7 +45501,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); siglongjmp(reenterInterpreter, ReturnToInterpreter); } @@ -51609,29 +51609,17 @@ sqInt activateCogMethod; sqInt activeContext; sqInt activeProc; - sqInt chunk; CogMethod *cogMethod; sqInt errorCode; - sqInt fmt; - sqInt fwdBlock; - sqInt header; - sqInt header1; - sqInt header2; sqInt i; - sqInt i1; - sqInt iLimiT; usqInt initialIP; sqInt methodHeader; sqInt numArgs; sqInt numTemps; - sqInt obj; sqInt object; sqInt oop; - sqInt oop1; - sqInt oop2; sqInt rcvr; sqInt rcvr1; - sqInt realHeader; void *setMacType; char *sp; char *sp1; @@ -51647,8 +51635,6 @@ char *sp8; char *sp9; sqInt stackIndex; - sqInt sz1; - sqInt sz2; sqInt table;
@@ -51664,101 +51650,20 @@
/* update state of active process */
- activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(1); activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord)); /* begin storePointer:ofObject:withValue: */ if ((((usqInt) activeProc)) < (((usqInt) GIV(youngStart)))) { possibleRootStoreIntovalue(activeProc, activeContext); } longAtput((activeProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord), activeContext); - /* begin pushRemappableOop: */ - assert(addressCouldBeOop(activeContext)); - GIV(remapBuffer)[(GIV(remapBufferCount) += 1)] = activeContext; - if (!(GIV(remapBufferCount) <= RemapBufferSize)) { - error("remapBuffer overflow"); - } - /* begin snapshotCleanUp */ + GIV(tempOop) = activeContext; + /* begin garbageCollectForSnapshot */ incrementalGC(); - fullGC(); - /* begin bereaveAndNormalizeContextsAndFlushExternalPrimitives */ - /* begin allObjectsDo: */ - /* begin oopFromChunk: */ - chunk = startOfMemory(); - oop2 = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]); - while (oop2 < GIV(freeStart)) { - if (!(((longAt(oop2)) & TypeMask) == HeaderTypeFree)) { - header = longAt(oop2); - - /* Clean out context */ - - fmt = (((usqInt) header) >> (instFormatFieldLSB())) & 15; - if ((fmt == 3) - && (((((usqInt) header) >> 12) & 0x1F) == ClassMethodContextCompactIndex)) { - - /* All contexts have been divorced. Bereave remaining widows. */ - - if (((longAt((oop2 + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) { - /* begin markContextAsDead: */ - assert(isContext(oop2)); - longAtput((oop2 + BaseHeaderSize) + (SenderIndex << ShiftForWord), GIV(nilObj)); - longAtput((oop2 + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), GIV(nilObj)); - } - for (i1 = ((fetchStackPointerOf(oop2)) + CtxtTempFrameStart), iLimiT = ((numSlotsOf(oop2)) - 1); i1 <= iLimiT; i1 += 1) { - longAtput((oop2 + BaseHeaderSize) + (i1 << ShiftForWord), GIV(nilObj)); - } - } - if (fmt >= 12) { - - /* Its primitiveExternalCall */ - - if ((primitiveIndexOfMethodheader(oop2, headerOf(oop2))) == PrimitiveExternalCallIndex) { - flushExternalPrimitiveOf(oop2); - } - } - - } - /* begin objectAfterWhileForwarding: */ - header1 = longAt(oop2); - if ((header1 & MarkBit) == 0) { - /* begin objectAfter: */ - if (!(asserta(oopisLessThan(oop2, GIV(freeStart))))) { - error("no objects after the end of memory"); - } - if (((longAt(oop2)) & TypeMask) == HeaderTypeFree) { - sz2 = (longAt(oop2)) & AllButTypeMask; - } - else { - /* begin sizeBitsOf: */ - header2 = longAt(oop2); - sz2 = ((header2 & TypeMask) == HeaderTypeSizeAndClass - ? (longAt(oop2 - (BytesPerWord * 2))) & LongSizeMask - : header2 & SizeMask); - } - oop2 = (oop2 + sz2) + (headerTypeBytes[(longAt(oop2 + sz2)) & TypeMask]); - goto l2; - } - fwdBlock = (header1 & AllButMarkBitAndTypeMask) << 1; - assert(fwdBlockValid(fwdBlock)); - - /* following code is like sizeBitsOf: */ - - realHeader = longAt(fwdBlock + BytesPerWord); - if ((realHeader & TypeMask) == HeaderTypeSizeAndClass) { - sz1 = (longAt(oop2 - (BytesPerWord * 2))) & LongSizeMask; - } - else { - sz1 = realHeader & SizeMask; - } - oop2 = (oop2 + sz1) + (headerTypeBytes[(longAt(oop2 + sz1)) & TypeMask]); - l2: /* end objectAfterWhileForwarding: */; - } clearRootsTable(); - - /* begin popRemappableOop */ - oop1 = GIV(remapBuffer)[GIV(remapBufferCount)]; - GIV(remapBufferCount) -= 1; - activeContext = oop1; + activeContext = GIV(tempOop); + GIV(tempOop) = 0; if (!GIV(primFailCode)) {
/* Without contexts or stacks simulate @@ -54489,22 +54394,31 @@
/* Make sure that all VM state that affects the heap contents is voided so - that the heap is ready - to be snapshotted. Answer the activeContext object that should be stored - in the snapshot. - */ + that the heap is + ready to be snapshotted. If flushExtPrims is true, flush references to + external primitives in methods. Answer the activeContext that should be + stored in the snapshot. */ +/* Make sure that all VM state that affects the heap contents is voided so + that the heap is + ready to be snapshotted. If flushExtPrims is true, flush references to + external primitives in methods. Answer the activeContext that should be + stored in the snapshot. */
static sqInt -voidVMStateForSnapshot(void) +voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt activeContext; + sqInt activeContext1; sqInt chunk; sqInt decodedIP; + sqInt fmt; sqInt fwdBlock; sqInt header; sqInt header1; + sqInt i; + sqInt iLimiT; + sqInt obj; sqInt oop; - sqInt oop1; sqInt realHeader; sqInt sz; sqInt sz1; @@ -54513,53 +54427,67 @@ /* in case of code compactions. */
GIV(instructionPointer) = 0; - activeContext = divorceAllFrames(); - /* begin ensureAllContextsHaveBytecodePCsOrAreBereaved */ + activeContext1 = divorceAllFrames(); + /* begin bereaveAllMarriedContextsForSnapshotFlushingExternalPrimitivesIf: */ /* begin allObjectsDo: */ /* begin oopFromChunk: */ chunk = startOfMemory(); - oop1 = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]); - while (oop1 < GIV(freeStart)) { - if (!(((longAt(oop1)) & TypeMask) == HeaderTypeFree)) { - if (((((usqInt) (longAt(oop1))) >> 12) & 0x1F) == ClassMethodContextCompactIndex) { - if (((longAt((oop1 + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) { + oop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]); + while (oop < GIV(freeStart)) { + if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) { + fmt = (((usqInt) (longAt(oop))) >> (instFormatFieldLSB())) & 15; + if ((fmt == 3) + && (((((usqInt) (longAt(oop))) >> 12) & 0x1F) == ClassMethodContextCompactIndex)) { + if (((longAt((oop + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) {
/* The stack pages have already been discarded. Any remaining married contexts are actually widows. */
/* begin markContextAsDead: */ - assert(isContext(oop1)); - longAtput((oop1 + BaseHeaderSize) + (SenderIndex << ShiftForWord), GIV(nilObj)); - longAtput((oop1 + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), GIV(nilObj)); + assert(isContext(oop)); + longAtput((oop + BaseHeaderSize) + (SenderIndex << ShiftForWord), GIV(nilObj)); + longAtput((oop + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), GIV(nilObj)); } else { - decodedIP = longAt((oop1 + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord)); + decodedIP = longAt((oop + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord)); if (((decodedIP & 1)) && ((((sqInt) decodedIP)) < 0)) { - decodedIP = mustMapMachineCodePCcontext((decodedIP >> 1), oop1); - longAtput((oop1 + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), decodedIP); + decodedIP = mustMapMachineCodePCcontext((decodedIP >> 1), oop); + longAtput((oop + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), decodedIP); } } + for (i = ((fetchStackPointerOf(oop)) + CtxtTempFrameStart), iLimiT = ((numSlotsOf(oop)) - 1); i <= iLimiT; i += 1) { + longAtput((oop + BaseHeaderSize) + (i << ShiftForWord), GIV(nilObj)); + } } + if (flushExtPrims + && (fmt >= 12)) {
+ /* Its primitiveExternalCall */ + + if ((primitiveIndexOfMethodheader(oop, headerOf(oop))) == PrimitiveExternalCallIndex) { + flushExternalPrimitiveOf(oop); + } + } + } /* begin objectAfterWhileForwarding: */ - header = longAt(oop1); + header = longAt(oop); if ((header & MarkBit) == 0) { /* begin objectAfter: */ - if (!(asserta(oopisLessThan(oop1, GIV(freeStart))))) { + if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) { error("no objects after the end of memory"); } - if (((longAt(oop1)) & TypeMask) == HeaderTypeFree) { - sz1 = (longAt(oop1)) & AllButTypeMask; + if (((longAt(oop)) & TypeMask) == HeaderTypeFree) { + sz1 = (longAt(oop)) & AllButTypeMask; } else { /* begin sizeBitsOf: */ - header1 = longAt(oop1); + header1 = longAt(oop); sz1 = ((header1 & TypeMask) == HeaderTypeSizeAndClass - ? (longAt(oop1 - (BytesPerWord * 2))) & LongSizeMask + ? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask : header1 & SizeMask); } - oop1 = (oop1 + sz1) + (headerTypeBytes[(longAt(oop1 + sz1)) & TypeMask]); + oop = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]); goto l1; } fwdBlock = (header & AllButMarkBitAndTypeMask) << 1; @@ -54569,14 +54497,15 @@
realHeader = longAt(fwdBlock + BytesPerWord); if ((realHeader & TypeMask) == HeaderTypeSizeAndClass) { - sz = (longAt(oop1 - (BytesPerWord * 2))) & LongSizeMask; + sz = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask; } else { sz = realHeader & SizeMask; } - oop1 = (oop1 + sz) + (headerTypeBytes[(longAt(oop1 + sz)) & TypeMask]); + oop = (oop + sz) + (headerTypeBytes[(longAt(oop + sz)) & TypeMask]); l1: /* end objectAfterWhileForwarding: */; } + activeContext = activeContext1; voidCogCompiledCode(); return activeContext; }
Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2013-12-11 23:14:18 UTC (rev 2827) +++ branches/Cog/nscogsrc/vm/cointerp.h 2013-12-11 23:17:12 UTC (rev 2828) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 */
Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2013-12-11 23:14:18 UTC (rev 2827) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2013-12-11 23:17:12 UTC (rev 2828) @@ -2,11 +2,11 @@
/* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 from - CoInterpreter VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CoInterpreter VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -1247,7 +1247,7 @@ static void verifyCleanHeaders(void); sqInt vmEndianness(void); static void voidLongRunningPrimitive(char *reason); -static sqInt voidVMStateForSnapshot(void); +static sqInt voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); static sqInt wakeHighestPriority(void); sqInt weakArrayFormat(void); sqInt withoutForwardingOnandsendToCogit(sqInt obj1, sqInt obj2, sqInt (*selector)(sqInt,sqInt)); @@ -1300,11 +1300,11 @@ _iss sqInt needGCFlag; _iss usqInt fwdTableNext; _iss sqInt longRunningPrimitiveCheckSemaphore; +_iss sqInt tempOop; _iss sqInt profileProcess; _iss sqInt profileSemaphore; _iss usqInt compStart; _iss sqInt extraRootCount; -_iss sqInt tempOop; _iss sqInt classNameIndex; _iss sqInt weakRootCount; _iss sqInt longRunningPrimitiveCheckMethod; @@ -2033,7 +2033,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.555"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.558"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -39157,7 +39157,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); assert((((stackValue(0)) == (nilObject())) && (GIV(longRunningPrimitiveCheckSemaphore) == null)) @@ -40928,7 +40928,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); assert((((stackValue(0)) == (nilObject())) && (GIV(profileSemaphore) == (nilObject()))) @@ -45510,7 +45510,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); siglongjmp(reenterInterpreter, ReturnToInterpreter); } @@ -51618,29 +51618,17 @@ sqInt activateCogMethod; sqInt activeContext; sqInt activeProc; - sqInt chunk; CogMethod *cogMethod; sqInt errorCode; - sqInt fmt; - sqInt fwdBlock; - sqInt header; - sqInt header1; - sqInt header2; sqInt i; - sqInt i1; - sqInt iLimiT; usqInt initialIP; sqInt methodHeader; sqInt numArgs; sqInt numTemps; - sqInt obj; sqInt object; sqInt oop; - sqInt oop1; - sqInt oop2; sqInt rcvr; sqInt rcvr1; - sqInt realHeader; void *setMacType; char *sp; char *sp1; @@ -51656,8 +51644,6 @@ char *sp8; char *sp9; sqInt stackIndex; - sqInt sz1; - sqInt sz2; sqInt table;
@@ -51673,101 +51659,20 @@
/* update state of active process */
- activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(1); activeProc = longAt(((longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SchedulerAssociation << ShiftForWord))) + BaseHeaderSize) + (ValueIndex << ShiftForWord))) + BaseHeaderSize) + (ActiveProcessIndex << ShiftForWord)); /* begin storePointer:ofObject:withValue: */ if ((((usqInt) activeProc)) < (((usqInt) GIV(youngStart)))) { possibleRootStoreIntovalue(activeProc, activeContext); } longAtput((activeProc + BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord), activeContext); - /* begin pushRemappableOop: */ - assert(addressCouldBeOop(activeContext)); - GIV(remapBuffer)[(GIV(remapBufferCount) += 1)] = activeContext; - if (!(GIV(remapBufferCount) <= RemapBufferSize)) { - error("remapBuffer overflow"); - } - /* begin snapshotCleanUp */ + GIV(tempOop) = activeContext; + /* begin garbageCollectForSnapshot */ incrementalGC(); - fullGC(); - /* begin bereaveAndNormalizeContextsAndFlushExternalPrimitives */ - /* begin allObjectsDo: */ - /* begin oopFromChunk: */ - chunk = startOfMemory(); - oop2 = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]); - while (oop2 < GIV(freeStart)) { - if (!(((longAt(oop2)) & TypeMask) == HeaderTypeFree)) { - header = longAt(oop2); - - /* Clean out context */ - - fmt = (((usqInt) header) >> (instFormatFieldLSB())) & 15; - if ((fmt == 3) - && (((((usqInt) header) >> 12) & 0x1F) == ClassMethodContextCompactIndex)) { - - /* All contexts have been divorced. Bereave remaining widows. */ - - if (((longAt((oop2 + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) { - /* begin markContextAsDead: */ - assert(isContext(oop2)); - longAtput((oop2 + BaseHeaderSize) + (SenderIndex << ShiftForWord), GIV(nilObj)); - longAtput((oop2 + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), GIV(nilObj)); - } - for (i1 = ((fetchStackPointerOf(oop2)) + CtxtTempFrameStart), iLimiT = ((numSlotsOf(oop2)) - 1); i1 <= iLimiT; i1 += 1) { - longAtput((oop2 + BaseHeaderSize) + (i1 << ShiftForWord), GIV(nilObj)); - } - } - if (fmt >= 12) { - - /* Its primitiveExternalCall */ - - if ((primitiveIndexOfMethodheader(oop2, headerOf(oop2))) == PrimitiveExternalCallIndex) { - flushExternalPrimitiveOf(oop2); - } - } - - } - /* begin objectAfterWhileForwarding: */ - header1 = longAt(oop2); - if ((header1 & MarkBit) == 0) { - /* begin objectAfter: */ - if (!(asserta(oopisLessThan(oop2, GIV(freeStart))))) { - error("no objects after the end of memory"); - } - if (((longAt(oop2)) & TypeMask) == HeaderTypeFree) { - sz2 = (longAt(oop2)) & AllButTypeMask; - } - else { - /* begin sizeBitsOf: */ - header2 = longAt(oop2); - sz2 = ((header2 & TypeMask) == HeaderTypeSizeAndClass - ? (longAt(oop2 - (BytesPerWord * 2))) & LongSizeMask - : header2 & SizeMask); - } - oop2 = (oop2 + sz2) + (headerTypeBytes[(longAt(oop2 + sz2)) & TypeMask]); - goto l2; - } - fwdBlock = (header1 & AllButMarkBitAndTypeMask) << 1; - assert(fwdBlockValid(fwdBlock)); - - /* following code is like sizeBitsOf: */ - - realHeader = longAt(fwdBlock + BytesPerWord); - if ((realHeader & TypeMask) == HeaderTypeSizeAndClass) { - sz1 = (longAt(oop2 - (BytesPerWord * 2))) & LongSizeMask; - } - else { - sz1 = realHeader & SizeMask; - } - oop2 = (oop2 + sz1) + (headerTypeBytes[(longAt(oop2 + sz1)) & TypeMask]); - l2: /* end objectAfterWhileForwarding: */; - } clearRootsTable(); - - /* begin popRemappableOop */ - oop1 = GIV(remapBuffer)[GIV(remapBufferCount)]; - GIV(remapBufferCount) -= 1; - activeContext = oop1; + activeContext = GIV(tempOop); + GIV(tempOop) = 0; if (!GIV(primFailCode)) {
/* Without contexts or stacks simulate @@ -54498,22 +54403,31 @@
/* Make sure that all VM state that affects the heap contents is voided so - that the heap is ready - to be snapshotted. Answer the activeContext object that should be stored - in the snapshot. - */ + that the heap is + ready to be snapshotted. If flushExtPrims is true, flush references to + external primitives in methods. Answer the activeContext that should be + stored in the snapshot. */ +/* Make sure that all VM state that affects the heap contents is voided so + that the heap is + ready to be snapshotted. If flushExtPrims is true, flush references to + external primitives in methods. Answer the activeContext that should be + stored in the snapshot. */
static sqInt -voidVMStateForSnapshot(void) +voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt activeContext; + sqInt activeContext1; sqInt chunk; sqInt decodedIP; + sqInt fmt; sqInt fwdBlock; sqInt header; sqInt header1; + sqInt i; + sqInt iLimiT; + sqInt obj; sqInt oop; - sqInt oop1; sqInt realHeader; sqInt sz; sqInt sz1; @@ -54522,53 +54436,67 @@ /* in case of code compactions. */
GIV(instructionPointer) = 0; - activeContext = divorceAllFrames(); - /* begin ensureAllContextsHaveBytecodePCsOrAreBereaved */ + activeContext1 = divorceAllFrames(); + /* begin bereaveAllMarriedContextsForSnapshotFlushingExternalPrimitivesIf: */ /* begin allObjectsDo: */ /* begin oopFromChunk: */ chunk = startOfMemory(); - oop1 = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]); - while (oop1 < GIV(freeStart)) { - if (!(((longAt(oop1)) & TypeMask) == HeaderTypeFree)) { - if (((((usqInt) (longAt(oop1))) >> 12) & 0x1F) == ClassMethodContextCompactIndex) { - if (((longAt((oop1 + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) { + oop = chunk + (headerTypeBytes[(longAt(chunk)) & TypeMask]); + while (oop < GIV(freeStart)) { + if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) { + fmt = (((usqInt) (longAt(oop))) >> (instFormatFieldLSB())) & 15; + if ((fmt == 3) + && (((((usqInt) (longAt(oop))) >> 12) & 0x1F) == ClassMethodContextCompactIndex)) { + if (((longAt((oop + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) {
/* The stack pages have already been discarded. Any remaining married contexts are actually widows. */
/* begin markContextAsDead: */ - assert(isContext(oop1)); - longAtput((oop1 + BaseHeaderSize) + (SenderIndex << ShiftForWord), GIV(nilObj)); - longAtput((oop1 + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), GIV(nilObj)); + assert(isContext(oop)); + longAtput((oop + BaseHeaderSize) + (SenderIndex << ShiftForWord), GIV(nilObj)); + longAtput((oop + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), GIV(nilObj)); } else { - decodedIP = longAt((oop1 + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord)); + decodedIP = longAt((oop + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord)); if (((decodedIP & 1)) && ((((sqInt) decodedIP)) < 0)) { - decodedIP = mustMapMachineCodePCcontext((decodedIP >> 1), oop1); - longAtput((oop1 + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), decodedIP); + decodedIP = mustMapMachineCodePCcontext((decodedIP >> 1), oop); + longAtput((oop + BaseHeaderSize) + (InstructionPointerIndex << ShiftForWord), decodedIP); } } + for (i = ((fetchStackPointerOf(oop)) + CtxtTempFrameStart), iLimiT = ((numSlotsOf(oop)) - 1); i <= iLimiT; i += 1) { + longAtput((oop + BaseHeaderSize) + (i << ShiftForWord), GIV(nilObj)); + } } + if (flushExtPrims + && (fmt >= 12)) {
+ /* Its primitiveExternalCall */ + + if ((primitiveIndexOfMethodheader(oop, headerOf(oop))) == PrimitiveExternalCallIndex) { + flushExternalPrimitiveOf(oop); + } + } + } /* begin objectAfterWhileForwarding: */ - header = longAt(oop1); + header = longAt(oop); if ((header & MarkBit) == 0) { /* begin objectAfter: */ - if (!(asserta(oopisLessThan(oop1, GIV(freeStart))))) { + if (!(asserta(oopisLessThan(oop, GIV(freeStart))))) { error("no objects after the end of memory"); } - if (((longAt(oop1)) & TypeMask) == HeaderTypeFree) { - sz1 = (longAt(oop1)) & AllButTypeMask; + if (((longAt(oop)) & TypeMask) == HeaderTypeFree) { + sz1 = (longAt(oop)) & AllButTypeMask; } else { /* begin sizeBitsOf: */ - header1 = longAt(oop1); + header1 = longAt(oop); sz1 = ((header1 & TypeMask) == HeaderTypeSizeAndClass - ? (longAt(oop1 - (BytesPerWord * 2))) & LongSizeMask + ? (longAt(oop - (BytesPerWord * 2))) & LongSizeMask : header1 & SizeMask); } - oop1 = (oop1 + sz1) + (headerTypeBytes[(longAt(oop1 + sz1)) & TypeMask]); + oop = (oop + sz1) + (headerTypeBytes[(longAt(oop + sz1)) & TypeMask]); goto l1; } fwdBlock = (header & AllButMarkBitAndTypeMask) << 1; @@ -54578,14 +54506,15 @@
realHeader = longAt(fwdBlock + BytesPerWord); if ((realHeader & TypeMask) == HeaderTypeSizeAndClass) { - sz = (longAt(oop1 - (BytesPerWord * 2))) & LongSizeMask; + sz = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask; } else { sz = realHeader & SizeMask; } - oop1 = (oop1 + sz) + (headerTypeBytes[(longAt(oop1 + sz)) & TypeMask]); + oop = (oop + sz) + (headerTypeBytes[(longAt(oop + sz)) & TypeMask]); l1: /* end objectAfterWhileForwarding: */; } + activeContext = activeContext1; voidCogCompiledCode(); return activeContext; }
Modified: branches/Cog/nscogsrc/vm/interp.h =================================================================== --- branches/Cog/nscogsrc/vm/interp.h 2013-12-11 23:14:18 UTC (rev 2827) +++ branches/Cog/nscogsrc/vm/interp.h 2013-12-11 23:17:12 UTC (rev 2828) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 */
#define VM_PROXY_MAJOR 1
Modified: branches/Cog/nscogsrc/vm/vmCallback.h =================================================================== --- branches/Cog/nscogsrc/vm/vmCallback.h 2013-12-11 23:14:18 UTC (rev 2827) +++ branches/Cog/nscogsrc/vm/vmCallback.h 2013-12-11 23:17:12 UTC (rev 2828) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 */
#define VM_CALLBACK_INC 1
Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h ___________________________________________________________________ Modified: checkindate - Tue Dec 10 17:30:58 PST 2013 + Wed Dec 11 15:15:14 PST 2013
Modified: branches/Cog/spursrc/vm/cointerp.c =================================================================== --- branches/Cog/spursrc/vm/cointerp.c 2013-12-11 23:14:18 UTC (rev 2827) +++ branches/Cog/spursrc/vm/cointerp.c 2013-12-11 23:17:12 UTC (rev 2828) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 from - CoInterpreter VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 + CoInterpreter VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.555 uuid: 9b99d897-eecb-4b11-97c9-7f7a75c7d8b0 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.558 uuid: ef7afd3b-c404-472c-a05a-9d9c6d905052 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -399,6 +399,7 @@ void beRootIfOld(sqInt oop); static sqInt bitsSetInFreeSpaceMaskForAllFreeLists(void); sqInt booleanValueOf(sqInt obj); +static sqInt bootstrapping(void); static sqInt bridgeAt(sqInt segIndex); static sqInt bridgeFor(SpurSegmentInfo *aSegment); static void bridgeFromto(SpurSegmentInfo *aSegment, SpurSegmentInfo *nextSegmentOrNil); @@ -521,6 +522,7 @@ char * cStringOrNullFor(sqInt oop); static double dbgFloatValueOf(sqInt oop); static sqInt defaultCogCodeSize(void); +static sqInt defaultEdenBytes(void); static sqInt defaultNumStackPages(void); static sqInt deferStackLimitSmashAroundwith(void (*functionSymbol)(sqInt), sqInt arg); static void detachFreeObject(sqInt freeChunk); @@ -1174,6 +1176,7 @@ sqInt printFrame(char *theFP); void printFrameWithSP(char *theFP, char *theSP); void printFreeChunk(sqInt freeChunk); +void printFreeList(sqInt chunkOrIndex); void printHex(sqInt n); void printInstancesOf(sqInt aClassOop); void printInstancesWithClassIndex(sqInt classIndex); @@ -1360,7 +1363,7 @@ static sqInt validStackPageBaseFrame(StackPage *aPage); sqInt vmEndianness(void); static void voidLongRunningPrimitive(char *reason); -static sqInt voidVMStateForSnapshot(void); +static sqInt voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); static sqInt wakeHighestPriority(void); sqInt weakArrayFormat(void); sqInt withoutForwardingOnandsendToCogit(sqInt obj1, sqInt obj2, sqInt (*selector)(sqInt,sqInt)); @@ -1395,8 +1398,8 @@ _iss usqInt freeStart; _iss SpurCircularBuffer highestObjects; _iss usqInt endOfMemory; -_iss sqInt remapBufferCount; _iss sqInt totalFreeOldSpace; +_iss sqInt remapBufferCount; _iss sqInt trueObj; _iss sqInt falseObj; _iss sqInt traceLogIndex; @@ -1411,9 +1414,9 @@ _iss sqInt weaklingStack; _iss SpurContiguousObjStack unscannedEphemerons; _iss SpurNewSpaceSpace futureSpace; +_iss sqInt numSegments; _iss StackPage * mostRecentlyUsedPage; _iss usqInt newSpaceStart; -_iss sqInt numSegments; _iss unsigned char primTraceLogIndex; _iss sqInt numStackPages; _iss sqInt classTableFirstPage; @@ -1427,19 +1430,19 @@ _iss sqInt markStack; _iss sqInt numClassTablePages; _iss sqInt longRunningPrimitiveCheckSemaphore; +_iss sqInt tempOop; _iss SpurNewSpaceSpace eden; _iss sqInt profileProcess; _iss sqInt profileSemaphore; _iss sqInt tenureThreshold; _iss sqInt ephemeronList; _iss sqInt needGCFlag; -_iss sqInt tempOop; +_iss sqInt extraRootCount; _iss char * objStackInvalidBecause; _iss sqInt previousRememberedSetSize; _iss unsigned char * classTableBitmap; _iss sqInt longRunningPrimitiveCheckMethod; _iss sqInt ephemeronQueue; -_iss sqInt extraRootCount; _iss sqInt lastMethodCacheProbeWrite; _iss sqInt lkupClass; _iss sqInt profileMethod; @@ -1469,6 +1472,7 @@ _iss sqInt statIOProcessEvents; _iss sqInt weakList; _iss sqInt backwardJumpCount; +_iss sqInt firstSegmentSize; _iss usqLong gcStartUsecs; _iss usqInt memory; _iss sqInt noThreadingOfGUIThread; @@ -1477,7 +1481,6 @@ _iss sqInt statCompactPassCount; _iss sqInt thisClassIndex; _iss sqInt externalPrimitiveTableFirstFreeIndex; -_iss sqInt firstSegmentSize; _iss sqInt fullScreenFlag; _iss sqInt interruptPending; _iss sqInt lastHash; @@ -1525,8 +1528,8 @@ _iss sqInt the2ndUnknownShort; _iss long methodCache[MethodCacheSize + 1 /* 4097 */]; _iss sqInt traceLog[TraceBufferSize /* 768 */]; -_iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt atCache[AtCacheTotalSize + 1 /* 65 */]; +_iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt rememberedSet[RememberedSetLimit + 1 /* 65537 */]; _iss sqInt primTraceLog[256]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 2049 */]; @@ -2159,7 +2162,7 @@ 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); usqInt heapBase; -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.555]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.558]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -11053,7 +11056,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -12776,6 +12780,12 @@ }
static sqInt +bootstrapping(void) +{ + return 0; +} + +static sqInt bridgeAt(sqInt segIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -14666,7 +14676,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -14990,7 +15001,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -16553,7 +16565,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -17237,7 +17250,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -17569,6 +17583,17 @@ }
+/* Return the default amount of memory to allocate for the eden space. + The actual value can be set via vmParameterAt: and/or a preference in the + ini file. */ + +static sqInt +defaultEdenBytes(void) +{ + return (2 * 1024) * 1024; +} + + /* Return the default number of stack pages allocate at startup. This default suits Qwaq Forums (specifically general rendering). It is probably a bit high for normal use but QF is profligate with @@ -18739,7 +18764,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -18915,7 +18941,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj2 = (prevObj2 = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address2 = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -20219,7 +20246,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -21685,7 +21713,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -21820,7 +21849,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -23643,6 +23673,7 @@ sqInt i21; sqInt i3; sqInt i4; + sqInt i5; sqInt iLimiT; sqInt iLimiT1; sqInt iLimiT2; @@ -23661,6 +23692,7 @@ sqInt obj2slots; sqInt objOop; sqInt oop; + sqInt oop1; sqInt prev; sqInt prevObj; sqInt prevPrevObj; @@ -23791,9 +23823,9 @@ (GIV(stackPage)->headSP = GIV(stackPointer)); assert(pageListIsWellFormed()); } - for (i11 = 0; i11 < GIV(numStackPages); i11 += 1) { + for (i2 = 0; i2 < GIV(numStackPages); i2 += 1) { /* begin stackPageAt: */ - thePage = stackPageAtpages(i11, GIV(pages)); + thePage = stackPageAtpages(i2, GIV(pages)); (thePage->trace = StackPageUnreached); } /* begin markAndTraceHiddenRoots */ @@ -23807,10 +23839,19 @@ } setIsMarkedOfto(GIV(hiddenRootsObj), 1); markAndTrace(GIV(classTableFirstPage)); - for (i3 = 1; i3 < GIV(numClassTablePages); i3 += 1) { - setIsMarkedOfto(longAt((GIV(hiddenRootsObj) + (BaseHeaderSize)) + (i3 << 2)), 1); + for (i4 = 1; i4 < GIV(numClassTablePages); i4 += 1) { + setIsMarkedOfto(longAt((GIV(hiddenRootsObj) + (BaseHeaderSize)) + (i4 << 2)), 1); } l1: /* end markAndTraceHiddenRoots */; + /* begin markAndTraceExtraRoots */ + assert(GIV(remapBufferCount) == 0); + for (i11 = 1; i11 <= GIV(extraRootCount); i11 += 1) { + oop = (GIV(extraRoots)[i11])[0]; + if (!(((oop & 3) != 0) + || (((longAt(oop)) & 0x3FFFFF) == 0))) { + markAndTrace(oop); + } + } assert(validClassTableRootPages()); /* begin markAndTraceInterpreterOops: */ markAndTraceStackPages(1); @@ -23835,20 +23876,20 @@ if (!(GIV(tempOop) == 0)) { markAndTrace(GIV(tempOop)); } - for (i2 = 1, iLimiT = GIV(remapBufferCount); i2 <= iLimiT; i2 += 1) { - oop = GIV(remapBuffer)[i2]; - if (!((oop & 1))) { - markAndTrace(oop); + for (i3 = 1, iLimiT = GIV(remapBufferCount); i3 <= iLimiT; i3 += 1) { + oop1 = GIV(remapBuffer)[i3]; + if (!((oop1 & 1))) { + markAndTrace(oop1); } } - for (i2 = 1; i2 <= GIV(jmpDepth); i2 += 1) { - oop = GIV(suspendedCallbacks)[i2]; - if (!((oop & 1))) { - markAndTrace(oop); + for (i3 = 1; i3 <= GIV(jmpDepth); i3 += 1) { + oop1 = GIV(suspendedCallbacks)[i3]; + if (!((oop1 & 1))) { + markAndTrace(oop1); } - oop = GIV(suspendedMethods)[i2]; - if (!((oop & 1))) { - markAndTrace(oop); + oop1 = GIV(suspendedMethods)[i3]; + if (!((oop1 & 1))) { + markAndTrace(oop1); } } assert(validObjStacks()); @@ -23882,8 +23923,8 @@ assert(GIV(rememberedSetSize) >= 0); /* begin prepareForGlobalSweep */ sweepIndex = 0; - for (i4 = 0; i4 < GIV(numSegments); i4 += 1) { - ((GIV(segments)[i4]).containsPinned = 0); + for (i5 = 0; i5 < GIV(numSegments); i5 += 1) { + ((GIV(segments)[i5]).containsPinned = 0); } /* begin resetFreeListHeads */ for (i12 = 0, iLimiT2 = (32 - 1); i12 <= iLimiT2; i12 += 1) { @@ -25139,7 +25180,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -25254,6 +25296,7 @@ sqInt obj; sqInt p; sqInt valuePointer; + sqInt valuePointer1;
assert(BaseHeaderSize == (BaseHeaderSize)); initSegmentBridgeWithBytesat(2 * (BaseHeaderSize), GIV(endOfMemory) - (2 * (BaseHeaderSize))); @@ -25303,14 +25346,20 @@ while ((((usqInt) obj)) < (((usqInt) GIV(endOfMemory)))) { if (((longAt(obj)) & 0x3FFFFF) == 0) { /* begin swizzleFieldsOfFreeChunk: */ - for (index = 0, indexLimiT = (((((sqInt) (bytesInObject(obj)) >> 3)) > 32 - ? 4 - : 0)); index <= indexLimiT; index += 1) { - field = longAt((obj + (BaseHeaderSize)) + (index << 2)); - if (field != 0) { - /* begin storePointerNoAssert:ofFreeChunk:withValue: */ - valuePointer = swizzleObj(field); - longAtput((obj + (BaseHeaderSize)) + (index << 2), valuePointer); + field = longAt((obj + (BaseHeaderSize)) + (0 << 2)); + if (field != 0) { + /* begin storePointerNoAssert:ofFreeChunk:withValue: */ + valuePointer = swizzleObj(field); + longAtput((obj + (BaseHeaderSize)) + (0 << 2), valuePointer); + } + if ((((sqInt) (bytesInObject(obj)) >> 3)) >= 32) { + for (index = 2, indexLimiT = 4; index <= indexLimiT; index += 1) { + field = longAt((obj + (BaseHeaderSize)) + (index << 2)); + if (field != 0) { + /* begin storePointerNoAssert:ofFreeChunk:withValue: */ + valuePointer1 = swizzleObj(field); + longAtput((obj + (BaseHeaderSize)) + (index << 2), valuePointer1); + } } } } @@ -27600,7 +27649,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -31169,7 +31219,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -38664,7 +38715,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -41225,7 +41277,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); assert((((stackValue(0)) == (nilObject())) && (GIV(longRunningPrimitiveCheckSemaphore) == null)) @@ -42984,7 +43036,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); assert((((stackValue(0)) == (nilObject())) && (GIV(profileSemaphore) == (nilObject()))) @@ -46933,7 +46985,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -47978,7 +48031,7 @@ /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; - activeContext = voidVMStateForSnapshot(); + activeContext = voidVMStateForSnapshotFlushingExternalPrimitivesIf(0); marryContextInNewStackPageAndInitializeInterpreterRegisters(activeContext); siglongjmp(reenterInterpreter, ReturnToInterpreter); } @@ -48130,7 +48183,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -48677,7 +48731,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -49632,7 +49687,7 @@ /* begin printHexPtrnp: */ /* begin printHexnp: */ printf("0x%x", oopForPointer(longAt((freeChunk + (BaseHeaderSize)) + (0 << 2)))); - if ((((sqInt) numBytes >> 3)) > 32) { + if ((((sqInt) numBytes >> 3)) >= 32) { print(" ^ "); /* begin printHexPtrnp: */ /* begin printHexnp: */ @@ -49650,7 +49705,52 @@ printf("\n"); }
+void +printFreeList(sqInt chunkOrIndex) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt freeChunk; + usqLong numBytes;
+ if ((chunkOrIndex >= 0) + && (chunkOrIndex < 32)) { + printFreeList(GIV(freeLists)[chunkOrIndex]); + return; + } + freeChunk = chunkOrIndex; + while (freeChunk != 0) { + /* begin printFreeChunk: */ + numBytes = bytesInObject(freeChunk); + print("freeChunk "); + /* begin printHexPtrnp: */ + /* begin printHexnp: */ + printf("0x%x", oopForPointer(freeChunk)); + print(" bytes "); + printNum(numBytes); + print(" next "); + /* begin printHexPtrnp: */ + /* begin printHexnp: */ + printf("0x%x", oopForPointer(longAt((freeChunk + (BaseHeaderSize)) + (0 << 2)))); + if ((((sqInt) numBytes >> 3)) >= 32) { + print(" ^ "); + /* begin printHexPtrnp: */ + /* begin printHexnp: */ + printf("0x%x", oopForPointer(longAt((freeChunk + (BaseHeaderSize)) + (2 << 2)))); + print(" < "); + /* begin printHexPtrnp: */ + /* begin printHexnp: */ + printf("0x%x", oopForPointer(longAt((freeChunk + (BaseHeaderSize)) + (3 << 2)))); + print(" > "); + /* begin printHexPtrnp: */ + /* begin printHexnp: */ + printf("0x%x", oopForPointer(longAt((freeChunk + (BaseHeaderSize)) + (4 << 2)))); + } + /* begin cr */ + printf("\n"); + freeChunk = longAt((freeChunk + (BaseHeaderSize)) + (0 << 2)); + } +} + + /* Print n in hex, in the form ' 0x1234', padded to a width of 10 characters in 32-bits ('0x' + 8 nibbles) or 18 characters in 64-bits ('0x' + 16 nibbles) */ @@ -49709,7 +49809,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -50013,7 +50114,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -50756,7 +50858,8 @@ in pastSpace. Objects are allocated in eden. So enumerate only pastSpace and eden. */
prevPrevObj = (prevObj = null); - assert((((pastSpace()).start)) < (((eden()).start))); + assert((bootstrapping()) + || ((((pastSpace()).start)) < (((eden()).start)))); /* begin objectStartingAt: */ address = ((pastSpace()).start); /* begin rawNumSlotsOf: */ @@ -51974,6 +52077,7 @@ assert((newBase - (oldSpaceStart())) == (totalBytesRead - (GIV(numSegments) * (bridgeSize())))); /* begin setFreeOldSpaceStart: */ GIV(freeOldSpaceStart) = newBase; + GIV(firstSegmentSize) = null; return totalBytesRead; }
@@ -52115,7 +52219,7 @@ bytes = (desiredEdenBytes != 0 ? desiredEdenBytes : (hdrEdenBytes == 0 - ? ((2 * 1024) * 1024) + ((((interpreterAllocationReserveBytes()) * 7) + 2) / 7) + ? defaultEdenBytes() : hdrEdenBytes)); edenBytes = bytes; desiredEdenBytes = hdrEdenBytes; @@ -52417,11 +52521,11 @@ cameFrom = -1; do { smallChild = longAt((treeNode1 + (BaseHeaderSize)) + (3 << 2)); - - /* apply if the node has no children, or it has no large children and we're - returning from the small child, or we're returning from the large child. */ - largeChild = longAt((treeNode1 + (BaseHeaderSize)) + (4 << 2));
@@ Diff output truncated at 50000 characters. @@
vm-dev@lists.squeakfoundation.org