diff --git a/platforms/Cross/vm/sq.h b/platforms/Cross/vm/sq.h index 00e436844b..5473513977 100755 --- a/platforms/Cross/vm/sq.h +++ b/platforms/Cross/vm/sq.h @@ -126,7 +126,10 @@ unsigned int ioMicroMSecs(void); * Since all OpenSmalltalk VMs are at least STACKVMs, STACKVM is synonymous * with OpenSmalltalk-VM and Cog VM. */ -/* Time API, Cog uses 64-bit microseconds fron 1901 as much as possible */ + +// Alternate stack zone initialization path, e.g. for threaded VMs +void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *); +// Time API, Cog uses 64-bit microseconds fron 1901 as much as possible void forceInterruptCheckFromHeartbeat(void); void ioInitTime(void); usqLong ioUTCMicrosecondsNow(void); @@ -138,9 +141,9 @@ sqInt ioLocalSecondsOffset(void); void ioUpdateVMTimezone(void); void ioSynchronousCheckForEvents(void); void checkHighPriorityTickees(usqLong); -# if ITIMER_HEARTBEAT /* Hack; allow heartbeat to avoid */ -extern int numAsyncTickees; /* prodHighPriorityThread unless necessary */ -# endif /* see platforms/unix/vm/sqUnixHeartbeat.c */ +# if ITIMER_HEARTBEAT // Hack; allow heartbeat to avoid +extern int numAsyncTickees; // prodHighPriorityThread unless necessary +# endif // see platforms/unix/vm/sqUnixHeartbeat.c void ioGetClockLogSizeUsecsIdxMsecsIdx(sqInt*,void**,sqInt*,void**,sqInt*); void addIdleUsecs(sqInt); @@ -162,7 +165,7 @@ extern void reportMinimumUnusedHeadroomOn(FILE *); extern void ifValidWriteBackStackPointersSaveTo(void *,void *,char **,char **); extern void dumpPrimTraceLog(); extern void dumpPrimTraceLogOn(FILE *); -#endif /* STACKVM */ +#endif // STACKVM extern void printCallStack(void); extern void printCallStackOn(FILE *); extern void printAllStacks(void); @@ -271,7 +274,7 @@ int ioOSThreadsEqual(sqOSThread,sqOSThread); extern sqOSThread ioVMThread; # define getVMOSThread() ioVMThread # endif -#endif /* STACKVM || NewspeakVM */ +#endif // STACKVM || NewspeakVM #if STACKVM /* Event polling via periodic heartbeat thread. */ @@ -279,7 +282,7 @@ void ioInitHeartbeat(void); int ioHeartbeatMilliseconds(void); void ioSetHeartbeatMilliseconds(int); unsigned long ioHeartbeatFrequency(int); -#endif /* STACKVM */ +#endif // STACKVM #if COGMTVM /* COGMTVM is a yet-to-be-released "multi-threaded" VM in the style of Python, @@ -356,7 +359,7 @@ void ioTransferTimeslice(void); # if !defined(ioEventThreadAffinity) # define ioEventThreadAffinity() -1 #endif -#endif /* COGMTVM */ +#endif // COGMTVM /* Profiling. */ void ioControlProfile(int on, void **vhp, long *nvb, void **ehp, long *neb); @@ -641,4 +644,4 @@ sqInt ioFreeModule(void *moduleHandle); /* The Squeak version from which this interpreter was generated. */ extern const char *interpreterVersion; -#endif /* _SQ_H */ +#endif // _SQ_H diff --git a/platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m b/platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m index 2c54963dbb..ebca875224 100644 --- a/platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m +++ b/platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m @@ -250,8 +250,8 @@ Some of this code was funded via a grant from the European Smalltalk User Group " x16 %14p x17 %14p x18 %14p x19 %14p\n" " x20 %14p x21 %14p x22 %14p x23 %14p\n" " x24 %14p x25 %14p x26 %14p x27 %14p\n" - " x29 %14p fp %14p lr %14p sp %14p\n", - " cpsr 0x%08x\n", + " x28 %14p fp %14p lr %14p sp %14p\n", + " pc %14p cpsr 0x%08x\n", vr( __x[0]), vr( __x[1]), vr( __x[2]), vr( __x[3]), vr( __x[4]), vr( __x[5]), vr( __x[6]), vr( __x[7]), vr( __x[8]), vr( __x[9]), vr(__x[10]), vr(__x[11]), diff --git a/src/plugins/B2DPlugin/B2DPlugin.c b/src/plugins/B2DPlugin/B2DPlugin.c index 7c3aa7775c..7161d47786 100644 --- a/src/plugins/B2DPlugin/B2DPlugin.c +++ b/src/plugins/B2DPlugin/B2DPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.3228 uuid: 02cd75d5-0049-4b27-a5b9-3451af576384 + VMPluginCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - BalloonEnginePlugin VMMaker.oscog-eem.3228 uuid: 02cd75d5-0049-4b27-a5b9-3451af576384 + BalloonEnginePlugin VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.3228 uuid: 02cd75d5-0049-4b27-a5b9-3451af576384 " __DATE__ ; +static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; #include "config.h" @@ -838,7 +838,7 @@ extern #endif struct VirtualMachine* interpreterProxy; static void * loadBBFn; -static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.3228 " INT_EXT; +static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.3380 " INT_EXT; static int* objBuffer; static sqInt objUsed; static unsigned int* spanBuffer; @@ -2471,7 +2471,6 @@ computeBeziersplitAt(sqInt index, double param) goto l1; } } - /* leftViaY = */ leftViaY; l1: /* end assureValue:between:and: */; /* begin assureValue:between:and: */ if (sharedY > endY) { @@ -2494,7 +2493,6 @@ computeBeziersplitAt(sqInt index, double param) goto l2; } } - /* rightViaY = */ rightViaY; l2: /* end assureValue:between:and: */; /* begin allocateBezierStackEntry */ if (!(needAvailableSpace(6))) { @@ -3219,7 +3217,6 @@ fillBitmapSpanAAfromtoat(sqInt bmFill, sqInt leftX, sqInt rightX, sqInt yValue) goto l1; } else { - /* xp = */ xp; goto l1; } } @@ -3235,7 +3232,6 @@ fillBitmapSpanAAfromtoat(sqInt bmFill, sqInt leftX, sqInt rightX, sqInt yValue) goto l2; } else { - /* yp = */ yp; goto l2; } } @@ -3340,7 +3336,6 @@ fillBitmapSpanAAfromtoat(sqInt bmFill, sqInt leftX, sqInt rightX, sqInt yValue) goto l3; } else { - /* xp = */ xp; goto l3; } } @@ -3356,7 +3351,6 @@ fillBitmapSpanAAfromtoat(sqInt bmFill, sqInt leftX, sqInt rightX, sqInt yValue) goto l4; } else { - /* yp = */ yp; goto l4; } } @@ -3462,7 +3456,6 @@ fillBitmapSpanAAfromtoat(sqInt bmFill, sqInt leftX, sqInt rightX, sqInt yValue) goto l5; } else { - /* xp = */ xp; goto l5; } } @@ -3478,7 +3471,6 @@ fillBitmapSpanAAfromtoat(sqInt bmFill, sqInt leftX, sqInt rightX, sqInt yValue) goto l6; } else { - /* yp = */ yp; goto l6; } } @@ -3697,7 +3689,6 @@ fillBitmapSpanfromtoat(sqInt bmFill, sqInt leftX, sqInt rightX, sqInt yValue) goto l1; } else { - /* xp = */ xp; goto l1; } } @@ -3713,7 +3704,6 @@ fillBitmapSpanfromtoat(sqInt bmFill, sqInt leftX, sqInt rightX, sqInt yValue) goto l2; } else { - /* yp = */ yp; goto l2; } } diff --git a/src/plugins/BitBltPlugin/BitBltPlugin.c b/src/plugins/BitBltPlugin/BitBltPlugin.c index 30bfd7726c..d203ef90a5 100644 --- a/src/plugins/BitBltPlugin/BitBltPlugin.c +++ b/src/plugins/BitBltPlugin/BitBltPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3313 uuid: eec7f9f2-1dea-4660-bacc-8f63d29beb2e + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - BitBltSimulation VMMaker.oscog-eem.3313 uuid: eec7f9f2-1dea-4660-bacc-8f63d29beb2e + BitBltSimulation VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.3313 uuid: eec7f9f2-1dea-4660-bacc-8f63d29beb2e " __DATE__ ; +static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; #include "config.h" @@ -364,7 +364,7 @@ static int maskTable[33] = { 0, 1, 3, 0, 15, 31, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 65535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1 }; -static const char *moduleName = "BitBltPlugin VMMaker.oscog-eem.3313 " INT_EXT; +static const char *moduleName = "BitBltPlugin VMMaker.oscog-eem.3380 " INT_EXT; static sqInt noHalftone; static sqInt noSource; static sqInt numGCsOnInvocation; @@ -4700,11 +4700,9 @@ partitionedRgbComponentAlphadestnBitsnPartitions(unsigned int sourceWord, unsign v = v & 0xFFFFFF; goto l1; } - /* v = */ v; goto l1; } if (v == 0) { - /* v = */ v; goto l1; } d = 32 - nBits; @@ -6537,11 +6535,9 @@ rgbComponentAlphawith(sqInt sourceWord, sqInt destinationWord) v = v & 0xFFFFFF; goto l1; } - /* v = */ v; goto l1; } if (v == 0) { - /* v = */ v; goto l1; } d = 32 - destDepth; @@ -8184,7 +8180,6 @@ warpPickSmoothPixelsxDeltahyDeltahxDeltavyDeltavsourceMapsmoothingdstShiftInc(sq } else { /* begin rgbMap32To32: */ - /* rgb = */ rgb; } } b += rgb & 0xFF; diff --git a/src/plugins/FilePlugin/FilePlugin.c b/src/plugins/FilePlugin/FilePlugin.c index 3d68b0f949..a5026b5731 100644 --- a/src/plugins/FilePlugin/FilePlugin.c +++ b/src/plugins/FilePlugin/FilePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.3371 uuid: caae1504-f28c-4fb4-92c6-fd8c7feb1941 + VMPluginCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - FilePlugin VMMaker.oscog-eem.3371 uuid: caae1504-f28c-4fb4-92c6-fd8c7feb1941 + FilePlugin VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.3371 uuid: caae1504-f28c-4fb4-92c6-fd8c7feb1941 " __DATE__ ; +static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; #include "config.h" @@ -208,7 +208,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "FilePlugin VMMaker.oscog-eem.3371 " INT_EXT; +static const char *moduleName = "FilePlugin VMMaker.oscog-eem.3380 " INT_EXT; static void * sCCPfn; static void * sCDFfn; static void * sCDPfn; @@ -759,6 +759,12 @@ primitiveDirectoryEntry(void) sqInt status; sqInt symlinkFlag; + createDate = 0; + dirFlag = 0; + entryNameSize = 0; + modifiedDate = 0; + posixPermissions = 0; + symlinkFlag = 0; requestedName = stackValue(0); pathName = stackValue(1); if (!(isBytes(pathName))) { @@ -883,6 +889,12 @@ primitiveDirectoryLookup(void) sqInt status; sqInt symlinkFlag; + createDate = 0; + dirFlag = 0; + entryNameSize = 0; + modifiedDate = 0; + posixPermissions = 0; + symlinkFlag = 0; index = stackIntegerValue(0); pathName = stackValue(1); if (!(isBytes(pathName))) { diff --git a/src/plugins/ScratchPlugin/ScratchPlugin.c b/src/plugins/ScratchPlugin/ScratchPlugin.c index 7227c8abeb..f521b448e2 100644 --- a/src/plugins/ScratchPlugin/ScratchPlugin.c +++ b/src/plugins/ScratchPlugin/ScratchPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.3228 uuid: 02cd75d5-0049-4b27-a5b9-3451af576384 + VMPluginCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - ScratchPlugin VMMaker.oscog-eem.3228 uuid: 02cd75d5-0049-4b27-a5b9-3451af576384 + ScratchPlugin VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "ScratchPlugin VMMaker.oscog-eem.3228 uuid: 02cd75d5-0049-4b27-a5b9-3451af576384 " __DATE__ ; +static char __buildInfo[] = "ScratchPlugin VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; #include "config.h" @@ -115,7 +115,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "ScratchPlugin VMMaker.oscog-eem.3228 " INT_EXT; +static const char *moduleName = "ScratchPlugin VMMaker.oscog-eem.3380 " INT_EXT; /* ScratchPlugin>>#bitmap:at:putH:s:v: */ @@ -317,7 +317,6 @@ interpolatedFromxywidthheight(unsigned int *bitmap, sqInt xFixed, sqInt yFixed, goto l1; } if (((bitmap[index + 1]) & 0xFFFFFF) == 0) { - /* topPix = */ topPix; goto l1; } frac1 = 0x400 - xFrac; @@ -345,7 +344,6 @@ interpolatedFromxywidthheight(unsigned int *bitmap, sqInt xFixed, sqInt yFixed, goto l2; } if (((bitmap[index + 1]) & 0xFFFFFF) == 0) { - /* bottomPix = */ bottomPix; goto l2; } frac11 = 0x400 - xFrac; @@ -989,7 +987,6 @@ primitiveFisheye(void) goto l3; } if (((in[index + 1]) & 0xFFFFFF) == 0) { - /* topPix = */ topPix; goto l3; } frac1 = 0x400 - xFrac; @@ -1018,7 +1015,6 @@ primitiveFisheye(void) goto l4; } if (((in[index + 1]) & 0xFFFFFF) == 0) { - /* bottomPix = */ bottomPix; goto l4; } frac11 = 0x400 - xFrac; @@ -1528,7 +1524,6 @@ primitiveInterpolate(void) goto l3; } if (((in[index + 1]) & 0xFFFFFF) == 0) { - /* topPix = */ topPix; goto l3; } frac1 = 0x400 - xFrac; @@ -1557,7 +1552,6 @@ primitiveInterpolate(void) goto l2; } if (((in[index + 1]) & 0xFFFFFF) == 0) { - /* bottomPix = */ bottomPix; goto l2; } frac11 = 0x400 - xFrac; @@ -2400,7 +2394,6 @@ primitiveWhirl(void) goto l3; } if (((in[index + 1]) & 0xFFFFFF) == 0) { - /* topPix = */ topPix; goto l3; } frac1 = 0x400 - xFrac; @@ -2429,7 +2422,6 @@ primitiveWhirl(void) goto l4; } if (((in[index + 1]) & 0xFFFFFF) == 0) { - /* bottomPix = */ bottomPix; goto l4; } frac11 = 0x400 - xFrac; diff --git a/src/spur32.cog.lowcode/_variable_order b/src/spur32.cog.lowcode/_variable_order index 8afae68358..092aaf7663 100644 --- a/src/spur32.cog.lowcode/_variable_order +++ b/src/spur32.cog.lowcode/_variable_order @@ -1,5 +1,3 @@ -_vmOwner -_stackLimitFromMachineCode _stackLimit _stackPointer _framePointer @@ -17,7 +15,6 @@ _newMethod _instructionPointer _argumentCount _nextProfileTick -_nativeSP _nativeStackPointer _shadowCallStackPointer _primTraceLog diff --git a/src/spur32.cog.lowcode/cogit.h b/src/spur32.cog.lowcode/cogit.h index 9d554f0c72..b00f94eaaa 100644 --- a/src/spur32.cog.lowcode/cogit.h +++ b/src/spur32.cog.lowcode/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur32.cog.lowcode/cogitARMv5.c b/src/spur32.cog.lowcode/cogitARMv5.c index bfcf0a80d4..f9c445dafa 100644 --- a/src/spur32.cog.lowcode/cogitARMv5.c +++ b/src/spur32.cog.lowcode/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -8606,7 +8606,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -10195,7 +10194,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -11548,7 +11546,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -14935,7 +14932,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -16750,8 +16746,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -29005,7 +29001,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -30001,7 +29997,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -46446,7 +46441,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur32.cog.lowcode/cogitIA32.c b/src/spur32.cog.lowcode/cogitIA32.c index cf170b1020..d9feffc6b6 100644 --- a/src/spur32.cog.lowcode/cogitIA32.c +++ b/src/spur32.cog.lowcode/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -8238,7 +8238,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -9807,7 +9806,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -11289,7 +11287,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -14522,7 +14519,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -16328,8 +16324,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -26453,7 +26449,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -27447,7 +27443,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -43016,7 +43011,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur32.cog.lowcode/cointerp.c b/src/spur32.cog.lowcode/cointerp.c index 23e5f7013d..890b5c8804 100644 --- a/src/spur32.cog.lowcode/cointerp.c +++ b/src/spur32.cog.lowcode/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -405,10 +405,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1456,7 +1456,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1518,6 +1518,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1823,9 +1824,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2701,7 +2702,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2859,20 +2860,21 @@ interpret(void) char * nativeSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; extA = 0; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -31016,7 +31018,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -31024,10 +31026,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -31035,6 +31037,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -31046,12 +31049,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -31063,16 +31065,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -31082,6 +31084,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -31098,12 +31101,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -31112,6 +31115,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -39015,7 +39019,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - usqInt numTemps; + sqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -39827,7 +39831,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -50625,7 +50630,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -56963,7 +56968,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -56980,7 +56984,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -62867,7 +62870,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -68143,7 +68145,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -75605,7 +75606,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -77088,7 +77089,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -79418,7 +79418,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -79987,7 +79987,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -82089,11 +82088,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -84408,6 +84412,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples diff --git a/src/spur32.cog.lowcode/cointerp.h b/src/spur32.cog.lowcode/cointerp.h index fe2933951f..b9543ca722 100644 --- a/src/spur32.cog.lowcode/cointerp.h +++ b/src/spur32.cog.lowcode/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur32.cog.lowcode/gcc3x-cointerp.c b/src/spur32.cog.lowcode/gcc3x-cointerp.c index 7cc33ff01f..2f04558aec 100644 --- a/src/spur32.cog.lowcode/gcc3x-cointerp.c +++ b/src/spur32.cog.lowcode/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -408,10 +408,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1459,7 +1459,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1521,6 +1521,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1826,9 +1827,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2704,7 +2705,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2862,8 +2863,8 @@ interpret(void) char * nativeSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2875,13 +2876,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -31025,7 +31027,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -31033,10 +31035,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -31044,6 +31046,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -31055,12 +31058,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -31072,16 +31074,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -31091,6 +31093,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -31107,12 +31110,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -31121,6 +31124,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -39024,7 +39028,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - usqInt numTemps; + sqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -39836,7 +39840,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -50634,7 +50639,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -56972,7 +56977,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -56989,7 +56993,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -62876,7 +62879,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -68152,7 +68154,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -75614,7 +75615,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -77097,7 +77098,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -79427,7 +79427,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -79996,7 +79996,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -82098,11 +82097,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -84417,6 +84421,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples diff --git a/src/spur32.cog.lowcode/variable_order b/src/spur32.cog.lowcode/variable_order index 288ee540ab..007e8e785a 100644 --- a/src/spur32.cog.lowcode/variable_order +++ b/src/spur32.cog.lowcode/variable_order @@ -1,5 +1,3 @@ -vmOwner -stackLimitFromMachineCode stackLimit stackPointer framePointer @@ -17,7 +15,6 @@ newMethod instructionPointer argumentCount nextProfileTick -nativeSP nativeStackPointer shadowCallStackPointer primTraceLog diff --git a/src/spur32.cog/_variable_order b/src/spur32.cog/_variable_order index 8afae68358..a142fd684b 100644 --- a/src/spur32.cog/_variable_order +++ b/src/spur32.cog/_variable_order @@ -1,5 +1,3 @@ -_vmOwner -_stackLimitFromMachineCode _stackLimit _stackPointer _framePointer @@ -17,7 +15,4 @@ _newMethod _instructionPointer _argumentCount _nextProfileTick -_nativeSP -_nativeStackPointer -_shadowCallStackPointer _primTraceLog diff --git a/src/spur32.cog/cogit.h b/src/spur32.cog/cogit.h index 1d23d75dd9..ba735c36be 100644 --- a/src/spur32.cog/cogit.h +++ b/src/spur32.cog/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur32.cog/cogitARMv5.c b/src/spur32.cog/cogitARMv5.c index d56058bf37..75bbd8c2e8 100644 --- a/src/spur32.cog/cogitARMv5.c +++ b/src/spur32.cog/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -8412,7 +8412,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -10001,7 +10000,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -11094,7 +11092,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -14311,7 +14308,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -16123,8 +16119,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -26807,7 +26803,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -27743,7 +27739,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -33093,7 +33088,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur32.cog/cogitIA32.c b/src/spur32.cog/cogitIA32.c index a24cd4e79e..e8008c766a 100644 --- a/src/spur32.cog/cogitIA32.c +++ b/src/spur32.cog/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -8038,7 +8038,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -9607,7 +9606,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -10703,7 +10701,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -13750,7 +13747,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -15553,8 +15549,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -24293,7 +24289,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -25242,7 +25238,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -30375,7 +30370,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur32.cog/cointerp.c b/src/spur32.cog/cointerp.c index 4382c21766..4a848b97b5 100644 --- a/src/spur32.cog/cointerp.c +++ b/src/spur32.cog/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -402,10 +402,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1439,7 +1439,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1499,6 +1499,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1798,9 +1799,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2002,7 +2003,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 584 */] = { /*78*/ 0, 0, /*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256, 0,-256, /*98*/ 0, 0, -/*100*/ 260, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, +/*100*/ 260, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, /*115*/ 0x100, 0, 12, 260, 0, /*120*/ 524, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256, /*139*/ 0, @@ -2676,7 +2677,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2832,19 +2833,20 @@ interpret(void) char * localSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11228,7 +11230,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11236,10 +11238,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11247,6 +11249,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11258,12 +11261,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11275,16 +11277,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11294,6 +11296,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11310,12 +11313,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11324,6 +11327,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -17911,7 +17915,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -17960,7 +17964,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -17978,7 +17982,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -19945,7 +19949,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -30723,7 +30728,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -37061,7 +37066,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -37078,7 +37082,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -42934,7 +42937,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -48210,7 +48212,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -55624,7 +55625,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -57097,7 +57098,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -59352,7 +59352,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(obj))); contextSize = (sp >> 1); l6: /* end fetchStackPointerOf: */; - numPointerSlots = CtxtTempFrameStart + contextSize; + numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); goto l10; } /* begin numSlotsOf: */ @@ -59382,7 +59382,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((header & 1)); numLiterals = ((header >> 1)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = numLiterals + LiteralStart; + numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -59427,7 +59427,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -59934,7 +59934,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - sqInt node; + usqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -59996,7 +59996,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -62098,11 +62097,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -64403,6 +64407,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -65983,7 +66020,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -66027,7 +66064,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -66045,7 +66082,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur32.cog/cointerp.h b/src/spur32.cog/cointerp.h index b399c45100..a768cf4169 100644 --- a/src/spur32.cog/cointerp.h +++ b/src/spur32.cog/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur32.cog/cointerpmt.c b/src/spur32.cog/cointerpmt.c index d01c85ec75..f7378b173e 100644 --- a/src/spur32.cog/cointerpmt.c +++ b/src/spur32.cog/cointerpmt.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreterMT VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreterMT VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -452,10 +452,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1538,7 +1538,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1598,6 +1598,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1846,7 +1847,6 @@ static struct foo { #else # define _iss static #endif -_iss volatile atomic_int vmOwner; _iss char * stackLimit; _iss char * stackPointer; _iss char * framePointer; @@ -1894,10 +1894,10 @@ _iss sqInt * rememberedSet; _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss sqInt numThreads; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2068,6 +2068,7 @@ _iss usqLong statIGCDeltaUsecs; _iss usqLong byteCount; _iss usqLong statFGCDeltaUsecs; _iss usqLong statIncrGCUsecs; +_iss volatile atomic_int vmOwner; _iss SpurContiguousObjStack savedFirstFieldsSpace; _iss SpurContiguousObjStack unscannedEphemerons; _iss SpurNewSpaceSpace pastSpace; @@ -2791,7 +2792,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2953,19 +2954,20 @@ interpret(void) char * localSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11349,7 +11351,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11357,10 +11359,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11368,6 +11370,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11379,12 +11382,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11396,16 +11398,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11415,6 +11417,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11431,12 +11434,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11445,6 +11448,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -18487,7 +18491,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -18536,7 +18540,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -18554,7 +18558,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -19714,7 +19718,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -20530,7 +20534,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -23192,7 +23197,6 @@ ownVM(void *vmThreadHandle) } } atomic_store((&((vmThread->state))), CTMAssignableOrInVM); - /* vmThread = */ vmThread; disownCount -= 1; if (((flags & DisownVMForProcessorRelinquish) != 0)) { @@ -34278,7 +34282,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -40483,7 +40487,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -40500,7 +40503,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -46369,7 +46371,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -51645,7 +51646,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -59077,7 +59077,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -60550,7 +60550,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -62805,7 +62804,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(obj))); contextSize = (sp >> 1); l6: /* end fetchStackPointerOf: */; - numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); + numPointerSlots = CtxtTempFrameStart + contextSize; goto l10; } /* begin numSlotsOf: */ @@ -62835,7 +62834,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((header & 1)); numLiterals = ((header >> 1)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); + numPointerSlots = numLiterals + LiteralStart; l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -62880,7 +62879,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -63449,7 +63448,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -65451,11 +65449,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -67756,6 +67759,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -69306,7 +69342,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -69350,7 +69386,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -69368,7 +69404,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur32.cog/cointerpmt.h b/src/spur32.cog/cointerpmt.h index d519338d54..3f116beb0b 100644 --- a/src/spur32.cog/cointerpmt.h +++ b/src/spur32.cog/cointerpmt.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur32.cog/gcc3x-cointerp.c b/src/spur32.cog/gcc3x-cointerp.c index 2db4002c2e..feced522fc 100644 --- a/src/spur32.cog/gcc3x-cointerp.c +++ b/src/spur32.cog/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -405,10 +405,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1442,7 +1442,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1502,6 +1502,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1801,9 +1802,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2005,7 +2006,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 584 */] = { /*78*/ 0, 0, /*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256, 0,-256, /*98*/ 0, 0, -/*100*/ 260, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, +/*100*/ 260, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, /*115*/ 0x100, 0, 12, 260, 0, /*120*/ 524, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256, /*139*/ 0, @@ -2679,7 +2680,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2835,8 +2836,8 @@ interpret(void) register char* localSP SP_REG; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2847,13 +2848,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11237,7 +11239,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11245,10 +11247,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11256,6 +11258,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11267,12 +11270,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11284,16 +11286,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11303,6 +11305,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11319,12 +11322,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11333,6 +11336,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -17920,7 +17924,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -17969,7 +17973,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -17987,7 +17991,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -19954,7 +19958,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -30732,7 +30737,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -37070,7 +37075,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -37087,7 +37091,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -42943,7 +42946,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -48219,7 +48221,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -55633,7 +55634,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -57106,7 +57107,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -59361,7 +59361,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(obj))); contextSize = (sp >> 1); l6: /* end fetchStackPointerOf: */; - numPointerSlots = CtxtTempFrameStart + contextSize; + numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); goto l10; } /* begin numSlotsOf: */ @@ -59391,7 +59391,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((header & 1)); numLiterals = ((header >> 1)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = numLiterals + LiteralStart; + numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -59436,7 +59436,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -59943,7 +59943,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - sqInt node; + usqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -60005,7 +60005,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -62107,11 +62106,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -64412,6 +64416,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -65992,7 +66029,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -66036,7 +66073,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -66054,7 +66091,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur32.cog/gcc3x-cointerpmt.c b/src/spur32.cog/gcc3x-cointerpmt.c index ed86614f8b..188eb3e6aa 100644 --- a/src/spur32.cog/gcc3x-cointerpmt.c +++ b/src/spur32.cog/gcc3x-cointerpmt.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreterMT VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreterMT VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -455,10 +455,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1541,7 +1541,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1601,6 +1601,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1849,7 +1850,6 @@ static struct foo { #else # define _iss static #endif -_iss volatile atomic_int vmOwner; _iss char * stackLimit; _iss char * stackPointer; _iss char * framePointer; @@ -1897,10 +1897,10 @@ _iss sqInt * rememberedSet; _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss sqInt numThreads; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2071,6 +2071,7 @@ _iss usqLong statIGCDeltaUsecs; _iss usqLong byteCount; _iss usqLong statFGCDeltaUsecs; _iss usqLong statIncrGCUsecs; +_iss volatile atomic_int vmOwner; _iss SpurContiguousObjStack savedFirstFieldsSpace; _iss SpurContiguousObjStack unscannedEphemerons; _iss SpurNewSpaceSpace pastSpace; @@ -2794,7 +2795,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2956,8 +2957,8 @@ interpret(void) register char* localSP SP_REG; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2968,13 +2969,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11358,7 +11360,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11366,10 +11368,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11377,6 +11379,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11388,12 +11391,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11405,16 +11407,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11424,6 +11426,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11440,12 +11443,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11454,6 +11457,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -18496,7 +18500,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -18545,7 +18549,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -18563,7 +18567,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -19723,7 +19727,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -20539,7 +20543,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -23201,7 +23206,6 @@ ownVM(void *vmThreadHandle) } } atomic_store((&((vmThread->state))), CTMAssignableOrInVM); - /* vmThread = */ vmThread; disownCount -= 1; if (((flags & DisownVMForProcessorRelinquish) != 0)) { @@ -34287,7 +34291,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -40492,7 +40496,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -40509,7 +40512,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -46378,7 +46380,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -51654,7 +51655,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -59086,7 +59086,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -60559,7 +60559,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -62814,7 +62813,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(obj))); contextSize = (sp >> 1); l6: /* end fetchStackPointerOf: */; - numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); + numPointerSlots = CtxtTempFrameStart + contextSize; goto l10; } /* begin numSlotsOf: */ @@ -62844,7 +62843,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((header & 1)); numLiterals = ((header >> 1)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); + numPointerSlots = numLiterals + LiteralStart; l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -62889,7 +62888,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -63458,7 +63457,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -65460,11 +65458,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -67765,6 +67768,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -69315,7 +69351,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -69359,7 +69395,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -69377,7 +69413,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur32.cog/variable_order b/src/spur32.cog/variable_order index 288ee540ab..c3f2c2e8d7 100644 --- a/src/spur32.cog/variable_order +++ b/src/spur32.cog/variable_order @@ -1,5 +1,3 @@ -vmOwner -stackLimitFromMachineCode stackLimit stackPointer framePointer @@ -17,7 +15,4 @@ newMethod instructionPointer argumentCount nextProfileTick -nativeSP -nativeStackPointer -shadowCallStackPointer primTraceLog diff --git a/src/spur32.sista/_variable_order b/src/spur32.sista/_variable_order index 8afae68358..a142fd684b 100644 --- a/src/spur32.sista/_variable_order +++ b/src/spur32.sista/_variable_order @@ -1,5 +1,3 @@ -_vmOwner -_stackLimitFromMachineCode _stackLimit _stackPointer _framePointer @@ -17,7 +15,4 @@ _newMethod _instructionPointer _argumentCount _nextProfileTick -_nativeSP -_nativeStackPointer -_shadowCallStackPointer _primTraceLog diff --git a/src/spur32.sista/cogit.h b/src/spur32.sista/cogit.h index 24ddb6cff9..2dcd2c1bed 100644 --- a/src/spur32.sista/cogit.h +++ b/src/spur32.sista/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur32.sista/cogitARMv5.c b/src/spur32.sista/cogitARMv5.c index 744609eaae..7e4b8916b0 100644 --- a/src/spur32.sista/cogitARMv5.c +++ b/src/spur32.sista/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -16306,8 +16306,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -27812,7 +27812,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ diff --git a/src/spur32.sista/cogitIA32.c b/src/spur32.sista/cogitIA32.c index a3b651c0ed..cac762551c 100644 --- a/src/spur32.sista/cogitIA32.c +++ b/src/spur32.sista/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -15725,8 +15725,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -25204,7 +25204,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ diff --git a/src/spur32.sista/cointerp.c b/src/spur32.sista/cointerp.c index e5959a08ff..71f3982aff 100644 --- a/src/spur32.sista/cointerp.c +++ b/src/spur32.sista/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -404,10 +404,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1454,7 +1454,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1514,6 +1514,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1814,9 +1815,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2692,7 +2693,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2848,19 +2849,20 @@ interpret(void) char * localSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -13906,7 +13908,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -13914,10 +13916,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -13925,6 +13927,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -13936,12 +13939,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -13953,16 +13955,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -13972,6 +13974,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -13988,12 +13991,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -14002,6 +14005,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -20802,7 +20806,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -20851,7 +20855,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -20869,7 +20873,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -22837,7 +22841,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -33724,7 +33729,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -40062,7 +40067,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -40079,7 +40083,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -45966,7 +45969,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -51242,7 +51244,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -58704,7 +58705,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -60187,7 +60188,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -62517,7 +62517,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -63024,7 +63024,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - usqInt node; + sqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -63086,7 +63086,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -65188,11 +65187,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -67493,6 +67497,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -69094,7 +69131,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -69138,7 +69175,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -69156,7 +69193,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur32.sista/cointerp.h b/src/spur32.sista/cointerp.h index 7cad30998b..d3abbc637c 100644 --- a/src/spur32.sista/cointerp.h +++ b/src/spur32.sista/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur32.sista/gcc3x-cointerp.c b/src/spur32.sista/gcc3x-cointerp.c index 96af7e5ae7..215b28d06d 100644 --- a/src/spur32.sista/gcc3x-cointerp.c +++ b/src/spur32.sista/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -407,10 +407,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1457,7 +1457,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1517,6 +1517,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1817,9 +1818,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2695,7 +2696,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2851,8 +2852,8 @@ interpret(void) register char* localSP SP_REG; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2863,13 +2864,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -13915,7 +13917,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -13923,10 +13925,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -13934,6 +13936,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -13945,12 +13948,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -13962,16 +13964,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -13981,6 +13983,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -13997,12 +14000,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -14011,6 +14014,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -20811,7 +20815,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -20860,7 +20864,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -20878,7 +20882,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -22846,7 +22850,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -33733,7 +33738,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -40071,7 +40076,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -40088,7 +40092,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -45975,7 +45978,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -51251,7 +51253,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -58713,7 +58714,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -60196,7 +60197,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -62526,7 +62526,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -63033,7 +63033,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - usqInt node; + sqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -63095,7 +63095,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -65197,11 +65196,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -67502,6 +67506,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -69103,7 +69140,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -69147,7 +69184,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -69165,7 +69202,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur32.sista/variable_order b/src/spur32.sista/variable_order index 288ee540ab..c3f2c2e8d7 100644 --- a/src/spur32.sista/variable_order +++ b/src/spur32.sista/variable_order @@ -1,5 +1,3 @@ -vmOwner -stackLimitFromMachineCode stackLimit stackPointer framePointer @@ -17,7 +15,4 @@ newMethod instructionPointer argumentCount nextProfileTick -nativeSP -nativeStackPointer -shadowCallStackPointer primTraceLog diff --git a/src/spur32.stack.lowcode/gcc3x-interp.c b/src/spur32.stack.lowcode/gcc3x-interp.c index c3c920d7a0..9f4c551744 100644 --- a/src/spur32.stack.lowcode/gcc3x-interp.c +++ b/src/spur32.stack.lowcode/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -346,10 +346,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -598,7 +598,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static usqInt NoDbgRegParms addressAfter(sqInt objOop); static sqInt NoDbgRegParms allocateSlotsForPinningInOldSpacebytesformatclassIndex(sqInt numSlots, usqInt totalBytes, sqInt formatField, sqInt classIndex); @@ -1137,7 +1137,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); @@ -1212,6 +1212,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -1746,7 +1747,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 584 */] /*40*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, /*60*/ 0, 0, 0, 0, 0,-1,-1,-1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, /*80*/ -1,-1,-1, 0, 0, 0, 1, 0, 2,-1,-1, 0, 0, 0, 1,-1, 0,-1, 0, 0, -/*100*/ 1, 2, 1, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, +/*100*/ 1, 2, 2, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, /*120*/ 2, 1,-1,-1, 0, 0, 0, 0, 0,-1,-1,-1, 0, 0, 0,-1, 0,-1,-1, 0, /*140*/ -1, 1,-1, 1, 1, 1,-1,-1, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1, 1, 1, /*160*/ 0, 0,-1, 0, 0, 1, 1,-1, 1, 0, 0, 0,-1, 1, 1, 0,-1, 0,-1,-1, @@ -2387,7 +2388,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2506,7 +2507,7 @@ interpret(void) char * nativeSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; JUMP_TABLE; @@ -2519,12 +2520,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -23985,7 +23988,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -23993,10 +23996,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -24004,6 +24007,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -24015,12 +24019,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -24032,16 +24035,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -24051,6 +24054,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -24067,12 +24071,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -24081,6 +24085,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -30506,7 +30511,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -37326,7 +37331,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -37343,7 +37347,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -38579,7 +38582,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -38652,7 +38655,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -43059,7 +43061,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -48410,7 +48411,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -55799,7 +55799,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -57232,7 +57232,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -59532,7 +59531,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -60101,7 +60100,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -62512,11 +62510,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -64937,6 +64940,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -69492,7 +69528,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -71670,7 +71706,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), diff --git a/src/spur32.stack.lowcode/interp.c b/src/spur32.stack.lowcode/interp.c index ba8fa78d87..b2627e4370 100644 --- a/src/spur32.stack.lowcode/interp.c +++ b/src/spur32.stack.lowcode/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -343,10 +343,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -595,7 +595,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static usqInt NoDbgRegParms addressAfter(sqInt objOop); static sqInt NoDbgRegParms allocateSlotsForPinningInOldSpacebytesformatclassIndex(sqInt numSlots, usqInt totalBytes, sqInt formatField, sqInt classIndex); @@ -1134,7 +1134,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); @@ -1209,6 +1209,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -1743,7 +1744,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 584 */] /*40*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, /*60*/ 0, 0, 0, 0, 0,-1,-1,-1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, /*80*/ -1,-1,-1, 0, 0, 0, 1, 0, 2,-1,-1, 0, 0, 0, 1,-1, 0,-1, 0, 0, -/*100*/ 1, 2, 1, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, +/*100*/ 1, 2, 2, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, /*120*/ 2, 1,-1,-1, 0, 0, 0, 0, 0,-1,-1,-1, 0, 0, 0,-1, 0,-1,-1, 0, /*140*/ -1, 1,-1, 1, 1, 1,-1,-1, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1, 1, 1, /*160*/ 0, 0,-1, 0, 0, 1, 1,-1, 1, 0, 0, 0,-1, 1, 1, 0,-1, 0,-1,-1, @@ -2384,7 +2385,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2503,19 +2504,21 @@ interpret(void) char * nativeSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; extA = 0; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -23976,7 +23979,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -23984,10 +23987,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -23995,6 +23998,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -24006,12 +24010,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -24023,16 +24026,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -24042,6 +24045,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -24058,12 +24062,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -24072,6 +24076,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -30497,7 +30502,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -37317,7 +37322,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -37334,7 +37338,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -38570,7 +38573,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -38643,7 +38646,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -43050,7 +43052,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -48401,7 +48402,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -55790,7 +55790,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -57223,7 +57223,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -59523,7 +59522,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -60092,7 +60091,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -62503,11 +62501,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -64928,6 +64931,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -69483,7 +69519,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -71661,7 +71697,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), diff --git a/src/spur32.stack/gcc3x-interp.c b/src/spur32.stack/gcc3x-interp.c index 47c804adbf..3c6a645010 100644 --- a/src/spur32.stack/gcc3x-interp.c +++ b/src/spur32.stack/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -343,10 +343,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -595,7 +595,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static usqInt NoDbgRegParms addressAfter(sqInt objOop); static sqInt NoDbgRegParms allocateSlotsForPinningInOldSpacebytesformatclassIndex(sqInt numSlots, usqInt totalBytes, sqInt formatField, sqInt classIndex); @@ -1127,7 +1127,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); @@ -1200,6 +1200,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -1511,8 +1512,8 @@ _iss sqInt trueObj; _iss sqInt falseObj; _iss SpurSegmentInfo * segments; _iss sqInt hiddenRootsObj; -_iss usqInt scavengeThreshold; _iss StackPage * pages; +_iss usqInt scavengeThreshold; _iss sqInt numSegments; _iss sqInt * freeLists; _iss char * stackMemory; @@ -2361,7 +2362,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2478,7 +2479,7 @@ interpret(void) register char* localSP SP_REG; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; JUMP_TABLE; @@ -2490,12 +2491,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -10989,7 +10992,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -10997,10 +11000,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11008,6 +11011,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11019,12 +11023,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11036,16 +11039,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11055,6 +11058,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11071,12 +11075,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11085,6 +11089,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -17510,7 +17515,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -24330,7 +24335,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -24347,7 +24351,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -25583,7 +25586,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -25656,7 +25659,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -30049,7 +30051,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -35400,7 +35401,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -42741,7 +42741,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -44164,7 +44164,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -46464,7 +46463,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -47033,7 +47032,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -49444,11 +49442,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -51855,6 +51858,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -56302,7 +56338,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -58480,7 +58516,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), diff --git a/src/spur32.stack/interp.c b/src/spur32.stack/interp.c index 94f820b179..98e50a96e1 100644 --- a/src/spur32.stack/interp.c +++ b/src/spur32.stack/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -340,10 +340,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -592,7 +592,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static usqInt NoDbgRegParms addressAfter(sqInt objOop); static sqInt NoDbgRegParms allocateSlotsForPinningInOldSpacebytesformatclassIndex(sqInt numSlots, usqInt totalBytes, sqInt formatField, sqInt classIndex); @@ -1124,7 +1124,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); @@ -1197,6 +1197,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -1508,8 +1509,8 @@ _iss sqInt trueObj; _iss sqInt falseObj; _iss SpurSegmentInfo * segments; _iss sqInt hiddenRootsObj; -_iss usqInt scavengeThreshold; _iss StackPage * pages; +_iss usqInt scavengeThreshold; _iss sqInt numSegments; _iss sqInt * freeLists; _iss char * stackMemory; @@ -2358,7 +2359,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2475,18 +2476,20 @@ interpret(void) char * localSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -10980,7 +10983,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -10988,10 +10991,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -10999,6 +11002,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11010,12 +11014,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11027,16 +11030,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11046,6 +11049,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11062,12 +11066,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11076,6 +11080,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -17501,7 +17506,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -24321,7 +24326,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -24338,7 +24342,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -25574,7 +25577,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -25647,7 +25650,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -30040,7 +30042,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -35391,7 +35392,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -42732,7 +42732,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -44155,7 +44155,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -46455,7 +46454,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -47024,7 +47023,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -49435,11 +49433,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -51846,6 +51849,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -56293,7 +56329,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -58471,7 +58507,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), diff --git a/src/spur32.stack/validImage.c b/src/spur32.stack/validImage.c index 99e4db2d44..948f3c6428 100644 --- a/src/spur32.stack/validImage.c +++ b/src/spur32.stack/validImage.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - ImageLeakChecker VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + ImageLeakChecker VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "ImageLeakChecker VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "ImageLeakChecker VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -995,7 +995,7 @@ sqInt extraVMMemory; sqInt ffiExceptionResponse; sqInt inIOProcessEvents; struct VirtualMachine* interpreterProxy; -const char *interpreterVersion = "Open Smalltalk ImageChecker VM [ImageLeakChecker VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk ImageChecker VM [ImageLeakChecker VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; volatile int sendTrace; @@ -3144,7 +3144,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; treeNode = fetchPointerofFreeChunk(2 /* freeChunkParentIndex */, treeNode); } @@ -10310,7 +10309,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOf(oop)) < 0x100) ? (lengthOf(oop)) : 0x100); while (i < limit) { @@ -11047,7 +11046,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; treeNode1 = fetchPointerofFreeChunk(2 /* freeChunkParentIndex */, treeNode1); } @@ -11306,7 +11304,6 @@ updateFreeLists(void) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; treeNode = fetchPointerofFreeChunk(2 /* freeChunkParentIndex */, treeNode); } diff --git a/src/spur64.cog.lowcode/_variable_order b/src/spur64.cog.lowcode/_variable_order index 8afae68358..092aaf7663 100644 --- a/src/spur64.cog.lowcode/_variable_order +++ b/src/spur64.cog.lowcode/_variable_order @@ -1,5 +1,3 @@ -_vmOwner -_stackLimitFromMachineCode _stackLimit _stackPointer _framePointer @@ -17,7 +15,6 @@ _newMethod _instructionPointer _argumentCount _nextProfileTick -_nativeSP _nativeStackPointer _shadowCallStackPointer _primTraceLog diff --git a/src/spur64.cog.lowcode/cogit.h b/src/spur64.cog.lowcode/cogit.h index 9d554f0c72..b00f94eaaa 100644 --- a/src/spur64.cog.lowcode/cogit.h +++ b/src/spur64.cog.lowcode/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur64.cog.lowcode/cogitARMv8.c b/src/spur64.cog.lowcode/cogitARMv8.c index f7b1a680bc..9b6940bcb3 100644 --- a/src/spur64.cog.lowcode/cogitARMv8.c +++ b/src/spur64.cog.lowcode/cogitARMv8.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -7493,7 +7493,7 @@ rewriteImm19JumpBeforetarget(AbstractInstruction * self_in_rewriteImm19JumpBefor static sqInt NoDbgRegParms rewriteImm26JumpBeforetarget(AbstractInstruction * self_in_rewriteImm26JumpBeforetarget, sqInt followingAddress, sqInt targetAddress) { - usqInt instrOpcode; + sqInt instrOpcode; sqInt mcpc; sqInt offset; @@ -7503,7 +7503,7 @@ rewriteImm26JumpBeforetarget(AbstractInstruction * self_in_rewriteImm26JumpBefor instrOpcode = ((instructionBeforeAddress(self_in_rewriteImm26JumpBeforetarget, followingAddress))) >> 26; assert((instrOpcode == 5) || (instrOpcode == 37)); - codeLong32Atput(mcpc, (instrOpcode << 26) + (((offset) >> 2) & (0x3FFFFFF))); + codeLong32Atput(mcpc, (((sqInt)((usqInt)(instrOpcode) << 26))) + (((offset) >> 2) & (0x3FFFFFF))); return 4; } @@ -8551,7 +8551,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -10335,7 +10334,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -11587,7 +11585,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -15492,7 +15489,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -17705,8 +17701,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -31169,7 +31165,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -32222,7 +32218,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -47456,7 +47451,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur64.cog.lowcode/cogitX64SysV.c b/src/spur64.cog.lowcode/cogitX64SysV.c index df91f3bdb9..36c0bcdefd 100644 --- a/src/spur64.cog.lowcode/cogitX64SysV.c +++ b/src/spur64.cog.lowcode/cogitX64SysV.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4010,7 +4010,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -5587,7 +5586,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -7134,7 +7132,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -10429,7 +10426,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -12259,8 +12255,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -29146,7 +29142,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -30146,7 +30142,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -44766,7 +44761,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur64.cog.lowcode/cogitX64WIN64.c b/src/spur64.cog.lowcode/cogitX64WIN64.c index 4568db3a5f..7f8efe4441 100644 --- a/src/spur64.cog.lowcode/cogitX64WIN64.c +++ b/src/spur64.cog.lowcode/cogitX64WIN64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4010,7 +4010,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -5587,7 +5586,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -7166,7 +7164,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -10471,7 +10468,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -12301,8 +12297,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -29218,7 +29214,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -30234,7 +30230,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -44854,7 +44849,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur64.cog.lowcode/cointerp.c b/src/spur64.cog.lowcode/cointerp.c index 1d78650509..7296ba4a96 100644 --- a/src/spur64.cog.lowcode/cointerp.c +++ b/src/spur64.cog.lowcode/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -406,10 +406,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1479,7 +1479,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1541,6 +1541,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1845,9 +1846,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2049,7 +2050,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 584 */] = { /*78*/ 0, 0, /*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256, 0,-256, /*98*/ 0, 0, -/*100*/ 260, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, +/*100*/ 260, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, /*115*/ 0x100, 0, 12, 260, 0, /*120*/ 524, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256, /*139*/ 0, @@ -2719,7 +2720,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2884,20 +2885,21 @@ interpret(void) char * nativeSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; extA = 0; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -30939,7 +30941,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -30947,10 +30949,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -30958,6 +30960,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -30969,12 +30972,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -30986,16 +30988,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -31005,6 +31007,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -31021,12 +31024,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -31035,6 +31038,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -37652,7 +37656,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -37699,7 +37703,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -37717,7 +37721,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -38784,7 +38788,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -39596,7 +39600,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -50143,7 +50148,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -57414,7 +57419,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -57431,7 +57435,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -63394,7 +63397,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -68736,7 +68738,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -73664,8 +73665,8 @@ outOfPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt classIndex1; - sqInt clone1; - sqInt clone2; + usqInt clone1; + usqInt clone2; sqInt format; sqInt format1; sqInt hash; @@ -76248,7 +76249,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -77743,7 +77744,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -80036,7 +80036,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 3))) < (lengthOf(obj))); contextSize = (sp >> 3); l6: /* end fetchStackPointerOf: */; - numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); + numPointerSlots = CtxtTempFrameStart + contextSize; goto l10; } /* begin numSlotsOf: */ @@ -80066,7 +80066,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((((header) & 7) == 1)); numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); + numPointerSlots = numLiterals + LiteralStart; l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -80111,7 +80111,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -80680,7 +80680,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -82782,11 +82781,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -84516,8 +84520,8 @@ static sqInt getErrorObjectFromPrimFailCode(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; - usqInt clone; - usqInt errObj; + sqInt clone; + sqInt errObj; sqInt fieldIndex; sqInt i; usqInt newObj; @@ -85086,6 +85090,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -86682,7 +86719,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -86724,7 +86761,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -86742,7 +86779,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur64.cog.lowcode/cointerp.h b/src/spur64.cog.lowcode/cointerp.h index 43ffa5cac9..c38a9a73e5 100644 --- a/src/spur64.cog.lowcode/cointerp.h +++ b/src/spur64.cog.lowcode/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur64.cog.lowcode/gcc3x-cointerp.c b/src/spur64.cog.lowcode/gcc3x-cointerp.c index 2e2b84065b..1867bc7b7b 100644 --- a/src/spur64.cog.lowcode/gcc3x-cointerp.c +++ b/src/spur64.cog.lowcode/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -409,10 +409,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1482,7 +1482,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1544,6 +1544,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1848,9 +1849,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2052,7 +2053,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 584 */] = { /*78*/ 0, 0, /*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256, 0,-256, /*98*/ 0, 0, -/*100*/ 260, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, +/*100*/ 260, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, /*115*/ 0x100, 0, 12, 260, 0, /*120*/ 524, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256, /*139*/ 0, @@ -2722,7 +2723,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2887,8 +2888,8 @@ interpret(void) char * nativeSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2900,13 +2901,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -30948,7 +30950,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -30956,10 +30958,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -30967,6 +30969,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -30978,12 +30981,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -30995,16 +30997,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -31014,6 +31016,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -31030,12 +31033,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -31044,6 +31047,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -37661,7 +37665,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -37708,7 +37712,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -37726,7 +37730,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -38793,7 +38797,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -39605,7 +39609,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -50152,7 +50157,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -57423,7 +57428,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -57440,7 +57444,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -63403,7 +63406,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -68745,7 +68747,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -73673,8 +73674,8 @@ outOfPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt classIndex1; - sqInt clone1; - sqInt clone2; + usqInt clone1; + usqInt clone2; sqInt format; sqInt format1; sqInt hash; @@ -76257,7 +76258,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -77752,7 +77753,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -80045,7 +80045,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 3))) < (lengthOf(obj))); contextSize = (sp >> 3); l6: /* end fetchStackPointerOf: */; - numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); + numPointerSlots = CtxtTempFrameStart + contextSize; goto l10; } /* begin numSlotsOf: */ @@ -80075,7 +80075,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((((header) & 7) == 1)); numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); + numPointerSlots = numLiterals + LiteralStart; l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -80120,7 +80120,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -80689,7 +80689,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -82791,11 +82790,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -84525,8 +84529,8 @@ static sqInt getErrorObjectFromPrimFailCode(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; - usqInt clone; - usqInt errObj; + sqInt clone; + sqInt errObj; sqInt fieldIndex; sqInt i; usqInt newObj; @@ -85095,6 +85099,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -86691,7 +86728,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -86733,7 +86770,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -86751,7 +86788,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur64.cog.lowcode/variable_order b/src/spur64.cog.lowcode/variable_order index 288ee540ab..007e8e785a 100644 --- a/src/spur64.cog.lowcode/variable_order +++ b/src/spur64.cog.lowcode/variable_order @@ -1,5 +1,3 @@ -vmOwner -stackLimitFromMachineCode stackLimit stackPointer framePointer @@ -17,7 +15,6 @@ newMethod instructionPointer argumentCount nextProfileTick -nativeSP nativeStackPointer shadowCallStackPointer primTraceLog diff --git a/src/spur64.cog/_variable_order b/src/spur64.cog/_variable_order index 8afae68358..a142fd684b 100644 --- a/src/spur64.cog/_variable_order +++ b/src/spur64.cog/_variable_order @@ -1,5 +1,3 @@ -_vmOwner -_stackLimitFromMachineCode _stackLimit _stackPointer _framePointer @@ -17,7 +15,4 @@ _newMethod _instructionPointer _argumentCount _nextProfileTick -_nativeSP -_nativeStackPointer -_shadowCallStackPointer _primTraceLog diff --git a/src/spur64.cog/cogit.h b/src/spur64.cog/cogit.h index 1d23d75dd9..ba735c36be 100644 --- a/src/spur64.cog/cogit.h +++ b/src/spur64.cog/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur64.cog/cogitARMv8.c b/src/spur64.cog/cogitARMv8.c index aded2fc638..6023a2ad7f 100644 --- a/src/spur64.cog/cogitARMv8.c +++ b/src/spur64.cog/cogitARMv8.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -7310,7 +7310,7 @@ rewriteImm19JumpBeforetarget(AbstractInstruction * self_in_rewriteImm19JumpBefor static sqInt NoDbgRegParms rewriteImm26JumpBeforetarget(AbstractInstruction * self_in_rewriteImm26JumpBeforetarget, sqInt followingAddress, sqInt targetAddress) { - sqInt instrOpcode; + usqInt instrOpcode; sqInt mcpc; sqInt offset; @@ -7320,7 +7320,7 @@ rewriteImm26JumpBeforetarget(AbstractInstruction * self_in_rewriteImm26JumpBefor instrOpcode = ((instructionBeforeAddress(self_in_rewriteImm26JumpBeforetarget, followingAddress))) >> 26; assert((instrOpcode == 5) || (instrOpcode == 37)); - codeLong32Atput(mcpc, (((sqInt)((usqInt)(instrOpcode) << 26))) + (((offset) >> 2) & (0x3FFFFFF))); + codeLong32Atput(mcpc, (instrOpcode << 26) + (((offset) >> 2) & (0x3FFFFFF))); return 4; } @@ -8365,7 +8365,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -10149,7 +10148,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -11252,7 +11250,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -14987,7 +14984,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -17197,8 +17193,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -29119,7 +29115,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -30112,7 +30108,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -35470,7 +35465,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur64.cog/cogitX64SysV.c b/src/spur64.cog/cogitX64SysV.c index 2537b1225f..b5601e7960 100644 --- a/src/spur64.cog/cogitX64SysV.c +++ b/src/spur64.cog/cogitX64SysV.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -3840,7 +3840,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -5417,7 +5416,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -6525,7 +6523,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -9634,7 +9631,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -11461,8 +11457,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -26981,7 +26977,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -27936,7 +27932,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -33096,7 +33091,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur64.cog/cogitX64WIN64.c b/src/spur64.cog/cogitX64WIN64.c index 88fafcbc08..941a6cbae7 100644 --- a/src/spur64.cog/cogitX64WIN64.c +++ b/src/spur64.cog/cogitX64WIN64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -3840,7 +3840,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -5417,7 +5416,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -6533,7 +6531,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -9652,7 +9649,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -11479,8 +11475,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -27029,7 +27025,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -28000,7 +27996,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -33160,7 +33155,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/spur64.cog/cointerp.c b/src/spur64.cog/cointerp.c index 03d24e93f6..5202a8f606 100644 --- a/src/spur64.cog/cointerp.c +++ b/src/spur64.cog/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -403,10 +403,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1463,7 +1463,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1523,6 +1523,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1821,9 +1822,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2025,7 +2026,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 584 */] = { /*78*/ 0, 0, /*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256, 0,-256, /*98*/ 0, 0, -/*100*/ 260, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, +/*100*/ 260, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, /*115*/ 0x100, 0, 12, 260, 0, /*120*/ 524, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256, /*139*/ 0, @@ -2695,7 +2696,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2858,19 +2859,20 @@ interpret(void) char * localSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11356,7 +11358,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11364,10 +11366,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11375,6 +11377,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11386,12 +11389,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11403,16 +11405,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11422,6 +11424,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11438,12 +11441,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11452,6 +11455,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -18019,7 +18023,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -18066,7 +18070,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -18084,7 +18088,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -19919,7 +19923,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -30446,7 +30451,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -37717,7 +37722,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -37734,7 +37738,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -43673,7 +43676,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -49015,7 +49017,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -56479,7 +56480,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -57964,7 +57965,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -60257,7 +60257,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 3))) < (lengthOf(obj))); contextSize = (sp >> 3); l6: /* end fetchStackPointerOf: */; - numPointerSlots = CtxtTempFrameStart + contextSize; + numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); goto l10; } /* begin numSlotsOf: */ @@ -60287,7 +60287,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((((header) & 7) == 1)); numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = numLiterals + LiteralStart; + numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -60332,7 +60332,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -60839,7 +60839,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - sqInt node; + usqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -60901,7 +60901,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -63003,11 +63002,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -64723,8 +64727,8 @@ static sqInt getErrorObjectFromPrimFailCode(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; - sqInt clone; - sqInt errObj; + usqInt clone; + usqInt errObj; sqInt fieldIndex; sqInt i; usqInt newObj; @@ -65293,6 +65297,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -66868,7 +66905,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -66910,7 +66947,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -66928,7 +66965,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur64.cog/cointerp.h b/src/spur64.cog/cointerp.h index 2f7ba4934d..120d3dcb00 100644 --- a/src/spur64.cog/cointerp.h +++ b/src/spur64.cog/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur64.cog/cointerpmt.c b/src/spur64.cog/cointerpmt.c index 893ac36328..dd595e865b 100644 --- a/src/spur64.cog/cointerpmt.c +++ b/src/spur64.cog/cointerpmt.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreterMT VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreterMT VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -453,10 +453,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1562,7 +1562,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1622,6 +1622,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1869,7 +1870,6 @@ static struct foo { #else # define _iss static #endif -_iss volatile atomic_int vmOwner; _iss char * stackLimit; _iss char * stackPointer; _iss char * framePointer; @@ -1917,10 +1917,10 @@ _iss sqInt * rememberedSet; _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss sqInt numThreads; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2091,6 +2091,7 @@ _iss sqInt statCoalesces; _iss usqLong statFGCDeltaUsecs; _iss usqLong statIncrGCUsecs; _iss sqInt theUnknownShort; +_iss volatile atomic_int vmOwner; _iss SpurContiguousObjStack savedFirstFieldsSpace; _iss SpurContiguousObjStack unscannedEphemerons; _iss SpurNewSpaceSpace pastSpace; @@ -2138,7 +2139,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 584 */] = { /*78*/ 0, 0, /*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256, 0,-256, /*98*/ 0, 0, -/*100*/ 260, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, +/*100*/ 260, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, /*115*/ 0x100, 0, 12, 260, 0, /*120*/ 524, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256, /*139*/ 0, @@ -2810,7 +2811,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2979,19 +2980,20 @@ interpret(void) char * localSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11477,7 +11479,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11485,10 +11487,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11496,6 +11498,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11507,12 +11510,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11524,16 +11526,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11543,6 +11545,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11559,12 +11562,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11573,6 +11576,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -18595,7 +18599,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -18642,7 +18646,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -18660,7 +18664,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -20504,7 +20508,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -23162,7 +23167,6 @@ ownVM(void *vmThreadHandle) } } atomic_store((&((vmThread->state))), CTMAssignableOrInVM); - /* vmThread = */ vmThread; disownCount -= 1; if (((flags & DisownVMForProcessorRelinquish) != 0)) { @@ -34001,7 +34005,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -35314,7 +35318,7 @@ primitiveInvokeObjectAsMethod(void) sqInt i; sqInt lookupClassTag; sqInt objFormat; - usqInt runArgs; + sqInt runArgs; sqInt runReceiver; char *sp; char *sp1; @@ -41139,7 +41143,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -41156,7 +41159,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -47108,7 +47110,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -52450,7 +52451,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -59932,7 +59932,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -61417,7 +61417,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -63710,7 +63709,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 3))) < (lengthOf(obj))); contextSize = (sp >> 3); l6: /* end fetchStackPointerOf: */; - numPointerSlots = CtxtTempFrameStart + contextSize; + numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); goto l10; } /* begin numSlotsOf: */ @@ -63740,7 +63739,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((((header) & 7) == 1)); numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = numLiterals + LiteralStart; + numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -63785,7 +63784,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -64292,7 +64291,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - sqInt node; + usqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -64354,7 +64353,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -66356,11 +66354,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -68646,6 +68649,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -70191,7 +70227,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -70233,7 +70269,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -70251,7 +70287,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur64.cog/cointerpmt.h b/src/spur64.cog/cointerpmt.h index 46f68c9a5c..864ad38352 100644 --- a/src/spur64.cog/cointerpmt.h +++ b/src/spur64.cog/cointerpmt.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur64.cog/gcc3x-cointerp.c b/src/spur64.cog/gcc3x-cointerp.c index adccca6415..f4c75cedfc 100644 --- a/src/spur64.cog/gcc3x-cointerp.c +++ b/src/spur64.cog/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -406,10 +406,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1466,7 +1466,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1526,6 +1526,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1824,9 +1825,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2028,7 +2029,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 584 */] = { /*78*/ 0, 0, /*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256, 0,-256, /*98*/ 0, 0, -/*100*/ 260, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, +/*100*/ 260, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, /*115*/ 0x100, 0, 12, 260, 0, /*120*/ 524, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256, /*139*/ 0, @@ -2698,7 +2699,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2861,8 +2862,8 @@ interpret(void) register char* localSP SP_REG; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2873,13 +2874,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11365,7 +11367,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11373,10 +11375,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11384,6 +11386,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11395,12 +11398,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11412,16 +11414,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11431,6 +11433,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11447,12 +11450,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11461,6 +11464,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -18028,7 +18032,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -18075,7 +18079,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -18093,7 +18097,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -19928,7 +19932,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -30455,7 +30460,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -37726,7 +37731,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -37743,7 +37747,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -43682,7 +43685,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -49024,7 +49026,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -56488,7 +56489,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -57973,7 +57974,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -60266,7 +60266,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 3))) < (lengthOf(obj))); contextSize = (sp >> 3); l6: /* end fetchStackPointerOf: */; - numPointerSlots = CtxtTempFrameStart + contextSize; + numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); goto l10; } /* begin numSlotsOf: */ @@ -60296,7 +60296,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((((header) & 7) == 1)); numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = numLiterals + LiteralStart; + numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -60341,7 +60341,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -60848,7 +60848,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - sqInt node; + usqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -60910,7 +60910,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -63012,11 +63011,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -64732,8 +64736,8 @@ static sqInt getErrorObjectFromPrimFailCode(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; - sqInt clone; - sqInt errObj; + usqInt clone; + usqInt errObj; sqInt fieldIndex; sqInt i; usqInt newObj; @@ -65302,6 +65306,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -66877,7 +66914,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -66919,7 +66956,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -66937,7 +66974,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur64.cog/gcc3x-cointerpmt.c b/src/spur64.cog/gcc3x-cointerpmt.c index ac69429e50..2e2adbafc5 100644 --- a/src/spur64.cog/gcc3x-cointerpmt.c +++ b/src/spur64.cog/gcc3x-cointerpmt.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreterMT VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreterMT VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -456,10 +456,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1565,7 +1565,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1625,6 +1625,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1872,7 +1873,6 @@ static struct foo { #else # define _iss static #endif -_iss volatile atomic_int vmOwner; _iss char * stackLimit; _iss char * stackPointer; _iss char * framePointer; @@ -1920,10 +1920,10 @@ _iss sqInt * rememberedSet; _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss sqInt numThreads; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2094,6 +2094,7 @@ _iss sqInt statCoalesces; _iss usqLong statFGCDeltaUsecs; _iss usqLong statIncrGCUsecs; _iss sqInt theUnknownShort; +_iss volatile atomic_int vmOwner; _iss SpurContiguousObjStack savedFirstFieldsSpace; _iss SpurContiguousObjStack unscannedEphemerons; _iss SpurNewSpaceSpace pastSpace; @@ -2141,7 +2142,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 584 */] = { /*78*/ 0, 0, /*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256, 0,-256, /*98*/ 0, 0, -/*100*/ 260, 0x200, 0x200, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, +/*100*/ 260, 0x200, 0x100, 0x200,-256, 513,-256,-256,-256,-256, 0, 0x100, 0, 0,-256, /*115*/ 0x100, 0, 12, 260, 0, /*120*/ 524, 0x100,-256,-256, 1, 0, 0, 0, 0,-255,-256,-256, 0, 0, 0,-256, 0,-256,-256, /*139*/ 0, @@ -2813,7 +2814,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2982,8 +2983,8 @@ interpret(void) register char* localSP SP_REG; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2994,13 +2995,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11486,7 +11488,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11494,10 +11496,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11505,6 +11507,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11516,12 +11519,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11533,16 +11535,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11552,6 +11554,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11568,12 +11571,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11582,6 +11585,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -18604,7 +18608,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -18651,7 +18655,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -18669,7 +18673,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -20513,7 +20517,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -23171,7 +23176,6 @@ ownVM(void *vmThreadHandle) } } atomic_store((&((vmThread->state))), CTMAssignableOrInVM); - /* vmThread = */ vmThread; disownCount -= 1; if (((flags & DisownVMForProcessorRelinquish) != 0)) { @@ -34010,7 +34014,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -35323,7 +35327,7 @@ primitiveInvokeObjectAsMethod(void) sqInt i; sqInt lookupClassTag; sqInt objFormat; - usqInt runArgs; + sqInt runArgs; sqInt runReceiver; char *sp; char *sp1; @@ -41148,7 +41152,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -41165,7 +41168,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -47117,7 +47119,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -52459,7 +52460,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -59941,7 +59941,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -61426,7 +61426,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -63719,7 +63718,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) assert((ReceiverIndex + ((sp >> 3))) < (lengthOf(obj))); contextSize = (sp >> 3); l6: /* end fetchStackPointerOf: */; - numPointerSlots = CtxtTempFrameStart + contextSize; + numPointerSlots = ((usqInt) (CtxtTempFrameStart + contextSize)); goto l10; } /* begin numSlotsOf: */ @@ -63749,7 +63748,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) /* begin literalCountOfMethodHeader: */ assert((((header) & 7) == 1)); numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask; - numPointerSlots = numLiterals + LiteralStart; + numPointerSlots = ((usqInt) (numLiterals + LiteralStart)); l10: /* end numPointerSlotsWhileCompactingOf:withFormat:savedFirstFieldPointer: */; if ((fmt <= 5 /* lastPointerFormat */) && (numPointerSlots > 0)) { @@ -63794,7 +63793,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -64301,7 +64300,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - sqInt node; + usqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -64363,7 +64362,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -66365,11 +66363,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -68655,6 +68658,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -70200,7 +70236,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -70242,7 +70278,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -70260,7 +70296,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur64.cog/variable_order b/src/spur64.cog/variable_order index 288ee540ab..c3f2c2e8d7 100644 --- a/src/spur64.cog/variable_order +++ b/src/spur64.cog/variable_order @@ -1,5 +1,3 @@ -vmOwner -stackLimitFromMachineCode stackLimit stackPointer framePointer @@ -17,7 +15,4 @@ newMethod instructionPointer argumentCount nextProfileTick -nativeSP -nativeStackPointer -shadowCallStackPointer primTraceLog diff --git a/src/spur64.sista/_variable_order b/src/spur64.sista/_variable_order index 8afae68358..a142fd684b 100644 --- a/src/spur64.sista/_variable_order +++ b/src/spur64.sista/_variable_order @@ -1,5 +1,3 @@ -_vmOwner -_stackLimitFromMachineCode _stackLimit _stackPointer _framePointer @@ -17,7 +15,4 @@ _newMethod _instructionPointer _argumentCount _nextProfileTick -_nativeSP -_nativeStackPointer -_shadowCallStackPointer _primTraceLog diff --git a/src/spur64.sista/cogit.h b/src/spur64.sista/cogit.h index 24ddb6cff9..2dcd2c1bed 100644 --- a/src/spur64.sista/cogit.h +++ b/src/spur64.sista/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur64.sista/cogitARMv8.c b/src/spur64.sista/cogitARMv8.c index 703eeaee88..128f6ea6c0 100644 --- a/src/spur64.sista/cogitARMv8.c +++ b/src/spur64.sista/cogitARMv8.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -17290,8 +17290,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -30164,7 +30164,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ diff --git a/src/spur64.sista/cogitX64SysV.c b/src/spur64.sista/cogitX64SysV.c index 469d23887c..506e4ffac6 100644 --- a/src/spur64.sista/cogitX64SysV.c +++ b/src/spur64.sista/cogitX64SysV.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -11637,8 +11637,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -28043,7 +28043,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ diff --git a/src/spur64.sista/cogitX64WIN64.c b/src/spur64.sista/cogitX64WIN64.c index 7dd216145b..e8ddcd9bff 100644 --- a/src/spur64.sista/cogitX64WIN64.c +++ b/src/spur64.sista/cogitX64WIN64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -11655,8 +11655,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -28091,7 +28091,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ diff --git a/src/spur64.sista/cointerp.c b/src/spur64.sista/cointerp.c index be7733b7a7..d59048a037 100644 --- a/src/spur64.sista/cointerp.c +++ b/src/spur64.sista/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -405,10 +405,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1477,7 +1477,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1537,6 +1537,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1836,9 +1837,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2710,7 +2711,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2873,19 +2874,20 @@ interpret(void) char * localSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -13959,7 +13961,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -13967,10 +13969,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -13978,6 +13980,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -13989,12 +13992,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -14006,16 +14008,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -14025,6 +14027,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -14041,12 +14044,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -14055,6 +14058,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -20835,7 +20839,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -20882,7 +20886,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -20900,7 +20904,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -21924,7 +21928,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -22736,7 +22740,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -33372,7 +33377,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -40643,7 +40648,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -40660,7 +40664,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -46623,7 +46626,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -51965,7 +51967,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -59477,7 +59478,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -60972,7 +60973,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -63340,7 +63340,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -63847,7 +63847,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - usqInt node; + sqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -63909,7 +63909,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -66011,11 +66010,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -68301,6 +68305,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -69897,7 +69934,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -69939,7 +69976,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -69957,7 +69994,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur64.sista/cointerp.h b/src/spur64.sista/cointerp.h index 8ccea90a16..b1bd5a0570 100644 --- a/src/spur64.sista/cointerp.h +++ b/src/spur64.sista/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/spur64.sista/gcc3x-cointerp.c b/src/spur64.sista/gcc3x-cointerp.c index f7a5520bf9..f45373b87e 100644 --- a/src/spur64.sista/gcc3x-cointerp.c +++ b/src/spur64.sista/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -408,10 +408,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1480,7 +1480,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); static void NoDbgRegParms ensureImageFormatIsUpToDate(sqInt swapBytes); @@ -1540,6 +1540,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -1839,9 +1840,9 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss sqInt numStackPages; _iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; -_iss sqInt numStackPages; _iss sqInt tempOop; _iss usqInt lastMobileObject; _iss sqInt numClassTablePages; @@ -2713,7 +2714,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2876,8 +2877,8 @@ interpret(void) register char* localSP SP_REG; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2888,13 +2889,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -13968,7 +13970,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -13976,10 +13978,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -13987,6 +13989,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -13998,12 +14001,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -14015,16 +14017,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -14034,6 +14036,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -14050,12 +14053,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -14064,6 +14067,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -20844,7 +20848,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -20891,7 +20895,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l11; @@ -20909,7 +20913,7 @@ mnuMethodOrNilFor(sqInt rcvr) } methodArray = objOop; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -21933,7 +21937,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -22745,7 +22749,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), @@ -33381,7 +33386,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -40652,7 +40657,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -40669,7 +40673,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -46632,7 +46635,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -51974,7 +51976,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -59486,7 +59487,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -60981,7 +60982,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -63349,7 +63349,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -63856,7 +63856,7 @@ prepareForSnapshot(void) sqInt limit; sqInt newEndOfMemory; sqInt next; - usqInt node; + sqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -63918,7 +63918,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -66020,11 +66019,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -68310,6 +68314,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -69906,7 +69943,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -69948,7 +69985,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -69966,7 +70003,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); diff --git a/src/spur64.sista/variable_order b/src/spur64.sista/variable_order index 288ee540ab..c3f2c2e8d7 100644 --- a/src/spur64.sista/variable_order +++ b/src/spur64.sista/variable_order @@ -1,5 +1,3 @@ -vmOwner -stackLimitFromMachineCode stackLimit stackPointer framePointer @@ -17,7 +15,4 @@ newMethod instructionPointer argumentCount nextProfileTick -nativeSP -nativeStackPointer -shadowCallStackPointer primTraceLog diff --git a/src/spur64.stack.lowcode/gcc3x-interp.c b/src/spur64.stack.lowcode/gcc3x-interp.c index 3465ae641e..6d8034fbae 100644 --- a/src/spur64.stack.lowcode/gcc3x-interp.c +++ b/src/spur64.stack.lowcode/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -347,10 +347,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -617,7 +617,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static usqInt NoDbgRegParms addressAfter(sqInt objOop); static sqInt NoDbgRegParms allocateSlotsForPinningInOldSpacebytesformatclassIndex(sqInt numSlots, usqInt totalBytes, sqInt formatField, sqInt classIndex); @@ -1158,7 +1158,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); @@ -1233,6 +1233,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -1766,7 +1767,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 584 */] /*40*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, /*60*/ 0, 0, 0, 0, 0,-1,-1,-1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, /*80*/ -1,-1,-1, 0, 0, 0, 1, 0, 2,-1,-1, 0, 0, 0, 1,-1, 0,-1, 0, 0, -/*100*/ 1, 2, 1, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, +/*100*/ 1, 2, 2, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, /*120*/ 2, 1,-1,-1, 0, 0, 0, 0, 0,-1,-1,-1, 0, 0, 0,-1, 0,-1,-1, 0, /*140*/ -1, 1,-1, 1, 1, 1,-1,-1, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1, 1, 1, /*160*/ 0, 0,-1, 0, 0, 1, 1,-1, 1, 0, 0, 0,-1, 1, 1, 0,-1, 0,-1,-1, @@ -2404,7 +2405,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; int displayWidth; int displayDepth; @@ -2530,7 +2531,7 @@ interpret(void) char * nativeSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; JUMP_TABLE; @@ -2543,12 +2544,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -23848,7 +23851,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -23856,10 +23859,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -23867,6 +23870,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -23878,12 +23882,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -23895,16 +23898,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -23914,6 +23917,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -23930,12 +23934,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -23944,6 +23948,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -30090,7 +30095,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -37843,7 +37848,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -37860,7 +37864,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -39087,7 +39090,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -39160,7 +39163,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -43672,7 +43674,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -49085,7 +49086,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -56524,7 +56524,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -57964,7 +57964,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -60291,7 +60290,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -60860,7 +60859,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -63271,11 +63269,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -65681,6 +65684,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -67151,7 +67187,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -67193,7 +67229,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -67211,7 +67247,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -70283,7 +70319,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -72458,7 +72494,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), diff --git a/src/spur64.stack.lowcode/interp.c b/src/spur64.stack.lowcode/interp.c index 26964cbfa7..f87adf6bf0 100644 --- a/src/spur64.stack.lowcode/interp.c +++ b/src/spur64.stack.lowcode/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -344,10 +344,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -614,7 +614,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static usqInt NoDbgRegParms addressAfter(sqInt objOop); static sqInt NoDbgRegParms allocateSlotsForPinningInOldSpacebytesformatclassIndex(sqInt numSlots, usqInt totalBytes, sqInt formatField, sqInt classIndex); @@ -1155,7 +1155,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); @@ -1230,6 +1230,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -1763,7 +1764,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 584 */] /*40*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, /*60*/ 0, 0, 0, 0, 0,-1,-1,-1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, /*80*/ -1,-1,-1, 0, 0, 0, 1, 0, 2,-1,-1, 0, 0, 0, 1,-1, 0,-1, 0, 0, -/*100*/ 1, 2, 1, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, +/*100*/ 1, 2, 2, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, /*120*/ 2, 1,-1,-1, 0, 0, 0, 0, 0,-1,-1,-1, 0, 0, 0,-1, 0,-1,-1, 0, /*140*/ -1, 1,-1, 1, 1, 1,-1,-1, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1, 1, 1, /*160*/ 0, 0,-1, 0, 0, 1, 1,-1, 1, 0, 0, 0,-1, 1, 1, 0,-1, 0,-1,-1, @@ -2401,7 +2402,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; int displayWidth; int displayDepth; @@ -2527,19 +2528,21 @@ interpret(void) char * nativeSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; extA = 0; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -23839,7 +23842,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -23847,10 +23850,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -23858,6 +23861,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -23869,12 +23873,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -23886,16 +23889,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -23905,6 +23908,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -23921,12 +23925,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -23935,6 +23939,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -30081,7 +30086,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -37834,7 +37839,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -37851,7 +37855,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -39078,7 +39081,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -39151,7 +39154,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -43663,7 +43665,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -49076,7 +49077,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -56515,7 +56515,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -57955,7 +57955,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -60282,7 +60281,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -60851,7 +60850,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -63262,11 +63260,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -65672,6 +65675,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -67142,7 +67178,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -67184,7 +67220,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -67202,7 +67238,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -70274,7 +70310,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -72449,7 +72485,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), diff --git a/src/spur64.stack/gcc3x-interp.c b/src/spur64.stack/gcc3x-interp.c index 28e5f561be..74c163fc97 100644 --- a/src/spur64.stack/gcc3x-interp.c +++ b/src/spur64.stack/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -344,10 +344,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -614,7 +614,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static usqInt NoDbgRegParms addressAfter(sqInt objOop); static sqInt NoDbgRegParms allocateSlotsForPinningInOldSpacebytesformatclassIndex(sqInt numSlots, usqInt totalBytes, sqInt formatField, sqInt classIndex); @@ -1149,7 +1149,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); @@ -1222,6 +1222,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -2379,7 +2380,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; int displayWidth; int displayDepth; @@ -2503,7 +2504,7 @@ interpret(void) register char* localSP SP_REG; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; JUMP_TABLE; @@ -2515,12 +2516,14 @@ interpret(void) extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11071,7 +11074,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11079,10 +11082,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11090,6 +11093,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11101,12 +11105,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11118,16 +11121,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11137,6 +11140,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11153,12 +11157,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11167,6 +11171,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -17313,7 +17318,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -25066,7 +25071,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -25083,7 +25087,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -26310,7 +26313,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -26383,7 +26386,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -30888,7 +30890,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -36301,7 +36302,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -43692,7 +43692,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -45122,7 +45122,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -47449,7 +47448,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -48018,7 +48017,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -50429,11 +50427,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -52825,6 +52828,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -54278,7 +54314,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -54320,7 +54356,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -54338,7 +54374,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -57319,7 +57355,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -59494,7 +59530,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), diff --git a/src/spur64.stack/interp.c b/src/spur64.stack/interp.c index 725a6f0573..4e656b3006 100644 --- a/src/spur64.stack/interp.c +++ b/src/spur64.stack/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -341,10 +341,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -611,7 +611,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static usqInt NoDbgRegParms addressAfter(sqInt objOop); static sqInt NoDbgRegParms allocateSlotsForPinningInOldSpacebytesformatclassIndex(sqInt numSlots, usqInt totalBytes, sqInt formatField, sqInt classIndex); @@ -1146,7 +1146,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); @@ -1219,6 +1219,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -2376,7 +2377,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; int displayWidth; int displayDepth; @@ -2500,18 +2501,20 @@ interpret(void) char * localSP; sqInt numExtB; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; extB = 0; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -11062,7 +11065,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -11070,10 +11073,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -11081,6 +11084,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -11092,12 +11096,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -11109,16 +11112,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11128,6 +11131,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -11144,12 +11148,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -11158,6 +11162,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -17304,7 +17309,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -25057,7 +25062,6 @@ primitiveStringReplace(void) goto l9; } if (arrayFmt <= (sixtyFourBitIndexableFormat())) { - /* arrayFmt = */ arrayFmt; goto l9; } if (arrayFmt < (firstShortFormat())) { @@ -25074,7 +25078,6 @@ primitiveStringReplace(void) goto l10; } if (replFmt <= (sixtyFourBitIndexableFormat())) { - /* replFmt = */ replFmt; goto l10; } if (replFmt < (firstShortFormat())) { @@ -26301,7 +26304,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -26374,7 +26377,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -30879,7 +30881,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex = 2 /* freeChunkParentIndex */; @@ -36292,7 +36293,6 @@ initializeObjectMemory(sqInt bytesToShift) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex4 = 2 /* freeChunkParentIndex */; @@ -43683,7 +43683,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) < 0x100) ? (lengthOfformat(oop, (((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask()))) : 0x100); while (i < limit) { @@ -45113,7 +45113,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -47440,7 +47439,7 @@ updatePointersInsavedFirstFieldPointer(sqInt obj, sqInt firstFieldPtr) static sqInt NoDbgRegParms useSegmentForSavedFirstFieldsSpace(sqInt spaceEstimate) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt allocatedSize; + usqInt allocatedSize; sqInt roundedSize; void *segAddress; @@ -48009,7 +48008,6 @@ prepareForSnapshot(void) node = longAt((node + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << (shiftForWord()))))); } } - /* treeNode = */ treeNode; cameFrom = treeNode; /* begin fetchPointer:ofFreeChunk: */ fieldIndex3 = 2 /* freeChunkParentIndex */; @@ -50420,11 +50418,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -52816,6 +52819,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -54269,7 +54305,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt meth; @@ -54311,7 +54347,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l8; @@ -54329,7 +54365,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) } methodArray = objOop2; /* begin followField:ofObject: */ - objOop1 = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + objOop1 = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); if (((!(objOop1 & (tagMask())))) && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { objOop1 = fixFollowedFieldofObjectwithInitialValue(index - SelectorStart, methodArray, objOop1); @@ -57310,7 +57346,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -59485,7 +59521,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(oldSpaceStart) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(ClassArray) << (shiftForWord())))))) != ((assert(((ClassArrayCompactIndex >= 1) && (ClassArrayCompactIndex <= (classTablePageSize())))), diff --git a/src/spur64.stack/validImage.c b/src/spur64.stack/validImage.c index a6355d5f28..5a839a5cae 100644 --- a/src/spur64.stack/validImage.c +++ b/src/spur64.stack/validImage.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - ImageLeakChecker VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + ImageLeakChecker VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "ImageLeakChecker VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "ImageLeakChecker VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -1001,7 +1001,7 @@ sqInt extraVMMemory; sqInt ffiExceptionResponse; sqInt inIOProcessEvents; struct VirtualMachine* interpreterProxy; -const char *interpreterVersion = "Open Smalltalk ImageChecker VM [ImageLeakChecker VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk ImageChecker VM [ImageLeakChecker VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; int displayDepth; int displayHeight; @@ -3281,7 +3281,6 @@ assertInnerValidFreeObject(sqInt objOop) if (treeNode == objOop) { assert(chunk == 0); } - /* treeNode = */ treeNode; cameFrom = treeNode; treeNode = fetchPointerofFreeChunk(2 /* freeChunkParentIndex */, treeNode); } @@ -10481,7 +10480,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOf(oop)) < 0x100) ? (lengthOf(oop)) : 0x100); while (i < limit) { @@ -11221,7 +11220,6 @@ totalFreeListBytes(void) assert(nextNode != listNode); listNode = nextNode; } - /* treeNode1 = */ treeNode1; cameFrom = treeNode1; treeNode1 = fetchPointerofFreeChunk(2 /* freeChunkParentIndex */, treeNode1); } @@ -11483,7 +11481,6 @@ updateFreeLists(void) /* and since we've applied we must move on up */ updateListStartingAt(treeNode); - /* treeNode = */ treeNode; cameFrom = treeNode; treeNode = fetchPointerofFreeChunk(2 /* freeChunkParentIndex */, treeNode); } diff --git a/src/v3.cog/_variable_order b/src/v3.cog/_variable_order index 8afae68358..a142fd684b 100644 --- a/src/v3.cog/_variable_order +++ b/src/v3.cog/_variable_order @@ -1,5 +1,3 @@ -_vmOwner -_stackLimitFromMachineCode _stackLimit _stackPointer _framePointer @@ -17,7 +15,4 @@ _newMethod _instructionPointer _argumentCount _nextProfileTick -_nativeSP -_nativeStackPointer -_shadowCallStackPointer _primTraceLog diff --git a/src/v3.cog/cogit.h b/src/v3.cog/cogit.h index 7f280ec2ae..4081fe2540 100644 --- a/src/v3.cog/cogit.h +++ b/src/v3.cog/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/v3.cog/cogitARMv5.c b/src/v3.cog/cogitARMv5.c index ab92665b06..549634c28b 100644 --- a/src/v3.cog/cogitARMv5.c +++ b/src/v3.cog/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -7901,7 +7901,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -9389,7 +9388,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -10377,7 +10375,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -13314,7 +13311,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -14858,8 +14854,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -20746,7 +20742,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -21569,7 +21565,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -25914,7 +25909,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/v3.cog/cogitIA32.c b/src/v3.cog/cogitIA32.c index cc0cb1688f..15f1a366f8 100644 --- a/src/v3.cog/cogitIA32.c +++ b/src/v3.cog/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGenerator VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -7557,7 +7557,6 @@ bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -9020,7 +9019,6 @@ collectCogMethodConstituent(CogMethod *cogMethod) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -10019,7 +10017,6 @@ endPCOf(sqInt aMethod) } } else { - /* latestContinuation = */ latestContinuation; } nExts = ((descriptor->isExtension) ? nExts + 1 @@ -12784,7 +12781,6 @@ mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *co targetPC = (bcpc1 + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc1 + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -14320,8 +14316,8 @@ voidCogCompiledCode(void) cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); } /* begin manageFrom:to: */ - mzFreeStart = (/* baseAddress = */ baseAddress); - youngReferrers = (/* limitAddress = */ limitAddress); + mzFreeStart = (baseAddress); + youngReferrers = (limitAddress); openPICList = null; methodBytesFreedSinceLastCompaction = 0; methodCount = 0; @@ -19097,7 +19093,7 @@ genFastPrimFail(void) } -/* Suport for compileInterpreterPrimitive. Generate inline code +/* Support for compileInterpreterPrimitive. Generate inline code so as to record the primitive trace as fast as possible. */ /* SimpleStackBasedCogit>>#genFastPrimTraceUsing:and: */ @@ -19936,7 +19932,6 @@ mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj) targetPC = (bcpc + ((descriptor->numBytes))) + (((distance < 0) ? 0 : distance)); latestContinuation = ((latestContinuation < targetPC) ? targetPC : latestContinuation); } - /* latestContinuation = */ latestContinuation; } nextBcpc = (bcpc + ((descriptor->numBytes))) + (((descriptor->isBlockCreation) ? (/* begin spanFor:at:exts:in: */ @@ -24109,7 +24104,6 @@ scanMethod(void) } } /* begin maybeDealWithUnsafeJumpForDescriptor:pc:latestContinuation: */ - /* latestContinuation = */ latestContinuation; if ((descriptor->isBlockCreation)) { numBlocks += 1; /* begin spanFor:at:exts:in: */ diff --git a/src/v3.cog/cointerp.c b/src/v3.cog/cointerp.c index beaf578dcf..444edda49f 100644 --- a/src/v3.cog/cointerp.c +++ b/src/v3.cog/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -365,10 +365,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1147,7 +1147,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern sqInt dumpImage(sqInt fileName); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); @@ -1204,6 +1204,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -2270,7 +2271,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2380,18 +2381,19 @@ interpret(void) sqInt localReturnValue; char * localSP; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -8197,7 +8199,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -8205,10 +8207,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -8216,6 +8218,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -8227,12 +8230,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -8244,16 +8246,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -8263,6 +8265,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -8279,12 +8282,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -8293,6 +8296,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -14042,7 +14046,7 @@ mnuMethodOrNilFor(sqInt rcvr) sqInt currentClass; sqInt dictionary; sqInt header; - sqInt index; + usqInt index; sqInt length; sqInt mask; sqInt methodArray; @@ -14094,7 +14098,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l15; @@ -14103,7 +14107,7 @@ mnuMethodOrNilFor(sqInt rcvr) /* begin followObjField:ofObject: */ methodArray = longAt((dictionary + BaseHeaderSize) + (((int)((usqInt)(MethodArrayIndex) << (shiftForWord()))))); /* begin followField:ofObject: */ - mnuMethod = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + mnuMethod = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); goto l15; } index += 1; @@ -15104,7 +15108,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - usqInt numTemps; + sqInt numTemps; sqInt oop; char *rcvrAddress; sqInt rcvrOrClosure; @@ -15912,7 +15916,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = (heapBase()) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != (fetchPointerofObject(ClassArrayCompactIndex - 1, splObj(CompactClasses)))) { @@ -15942,11 +15947,11 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea for (index = ((lengthOf(cct)) - 1); index >= 0; index += -2) { if ((longAt((cct + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) == aClassOop) { GIV(classByteArrayCompactIndex) = index + 1; - goto l25; + goto l26; } } GIV(classByteArrayCompactIndex) = 0; - l25: /* end compactIndexOfClass: */; + l26: /* end compactIndexOfClass: */; /* begin initializeExtraClassInstVarIndices */ classArrayObj = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord()))))); if (((ccIndex = (((usqInt)((longAt(classArrayObj)))) >> (compactClassFieldLSB())) & 0x1F)) == 0) { @@ -25229,7 +25234,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -33089,7 +33094,6 @@ eeInstantiateAndInitializeClassindexableSize(sqInt classPointer, sqInt size) /* requires size header word */ header3 = byteSize; - /* header1 = */ header1; } else { header1 = header1 | byteSize; @@ -33353,7 +33357,6 @@ eeInstantiateClassindexableSize(sqInt classPointer, sqInt size) /* requires size header word */ header3 = byteSize; - /* header1 = */ header1; } else { header1 = header1 | byteSize; @@ -33561,7 +33564,7 @@ eeInstantiateSmallClassnumSlots(sqInt classPointer, sqInt numSlots) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt hash; int hdrSize; - sqInt header1; + usqInt header1; sqInt header2; usqInt newChunk; usqInt newFreeStart; @@ -40805,7 +40808,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOf(oop)) < 0x100) ? (lengthOf(oop)) : 0x100); while (i < limit) { @@ -43002,11 +43005,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -44990,6 +44998,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -46409,7 +46450,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) sqInt currentClass; sqInt dictionary; sqInt header; - sqInt index; + usqInt index; sqInt length; sqInt mask; sqInt meth; @@ -46443,7 +46484,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l7; @@ -46452,7 +46493,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) /* begin followObjField:ofObject: */ methodArray = longAt((dictionary + BaseHeaderSize) + (((int)((usqInt)(MethodArrayIndex) << (shiftForWord()))))); /* begin followField:ofObject: */ - meth = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); goto l7; } index += 1; diff --git a/src/v3.cog/cointerp.h b/src/v3.cog/cointerp.h index 474dd18b34..97761ff959 100644 --- a/src/v3.cog/cointerp.h +++ b/src/v3.cog/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ diff --git a/src/v3.cog/gcc3x-cointerp.c b/src/v3.cog/gcc3x-cointerp.c index f769931be0..4f91e262c5 100644 --- a/src/v3.cog/gcc3x-cointerp.c +++ b/src/v3.cog/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -368,10 +368,10 @@ static sqInt NoDbgRegParms isCMMethodEtAl(CogBlockMethod * self_in_isCMMethodEtA static sqInt NoDbgRegParms isCMOpenPIC(CogBlockMethod * self_in_isCMOpenPIC); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -1150,7 +1150,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern sqInt dumpImage(sqInt fileName); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); @@ -1207,6 +1207,7 @@ static sqInt NoDbgRegParms ifCurrentStackPageHasValidHeadPointers(StackPage *the static usqInt NoDbgRegParms iframeMethod(char *theFP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); static sqInt NoDbgRegParms isBaseFrame(char *theFP); extern sqInt isBooleanObject(sqInt oop); @@ -2273,7 +2274,7 @@ sqInt debugCallbackReturns; sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Cog[SqueakV3] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2383,8 +2384,8 @@ interpret(void) sqInt localReturnValue; register char* localSP SP_REG; sqInt stackPageBytes; - sqInt stackPagesBytes; - char *theStackMemory; + sqInt stackZoneBytes; + void *theStackMemory; JUMP_TABLE; #if MULTIPLEBYTECODESETS @@ -2394,13 +2395,14 @@ interpret(void) if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); - assert((minimumUnusedHeadroom()) == stackPageBytes); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -8206,7 +8208,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -8214,10 +8216,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -8225,6 +8227,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -8236,12 +8239,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -8253,16 +8255,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -8272,6 +8274,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -8288,12 +8291,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -8302,6 +8305,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -14051,7 +14055,7 @@ mnuMethodOrNilFor(sqInt rcvr) sqInt currentClass; sqInt dictionary; sqInt header; - sqInt index; + usqInt index; sqInt length; sqInt mask; sqInt methodArray; @@ -14103,7 +14107,7 @@ mnuMethodOrNilFor(sqInt rcvr) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { mnuMethod = null; goto l15; @@ -14112,7 +14116,7 @@ mnuMethodOrNilFor(sqInt rcvr) /* begin followObjField:ofObject: */ methodArray = longAt((dictionary + BaseHeaderSize) + (((int)((usqInt)(MethodArrayIndex) << (shiftForWord()))))); /* begin followField:ofObject: */ - mnuMethod = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + mnuMethod = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); goto l15; } index += 1; @@ -15113,7 +15117,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - usqInt numTemps; + sqInt numTemps; sqInt oop; char *rcvrAddress; sqInt rcvrOrClosure; @@ -15921,7 +15925,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = (heapBase()) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != (fetchPointerofObject(ClassArrayCompactIndex - 1, splObj(CompactClasses)))) { @@ -15951,11 +15956,11 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea for (index = ((lengthOf(cct)) - 1); index >= 0; index += -2) { if ((longAt((cct + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) == aClassOop) { GIV(classByteArrayCompactIndex) = index + 1; - goto l25; + goto l26; } } GIV(classByteArrayCompactIndex) = 0; - l25: /* end compactIndexOfClass: */; + l26: /* end compactIndexOfClass: */; /* begin initializeExtraClassInstVarIndices */ classArrayObj = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord()))))); if (((ccIndex = (((usqInt)((longAt(classArrayObj)))) >> (compactClassFieldLSB())) & 0x1F)) == 0) { @@ -25238,7 +25243,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -33098,7 +33103,6 @@ eeInstantiateAndInitializeClassindexableSize(sqInt classPointer, sqInt size) /* requires size header word */ header3 = byteSize; - /* header1 = */ header1; } else { header1 = header1 | byteSize; @@ -33362,7 +33366,6 @@ eeInstantiateClassindexableSize(sqInt classPointer, sqInt size) /* requires size header word */ header3 = byteSize; - /* header1 = */ header1; } else { header1 = header1 | byteSize; @@ -33570,7 +33573,7 @@ eeInstantiateSmallClassnumSlots(sqInt classPointer, sqInt numSlots) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt hash; int hdrSize; - sqInt header1; + usqInt header1; sqInt header2; usqInt newChunk; usqInt newFreeStart; @@ -40814,7 +40817,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOf(oop)) < 0x100) ? (lengthOf(oop)) : 0x100); while (i < limit) { @@ -43011,11 +43014,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -44999,6 +45007,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. Note the resolveAliases flag - this is an awful artefact of OSX and Apples @@ -46418,7 +46459,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) sqInt currentClass; sqInt dictionary; sqInt header; - sqInt index; + usqInt index; sqInt length; sqInt mask; sqInt meth; @@ -46452,7 +46493,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l7; @@ -46461,7 +46502,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) /* begin followObjField:ofObject: */ methodArray = longAt((dictionary + BaseHeaderSize) + (((int)((usqInt)(MethodArrayIndex) << (shiftForWord()))))); /* begin followField:ofObject: */ - meth = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); goto l7; } index += 1; diff --git a/src/v3.cog/variable_order b/src/v3.cog/variable_order index 288ee540ab..c3f2c2e8d7 100644 --- a/src/v3.cog/variable_order +++ b/src/v3.cog/variable_order @@ -1,5 +1,3 @@ -vmOwner -stackLimitFromMachineCode stackLimit stackPointer framePointer @@ -17,7 +15,4 @@ newMethod instructionPointer argumentCount nextProfileTick -nativeSP -nativeStackPointer -shadowCallStackPointer primTraceLog diff --git a/src/v3.stack/gcc3x-interp.c b/src/v3.stack/gcc3x-interp.c index e98e4688db..f862f711cf 100644 --- a/src/v3.stack/gcc3x-interp.c +++ b/src/v3.stack/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -297,10 +297,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -546,7 +546,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static sqInt NoDbgRegParms addressCouldBeObjWhileForwarding(sqInt address); extern sqInt addressCouldBeObj(sqInt address); @@ -832,7 +832,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern sqInt dumpImage(sqInt fileName); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); @@ -900,6 +900,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -1975,7 +1976,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2046,7 +2047,7 @@ interpret(void) sqInt localReturnValue; register char* localSP SP_REG; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; JUMP_TABLE; @@ -2057,12 +2058,14 @@ interpret(void) if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -8063,7 +8066,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -8071,10 +8074,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -8082,6 +8085,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -8093,12 +8097,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -8110,16 +8113,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -8129,6 +8132,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -8145,12 +8149,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -8159,6 +8163,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -13734,7 +13739,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -20743,7 +20748,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -20816,7 +20821,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -22111,7 +22115,6 @@ eeInstantiateClassindexableSize(sqInt classPointer, sqInt size) /* requires size header word */ header3 = byteSize; - /* header1 = */ header1; } else { header1 = header1 | byteSize; @@ -29482,7 +29485,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOf(oop)) < 0x100) ? (lengthOf(oop)) : 0x100); while (i < limit) { @@ -31970,11 +31973,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -33904,6 +33912,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -35235,7 +35276,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) sqInt currentClass; sqInt dictionary; sqInt header; - sqInt index; + usqInt index; sqInt length; sqInt mask; sqInt meth; @@ -35269,7 +35310,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l7; @@ -35278,7 +35319,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) /* begin followObjField:ofObject: */ methodArray = longAt((dictionary + BaseHeaderSize) + (((int)((usqInt)(MethodArrayIndex) << (shiftForWord()))))); /* begin followField:ofObject: */ - meth = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); goto l7; } index += 1; @@ -38195,7 +38236,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -40343,7 +40384,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(memory) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != (fetchPointerofObject(ClassArrayCompactIndex - 1, splObj(CompactClasses)))) { @@ -40373,11 +40415,11 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea for (index = ((lengthOf(cct)) - 1); index >= 0; index += -2) { if ((longAt((cct + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) == aClassOop) { GIV(classByteArrayCompactIndex) = index + 1; - goto l27; + goto l28; } } GIV(classByteArrayCompactIndex) = 0; - l27: /* end compactIndexOfClass: */; + l28: /* end compactIndexOfClass: */; /* begin initializeExtraClassInstVarIndices */ classArrayObj = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord()))))); if (((ccIndex = (((usqInt)((longAt(classArrayObj)))) >> (compactClassFieldLSB())) & 0x1F)) == 0) { diff --git a/src/v3.stack/interp.c b/src/v3.stack/interp.c index 61a88e32e0..9a73ff0fa0 100644 --- a/src/v3.stack/interp.c +++ b/src/v3.stack/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 from - StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a + StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3375 uuid: f5ac2627-c6fa-4468-b11e-a67fde7fb22a " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3380 uuid: c077b429-f897-47ad-92b4-563c161255f3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -294,10 +294,10 @@ typedef struct _StackPage { extern sqInt interpret(void); static sqInt NoDbgRegParms addressIsInPage(StackPage * self_in_addressIsInPage, char *address); static sqInt NoDbgRegParms isFree(StackPage * self_in_isFree); -static void NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); -static sqInt NoDbgRegParms freeStackPage(StackPage *aPage); -static void NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); -static void NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage); +static void NoDbgRegParms freeStackPage(StackPage *aPage); +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page); +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page); static StackPage * newStackPage(void); static sqInt pageListIsWellFormed(void); static StackPage * NoDbgRegParms stackPageAt(sqInt index); @@ -543,7 +543,7 @@ extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); extern usqInt sizeOfAlienData(sqInt oop); extern void * startOfAlienData(sqInt oop); extern sqInt success(sqInt successBoolean); -static sqInt NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage); static sqInt NoDbgRegParms pageIndexFor(void *pointer); static sqInt NoDbgRegParms addressCouldBeObjWhileForwarding(sqInt address); extern sqInt addressCouldBeObj(sqInt address); @@ -829,7 +829,7 @@ static void NoDbgRegParms divorceFramesIn(StackPage *aStackPage); static sqInt NoDbgRegParms doPrimitiveDivby(sqInt rcvr, sqInt arg); static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); -static void dummyReferToProxy(void); +extern struct VirtualMachine * * dummyReferToProxy(void); extern sqInt dumpImage(sqInt fileName); extern void dumpPrimTraceLog(void); extern void dumpPrimTraceLogOn(FILE *aStdioStream); @@ -897,6 +897,7 @@ static usqInt NoDbgRegParms iframeMethod(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageFormatVersionForSnapshot(void); extern sqInt includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass); +extern void initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); static sqInt NeverInline interpreterAllocationReserveBytes(void); extern void ioFilenamefromStringofLengthresolveAliases(char *aCharBuffer, char *aFilenameString, sqInt filenameLength, sqInt aBoolean); @@ -1972,7 +1973,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3375]"; +const char *interpreterVersion = "Open Smalltalk Stack VM [StackInterpreterPrimitives VMMaker.oscog-eem.3380]"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2043,17 +2044,19 @@ interpret(void) sqInt localReturnValue; char * localSP; sqInt stackPageBytes; - sqInt stackPagesBytes; + sqInt stackZoneBytes; void *theStackMemory; if (GIV(stackLimit) == 0) { /* begin initStackPagesAndInterpret */ - stackPageBytes = stackPageByteSize(); - /* begin computeStackZoneSize */ - stackPagesBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; - theStackMemory = alloca(stackPagesBytes); - memset(theStackMemory, 0, stackPagesBytes); - initializeStacknumSlotspageSize(theStackMemory, stackPagesBytes / BytesPerWord, stackPageBytes / BytesPerWord); + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } loadInitialContext(); ioInitHeartbeat(); initialEnterSmalltalkExecutive(); @@ -8054,7 +8057,7 @@ isFree(StackPage * self_in_isFree) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPageNoAssert: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms freeStackPageNoAssert(StackPage *aPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *prev; @@ -8062,10 +8065,10 @@ freeStackPageNoAssert(StackPage *aPage) (aPage->baseFP = 0); if (aPage == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = (GIV(mostRecentlyUsedPage)->prevPage); - return; + return null; } if ((((prev = (aPage->prevPage))->baseFP)) == 0) { - return; + return null; } (prev->nextPage = (aPage->nextPage)); (((aPage->nextPage))->prevPage = prev); @@ -8073,6 +8076,7 @@ freeStackPageNoAssert(StackPage *aPage) (((GIV(mostRecentlyUsedPage)->nextPage))->prevPage = aPage); (aPage->prevPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->nextPage = aPage); + return 0; } @@ -8084,12 +8088,11 @@ freeStackPageNoAssert(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#freeStackPage: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms freeStackPage(StackPage *aPage) { freeStackPageNoAssert(aPage); assert(pageListIsWellFormed()); - return 0; } @@ -8101,16 +8104,16 @@ freeStackPage(StackPage *aPage) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (page == GIV(mostRecentlyUsedPage)) { - return; + return null; } if (((page->prevPage)) == GIV(mostRecentlyUsedPage)) { GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -8120,6 +8123,7 @@ markStackPageMostRecentlyUsed(StackPage *page) (GIV(mostRecentlyUsedPage)->nextPage = page); GIV(mostRecentlyUsedPage) = page; assert(pageListIsWellFormed()); + return 0; } @@ -8136,12 +8140,12 @@ markStackPageMostRecentlyUsed(StackPage *page) free page<->free page<->free page<->free page */ /* CogStackPages>>#markStackPageNextMostRecentlyUsed: */ -static void NoDbgRegParms +static sqInt NoDbgRegParms markStackPageNextMostRecentlyUsed(StackPage *page) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(page != GIV(mostRecentlyUsedPage)); if (((page->nextPage)) == GIV(mostRecentlyUsedPage)) { - return; + return null; } (((page->prevPage))->nextPage = (page->nextPage)); (((page->nextPage))->prevPage = (page->prevPage)); @@ -8150,6 +8154,7 @@ markStackPageNextMostRecentlyUsed(StackPage *page) (page->nextPage = GIV(mostRecentlyUsedPage)); (GIV(mostRecentlyUsedPage)->prevPage = page); assert(pageListIsWellFormed()); + return 0; } @@ -13725,7 +13730,7 @@ primitiveGetenv(void) return (GIV(primFailCode) = PrimErrBadArgument); } /* begin primitiveFailFor: */ - return (/* GIV(primFailCode) = */ GIV(primFailCode)); + return (GIV(primFailCode)); } var = getenv(key); free(key); @@ -20734,7 +20739,7 @@ success(sqInt successBoolean) */ /* InterpreterStackPages>>#initializeStack:numSlots:pageSize: */ -static sqInt NoDbgRegParms +static void NoDbgRegParms initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slotsPerPage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt count; @@ -20807,7 +20812,6 @@ initializeStacknumSlotspageSize(char *theStackPages, sqInt stackSlots, sqInt slo } while(((page = (page->nextPage))) != GIV(mostRecentlyUsedPage)); assert(count == numPages); assert(pageListIsWellFormed()); - return 0; } @@ -22102,7 +22106,6 @@ eeInstantiateClassindexableSize(sqInt classPointer, sqInt size) /* requires size header word */ header3 = byteSize; - /* header1 = */ header1; } else { header1 = header1 | byteSize; @@ -29473,7 +29476,7 @@ printStringDataOfon(sqInt oop, FILE *aStream) } else { assert(isWordsNonImm(oop)); - wideBuffer = ((int *) (alloca(0x1000))); + wideBuffer = ((unsigned int *) (alloca(0x1000))); n = (i = 0); limit = (((lengthOf(oop)) < 0x100) ? (lengthOf(oop)) : 0x100); while (i < limit) { @@ -31961,11 +31964,16 @@ doSignalSemaphoreWithIndex(sqInt index) && (synchronousSignal(sema)); } + +/* Presumably this exists to squash C compiler warnings about unused + variables... + */ + /* StackInterpreter>>#dummyReferToProxy */ -static void +struct VirtualMachine * * dummyReferToProxy(void) { - interpreterProxy = interpreterProxy; + return (&interpreterProxy); } @@ -33895,6 +33903,39 @@ includesBehaviorThatOf(sqInt aClass, sqInt aSuperclass) } +/* Initialize the stack pages and then invoke continuation. Use alloca'ed + memory so that + when we have a JIT its stack pointer will be on the native stack since + alloca allocates + memory on the stack. Certain thread systems use the native stack pointer + as the + frame ID so putting the stack anywhere else can confuse the thread system. + + This path is for the threaded VM where we may want to allocate the stack + zone on + the stack of a thread other than the main VM thread. */ + + /* StackInterpreter>>#initStackPagesAndContinueInto:with: */ +void +initStackPagesAndContinueIntowith(void (*continuation)(void *), void *argument) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt stackPageBytes; + sqInt stackZoneBytes; + void *theStackMemory; + + /* begin ensureInitializeStackZone */ + if (!GIV(pages)) { + stackPageBytes = stackPageByteSize(); + /* begin computeStackZoneSize */ + stackZoneBytes = (GIV(numStackPages) * ((sizeof(CogStackPage)) + (stackPageByteSize()))) + BytesPerWord; + theStackMemory = alloca(stackZoneBytes); + memset(theStackMemory, 0, stackZoneBytes); + initializeStacknumSlotspageSize(theStackMemory, stackZoneBytes / BytesPerWord, stackPageBytes / BytesPerWord); + } + continuation(argument); +} + + /* Answer the bytecode pc object (i.e. SmallInteger) for an active frame. The bytecode pc is derived from the frame's pc. If the frame is the top frame on the current stack @@ -35226,7 +35267,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) sqInt currentClass; sqInt dictionary; sqInt header; - sqInt index; + usqInt index; sqInt length; sqInt mask; sqInt meth; @@ -35260,7 +35301,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) wrapAround = 0; while (1) { /* begin fetchPointer:ofObject: */ - nextSelector = longAt((dictionary + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord()))))); + nextSelector = longAt((dictionary + BaseHeaderSize) + (index << (shiftForWord()))); if (nextSelector == GIV(nilObj)) { meth = null; goto l7; @@ -35269,7 +35310,7 @@ lookupSelectorinClass(sqInt selector, sqInt class) /* begin followObjField:ofObject: */ methodArray = longAt((dictionary + BaseHeaderSize) + (((int)((usqInt)(MethodArrayIndex) << (shiftForWord()))))); /* begin followField:ofObject: */ - meth = longAt((methodArray + BaseHeaderSize) + (((sqInt)((usqInt)((index - SelectorStart)) << (shiftForWord()))))); + meth = longAt((methodArray + BaseHeaderSize) + ((index - SelectorStart) << (shiftForWord()))); goto l7; } index += 1; @@ -38186,7 +38227,7 @@ printContext(sqInt aContext) theMethod = longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - theMethod); + ((void *)theMethod)); shortPrintOop(theMethod); /* begin print: */ fprintf(GIV(transcript), "closure "); @@ -40334,7 +40375,8 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea bytesToShift = GIV(memory) - GIV(oldImageBaseAddress); /* begin initializeInterpreter: */ interpreterProxy = sqGetInterpreterProxy(); - dummyReferToProxy(); + /* begin dummyReferToProxy */ + (&interpreterProxy); initializeObjectMemory(bytesToShift); /* begin checkAssumedCompactClasses */ if ((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord())))))) != (fetchPointerofObject(ClassArrayCompactIndex - 1, splObj(CompactClasses)))) { @@ -40364,11 +40406,11 @@ readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squea for (index = ((lengthOf(cct)) - 1); index >= 0; index += -2) { if ((longAt((cct + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) == aClassOop) { GIV(classByteArrayCompactIndex) = index + 1; - goto l27; + goto l28; } } GIV(classByteArrayCompactIndex) = 0; - l27: /* end compactIndexOfClass: */; + l28: /* end compactIndexOfClass: */; /* begin initializeExtraClassInstVarIndices */ classArrayObj = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassArray) << (shiftForWord()))))); if (((ccIndex = (((usqInt)((longAt(classArrayObj)))) >> (compactClassFieldLSB())) & 0x1F)) == 0) {