Revision: 2750 Author: eliot Date: 2013-07-16 15:54:52 -0700 (Tue, 16 Jul 2013) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.303
Add assert:l: and asserta:l: which take line numbers. Refactor assertValidExecutionPointe:r:s:imbar: to take a line number and supply it to assert:l: et al, for more informative assert failures.
Use sqLowLevelMFence in deferStackLimitSmashAround:with: et al.
Refactor preambleCCode emission so that a comment indicating its source is generated.
Eliminate some compiler warnings is pathTo:using:followWeak:.
Modified Paths: -------------- branches/Cog/nscogsrc/examplePlugins.ext branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c branches/Cog/nscogsrc/vm/cointerp.c branches/Cog/nscogsrc/vm/cointerp.h branches/Cog/nscogsrc/vm/gcc3x-cointerp.c branches/Cog/nscogsrc/vm/interp.h branches/Cog/nscogsrc/vm/vmCallback.h branches/Cog/platforms/Cross/vm/dispdbg.h branches/Cog/platforms/Cross/vm/sqAssert.h branches/Cog/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c branches/Cog/src/vm/cointerp.c branches/Cog/src/vm/cointerp.h branches/Cog/src/vm/cointerpmt.c branches/Cog/src/vm/cointerpmt.h branches/Cog/src/vm/gcc3x-cointerp.c branches/Cog/src/vm/gcc3x-cointerpmt.c branches/Cog/src/vm/interp.h branches/Cog/src/vm/vmCallback.h
Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogsrc/examplePlugins.ext =================================================================== --- branches/Cog/nscogsrc/examplePlugins.ext 2013-07-15 22:18:31 UTC (rev 2749) +++ branches/Cog/nscogsrc/examplePlugins.ext 2013-07-16 22:54:52 UTC (rev 2750) @@ -26,5 +26,6 @@ SqueakFFIPrims \ UUIDPlugin \ UnixOSProcessPlugin \ +VMProfileLinuxSupportPlugin \ VMProfileMacSupportPlugin \ Win32OSProcessPlugin
Modified: branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c =================================================================== --- branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c 2013-07-15 22:18:31 UTC (rev 2749) +++ branches/Cog/nscogsrc/plugins/BitBltPlugin/BitBltPlugin.c 2013-07-16 22:54:52 UTC (rev 2750) @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 from - BitBltSimulation VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9 + BitBltSimulation VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 */ -static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.282 uuid: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9 " __DATE__ ; +static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 " __DATE__ ;
@@ -33,6 +33,12 @@ #define EXPORT(returnType) static returnType #endif
+#ifdef ENABLE_FAST_BLT +#include "BitBltDispatch.h" +#else +// to handle the unavoidable decl in the spec of copyBitsFallback(); +#define operation_t void +#endif #include "sqMemoryAccess.h"
@@ -102,8 +108,11 @@ static sqInt clearWordwith(sqInt source, sqInt destination); static void clipRange(void); EXPORT(void) copyBits(void); +static void copyBitsFastPathSpecialised(void); EXPORT(void) copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue); static void copyBitsLockedAndClipped(void); +static void copyBitsRule41Test(void); +void copyBitsFallback(operation_t *op, unsigned int flags); static void copyLoop(void); static void copyLoopNoSource(void); static void copyLoopPixMap(void); @@ -337,9 +346,9 @@ }; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "BitBltPlugin VMMaker.oscog-eem.282 (i)" + "BitBltPlugin VMMaker.oscog-eem.302 (i)" #else - "BitBltPlugin VMMaker.oscog-eem.282 (e)" + "BitBltPlugin VMMaker.oscog-eem.302 (e)" #endif ; static sqInt noHalftone; @@ -1203,18 +1212,6 @@ EXPORT(void) copyBits(void) { - sqInt done; - sqInt dWid; - sqInt dxLowBits; - sqInt endBits; - sqInt gammaLookupTableOop; - sqInt pixPerM1; - sqInt pixPerM11; - sqInt startBits; - sqInt sxLowBits; - sqInt t; - sqInt ungammaLookupTableOop; - clipRange(); if ((bbW <= 0) || (bbH <= 0)) { @@ -1227,68 +1224,160 @@ if (!(lockSurfaces())) { primitiveFail(); return; } - /* begin copyBitsLockedAndClipped */ - if (combinationRule == 41) { + +# if ENABLE_FAST_BLT
- /* fetch the forecolor into componentAlphaModeColor. */ + /* you really, really mustn't call this unless you have the rest of the code to link to */
- componentAlphaModeAlpha = 255; - componentAlphaModeColor = 16777215; - gammaLookupTable = null; - ungammaLookupTable = null; - if ((methodArgumentCount()) >= 2) { - componentAlphaModeAlpha = stackIntegerValue((methodArgumentCount()) - 2); - if (!(!(failed()))) { - primitiveFail(); - goto l1; + copyBitsFastPathSpecialised(); + +# else /* ENABLE_FAST_BLT */ + copyBitsLockedAndClipped(); + +# endif /* ENABLE_FAST_BLT */ + + unlockSurfaces(); +} + + +/* Perform the actual copyBits operation using the fast path specialised + code; fail some cases by falling back to normal code. + Assume: Surfaces have been locked and clipping was performed. + */ + +static void +copyBitsFastPathSpecialised(void) +{ + +# if ENABLE_FAST_BLT + + /* set the affected area to 0 first */ + + affectedL = (affectedR = (affectedT = (affectedB = 0))); + copyBitsRule41Test(); + if (!(!(failed()))) { + primitiveFail(); return; + } + if ((combinationRule == 30) || (combinationRule == 31)) { + + /* Check and fetch source alpha parameter for alpha blend */ + + if ((methodArgumentCount()) == 1) { + sourceAlpha = stackIntegerValue(0); + if (!((!(failed())) + && ((sourceAlpha >= 0) && (sourceAlpha <= 255)))) { + primitiveFail(); return; } - componentAlphaModeColor = stackIntegerValue((methodArgumentCount()) - 1); - if (!(!(failed()))) { - primitiveFail(); - goto l1; - } - if ((methodArgumentCount()) == 4) { - gammaLookupTableOop = stackObjectValue(1); - if (isBytes(gammaLookupTableOop)) { - gammaLookupTable = firstIndexableField(gammaLookupTableOop); - } - ungammaLookupTableOop = stackObjectValue(0); - if (isBytes(ungammaLookupTableOop)) { - ungammaLookupTable = firstIndexableField(ungammaLookupTableOop); - } - } } else { - if ((methodArgumentCount()) == 1) { - componentAlphaModeColor = stackIntegerValue(0); - if (!(!(failed()))) { - primitiveFail(); - goto l1; - } - } - else { - primitiveFail(); - goto l1; - } + primitiveFail(); return; } } + if ((combinationRule != 22) && (combinationRule != 32)) { + + /* zero width and height; return the count */ + + affectedL = dx; + affectedR = dx + bbW; + affectedT = dy; + affectedB = dy + bbH; + } + + // fill the operation structure + operation_t op; + op.combinationRule = combinationRule; + op.noSource = noSource; + op.src.bits = (void *) sourceBits; + op.src.pitch = sourcePitch; + op.src.depth = sourceDepth; + op.src.msb = sourceMSB; + op.src.x = sx; + op.src.y = sy; + op.dest.bits = (void *) destBits; + op.dest.pitch = destPitch; + op.dest.depth = destDepth; + op.dest.msb = destMSB; + op.dest.x = dx; + op.dest.y = dy; + op.width = bbW; + op.height = bbH; + op.cmFlags = cmFlags; + op.cmShiftTable = (void *) cmShiftTable; + op.cmMaskTable = (void *) cmMaskTable; + op.cmMask = cmMask; + op.cmLookupTable = (void *) cmLookupTable; + op.noHalftone = noHalftone; + op.halftoneHeight = halftoneHeight; + op.halftoneBase = (void *) halftoneBase; + if (combinationRule == 30 || combinationRule == 31) { + op.opt.sourceAlpha = sourceAlpha; + } + if (combinationRule == 41) { + op.opt.componentAlpha.componentAlphaModeColor = componentAlphaModeColor; + op.opt.componentAlpha.componentAlphaModeAlpha = componentAlphaModeAlpha; + op.opt.componentAlpha.gammaLookupTable = (void *) gammaLookupTable; + op.opt.componentAlpha.ungammaLookupTable = (void *) ungammaLookupTable; + } + // call the sneaky code + copyBitsDispatch(&op); + +# endif /* ENABLE_FAST_BLT */ + +} + + +/* Support for the balloon engine. */ + +EXPORT(void) +copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue) +{ + destX = startX; + destY = yValue; + sourceX = startX; + width = stopX - startX; + copyBits(); + /* begin showDisplayBits */ + showDisplayBitsLeftTopRightBottom(destForm, affectedL, affectedT, affectedR, affectedB); +} + + +/* Perform the actual copyBits operation. + Assume: Surfaces have been locked and clipping was performed. */ + +static void +copyBitsLockedAndClipped(void) +{ + sqInt done; + sqInt dWid; + sqInt dxLowBits; + sqInt endBits; + sqInt pixPerM1; + sqInt pixPerM11; + sqInt startBits; + sqInt sxLowBits; + sqInt t; + + copyBitsRule41Test(); + if (!(!(failed()))) { + primitiveFail(); return; + } /* begin tryCopyingBitsQuickly */ if (noSource) { done = 0; - goto l2; + goto l1; } if (!((combinationRule == 34) || (combinationRule == 41))) { done = 0; - goto l2; + goto l1; } if (!(sourceDepth == 32)) { done = 0; - goto l2; + goto l1; } if (sourceForm == destForm) { done = 0; - goto l2; + goto l1; } if (combinationRule == 41) { if (destDepth == 32) { @@ -1298,7 +1387,7 @@ affectedT = dy; affectedB = dy + bbH; done = 1; - goto l2; + goto l1; } if (destDepth == 16) { rgbComponentAlpha16(); @@ -1307,7 +1396,7 @@ affectedT = dy; affectedB = dy + bbH; done = 1; - goto l2; + goto l1; } if (destDepth == 8) { rgbComponentAlpha8(); @@ -1316,19 +1405,19 @@ affectedT = dy; affectedB = dy + bbH; done = 1; - goto l2; + goto l1; } done = 0; - goto l2; + goto l1; } if (destDepth < 8) { done = 0; - goto l2; + goto l1; } if ((destDepth == 8) && ((cmFlags & ColorMapPresent) == 0)) { done = 0; - goto l2; + goto l1; } if (destDepth == 32) { alphaSourceBlendBits32(); @@ -1344,10 +1433,9 @@ affectedT = dy; affectedB = dy + bbH; done = 1; -l2: /* end tryCopyingBitsQuickly */; +l1: /* end tryCopyingBitsQuickly */; if (done) { - null; - goto l1; + return; } if ((combinationRule == 30) || (combinationRule == 31)) {
@@ -1357,13 +1445,11 @@ sourceAlpha = stackIntegerValue(0); if (!((!(failed())) && ((sourceAlpha >= 0) && (sourceAlpha <= 255)))) { - primitiveFail(); - goto l1; + primitiveFail(); return; } } else { - primitiveFail(); - goto l1; + primitiveFail(); return; } }
@@ -1537,47 +1623,19 @@ affectedT = (dy - bbH) + 1; affectedB = dy + 1; } -l1: /* end copyBitsLockedAndClipped */; - unlockSurfaces(); }
-/* Support for the balloon engine. */ +/* Test possible use of rule 41, rgbComponentAlpha:with: Nothing to return, + just set up some variables + */
-EXPORT(void) -copyBitsFromtoat(sqInt startX, sqInt stopX, sqInt yValue) -{ - destX = startX; - destY = yValue; - sourceX = startX; - width = stopX - startX; - copyBits(); - /* begin showDisplayBits */ - showDisplayBitsLeftTopRightBottom(destForm, affectedL, affectedT, affectedR, affectedB); -} - - -/* Perform the actual copyBits operation. - Assume: Surfaces have been locked and clipping was performed. */ - static void -copyBitsLockedAndClipped(void) +copyBitsRule41Test(void) { - sqInt done; - sqInt dWid; - sqInt dxLowBits; - sqInt endBits; sqInt gammaLookupTableOop; - sqInt pixPerM1; - sqInt pixPerM11; - sqInt startBits; - sqInt sxLowBits; - sqInt t; sqInt ungammaLookupTableOop;
- - /* Try a shortcut for stuff that should be run as quickly as possible */ - if (combinationRule == 41) {
/* fetch the forecolor into componentAlphaModeColor. */ @@ -1618,6 +1676,74 @@ } } } +} + + +/* Recover from the fast path specialised code saying Help-I-cant-cope */ + +void +copyBitsFallback(operation_t *op, unsigned int flags) +{ + sqInt done; + sqInt dWid; + sqInt dxLowBits; + sqInt endBits; + sqInt pixPerM1; + sqInt pixPerM11; + sqInt startBits; + sqInt sxLowBits; + sqInt t; + + +# if ENABLE_FAST_BLT + + /* recover values from the operation struct used by the fast ARM code */ + + + combinationRule = op->combinationRule; + noSource = op->noSource; + sourceBits = (sqInt) op->src.bits; + sourcePitch = op->src.pitch; + sourceDepth = op->src.depth; + sourceMSB = op->src.msb; + sx = op->src.x; + sy = op->src.y; + destBits = (sqInt) op->dest.bits; + destPitch = op->dest.pitch; + destDepth = op->dest.depth; + destMSB = op->dest.msb; + dx = op->dest.x; + dy = op->dest.y; + bbW = op->width; + bbH = op->height; + cmFlags = op->cmFlags; + cmShiftTable = (void *) op->cmShiftTable; + cmMaskTable = (void *) op->cmMaskTable; + cmMask = op->cmMask; + cmLookupTable = (void *) op->cmLookupTable; + noHalftone = op->noHalftone; + halftoneHeight = op->halftoneHeight; + halftoneBase = (sqInt) op->halftoneBase; + if (combinationRule == 30 || combinationRule == 31) { + sourceAlpha = op->opt.sourceAlpha; + } + if (combinationRule == 41) { + componentAlphaModeColor = op->opt.componentAlpha.componentAlphaModeColor; + componentAlphaModeAlpha = op->opt.componentAlpha.componentAlphaModeAlpha; + gammaLookupTable = (void *) op->opt.componentAlpha.gammaLookupTable; + ungammaLookupTable = (void *) op->opt.componentAlpha.ungammaLookupTable; + } + destPPW = 32 / destDepth; + cmBitsPerColor = 0; + if (cmMask == 511) { + cmBitsPerColor = 3; + } + if (cmMask == 4095) { + cmBitsPerColor = 4; + } + if (cmMask == 16383) { + cmBitsPerColor = 5; + } /* begin tryCopyingBitsQuickly */ if (noSource) { done = 0; @@ -1694,22 +1820,7 @@ if (done) { return; } - if ((combinationRule == 30) || (combinationRule == 31)) {
- /* Check and fetch source alpha parameter for alpha blend */ - - if ((methodArgumentCount()) == 1) { - sourceAlpha = stackIntegerValue(0); - if (!((!(failed())) - && ((sourceAlpha >= 0) && (sourceAlpha <= 255)))) { - primitiveFail(); return; - } - } - else { - primitiveFail(); return; - } - } - /* Choose and perform the actual copy loop. */
bitCount = 0; @@ -1858,28 +1969,9 @@ copyLoop(); } } - if ((combinationRule == 22) || (combinationRule == 32)) {
- /* zero width and height; return the count */ +# endif /* ENABLE_FAST_BLT */
- affectedL = (affectedR = (affectedT = (affectedB = 0))); - } - if (hDir > 0) { - affectedL = dx; - affectedR = dx + bbW; - } - else { - affectedL = (dx - bbW) + 1; - affectedR = dx + 1; - } - if (vDir > 0) { - affectedT = dy; - affectedB = dy + bbH; - } - else { - affectedT = (dy - bbH) + 1; - affectedB = dy + 1; - } }
Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2013-07-15 22:18:31 UTC (rev 2749) +++ branches/Cog/nscogsrc/vm/cointerp.c 2013-07-16 22:54:52 UTC (rev 2750) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.303 uuid: 99b81fe2-3c89-43bb-8a2c-2541842da7e0 from - CoInterpreter VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 + CoInterpreter VMMaker.oscog-eem.303 uuid: 99b81fe2-3c89-43bb-8a2c-2541842da7e0 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.303 uuid: 99b81fe2-3c89-43bb-8a2c-2541842da7e0 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -32,20 +32,21 @@ #include "sqMemoryAccess.h"
-void printCallStack(void); - +/* StackInterpreter class>>preambleCCode */ /* Disable Intel compiler inlining of warning which is used for breakpoints */ #pragma auto_inline off void warning(char *s) { /* Print an error message but don't exit. */ printf("\n%s\n", s); } +void +warningat(char *s, int l) { /* ditto with line number. */ + printf("\n%s %d\n", s,l); +} #pragma auto_inline on
void invalidCompactClassError(char *s) { /* Print a compact class index error message and exit. */ - static sqInt printingStack = true; /* not running at this point */ - printf("\nClass %s does not have the required compact class index\n", s); exit(-1); } @@ -61,6 +62,8 @@ # define siglongjmp(jb,v) _longjmp(jb,v) #endif
+/* end StackInterpreter class>>preambleCCode */ + typedef struct _StackPage { char *stackLimit; char *headSP; @@ -361,9 +364,9 @@ static CogMethod * asCogHomeMethod(CogBlockMethod *aCogMethod); static sqInt asciiOfCharacter(sqInt characterObj); void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); -static void assertValidExecutionPointersimbar(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter); +static void assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln); void assertValidMachineCodeFrame(sqInt instrPtr); -static void assertValidStackLimits(void); +static void assertValidStackLimits(sqInt ln); static void attemptToSwitchToMachineCode(sqInt bcpc); sqInt becomewith(sqInt array1, sqInt array2); static sqInt becomewithtwoWaycopyHash(sqInt array1, sqInt array2, sqInt twoWayFlag, sqInt copyHashFlag); @@ -477,7 +480,7 @@ static sqInt defaultCogCodeSize(void); static sqInt defaultEdenBytes(void); static sqInt defaultNumStackPages(void); -static void deferStackLimitSmashAround(void (*functionSymbol)(void)); +static void deferStackLimitSmashAroundwith(void (*functionSymbol)(sqInt), sqInt arg); static void displayBitsOfLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); sqInt displayObject(void); static sqInt divorceAllFrames(void); @@ -593,9 +596,7 @@ sqInt headerOf(sqInt methodPointer); static sqInt headerWhileForwardingOf(sqInt oop); sqInt highBit(usqInt anUnsignedValue); -static sqInt iframeIsBlockActivation(char *theFP); static usqInt iframeMethod(char *theFP); -static sqInt iframeReceiver(char *theFP); static sqInt iframeSavedIP(char *theFP); void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageSegmentVersion(void); @@ -731,8 +732,6 @@ static CogBlockMethod * mframeCogMethod(char *theFP); CogMethod * mframeHomeMethodExport(void); CogMethod * mframeHomeMethod(char *theFP); -static sqInt mframeIsBlockActivation(char *theFP); -static sqInt mframeReceiver(char *theFP); static sqInt minimumUnusedHeadroom(void); sqInt mMethodClass(void); static sqInt mnuMethodOrNilFor(sqInt rcvr); @@ -1042,7 +1041,7 @@ static void printFrameThingat(char *name, char *address); static void printFrameThingatextra(char *name, char *address, sqInt extraValue); void printFrame(char *theFP); -static void printFrameWithSP(char *theFP, char *theSP); +void printFrameWithSP(char *theFP, char *theSP); void printHex(sqInt n); void printInstancesOf(sqInt aClassOop); static void printLogEntryAt(sqInt i); @@ -1068,7 +1067,6 @@ void print(char *s); static void pruneStackstackp(sqInt stack, sqInt stackp); void pushBool(sqInt trueOrFalse); -static sqInt pushedReceiverOrClosureOfFrame(char *theFP); void pushFloat(double f); sqInt pushInteger(sqInt integerValue); void pushRemappableOop(sqInt oop); @@ -1978,7 +1976,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.302"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.303"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -4442,7 +4440,7 @@ assertCStackWellAligned(); assert((((usqInt)localIP)) < (startOfMemory())); assert(isMachineCodeFrame(localFP)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 0); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 0, __LINE__); longAtPointerput(localSP, localIP); /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), localReturnValue); @@ -4667,7 +4665,7 @@ assertCStackWellAligned(); assert((((usqInt)localIP)) < (startOfMemory())); assert(isMachineCodeFrame(localFP)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 0); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 0, __LINE__); longAtPointerput(localSP, localIP); /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), localReturnValue); @@ -4717,7 +4715,7 @@ assertCStackWellAligned(); assert((((usqInt)localIP)) < (startOfMemory())); assert(isMachineCodeFrame(localFP)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 0); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 0, __LINE__); longAtPointerput(localSP, localIP); /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), localReturnValue); @@ -5649,7 +5647,7 @@ localSP = pointerForOop(GIV(stackPointer)); localFP = pointerForOop(GIV(framePointer)); markStackPageMostRecentlyUsed(GIV(stackPage)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 1); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 1, __LINE__); l5: /* end instVar:ofContext:put: */; } else { @@ -5912,7 +5910,6 @@ sqInt blockSize; sqInt context; sqInt i; - sqInt initialIP; sqInt newClosure; sqInt newClosure1; sqInt numArgs; @@ -5943,14 +5940,13 @@ l9: /* end ensureFrameIsMarried:SP: */; /* begin closureIn:numArgs:instructionPointer:numCopiedValues: */ VM_LABEL(0closureInnumArgsinstructionPointernumCopiedValues); - initialIP = ((oopForPointer(localIP)) + 2) - (GIV(method) + BaseHeaderSize); assert(((BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize) <= 252);
/* Assume: have just allocated a new closure; it must be young. Thus, can use unchecked stores. */
newClosure1 = eeInstantiateSmallClasssizeInBytes(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassBlockClosure << ShiftForWord)), (BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize); longAtput((newClosure1 + BaseHeaderSize) + (ClosureOuterContextIndex << ShiftForWord), context); - longAtput((newClosure1 + BaseHeaderSize) + (ClosureStartPCIndex << ShiftForWord), ((initialIP << 1) | 1)); + longAtput((newClosure1 + BaseHeaderSize) + (ClosureStartPCIndex << ShiftForWord), (((((oopForPointer(localIP)) + 2) - (GIV(method) + BaseHeaderSize)) << 1) | 1)); longAtput((newClosure1 + BaseHeaderSize) + (ClosureNumArgsIndex << ShiftForWord), ((numArgs << 1) | 1)); newClosure = newClosure1; if (recordSendTrace()) { @@ -12072,7 +12068,7 @@ localSP = pointerForOop(GIV(stackPointer)); localFP = pointerForOop(GIV(framePointer)); markStackPageMostRecentlyUsed(GIV(stackPage)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 1); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 1, __LINE__); l262: /* end instVar:ofContext:put: */; } else { @@ -12224,7 +12220,7 @@ localSP = pointerForOop(GIV(stackPointer)); localFP = pointerForOop(GIV(framePointer)); markStackPageMostRecentlyUsed(GIV(stackPage)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 1); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 1, __LINE__); l263: /* end instVar:ofContext:put: */; } else { @@ -12571,7 +12567,6 @@ sqInt byte; sqInt context; sqInt i; - sqInt initialIP; sqInt newClosure; sqInt newClosure1; sqInt numArgs; @@ -12599,14 +12594,13 @@ l266: /* end ensureFrameIsMarried:SP: */; /* begin closureIn:numArgs:instructionPointer:numCopiedValues: */ VM_LABEL(1closureInnumArgsinstructionPointernumCopiedValues); - initialIP = ((oopForPointer(localIP)) + 2) - (GIV(method) + BaseHeaderSize); assert(((BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize) <= 252);
/* Assume: have just allocated a new closure; it must be young. Thus, can use unchecked stores. */
newClosure1 = eeInstantiateSmallClasssizeInBytes(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassBlockClosure << ShiftForWord)), (BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize); longAtput((newClosure1 + BaseHeaderSize) + (ClosureOuterContextIndex << ShiftForWord), context); - longAtput((newClosure1 + BaseHeaderSize) + (ClosureStartPCIndex << ShiftForWord), ((initialIP << 1) | 1)); + longAtput((newClosure1 + BaseHeaderSize) + (ClosureStartPCIndex << ShiftForWord), (((((oopForPointer(localIP)) + 2) - (GIV(method) + BaseHeaderSize)) << 1) | 1)); longAtput((newClosure1 + BaseHeaderSize) + (ClosureNumArgsIndex << ShiftForWord), ((numArgs << 1) | 1)); newClosure = newClosure1; if (recordSendTrace()) { @@ -13399,44 +13393,46 @@ void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp) { - assertValidExecutionPointersimbar(lip, lifp, lisp, !((((usqInt)(longAt(lifp + FoxMethod)))) < (startOfMemory()))); + assertValidExecutionPointersimbarline(lip, lifp, lisp, !((((usqInt)(longAt(lifp + FoxMethod)))) < (startOfMemory())), __LINE__); }
static void -assertValidExecutionPointersimbar(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter) +assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln) { DECL_MAYBE_SQ_GLOBAL_STRUCT CogMethod *cogMethod; sqInt methodField; sqInt methodField1;
- assert(GIV(stackPage) == (stackPageFor(lifp))); - assert(GIV(stackPage) == (mostRecentlyUsedPage())); - deferStackLimitSmashAround(assertValidStackLimits); - assert(lifp < ((GIV(stackPage)->baseAddress))); - assert(lisp < lifp); - assert(lifp > lisp); - assert(lisp >= (((GIV(stackPage)->realStackLimit)) - (stackLimitOffset()))); - assert((lifp - lisp) < LargeContextSize); + assertl(GIV(stackPage) == (stackPageFor(lifp)), ln); + assertl(GIV(stackPage) == (mostRecentlyUsedPage()), ln); + deferStackLimitSmashAroundwith(assertValidStackLimits, ln); + assertl(lifp < ((GIV(stackPage)->baseAddress)), ln); + assertl(lisp < lifp, ln); + assertl(lifp > lisp, ln); + assertl(lisp >= (((GIV(stackPage)->realStackLimit)) - ((IFrameSlots + 64) * BytesPerWord)), ln); + assertl((lifp - lisp) < LargeContextSize, ln); methodField = longAt(lifp + FoxMethod); if (inInterpreter) { - assert(!(isMachineCodeFrame(lifp))); - assert(GIV(method) == methodField); - assert((methodUsesAlternateBytecodeSet(GIV(method))) == (GIV(bytecodeSetSelector) == 256)); + assertl(!((((usqInt)(longAt(lifp + FoxMethod)))) < (startOfMemory())), ln); + assertl(GIV(method) == methodField, ln); + assertl((headerIndicatesAlternateBytecodeSet(headerOf(GIV(method)))) == (GIV(bytecodeSetSelector) == 256), ln);
- if ((asserta((((usqInt)methodField)) > (startOfMemory()))) - && (asserta((((usqInt)methodField)) < (freeStart())))) { + if ((assertal((((usqInt)methodField)) > (startOfMemory()), ln)) + && (assertal((((usqInt)methodField)) < (freeStart()), ln))) { if (lip != (ceReturnToInterpreterPC())) { - assert((lip >= (((methodField + (lastPointerOf(methodField))) + BaseHeaderSize) - 1)) - && (lip < ((methodField + (byteLengthOf(methodField))) + BaseHeaderSize))); + assertl((lip >= (((methodField + (lastPointerOf(methodField))) + BaseHeaderSize) - 1)) + && (lip < ((methodField + (byteLengthOf(methodField))) + BaseHeaderSize)), ln); } } - assert((iframeIsBlockActivation(lifp)) - || ((pushedReceiverOrClosureOfFrame(lifp)) == (iframeReceiver(lifp)))); + assertl(((byteAt((lifp + FoxIFrameFlags) + 3)) != 0) + || ((longAt(lifp + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(lifp + FoxMethod)))) < (startOfMemory()) + ? (mframeCogMethod(lifp)->cmNumArgs) + : byteAt((lifp + FoxIFrameFlags) + 1)))))) == (longAt(lifp + FoxIFReceiver))), ln); } else { - assert(isMachineCodeFrame(lifp)); - if ((asserta((((usqInt)methodField)) >= (minCogMethodAddress()))) - && (asserta((((usqInt)methodField)) < (maxCogMethodAddress())))) { + assertl((((usqInt)(longAt(lifp + FoxMethod)))) < (startOfMemory()), ln); + if ((assertal((((usqInt)methodField)) >= (minCogMethodAddress()), ln)) + && (assertal((((usqInt)methodField)) < (maxCogMethodAddress()), ln))) { /* begin mframeHomeMethod: */ methodField1 = longAt(lifp + FoxMethod); if ((methodField1 & MFMethodFlagIsBlockFlag) != 0) { @@ -13445,17 +13441,21 @@ } cogMethod = ((CogMethod *) (methodField1 & MFMethodMask)); l1: /* end mframeHomeMethod: */; - assert((lip > (methodField + ((mframeIsBlockActivation(lifp) + assertl((lip > (methodField + ((((longAt(lifp + FoxMethod)) & MFMethodFlagIsBlockFlag) != 0 ? sizeof(CogBlockMethod) : sizeof(CogMethod))))) - && (lip < (methodField + ((cogMethod->blockSize))))); + && (lip < (methodField + ((cogMethod->blockSize)))), ln); } - assert((mframeIsBlockActivation(lifp)) - || ((pushedReceiverOrClosureOfFrame(lifp)) == (mframeReceiver(lifp)))); + assertl((((longAt(lifp + FoxMethod)) & MFMethodFlagIsBlockFlag) != 0) + || ((longAt(lifp + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(lifp + FoxMethod)))) < (startOfMemory()) + ? (mframeCogMethod(lifp)->cmNumArgs) + : byteAt((lifp + FoxIFrameFlags) + 1)))))) == (longAt(lifp + FoxMFReceiver))), ln); } if ((longAt(lifp + FoxSavedFP)) == 0) { - assert(frameHasContext(lifp)); - assert((frameContext(lifp)) == (longAt(((GIV(stackPage)->baseAddress)) - BytesPerWord))); + assertl(((((usqInt)(longAt(lifp + FoxMethod)))) < (startOfMemory()) + ? ((longAt(lifp + FoxMethod)) & MFMethodFlagHasContextFlag) != 0 + : (byteAt((lifp + FoxIFrameFlags) + 2)) != 0), ln); + assertl((longAt(lifp + FoxThisContext)) == (longAt(((GIV(stackPage)->baseAddress)) - BytesPerWord)), ln); } }
@@ -13484,12 +13484,12 @@ */
static void -assertValidStackLimits(void) +assertValidStackLimits(sqInt ln) { DECL_MAYBE_SQ_GLOBAL_STRUCT - assert((GIV(stackLimit) == ((GIV(stackPage)->realStackLimit))) - || (GIV(stackLimit) == (((char *) (((usqInt) -1)))))); - assert((((GIV(stackPage)->stackLimit)) == ((GIV(stackPage)->realStackLimit))) - || (((GIV(stackPage)->stackLimit)) == (((char *) (((usqInt) -1)))))); + assertl((GIV(stackLimit) == ((GIV(stackPage)->realStackLimit))) + || (GIV(stackLimit) == (((char *) (((usqInt) -1))))), ln); + assertl((((GIV(stackPage)->stackLimit)) == ((GIV(stackPage)->realStackLimit))) + || (((GIV(stackPage)->stackLimit)) == (((char *) (((usqInt) -1))))), ln); }
static void @@ -15216,7 +15216,7 @@ ? 256 : 0);
- assertValidExecutionPointersimbar(longAt(GIV(framePointer) + FoxIFSavedIP), GIV(framePointer), GIV(stackPointer), 1); + assertValidExecutionPointersimbarline(longAt(GIV(framePointer) + FoxIFSavedIP), GIV(framePointer), GIV(stackPointer), 1, __LINE__); GIV(instructionPointer) = longAt(GIV(framePointer) + FoxIFSavedIP); /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), anOop); @@ -15603,7 +15603,7 @@ cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask)); assert((cesoRetAddr - (abortOffset())) == (((sqInt)(asCogHomeMethod(cogMethod))))); GIV(instructionPointer) = (((sqInt)cogMethod)) + ((cogMethod->stackCheckOffset)); - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 0); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 0, __LINE__); GIV(method) = (GIV(newMethod) = (GIV(messageSelector) = (GIV(lkupClass) = GIV(nilObj)))); switched = handleStackOverflowOrEventAllowContextSwitch(contextSwitchIfNotNil != 0); returnToExecutivepostContextSwitch(0, switched); @@ -18394,13 +18394,16 @@ */
static void -deferStackLimitSmashAround(void (*functionSymbol)(void)) +deferStackLimitSmashAroundwith(void (*functionSymbol)(sqInt), sqInt arg) { DECL_MAYBE_SQ_GLOBAL_STRUCT GIV(deferSmash) = 1; - functionSymbol(); + sqLowLevelMFence(); + functionSymbol(arg); GIV(deferSmash) = 0; + sqLowLevelMFence(); if (GIV(deferredSmash)) { GIV(deferredSmash) = 0; + sqLowLevelMFence(); forceInterruptCheck(); } } @@ -19878,7 +19881,7 @@ if (GIV(instructionPointer) == (ceReturnToInterpreterPC())) { GIV(instructionPointer) = longAt(GIV(framePointer) + FoxIFSavedIP); } - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 1); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 1, __LINE__); interpret(); return 0; } @@ -19933,7 +19936,7 @@
assertCStackWellAligned(); assert(isMachineCodeFrame(GIV(framePointer))); - assertValidExecutionPointersimbar(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0); + assertValidExecutionPointersimbarline(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0, __LINE__); # if (numRegArgs()) > 0 if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { @@ -19973,7 +19976,7 @@
assertCStackWellAligned(); assert(isMachineCodeFrame(GIV(framePointer))); - assertValidExecutionPointersimbar(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0); + assertValidExecutionPointersimbarline(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0, __LINE__); /* begin push: */ object = (((sqInt)cogMethod)) + (entryOffset()); longAtput((sp1 = GIV(stackPointer) - BytesPerWord), object); @@ -20027,7 +20030,7 @@
assertCStackWellAligned(); assert(isMachineCodeFrame(GIV(framePointer))); - assertValidExecutionPointersimbar(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0); + assertValidExecutionPointersimbarline(longAt(GIV(stackPointer)), GIV(framePointer), GIV(stackPointer), 0, __LINE__); # if (numRegArgs()) > 0 if (((cogMethod->cmNumArgs)) <= (numRegArgs())) { @@ -20874,7 +20877,7 @@ : (byteAt((callerFP + FoxIFrameFlags) + 2)) != 0) ? (assert(checkIsStillMarriedContextcurrentFP(frameContext(callerFP), null)), longAt(callerFP + FoxThisContext)) - : callerFP)); + : ((sqInt)callerFP)));
case StackPointerIndex: case InstructionPointerIndex: @@ -21903,8 +21906,10 @@ sqLowLevelMFence(); } l1: /* end checkForLongRunningPrimitive */; + sqLowLevelMFence(); if (GIV(deferSmash)) { GIV(deferredSmash) = 1; + sqLowLevelMFence(); } else { forceInterruptCheck(); @@ -22924,15 +22929,6 @@ return bitNo + shifted; }
- -/* <Integer> */ - -static sqInt -iframeIsBlockActivation(char *theFP) -{ - return (byteAt((theFP + FoxIFrameFlags) + 3)) != 0; -} - static usqInt iframeMethod(char *theFP) { @@ -22940,12 +22936,6 @@ }
static sqInt -iframeReceiver(char *theFP) -{ - return longAt(theFP + FoxIFReceiver); -} - -static sqInt iframeSavedIP(char *theFP) { return longAt(theFP + FoxIFSavedIP); @@ -28521,21 +28511,6 @@ }
-/* <Integer> */ - -static sqInt -mframeIsBlockActivation(char *theFP) -{ - return ((longAt(theFP + FoxMethod)) & MFMethodFlagIsBlockFlag) != 0; -} - -static sqInt -mframeReceiver(char *theFP) -{ - return longAt(theFP + FoxMFReceiver); -} - - /* Traverse all stack pages looking for non-zero bytes in the headroom part of each page. Answer the minimum size of unused headroom (zero bytes) in the pages. This @@ -31706,7 +31681,7 @@ cogMethod = ((CogMethod *) methodHeader1); assertCStackWellAligned(); /* begin assertValidExecutionPointe:r:s: */ - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())), __LINE__); /* begin ensurePushedInstructionPointer */ if ((((usqInt)GIV(instructionPointer))) >= (startOfMemory())) {
@@ -31761,7 +31736,7 @@ cogMethod1 = ((CogMethod *) methodHeader2); assertCStackWellAligned(); /* begin assertValidExecutionPointe:r:s: */ - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())), __LINE__); /* begin ensurePushedInstructionPointer */ if ((((usqInt)GIV(instructionPointer))) >= (startOfMemory())) {
@@ -31978,7 +31953,7 @@ cogMethod = ((CogMethod *) methodHeader1); assertCStackWellAligned(); /* begin assertValidExecutionPointe:r:s: */ - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())), __LINE__); /* begin ensurePushedInstructionPointer */ if ((((usqInt)GIV(instructionPointer))) >= (startOfMemory())) {
@@ -32033,7 +32008,7 @@ cogMethod1 = ((CogMethod *) methodHeader2); assertCStackWellAligned(); /* begin assertValidExecutionPointe:r:s: */ - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())), __LINE__); /* begin ensurePushedInstructionPointer */ if ((((usqInt)GIV(instructionPointer))) >= (startOfMemory())) {
@@ -32285,7 +32260,7 @@ cogMethod = ((CogMethod *) methodHeader1); assertCStackWellAligned(); /* begin assertValidExecutionPointe:r:s: */ - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())), __LINE__); /* begin ensurePushedInstructionPointer */ if ((((usqInt)GIV(instructionPointer))) >= (startOfMemory())) {
@@ -32340,7 +32315,7 @@ cogMethod1 = ((CogMethod *) methodHeader2); assertCStackWellAligned(); /* begin assertValidExecutionPointe:r:s: */ - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())), __LINE__); /* begin ensurePushedInstructionPointer */ if ((((usqInt)GIV(instructionPointer))) >= (startOfMemory())) {
@@ -40000,7 +39975,7 @@ next = ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages)))))) ? (index >= 0 - ? fieldofFrame(index, current) + ? fieldofFrame(index, ((char *) current)) : GIV(nilObj)) : (index >= 0 ? ((hdr = longAt(current)), @@ -40012,7 +39987,7 @@ : longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord))))); if ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) { - assert(isFrameonPage(next, stackPageFor(next))); + assert(isFrameonPage(((char *) next), stackPageFor(((char *) next)))); } else { if (next >= heapBase) { @@ -45736,7 +45711,7 @@ printFrameWithSP(theFP, theSP); }
-static void +void printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -47407,19 +47382,6 @@ GIV(stackPointer) = sp; }
- -/* The receiver of a message send or the closure of a block activation is - always on the stack above any arguments and the frame itself. See the - diagram in StackInterpreter class>>initializeFrameIndices. */ - -static sqInt -pushedReceiverOrClosureOfFrame(char *theFP) -{ - return longAt(theFP + (frameStackedReceiverOffsetNumArgs(((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory()) - ? (mframeCogMethod(theFP)->cmNumArgs) - : byteAt((theFP + FoxIFrameFlags) + 1))))); -} - void pushFloat(double f) { DECL_MAYBE_SQ_GLOBAL_STRUCT @@ -48405,7 +48367,7 @@
assertCStackWellAligned(); if ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())) { - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 0); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 0, __LINE__); if (switchedContext) { /* begin mframeCogMethod: */ cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask)); @@ -48448,7 +48410,7 @@ GIV(instructionPointer) = ((usqInt)(longAt(GIV(framePointer) + FoxIFSavedIP))); fullyInInterpreter = 0; } - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 1); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 1, __LINE__); if (!fullyInInterpreter) { siglongjmp(reenterInterpreter, ReturnToInterpreter); } @@ -48472,7 +48434,7 @@
assertCStackWellAligned(); if ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())) { - assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 0); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 0, __LINE__); /* begin push: */ longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); GIV(stackPointer) = sp; @@ -48494,7 +48456,7 @@ ? 256 : 0);
- assertValidExecutionPointersimbar(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 1); + assertValidExecutionPointersimbarline(GIV(instructionPointer), GIV(framePointer), GIV(stackPointer), 1, __LINE__); if (GIV(instructionPointer) == (ceReturnToInterpreterPC())) { GIV(instructionPointer) = longAt(GIV(framePointer) + FoxIFSavedIP); } @@ -52458,7 +52420,7 @@
} /* begin assertValidExecutionPointe:r:s: */ - assertValidExecutionPointersimbar(((usqInt)(longAt(GIV(stackPointer)))), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))); + assertValidExecutionPointersimbarline(((usqInt)(longAt(GIV(stackPointer)))), GIV(framePointer), GIV(stackPointer), !((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())), __LINE__); /* begin popStack */ top = longAt(GIV(stackPointer)); GIV(stackPointer) += BytesPerWord;
Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2013-07-15 22:18:31 UTC (rev 2749) +++ branches/Cog/nscogsrc/vm/cointerp.h 2013-07-16 22:54:52 UTC (rev 2750) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.303 uuid: 99b81fe2-3c89-43bb-8a2c-2541842da7e0 */
@@ -161,6 +161,7 @@ void printCallStackOf(sqInt aContextOrProcess); void printChar(sqInt aByte); void printCogMethod(CogMethod *cogMethod); +void printFrameWithSP(char *theFP, char *theSP); void printHex(sqInt n); void printInstancesOf(sqInt aClassOop); void printMethodDictionaryOf(sqInt behavior);
Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2013-07-15 22:18:31 UTC (rev 2749) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2013-07-16 22:54:52 UTC (rev 2750) @@ -2,11 +2,11 @@
/* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.303 uuid: 99b81fe2-3c89-43bb-8a2c-2541842da7e0 from - CoInterpreter VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 + CoInterpreter VMMaker.oscog-eem.303 uuid: 99b81fe2-3c89-43bb-8a2c-2541842da7e0 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.302 uuid: 2ac39432-ac54-4584-964e-b129c90792f4 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.303 uuid: 99b81fe2-3c89-43bb-8a2c-2541842da7e0 " __DATE__ ; char *__interpBuildInfo = __buildInfo;
@@ -35,20 +35,21 @@ #include "sqMemoryAccess.h"
-void printCallStack(void); - +/* StackInterpreter class>>preambleCCode */ /* Disable Intel compiler inlining of warning which is used for breakpoints */ #pragma auto_inline off void warning(char *s) { /* Print an error message but don't exit. */ printf("\n%s\n", s); } +void +warningat(char *s, int l) { /* ditto with line number. */ + printf("\n%s %d\n", s,l); +} #pragma auto_inline on
void invalidCompactClassError(char *s) { /* Print a compact class index error message and exit. */ - static sqInt printingStack = true; /* not running at this point */ - printf("\nClass %s does not have the required compact class index\n", s); exit(-1); } @@ -64,6 +65,8 @@ # define siglongjmp(jb,v) _longjmp(jb,v) #endif
+/* end StackInterpreter class>>preambleCCode */ + typedef struct _StackPage { char *stackLimit; char *headSP; @@ -364,9 +367,9 @@ static CogMethod * asCogHomeMethod(CogBlockMethod *aCogMethod); static sqInt asciiOfCharacter(sqInt characterObj); void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); -static void assertValidExecutionPointersimbar(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter); +static void assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln); void assertValidMachineCodeFrame(sqInt instrPtr); -static void assertValidStackLimits(void); +static void assertValidStackLimits(sqInt ln); static void attemptToSwitchToMachineCode(sqInt bcpc); sqInt becomewith(sqInt array1, sqInt array2); static sqInt becomewithtwoWaycopyHash(sqInt array1, sqInt array2, sqInt twoWayFlag, sqInt copyHashFlag); @@ -480,7 +483,7 @@ static sqInt defaultCogCodeSize(void); static sqInt defaultEdenBytes(void); static sqInt defaultNumStackPages(void); -static void deferStackLimitSmashAround(void (*functionSymbol)(void)); +static void deferStackLimitSmashAroundwith(void (*functionSymbol)(sqInt), sqInt arg); static void displayBitsOfLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); sqInt displayObject(void); static sqInt divorceAllFrames(void); @@ -596,9 +599,7 @@ sqInt headerOf(sqInt methodPointer); static sqInt headerWhileForwardingOf(sqInt oop); sqInt highBit(usqInt anUnsignedValue); -static sqInt iframeIsBlockActivation(char *theFP); static usqInt iframeMethod(char *theFP); -static sqInt iframeReceiver(char *theFP); static sqInt iframeSavedIP(char *theFP); void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); static sqInt imageSegmentVersion(void); @@ -734,8 +735,6 @@ static CogBlockMethod * mframeCogMethod(char *theFP); CogMethod * mframeHomeMethodExport(void); CogMethod * mframeHomeMethod(char *theFP); -static sqInt mframeIsBlockActivation(char *theFP); -static sqInt mframeReceiver(char *theFP); static sqInt minimumUnusedHeadroom(void); sqInt mMethodClass(void); static sqInt mnuMethodOrNilFor(sqInt rcvr); @@ -1045,7 +1044,7 @@ static void printFrameThingat(char *name, char *address); static void printFrameThingatextra(char *name, char *address, sqInt extraValue); void printFrame(char *theFP); -static void printFrameWithSP(char *theFP, char *theSP); +void printFrameWithSP(char *theFP, char *theSP); void printHex(sqInt n); void printInstancesOf(sqInt aClassOop); static void printLogEntryAt(sqInt i); @@ -1071,7 +1070,6 @@ void print(char *s); static void pruneStackstackp(sqInt stack, sqInt stackp); void pushBool(sqInt trueOrFalse); -static sqInt pushedReceiverOrClosureOfFrame(char *theFP); void pushFloat(double f); sqInt pushInteger(sqInt integerValue); void pushRemappableOop(sqInt oop); @@ -1981,7 +1979,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.302"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.303"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace;
@@ -4451,7 +4449,7 @@ assertCStackWellAligned(); assert((((usqInt)localIP)) < (startOfMemory())); assert(isMachineCodeFrame(localFP)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 0); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 0, __LINE__); longAtPointerput(localSP, localIP); /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), localReturnValue); @@ -4676,7 +4674,7 @@ assertCStackWellAligned(); assert((((usqInt)localIP)) < (startOfMemory())); assert(isMachineCodeFrame(localFP)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 0); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 0, __LINE__); longAtPointerput(localSP, localIP); /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), localReturnValue); @@ -4726,7 +4724,7 @@ assertCStackWellAligned(); assert((((usqInt)localIP)) < (startOfMemory())); assert(isMachineCodeFrame(localFP)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 0); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 0, __LINE__); longAtPointerput(localSP, localIP); /* begin internalPush: */ longAtPointerput((localSP -= BytesPerOop), localReturnValue); @@ -5658,7 +5656,7 @@ localSP = pointerForOop(GIV(stackPointer)); localFP = pointerForOop(GIV(framePointer)); markStackPageMostRecentlyUsed(GIV(stackPage)); - assertValidExecutionPointersimbar(((usqInt)localIP), localFP, localSP, 1); + assertValidExecutionPointersimbarline(((usqInt)localIP), localFP, localSP, 1, __LINE__); l5: /* end instVar:ofContext:put: */; } else { @@ -5921,7 +5919,6 @@ sqInt blockSize; sqInt context; sqInt i; - sqInt initialIP; sqInt newClosure; sqInt newClosure1; sqInt numArgs; @@ -5952,14 +5949,13 @@ l9: /* end ensureFrameIsMarried:SP: */; /* begin closureIn:numArgs:instructionPointer:numCopiedValues: */ VM_LABEL(0closureInnumArgsinstructionPointernumCopiedValues); - initialIP = ((oopForPointer(localIP)) + 2) - (GIV(method) + BaseHeaderSize); assert(((BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize) <= 252);
/* Assume: have just allocated a new closure; it must be young. Thus, can use unchecked stores. */
newClosure1 = eeInstantiateSmallClasssizeInBytes(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassBlockClosure << ShiftForWord)), (BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize); longAtput((newClosure1 + BaseHeaderSize) + (ClosureOuterContextIndex << ShiftForWord), context); - longAtput((newClosure1 + BaseHeaderSize) + (ClosureStartPCIndex << ShiftForWord), ((initialIP << 1) | 1));
@@ Diff output truncated at 50000 characters. @@
vm-dev@lists.squeakfoundation.org