diff --git a/src/spur32.cog.lowcode/cogit.h b/src/spur32.cog.lowcode/cogit.h index 3229017f8b..c7b386282a 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.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -26,6 +26,7 @@ extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMetho extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); +extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern CogMethod * cogFullBlockMethodnumCopied(sqInt aMethodObj, sqInt numCopied); extern void cogitPostGCAction(sqInt gcMode); diff --git a/src/spur32.cog.lowcode/cogitARMv5.c b/src/spur32.cog.lowcode/cogitARMv5.c index c7b434d42b..57f8905c78 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.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -9411,7 +9411,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur32.cog.lowcode/cogitIA32.c b/src/spur32.cog.lowcode/cogitIA32.c index 8b78c2aebf..ddf58ee5df 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.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -9058,7 +9058,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur32.cog.newspeak/cogit.h b/src/spur32.cog.newspeak/cogit.h index 394a1b2caa..520c5edbb6 100644 --- a/src/spur32.cog.newspeak/cogit.h +++ b/src/spur32.cog.newspeak/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -23,31 +23,24 @@ extern sqInt abortOffset(void); extern void addCogMethodsToHeapMap(void); extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod); -extern void callCogCodePopReceiver(void); -extern void callCogCodePopReceiverAndClassRegs(void); -extern void ceFree(void *pointer); extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern void cogitPostGCAction(sqInt gcMode); -extern sqInt cogMethodDoesntLookKosher(CogMethod *cogMethod); extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs); extern CogMethod * cogselector(sqInt aMethodObj, sqInt aSelectorOop); extern void compactCogCompiledCode(void); extern sqInt defaultCogCodeSize(void); -extern void enterCogCodePopReceiver(void); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); extern void flagCogMethodForBecome(CogMethod *cogMethod); extern void followForwardedLiteralsIn(CogMethod *cogMethod); -extern void followForwardedMethods(void); extern void followMovableLiteralsAndUpdateYoungReferrers(void); extern void freeBecomeFlaggedMethods(void); extern void freeCogMethod(CogMethod *cogMethod); extern void freeUnmarkedMachineCode(void); extern void initializeCodeZoneFromupTo(sqInt startAddress, sqInt endAddress); -extern sqInt isPCWithinMethodZone(void *address); extern sqInt isSendReturnPC(sqInt retpc); extern void linkNSSendCacheclassTagenclosingObjecttargetcaller(NSSendCache *nsSendCache, sqInt classTag, sqInt enclosingObject, CogMethod *targetMethod, CogMethod *callingMethod); extern void linkSendAtintooffsetreceiver(sqInt callSiteReturnAddress, CogMethod *sendingMethod, CogMethod *targetMethod, sqInt theEntryOffset, sqInt receiver); @@ -58,17 +51,12 @@ extern usqInt maxCogMethodAddress(void); extern usqInt mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *cogMethod); extern sqInt mnuOffset(void); extern sqInt patchToOpenPICFornumArgsreceiver(sqInt selector, sqInt numArgs, sqInt receiver); -extern void printCogMethodFor(void *address); -extern void printTrampolineTable(void); -extern sqInt recordPrimTraceFunc(void); -extern void setBreakMethod(sqInt anObj); extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop); extern sqInt traceLinkedSendOffset(void); extern void unflagBecomeFlaggedMethods(void); extern void unlinkAllSends(void); extern void unlinkSendsLinkedForInvalidClasses(void); extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector); -extern void unlinkSendsToFree(void); extern void unlinkSendsToMethodsSuchThatAndFreeIf(sqInt (*criterion)(CogMethod *), sqInt freeIfTrue); extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue); extern void voidCogCompiledCode(void); @@ -78,15 +66,7 @@ extern CogMethod * methodFor(void *address); extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj); extern sqInt numMethods(void); extern sqInt numMethodsOfType(sqInt cogMethodType); -extern void printCogMethods(void); -extern void printCogMethodsOfType(sqInt cmType); -extern void printCogMethodsWithMethod(sqInt methodOop); -extern void printCogMethodsWithPrimitive(sqInt primIdx); -extern void printCogMethodsWithSelector(sqInt selectorOop); -extern void printCogYoungReferrers(void); -extern sqInt printOpenPICList(void); -extern sqInt pruneYoungReferrers(void); -EXPORT(char *) whereIsMaybeCodeThing(sqInt anOop); +extern char * whereIsMaybeCodeThing(sqInt anOop); extern sqInt cogMethodHasExternalPrim(CogMethod *aCogMethod); extern sqInt cogMethodHasMachineCodePrim(CogMethod *aCogMethod); extern sqInt genQuickReturnConst(void); @@ -99,7 +79,6 @@ extern void callCogCodePopReceiverArg1Arg0Regs(void); /*** Global Variables ***/ extern sqInt blockNoContextSwitchOffset; -extern sqInt breakPC; extern sqInt cbEntryOffset; extern sqInt cbNoSwitchEntryOffset; extern sqInt ceBaseFrameReturnTrampoline; @@ -121,26 +100,15 @@ extern sqInt ceReturnToInterpreterTrampoline; #if COGMTVM extern usqIntptr_t (*ceTryLockVMOwner)(usqIntptr_t); #endif -#if !defined(cFramePointerInUse) -extern sqInt cFramePointerInUse; -#endif extern sqInt cmEntryOffset; extern sqInt cmNoCheckEntryOffset; extern usqInt methodZoneBase; extern sqInt missOffset; -extern void (*realCECallCogCodePopReceiverAndClassRegs)(void); -extern void (*realCECallCogCodePopReceiverArg0Regs)(void); -extern void (*realCECallCogCodePopReceiverArg1Arg0Regs)(void); -extern void (*realCECallCogCodePopReceiverReg)(void); -extern void (*realCEEnterCogCodePopReceiverReg)(void); extern int traceFlags ; -extern const char * traceFlagsMeanings[] ; -extern sqInt traceStores; /*** Macros ***/ #define blockAlignment() 8 -#define breakOnImplicitReceiver() (traceFlags & 256) #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline) #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline) diff --git a/src/spur32.cog.newspeak/cogitARMv5.c b/src/spur32.cog.newspeak/cogitARMv5.c index 4721fd5cef..e096a8d187 100644 --- a/src/spur32.cog.newspeak/cogitARMv5.c +++ b/src/spur32.cog.newspeak/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -616,10 +616,10 @@ static AbstractInstruction * NoDbgRegParms CallNewspeakSend(sqInt callTarget); static AbstractInstruction * NoDbgRegParms CallRTregistersToBeSavedMask(sqInt callTarget, sqInt registersToBeSaved); static AbstractInstruction * NoDbgRegParms gCall(sqInt callTarget); static AbstractInstruction * NoDbgRegParms gCmpCqR(sqInt quickConstant, sqInt reg); -extern void callCogCodePopReceiver(void); -extern void callCogCodePopReceiverAndClassRegs(void); +static void callCogCodePopReceiver(void); +static void callCogCodePopReceiverAndClassRegs(void); static sqInt NoDbgRegParms ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver); -extern void ceFree(void *pointer); +static void NoDbgRegParms ceFree(void *pointer); static void* NoDbgRegParms ceMalloc(size_t size); static sqInt NoDbgRegParms ceSICMiss(sqInt receiver); static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod); @@ -635,7 +635,7 @@ extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); static void NoDbgRegParms cogExtendPICCaseNMethodtagisMNUCase(CogMethod *cPIC, sqInt caseNMethod, sqInt caseNTag, sqInt isMNUCase); extern void cogitPostGCAction(sqInt gcMode); -extern sqInt cogMethodDoesntLookKosher(CogMethod *cogMethod); +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod); extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs); static CogMethod * NoDbgRegParms cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs); static CogMethod * NoDbgRegParms cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt numArgs, CogMethod *case0CogMethod, sqInt case1MethodOrNil, sqInt case1Tag, sqInt isMNUCase); @@ -670,7 +670,7 @@ static AbstractInstruction * NoDbgRegParms gDivRRQuoRem(sqInt rDivisor, sqInt rD extern sqInt defaultCogCodeSize(void); static sqInt NoDbgRegParms deltaToSkipPrimAndErrorStoreInheader(sqInt aMethodObj, sqInt aMethodHeader); static sqInt NoDbgRegParms endPCOf(sqInt aMethod); -extern void enterCogCodePopReceiver(void); +static void enterCogCodePopReceiver(void); static sqInt NoDbgRegParms entryPointTagIsSelector(sqInt entryPoint); static sqInt NoDbgRegParms expectedClosedPICPrototype(CogMethod *cPIC); static sqInt extABytecode(void); @@ -688,9 +688,6 @@ static BytecodeFixup * NoDbgRegParms fixupAt(sqInt fixupPC); extern void flagCogMethodForBecome(CogMethod *cogMethod); static void NoDbgRegParms followForwardedLiteralsImplementationIn(CogMethod *cogMethod); extern void followForwardedLiteralsIn(CogMethod *cogMethod); -extern void followForwardedMethods(void); -static sqInt NoDbgRegParms followMaybeObjRefInClosedPICAt(sqInt mcpc); -static sqInt NoDbgRegParms followMethodReferencesInClosedPIC(CogMethod *cPIC); extern void followMovableLiteralsAndUpdateYoungReferrers(void); extern void freeBecomeFlaggedMethods(void); extern void freeCogMethod(CogMethod *cogMethod); @@ -733,7 +730,7 @@ static sqInt initialMethodUsageCount(void); static sqInt initialOpenPICUsageCount(void); static sqInt NoDbgRegParms inverseBranchFor(sqInt opcode); static sqInt NoDbgRegParms isPCMappedAnnotation(sqInt annotation); -extern sqInt isPCWithinMethodZone(void *address); +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address); extern sqInt isSendReturnPC(sqInt retpc); static AbstractInstruction * NoDbgRegParms gJumpFPEqual(void *jumpTarget); static AbstractInstruction * NoDbgRegParms gJumpFPGreaterOrEqual(void *jumpTarget); @@ -810,7 +807,6 @@ static void NoDbgRegParms rewriteCPICCaseAttagobjReftarget(sqInt followingAddres static AbstractInstruction * NoDbgRegParms gSubCwR(sqInt wordConstant, sqInt reg); static AbstractInstruction * NoDbgRegParms gSubRRR(sqInt subReg, sqInt fromReg, sqInt destReg); static sqInt scanForCleanBlocks(void); -extern void setBreakMethod(sqInt anObj); extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop); static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC); static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc); @@ -831,7 +827,7 @@ static sqInt NoDbgRegParms unlinkIfLinkedSendpcignored(sqInt annotation, char *m static sqInt NoDbgRegParms unlinkIfLinkedSendpcto(sqInt annotation, char *mcpc, CogMethod *theCogMethod); extern void unlinkSendsLinkedForInvalidClasses(void); extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector); -extern void unlinkSendsToFree(void); +static void unlinkSendsToFree(void); extern void unlinkSendsToMethodsSuchThatAndFreeIf(sqInt (*criterion)(CogMethod *), sqInt freeIfTrue); extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue); extern void voidCogCompiledCode(void); @@ -866,7 +862,7 @@ extern void printCogMethodsWithPrimitive(sqInt primIdx); extern void printCogMethodsWithSelector(sqInt selectorOop); extern void printCogYoungReferrers(void); extern sqInt printOpenPICList(void); -extern sqInt pruneYoungReferrers(void); +static sqInt pruneYoungReferrers(void); static sqInt relocateAndPruneYoungReferrers(void); static sqInt relocateMethodsPreCompaction(void); static sqInt NoDbgRegParms removeFromOpenPICList(CogMethod *anOpenPIC); @@ -875,7 +871,7 @@ static sqInt NoDbgRegParms roundUpLength(sqInt numBytes); static void voidOpenPICList(void); static void voidUnpairedMethodList(void); static void voidYoungReferrersPostTenureAll(void); -EXPORT(char *) whereIsMaybeCodeThing(sqInt anOop); +extern char * whereIsMaybeCodeThing(sqInt anOop); static sqInt NoDbgRegParms checkValidObjectReference(sqInt anOop); static AbstractInstruction * NoDbgRegParms genCmpClassFloatCompactIndexR(sqInt reg); static AbstractInstruction * NoDbgRegParms genCmpClassMethodContextCompactIndexR(sqInt reg); @@ -8558,12 +8554,11 @@ gCmpCqR(sqInt quickConstant, sqInt reg) } -/* This is a static version of ceCallCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverReg for break-pointing + when debugging in C. Marked so the code generator won't delete it. */ /* Cogit>>#callCogCodePopReceiver */ -void +static void callCogCodePopReceiver(void) { realCECallCogCodePopReceiverReg(); @@ -8573,12 +8568,12 @@ callCogCodePopReceiver(void) } -/* This is a static version of ceCallCogCodePopReceiverAndClassRegs - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverAndClassRegs for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#callCogCodePopReceiverAndClassRegs */ -void +static void callCogCodePopReceiverAndClassRegs(void) { realCECallCogCodePopReceiverAndClassRegs(); @@ -8592,6 +8587,7 @@ callCogCodePopReceiverAndClassRegs(void) receiver args sp=> sender return address */ +/* Marked so the code generator won't delete it. */ /* Cogit>>#ceCPICMiss:receiver: */ static sqInt NoDbgRegParms @@ -8674,13 +8670,23 @@ ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver) return null; } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceFree: */ -void +static void NoDbgRegParms ceFree(void *pointer) { free(pointer); } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceMalloc: */ static void* NoDbgRegParms ceMalloc(size_t size) @@ -8700,7 +8706,9 @@ ceMalloc(size_t size) sp=> ceMethodAbort call return address So we can find the method that did the failing entry check at ceMethodAbort call return address - missOffset - and we can find the send site from the outer return address. */ + and we can find the send site from the outer return address. + Invoked from a trampoline. Marked so the code generator won't delete + it. */ /* Cogit>>#ceSICMiss: */ static sqInt NoDbgRegParms @@ -8873,13 +8881,13 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * entryPoint = (nsSendCache->target); if (entryPoint != 0) { nsTargetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - if (!(asserta(isCMMethodEtAl(nsTargetMethod)))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) nsTargetMethod))))) { return 12; } } } if (annotation >= IsSendCall) { - if (!(asserta(isCMMethodEtAl(((CogMethod *) cogMethod))))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) cogMethod))))))) { return 3; } /* begin entryCacheTagAndCouldBeObjectAt:annotation:into: */ @@ -8955,9 +8963,9 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * } } targetMethod1 = ((CogMethod *) (entryPoint - offset1)); - if (!(asserta((isCMMethodEtAl(targetMethod1)) - || ((isCMClosedPIC(targetMethod1)) - || (isCMOpenPIC(targetMethod1)))))) { + if (!(asserta((isCMMethodEtAl(((CogBlockMethod *) targetMethod1))) + || ((isCMClosedPIC(((CogBlockMethod *) targetMethod1))) + || (isCMOpenPIC(((CogBlockMethod *) targetMethod1))))))) { return 10; } } @@ -9324,6 +9332,11 @@ codeEntryNameFor(char *address) return null; } + +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ + /* Cogit>>#cogCodeBase */ sqInt cogCodeBase(void) @@ -9518,7 +9531,7 @@ cogitPostGCAction(sqInt gcMode) the type. Answer 0 if it is ok, otherwise answer a code for the error. */ /* Cogit>>#cogMethodDoesntLookKosher: */ -sqInt +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod) { if (((((cogMethod->blockSize)) & (BytesPerWord - 1)) != 0) @@ -9641,7 +9654,7 @@ cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = 1; (writablePIC->cPICNumCases = 1); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 1); @@ -9719,7 +9732,7 @@ cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs) (pic->cPICNumCases = 0); (pic->blockEntryOffset = 0); flushICacheFromto(backEnd, (((usqInt)pic)) - codeToDataDelta, ((((usqInt)pic)) - codeToDataDelta) + openPICSize); - assert(isCMOpenPIC(pic)); + assert(isCMOpenPIC(((CogBlockMethod *) pic))); assert(((pic->selector)) == selector); assert(((pic->cmNumArgs)) == numArgs); assert((callTargetFromReturnAddress(backEnd, ((((sqInt)pic)) - codeToDataDelta) + missOffset)) == (picAbortTrampolineFor(numArgs))); @@ -9778,7 +9791,7 @@ cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt nu ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = isMNUCase; (writablePIC->cPICNumCases = 2); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 2); @@ -10846,8 +10859,8 @@ cPICCompactAndIsNowEmpty(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { if (i == 1) { return 1; @@ -10943,8 +10956,8 @@ cPICHasFreedTargets(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { return 1; } @@ -11040,7 +11053,7 @@ createCPICData(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); target = (targetMethod->methodObject); } storePointerUncheckedofObjectwithValue((i * 2) - 1, picData, class); @@ -11144,12 +11157,12 @@ endPCOf(sqInt aMethod) } -/* This is a static version of ceEnterCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceEnterCogCodePopReceiverReg for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#enterCogCodePopReceiver */ -void +static void enterCogCodePopReceiver(void) { realCEEnterCogCodePopReceiverReg(); @@ -11449,7 +11462,7 @@ findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if (startbcpc == (startPCOfMethodHeader((cogMethod->methodHeader)))) { return ((CogBlockMethod *) cogMethod); } @@ -11506,7 +11519,7 @@ fixupAt(sqInt fixupPC) void flagCogMethodForBecome(CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ ((((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)))->cmType = CMMethodFlaggedForBecome); } @@ -11524,7 +11537,7 @@ followForwardedLiteralsImplementationIn(CogMethod *cogMethod) sqInt result; CogMethod *writableCogMethod; - assert((!(isCMMethodEtAl(cogMethod))) + assert((!(isCMMethodEtAl(((CogBlockMethod *) cogMethod)))) || (!(isForwarded((cogMethod->methodObject))))); writableCogMethod = ((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)); hasYoungObj = isYoung((cogMethod->methodObject)); @@ -11585,102 +11598,6 @@ followForwardedLiteralsIn(CogMethod *cogMethod) /* begin ensureExecutableCodeZone */ } - /* Cogit>>#followForwardedMethods */ -void -followForwardedMethods(void) -{ - CogMethod *cogMethod; - sqInt freedPIC; - - /* begin ensureWritableCodeZone */ - freedPIC = 0; - cogMethod = ((CogMethod *) methodZoneBase); - while (cogMethod < (limitZony())) { - if (((cogMethod->cmType)) >= CMMethod) { - if (isForwarded((cogMethod->methodObject))) { - (cogMethod->methodObject = followForwarded((cogMethod->methodObject))); - if (isYoungObject((cogMethod->methodObject))) { - ensureInYoungReferrers(cogMethod); - } - } - } - if (((cogMethod->cmType)) == CMClosedPIC) { - if (followMethodReferencesInClosedPIC(cogMethod)) { - freedPIC = 1; - freeMethod(cogMethod); - } - } - cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); - } - if (freedPIC) { - unlinkSendsToFree(); - } - /* begin ensureExecutableCodeZone */ -} - - -/* Follow a potential object reference from a closed PIC. - This may be a method reference or null. - Answer if the followed literal is young. - 'mcpc' refers to the jump/branch instruction at the end of - each cpic case */ - - /* Cogit>>#followMaybeObjRefInClosedPICAt: */ -static sqInt NoDbgRegParms -followMaybeObjRefInClosedPICAt(sqInt mcpc) -{ - sqInt object; - sqInt subject; - - object = literalBeforeFollowingAddress(backEnd, mcpc); - if (!(couldBeObject(object))) { - return 0; - } - if (!(isForwarded(object))) { - return isYoungObject(object); - } - subject = followForwarded(object); - /* begin setCodeModified */ -# if DUAL_MAPPED_CODE_ZONE - codeModified = 1; -# else - codeModified = 1; -# endif - storeLiteralbeforeFollowingAddress(backEnd, subject, mcpc); - return isYoungObject(subject); -} - - -/* Remap all object references in the closed PIC. Answer if any references - are young. - Set codeModified if any modifications are made. */ - - /* Cogit>>#followMethodReferencesInClosedPIC: */ -static sqInt NoDbgRegParms -followMethodReferencesInClosedPIC(CogMethod *cPIC) -{ - sqInt i; - sqInt pc; - sqInt refersToYoung; - - - /* first we check the potential method oop load at the beginning of the CPIC */ - pc = addressOfEndOfCaseinCPIC(1, cPIC); - - /* We find the end address of the cPICNumCases'th case and can then just step forward by the case size thereafter */ - refersToYoung = followMaybeObjRefInClosedPICAt(pc - (jumpLongByteSize(backEnd))); - - /* Next we check the potential potential method oop load for each case. */ - pc = addressOfEndOfCaseinCPIC((cPIC->cPICNumCases), cPIC); - for (i = 2; i <= ((cPIC->cPICNumCases)); i += 1) { - if (followMaybeObjRefInClosedPICAt((pc - (jumpLongConditionalByteSize(backEnd))) - (cmpC32RTempByteSize(backEnd)))) { - refersToYoung = 1; - } - pc += cPICCaseSize; - } - return refersToYoung; -} - /* To avoid runtime checks on literal variable and literal accesses in == and ~~, @@ -13263,8 +13180,11 @@ isPCMappedAnnotation(sqInt annotation) return annotation >= HasBytecodePC; } + +/* Useful for debugging. Marked so the code generator won't delete it. */ + /* Cogit>>#isPCWithinMethodZone: */ -sqInt +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address) { return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (freeStart()))); @@ -13832,8 +13752,8 @@ mapObjectReferencesInMachineCodeForYoungGC(void) else { assert((cogMethodDoesntLookKosher(cogMethod)) == 0); if ((cogMethod->cmRefersToYoung)) { - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); if (!zoneIsWritable) { /* begin ensureWritableCodeZone */ zoneIsWritable = 1; @@ -13957,9 +13877,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) if ((((cogMethod->cmType)) >= CMMethod) && (isMarked((cogMethod->methodObject)))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -14000,9 +13920,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector))))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -14106,7 +14026,7 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) } if (firstVisit) { /* begin markLiteralsAndUnlinkUnmarkedSendsIn: */ - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); assert(isMarked((cogMethod->methodObject))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); /* begin maybeMarkIRCsIn: */ @@ -14160,9 +14080,9 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) freeMethod(cogMethod); return 1; } - assert((isCMMethodEtAl(cogMethod)) - || ((isCMClosedPIC(cogMethod)) - || (isCMOpenPIC(cogMethod)))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || ((isCMClosedPIC(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod))))); return 0; } @@ -14184,8 +14104,8 @@ markAndTraceOrFreePICTargetin(sqInt entryPoint, CogMethod *cPIC) return 0; } targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); return markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)cPIC))); } @@ -15021,6 +14941,9 @@ picInterpretAbortOffset(void) return (interpretOffset()) - ((pushLinkRegisterByteSize(backEnd)) + (callInstructionByteSize(backEnd))); } + +/* useful for debugging */ + /* Cogit>>#printCogMethodFor: */ void printCogMethodFor(void *address) @@ -15044,6 +14967,9 @@ printCogMethodFor(void *address) } } + +/* useful for debugging */ + /* Cogit>>#printTrampolineTable */ void printTrampolineTable(void) @@ -15148,9 +15074,9 @@ relocateCallsAndSelfReferencesInMethod(CogMethod *cogMethod) refDelta = (cogMethod->objectHeader); callDelta = refDelta; - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); - assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(cogMethod) + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); + assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(((CogBlockMethod *) cogMethod)) ? methodAbortTrampolineFor((cogMethod->cmNumArgs)) : picAbortTrampolineFor((cogMethod->cmNumArgs))))); relocateCallBeforeReturnPCby(backEnd, (((sqInt)cogMethod)) + missOffset, -callDelta); @@ -15214,7 +15140,7 @@ relocateCallsInClosedPIC(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); if (i == 1) { relocateJumpLongBeforeFollowingAddressby(backEnd, pc, -(callDelta - ((targetMethod->objectHeader)))); } @@ -15604,13 +15530,6 @@ scanForCleanBlocks(void) return numCleanBlocks; } - /* Cogit>>#setBreakMethod: */ -void -setBreakMethod(sqInt anObj) -{ - breakMethod = anObj; -} - /* If a method is compiled to machine code via a block entry it won't have a selector. A subsequent send can find the method and hence fill in the @@ -15623,7 +15542,7 @@ void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop) { compilationBreakpointisMNUCase(aSelectorOop, 0); - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ ((((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)))->selector = aSelectorOop); if (isYoung(aSelectorOop)) { @@ -16476,7 +16395,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) while (cogMethod < (limitZony())) { if (!(((cogMethod->cmType)) == CMFree)) { if ((cogMethod->cpicHasMNUCaseOrCMIsFullBlock)) { - assert(isCMClosedPIC(cogMethod)); + assert(isCMClosedPIC(((CogBlockMethod *) cogMethod))); freeMethod(cogMethod); mustScanAndUnlink = 1; } @@ -16552,7 +16471,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) /* Unlink all sends in cog methods to free methods and/or pics. */ /* Cogit>>#unlinkSendsToFree */ -void +static void unlinkSendsToFree(void) { sqInt annotation; @@ -16851,9 +16770,9 @@ counters(CogMethod * self_in_counters) static void NoDbgRegParms addToOpenPICList(CogMethod *anOpenPIC) { - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); assert((openPICList == null) - || (isCMOpenPIC(openPICList))); + || (isCMOpenPIC(((CogBlockMethod *) openPICList)))); assertValidDualZoneWriteAddress(anOpenPIC); (anOpenPIC->nextOpenPIC = ((usqInt)openPICList)); openPICList = ((CogMethod *) ((((usqInt)anOpenPIC)) - (getCodeToDataDelta()))); @@ -16863,10 +16782,10 @@ addToOpenPICList(CogMethod *anOpenPIC) static void NoDbgRegParms addToUnpairedMethodList(CogMethod *aCogMethod) { - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); assert((noAssertMethodClassAssociationOf((aCogMethod->methodObject))) == (nilObject())); assert((unpairedMethodList == null) - || (isCMMethodEtAl(((CogMethod *) unpairedMethodList)))); + || (isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) unpairedMethodList)))))); assertValidDualZoneWriteAddress(aCogMethod); (aCogMethod->nextMethodOrIRCs = unpairedMethodList); unpairedMethodList = (((usqInt)aCogMethod)) - (getCodeToDataDelta()); @@ -17080,7 +16999,7 @@ findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { cogMethod = ((CogMethod *) unpairedMethodList); while (cogMethod != null) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if ((((cogMethod->selector)) == aSelectorOop) && (((cogMethod->methodObject)) == aMethodObj)) { return cogMethod; @@ -17112,7 +17031,7 @@ freeMethod(CogMethod *cogMethod) usqInt maybeIRCs; CogMethod *writableMethod; - assert(!((isCMFree(cogMethod)))); + assert(!((isCMFree(((CogBlockMethod *) cogMethod))))); assert((cogMethodDoesntLookKosher(cogMethod)) == 0); /* begin ensureWritableCodeZone */ if (((cogMethod->cmType)) >= CMMethod) { @@ -17393,6 +17312,9 @@ planCompaction(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethods */ void printCogMethods(void) @@ -17455,6 +17377,9 @@ printCogMethods(void) cr(); } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsOfType: */ void printCogMethodsOfType(sqInt cmType) @@ -17471,6 +17396,9 @@ printCogMethodsOfType(sqInt cmType) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithMethod: */ void printCogMethodsWithMethod(sqInt methodOop) @@ -17488,6 +17416,9 @@ printCogMethodsWithMethod(sqInt methodOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithPrimitive: */ void printCogMethodsWithPrimitive(sqInt primIdx) @@ -17505,6 +17436,9 @@ printCogMethodsWithPrimitive(sqInt primIdx) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithSelector: */ void printCogMethodsWithSelector(sqInt selectorOop) @@ -17522,6 +17456,9 @@ printCogMethodsWithSelector(sqInt selectorOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogYoungReferrers */ void printCogYoungReferrers(void) @@ -17547,6 +17484,9 @@ printCogYoungReferrers(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printOpenPICList */ sqInt printOpenPICList(void) @@ -17566,7 +17506,7 @@ printOpenPICList(void) } /* CogMethodZone>>#pruneYoungReferrers */ -sqInt +static sqInt pruneYoungReferrers(void) { usqInt dest; @@ -17684,13 +17624,13 @@ removeFromOpenPICList(CogMethod *anOpenPIC) { CogMethod *prevPIC; - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); if (!openPICList) { return null; } - assert((isCMOpenPIC(openPICList)) + assert((isCMOpenPIC(((CogBlockMethod *) openPICList))) && ((((openPICList->nextOpenPIC)) == null) - || (isCMOpenPIC(((CogMethod *) ((openPICList->nextOpenPIC))))))); + || (isCMOpenPIC(((CogBlockMethod *) (((CogMethod *) ((openPICList->nextOpenPIC))))))))); if (anOpenPIC == openPICList) { /* N.B. Use self rather than coInterpreter to avoid attempting to cast nil. @@ -17701,7 +17641,7 @@ removeFromOpenPICList(CogMethod *anOpenPIC) prevPIC = openPICList; do { assert((prevPIC != null) - && (isCMOpenPIC(prevPIC))); + && (isCMOpenPIC(((CogBlockMethod *) prevPIC)))); if (((prevPIC->nextOpenPIC)) == (((usqInt)anOpenPIC))) { ((((CogMethod *) ((((usqInt)prevPIC)) + codeToDataDelta)))->nextOpenPIC = (anOpenPIC->nextOpenPIC)); return null; @@ -17717,7 +17657,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) { CogMethod *prevMethod; - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); if ((((usqInt)aCogMethod)) == unpairedMethodList) { unpairedMethodList = (aCogMethod->nextMethodOrIRCs); return null; @@ -17725,7 +17665,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) prevMethod = ((CogMethod *) unpairedMethodList); while (prevMethod != null) { assert((prevMethod != null) - && (isCMMethodEtAl(prevMethod))); + && (isCMMethodEtAl(((CogBlockMethod *) prevMethod)))); if (((prevMethod->nextMethodOrIRCs)) == (((usqInt)aCogMethod))) { (prevMethod->nextMethodOrIRCs = (aCogMethod->nextMethodOrIRCs)); return null; @@ -17783,11 +17723,8 @@ voidYoungReferrersPostTenureAll(void) youngReferrers = limitAddress; } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CogMethodZone>>#whereIsMaybeCodeThing: */ -EXPORT(char *) +char * whereIsMaybeCodeThing(sqInt anOop) { if (oopisGreaterThanOrEqualToandLessThan(anOop, codeBase, limitAddress)) { diff --git a/src/spur32.cog.newspeak/cogitIA32.c b/src/spur32.cog.newspeak/cogitIA32.c index 4cc1683b5d..15d6f3c072 100644 --- a/src/spur32.cog.newspeak/cogitIA32.c +++ b/src/spur32.cog.newspeak/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -604,10 +604,10 @@ static AbstractInstruction * NoDbgRegParms CallNewspeakSend(sqInt callTarget); static AbstractInstruction * NoDbgRegParms CallRTregistersToBeSavedMask(sqInt callTarget, sqInt registersToBeSaved); static AbstractInstruction * NoDbgRegParms gCall(sqInt callTarget); static AbstractInstruction * NoDbgRegParms gCmpCqR(sqInt quickConstant, sqInt reg); -extern void callCogCodePopReceiver(void); -extern void callCogCodePopReceiverAndClassRegs(void); +static void callCogCodePopReceiver(void); +static void callCogCodePopReceiverAndClassRegs(void); static sqInt NoDbgRegParms ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver); -extern void ceFree(void *pointer); +static void NoDbgRegParms ceFree(void *pointer); static void* NoDbgRegParms ceMalloc(size_t size); static sqInt NoDbgRegParms ceSICMiss(sqInt receiver); static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod); @@ -623,7 +623,7 @@ extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); static void NoDbgRegParms cogExtendPICCaseNMethodtagisMNUCase(CogMethod *cPIC, sqInt caseNMethod, sqInt caseNTag, sqInt isMNUCase); extern void cogitPostGCAction(sqInt gcMode); -extern sqInt cogMethodDoesntLookKosher(CogMethod *cogMethod); +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod); extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs); static CogMethod * NoDbgRegParms cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs); static CogMethod * NoDbgRegParms cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt numArgs, CogMethod *case0CogMethod, sqInt case1MethodOrNil, sqInt case1Tag, sqInt isMNUCase); @@ -658,7 +658,7 @@ static AbstractInstruction * NoDbgRegParms gDivRRQuoRem(sqInt rDivisor, sqInt rD extern sqInt defaultCogCodeSize(void); static sqInt NoDbgRegParms deltaToSkipPrimAndErrorStoreInheader(sqInt aMethodObj, sqInt aMethodHeader); static sqInt NoDbgRegParms endPCOf(sqInt aMethod); -extern void enterCogCodePopReceiver(void); +static void enterCogCodePopReceiver(void); static sqInt NoDbgRegParms entryPointTagIsSelector(sqInt entryPoint); static sqInt NoDbgRegParms expectedClosedPICPrototype(CogMethod *cPIC); static sqInt extABytecode(void); @@ -676,9 +676,6 @@ static BytecodeFixup * NoDbgRegParms fixupAt(sqInt fixupPC); extern void flagCogMethodForBecome(CogMethod *cogMethod); static void NoDbgRegParms followForwardedLiteralsImplementationIn(CogMethod *cogMethod); extern void followForwardedLiteralsIn(CogMethod *cogMethod); -extern void followForwardedMethods(void); -static sqInt NoDbgRegParms followMaybeObjRefInClosedPICAt(sqInt mcpc); -static sqInt NoDbgRegParms followMethodReferencesInClosedPIC(CogMethod *cPIC); extern void followMovableLiteralsAndUpdateYoungReferrers(void); extern void freeBecomeFlaggedMethods(void); extern void freeCogMethod(CogMethod *cogMethod); @@ -720,7 +717,7 @@ static sqInt initialMethodUsageCount(void); static sqInt initialOpenPICUsageCount(void); static sqInt NoDbgRegParms inverseBranchFor(sqInt opcode); static sqInt NoDbgRegParms isPCMappedAnnotation(sqInt annotation); -extern sqInt isPCWithinMethodZone(void *address); +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address); extern sqInt isSendReturnPC(sqInt retpc); static AbstractInstruction * NoDbgRegParms gJumpFPEqual(void *jumpTarget); static AbstractInstruction * NoDbgRegParms gJumpFPGreaterOrEqual(void *jumpTarget); @@ -795,7 +792,6 @@ static sqInt NoDbgRegParms remapMaybeObjRefInClosedPICAt(sqInt mcpc); static void NoDbgRegParms rewriteCPICCaseAttagobjReftarget(sqInt followingAddress, sqInt newTag, sqInt newObjRef, sqInt newTarget); static AbstractInstruction * NoDbgRegParms gSubRRR(sqInt subReg, sqInt fromReg, sqInt destReg); static sqInt scanForCleanBlocks(void); -extern void setBreakMethod(sqInt anObj); extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop); static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC); static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc); @@ -816,7 +812,7 @@ static sqInt NoDbgRegParms unlinkIfLinkedSendpcignored(sqInt annotation, char *m static sqInt NoDbgRegParms unlinkIfLinkedSendpcto(sqInt annotation, char *mcpc, CogMethod *theCogMethod); extern void unlinkSendsLinkedForInvalidClasses(void); extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector); -extern void unlinkSendsToFree(void); +static void unlinkSendsToFree(void); extern void unlinkSendsToMethodsSuchThatAndFreeIf(sqInt (*criterion)(CogMethod *), sqInt freeIfTrue); extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue); extern void voidCogCompiledCode(void); @@ -850,7 +846,7 @@ extern void printCogMethodsWithPrimitive(sqInt primIdx); extern void printCogMethodsWithSelector(sqInt selectorOop); extern void printCogYoungReferrers(void); extern sqInt printOpenPICList(void); -extern sqInt pruneYoungReferrers(void); +static sqInt pruneYoungReferrers(void); static sqInt relocateAndPruneYoungReferrers(void); static sqInt relocateMethodsPreCompaction(void); static sqInt NoDbgRegParms removeFromOpenPICList(CogMethod *anOpenPIC); @@ -859,7 +855,7 @@ static sqInt NoDbgRegParms roundUpLength(sqInt numBytes); static void voidOpenPICList(void); static void voidUnpairedMethodList(void); static void voidYoungReferrersPostTenureAll(void); -EXPORT(char *) whereIsMaybeCodeThing(sqInt anOop); +extern char * whereIsMaybeCodeThing(sqInt anOop); static sqInt NoDbgRegParms checkValidObjectReference(sqInt anOop); static AbstractInstruction * NoDbgRegParms genCmpClassFloatCompactIndexR(sqInt reg); static AbstractInstruction * NoDbgRegParms genCmpClassMethodContextCompactIndexR(sqInt reg); @@ -8211,12 +8207,11 @@ gCmpCqR(sqInt quickConstant, sqInt reg) } -/* This is a static version of ceCallCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverReg for break-pointing + when debugging in C. Marked so the code generator won't delete it. */ /* Cogit>>#callCogCodePopReceiver */ -void +static void callCogCodePopReceiver(void) { realCECallCogCodePopReceiverReg(); @@ -8226,12 +8221,12 @@ callCogCodePopReceiver(void) } -/* This is a static version of ceCallCogCodePopReceiverAndClassRegs - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverAndClassRegs for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#callCogCodePopReceiverAndClassRegs */ -void +static void callCogCodePopReceiverAndClassRegs(void) { realCECallCogCodePopReceiverAndClassRegs(); @@ -8245,6 +8240,7 @@ callCogCodePopReceiverAndClassRegs(void) receiver args sp=> sender return address */ +/* Marked so the code generator won't delete it. */ /* Cogit>>#ceCPICMiss:receiver: */ static sqInt NoDbgRegParms @@ -8327,13 +8323,23 @@ ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver) return null; } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceFree: */ -void +static void NoDbgRegParms ceFree(void *pointer) { free(pointer); } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceMalloc: */ static void* NoDbgRegParms ceMalloc(size_t size) @@ -8353,7 +8359,9 @@ ceMalloc(size_t size) sp=> ceMethodAbort call return address So we can find the method that did the failing entry check at ceMethodAbort call return address - missOffset - and we can find the send site from the outer return address. */ + and we can find the send site from the outer return address. + Invoked from a trampoline. Marked so the code generator won't delete + it. */ /* Cogit>>#ceSICMiss: */ static sqInt NoDbgRegParms @@ -8526,13 +8534,13 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * entryPoint = (nsSendCache->target); if (entryPoint != 0) { nsTargetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - if (!(asserta(isCMMethodEtAl(nsTargetMethod)))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) nsTargetMethod))))) { return 12; } } } if (annotation >= IsSendCall) { - if (!(asserta(isCMMethodEtAl(((CogMethod *) cogMethod))))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) cogMethod))))))) { return 3; } /* begin entryCacheTagAndCouldBeObjectAt:annotation:into: */ @@ -8608,9 +8616,9 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * } } targetMethod1 = ((CogMethod *) (entryPoint - offset1)); - if (!(asserta((isCMMethodEtAl(targetMethod1)) - || ((isCMClosedPIC(targetMethod1)) - || (isCMOpenPIC(targetMethod1)))))) { + if (!(asserta((isCMMethodEtAl(((CogBlockMethod *) targetMethod1))) + || ((isCMClosedPIC(((CogBlockMethod *) targetMethod1))) + || (isCMOpenPIC(((CogBlockMethod *) targetMethod1))))))) { return 10; } } @@ -8977,6 +8985,11 @@ codeEntryNameFor(char *address) return null; } + +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ + /* Cogit>>#cogCodeBase */ sqInt cogCodeBase(void) @@ -9169,7 +9182,7 @@ cogitPostGCAction(sqInt gcMode) the type. Answer 0 if it is ok, otherwise answer a code for the error. */ /* Cogit>>#cogMethodDoesntLookKosher: */ -sqInt +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod) { if (((((cogMethod->blockSize)) & (BytesPerWord - 1)) != 0) @@ -9292,7 +9305,7 @@ cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = 1; (writablePIC->cPICNumCases = 1); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 1); @@ -9370,7 +9383,7 @@ cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs) (pic->cPICNumCases = 0); (pic->blockEntryOffset = 0); flushICacheFromto(backEnd, (((usqInt)pic)) - codeToDataDelta, ((((usqInt)pic)) - codeToDataDelta) + openPICSize); - assert(isCMOpenPIC(pic)); + assert(isCMOpenPIC(((CogBlockMethod *) pic))); assert(((pic->selector)) == selector); assert(((pic->cmNumArgs)) == numArgs); assert((callTargetFromReturnAddress(backEnd, ((((sqInt)pic)) - codeToDataDelta) + missOffset)) == (picAbortTrampolineFor(numArgs))); @@ -9429,7 +9442,7 @@ cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt nu ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = isMNUCase; (writablePIC->cPICNumCases = 2); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 2); @@ -10509,8 +10522,8 @@ cPICCompactAndIsNowEmpty(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { if (i == 1) { return 1; @@ -10604,8 +10617,8 @@ cPICHasFreedTargets(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { return 1; } @@ -10701,7 +10714,7 @@ createCPICData(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); target = (targetMethod->methodObject); } storePointerUncheckedofObjectwithValue((i * 2) - 1, picData, class); @@ -10806,12 +10819,12 @@ endPCOf(sqInt aMethod) } -/* This is a static version of ceEnterCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceEnterCogCodePopReceiverReg for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#enterCogCodePopReceiver */ -void +static void enterCogCodePopReceiver(void) { realCEEnterCogCodePopReceiverReg(); @@ -11111,7 +11124,7 @@ findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if (startbcpc == (startPCOfMethodHeader((cogMethod->methodHeader)))) { return ((CogBlockMethod *) cogMethod); } @@ -11168,7 +11181,7 @@ fixupAt(sqInt fixupPC) void flagCogMethodForBecome(CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ ((((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)))->cmType = CMMethodFlaggedForBecome); } @@ -11186,7 +11199,7 @@ followForwardedLiteralsImplementationIn(CogMethod *cogMethod) sqInt result; CogMethod *writableCogMethod; - assert((!(isCMMethodEtAl(cogMethod))) + assert((!(isCMMethodEtAl(((CogBlockMethod *) cogMethod)))) || (!(isForwarded((cogMethod->methodObject))))); writableCogMethod = ((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)); hasYoungObj = isYoung((cogMethod->methodObject)); @@ -11247,102 +11260,6 @@ followForwardedLiteralsIn(CogMethod *cogMethod) /* begin ensureExecutableCodeZone */ } - /* Cogit>>#followForwardedMethods */ -void -followForwardedMethods(void) -{ - CogMethod *cogMethod; - sqInt freedPIC; - - /* begin ensureWritableCodeZone */ - freedPIC = 0; - cogMethod = ((CogMethod *) methodZoneBase); - while (cogMethod < (limitZony())) { - if (((cogMethod->cmType)) >= CMMethod) { - if (isForwarded((cogMethod->methodObject))) { - (cogMethod->methodObject = followForwarded((cogMethod->methodObject))); - if (isYoungObject((cogMethod->methodObject))) { - ensureInYoungReferrers(cogMethod); - } - } - } - if (((cogMethod->cmType)) == CMClosedPIC) { - if (followMethodReferencesInClosedPIC(cogMethod)) { - freedPIC = 1; - freeMethod(cogMethod); - } - } - cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); - } - if (freedPIC) { - unlinkSendsToFree(); - } - /* begin ensureExecutableCodeZone */ -} - - -/* Follow a potential object reference from a closed PIC. - This may be a method reference or null. - Answer if the followed literal is young. - 'mcpc' refers to the jump/branch instruction at the end of - each cpic case */ - - /* Cogit>>#followMaybeObjRefInClosedPICAt: */ -static sqInt NoDbgRegParms -followMaybeObjRefInClosedPICAt(sqInt mcpc) -{ - sqInt object; - sqInt subject; - - object = literalBeforeFollowingAddress(backEnd, mcpc); - if (!(couldBeObject(object))) { - return 0; - } - if (!(isForwarded(object))) { - return isYoungObject(object); - } - subject = followForwarded(object); - /* begin setCodeModified */ -# if DUAL_MAPPED_CODE_ZONE - codeModified = 1; -# else - codeModified = 1; -# endif - storeLiteralbeforeFollowingAddress(backEnd, subject, mcpc); - return isYoungObject(subject); -} - - -/* Remap all object references in the closed PIC. Answer if any references - are young. - Set codeModified if any modifications are made. */ - - /* Cogit>>#followMethodReferencesInClosedPIC: */ -static sqInt NoDbgRegParms -followMethodReferencesInClosedPIC(CogMethod *cPIC) -{ - sqInt i; - sqInt pc; - sqInt refersToYoung; - - - /* first we check the potential method oop load at the beginning of the CPIC */ - pc = addressOfEndOfCaseinCPIC(1, cPIC); - - /* We find the end address of the cPICNumCases'th case and can then just step forward by the case size thereafter */ - refersToYoung = followMaybeObjRefInClosedPICAt(pc - (jumpLongByteSize(backEnd))); - - /* Next we check the potential potential method oop load for each case. */ - pc = addressOfEndOfCaseinCPIC((cPIC->cPICNumCases), cPIC); - for (i = 2; i <= ((cPIC->cPICNumCases)); i += 1) { - if (followMaybeObjRefInClosedPICAt((pc - (jumpLongConditionalByteSize(backEnd))) - (cmpC32RTempByteSize(backEnd)))) { - refersToYoung = 1; - } - pc += cPICCaseSize; - } - return refersToYoung; -} - /* To avoid runtime checks on literal variable and literal accesses in == and ~~, @@ -12770,8 +12687,11 @@ isPCMappedAnnotation(sqInt annotation) return annotation >= HasBytecodePC; } + +/* Useful for debugging. Marked so the code generator won't delete it. */ + /* Cogit>>#isPCWithinMethodZone: */ -sqInt +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address) { return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (freeStart()))); @@ -13340,8 +13260,8 @@ mapObjectReferencesInMachineCodeForYoungGC(void) else { assert((cogMethodDoesntLookKosher(cogMethod)) == 0); if ((cogMethod->cmRefersToYoung)) { - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); if (!zoneIsWritable) { /* begin ensureWritableCodeZone */ zoneIsWritable = 1; @@ -13465,9 +13385,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) if ((((cogMethod->cmType)) >= CMMethod) && (isMarked((cogMethod->methodObject)))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -13508,9 +13428,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector))))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -13614,7 +13534,7 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) } if (firstVisit) { /* begin markLiteralsAndUnlinkUnmarkedSendsIn: */ - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); assert(isMarked((cogMethod->methodObject))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); /* begin maybeMarkIRCsIn: */ @@ -13668,9 +13588,9 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) freeMethod(cogMethod); return 1; } - assert((isCMMethodEtAl(cogMethod)) - || ((isCMClosedPIC(cogMethod)) - || (isCMOpenPIC(cogMethod)))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || ((isCMClosedPIC(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod))))); return 0; } @@ -13692,8 +13612,8 @@ markAndTraceOrFreePICTargetin(sqInt entryPoint, CogMethod *cPIC) return 0; } targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); return markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)cPIC))); } @@ -14510,6 +14430,9 @@ picInterpretAbortOffset(void) return (interpretOffset()) - (callInstructionByteSize(backEnd)); } + +/* useful for debugging */ + /* Cogit>>#printCogMethodFor: */ void printCogMethodFor(void *address) @@ -14533,6 +14456,9 @@ printCogMethodFor(void *address) } } + +/* useful for debugging */ + /* Cogit>>#printTrampolineTable */ void printTrampolineTable(void) @@ -14643,9 +14569,9 @@ relocateCallsAndSelfReferencesInMethod(CogMethod *cogMethod) refDelta = (cogMethod->objectHeader); callDelta = refDelta; - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); - assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(cogMethod) + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); + assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(((CogBlockMethod *) cogMethod)) ? methodAbortTrampolineFor((cogMethod->cmNumArgs)) : picAbortTrampolineFor((cogMethod->cmNumArgs))))); relocateCallBeforeReturnPCby(backEnd, (((sqInt)cogMethod)) + missOffset, -callDelta); @@ -14710,7 +14636,7 @@ relocateCallsInClosedPIC(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); if (i == 1) { relocateJumpLongBeforeFollowingAddressby(backEnd, pc, -(callDelta - ((targetMethod->objectHeader)))); } @@ -15094,13 +15020,6 @@ scanForCleanBlocks(void) return numCleanBlocks; } - /* Cogit>>#setBreakMethod: */ -void -setBreakMethod(sqInt anObj) -{ - breakMethod = anObj; -} - /* If a method is compiled to machine code via a block entry it won't have a selector. A subsequent send can find the method and hence fill in the @@ -15113,7 +15032,7 @@ void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop) { compilationBreakpointisMNUCase(aSelectorOop, 0); - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ ((((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)))->selector = aSelectorOop); if (isYoung(aSelectorOop)) { @@ -15966,7 +15885,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) while (cogMethod < (limitZony())) { if (!(((cogMethod->cmType)) == CMFree)) { if ((cogMethod->cpicHasMNUCaseOrCMIsFullBlock)) { - assert(isCMClosedPIC(cogMethod)); + assert(isCMClosedPIC(((CogBlockMethod *) cogMethod))); freeMethod(cogMethod); mustScanAndUnlink = 1; } @@ -16042,7 +15961,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) /* Unlink all sends in cog methods to free methods and/or pics. */ /* Cogit>>#unlinkSendsToFree */ -void +static void unlinkSendsToFree(void) { sqInt annotation; @@ -16328,9 +16247,9 @@ counters(CogMethod * self_in_counters) static void NoDbgRegParms addToOpenPICList(CogMethod *anOpenPIC) { - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); assert((openPICList == null) - || (isCMOpenPIC(openPICList))); + || (isCMOpenPIC(((CogBlockMethod *) openPICList)))); assertValidDualZoneWriteAddress(anOpenPIC); (anOpenPIC->nextOpenPIC = ((usqInt)openPICList)); openPICList = ((CogMethod *) ((((usqInt)anOpenPIC)) - (getCodeToDataDelta()))); @@ -16340,10 +16259,10 @@ addToOpenPICList(CogMethod *anOpenPIC) static void NoDbgRegParms addToUnpairedMethodList(CogMethod *aCogMethod) { - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); assert((noAssertMethodClassAssociationOf((aCogMethod->methodObject))) == (nilObject())); assert((unpairedMethodList == null) - || (isCMMethodEtAl(((CogMethod *) unpairedMethodList)))); + || (isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) unpairedMethodList)))))); assertValidDualZoneWriteAddress(aCogMethod); (aCogMethod->nextMethodOrIRCs = unpairedMethodList); unpairedMethodList = (((usqInt)aCogMethod)) - (getCodeToDataDelta()); @@ -16557,7 +16476,7 @@ findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { cogMethod = ((CogMethod *) unpairedMethodList); while (cogMethod != null) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if ((((cogMethod->selector)) == aSelectorOop) && (((cogMethod->methodObject)) == aMethodObj)) { return cogMethod; @@ -16589,7 +16508,7 @@ freeMethod(CogMethod *cogMethod) usqInt maybeIRCs; CogMethod *writableMethod; - assert(!((isCMFree(cogMethod)))); + assert(!((isCMFree(((CogBlockMethod *) cogMethod))))); assert((cogMethodDoesntLookKosher(cogMethod)) == 0); /* begin ensureWritableCodeZone */ if (((cogMethod->cmType)) >= CMMethod) { @@ -16870,6 +16789,9 @@ planCompaction(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethods */ void printCogMethods(void) @@ -16932,6 +16854,9 @@ printCogMethods(void) cr(); } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsOfType: */ void printCogMethodsOfType(sqInt cmType) @@ -16948,6 +16873,9 @@ printCogMethodsOfType(sqInt cmType) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithMethod: */ void printCogMethodsWithMethod(sqInt methodOop) @@ -16965,6 +16893,9 @@ printCogMethodsWithMethod(sqInt methodOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithPrimitive: */ void printCogMethodsWithPrimitive(sqInt primIdx) @@ -16982,6 +16913,9 @@ printCogMethodsWithPrimitive(sqInt primIdx) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithSelector: */ void printCogMethodsWithSelector(sqInt selectorOop) @@ -16999,6 +16933,9 @@ printCogMethodsWithSelector(sqInt selectorOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogYoungReferrers */ void printCogYoungReferrers(void) @@ -17024,6 +16961,9 @@ printCogYoungReferrers(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printOpenPICList */ sqInt printOpenPICList(void) @@ -17043,7 +16983,7 @@ printOpenPICList(void) } /* CogMethodZone>>#pruneYoungReferrers */ -sqInt +static sqInt pruneYoungReferrers(void) { usqInt dest; @@ -17161,13 +17101,13 @@ removeFromOpenPICList(CogMethod *anOpenPIC) { CogMethod *prevPIC; - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); if (!openPICList) { return null; } - assert((isCMOpenPIC(openPICList)) + assert((isCMOpenPIC(((CogBlockMethod *) openPICList))) && ((((openPICList->nextOpenPIC)) == null) - || (isCMOpenPIC(((CogMethod *) ((openPICList->nextOpenPIC))))))); + || (isCMOpenPIC(((CogBlockMethod *) (((CogMethod *) ((openPICList->nextOpenPIC))))))))); if (anOpenPIC == openPICList) { /* N.B. Use self rather than coInterpreter to avoid attempting to cast nil. @@ -17178,7 +17118,7 @@ removeFromOpenPICList(CogMethod *anOpenPIC) prevPIC = openPICList; do { assert((prevPIC != null) - && (isCMOpenPIC(prevPIC))); + && (isCMOpenPIC(((CogBlockMethod *) prevPIC)))); if (((prevPIC->nextOpenPIC)) == (((usqInt)anOpenPIC))) { ((((CogMethod *) ((((usqInt)prevPIC)) + codeToDataDelta)))->nextOpenPIC = (anOpenPIC->nextOpenPIC)); return null; @@ -17194,7 +17134,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) { CogMethod *prevMethod; - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); if ((((usqInt)aCogMethod)) == unpairedMethodList) { unpairedMethodList = (aCogMethod->nextMethodOrIRCs); return null; @@ -17202,7 +17142,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) prevMethod = ((CogMethod *) unpairedMethodList); while (prevMethod != null) { assert((prevMethod != null) - && (isCMMethodEtAl(prevMethod))); + && (isCMMethodEtAl(((CogBlockMethod *) prevMethod)))); if (((prevMethod->nextMethodOrIRCs)) == (((usqInt)aCogMethod))) { (prevMethod->nextMethodOrIRCs = (aCogMethod->nextMethodOrIRCs)); return null; @@ -17260,11 +17200,8 @@ voidYoungReferrersPostTenureAll(void) youngReferrers = limitAddress; } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CogMethodZone>>#whereIsMaybeCodeThing: */ -EXPORT(char *) +char * whereIsMaybeCodeThing(sqInt anOop) { if (oopisGreaterThanOrEqualToandLessThan(anOop, codeBase, limitAddress)) { diff --git a/src/spur32.cog.newspeak/cointerp.c b/src/spur32.cog.newspeak/cointerp.c index f0dac61a84..4c66147b5d 100644 --- a/src/spur32.cog.newspeak/cointerp.c +++ b/src/spur32.cog.newspeak/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - CoInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CoInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -170,7 +170,6 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define GCCheckShorten 64 #define GCModeBecome 8 #define GCModeFull 1 -#define GCModeIncremental 4 #define GCModeNewSpace 2 #define HasBeenReturnedFromMCPC -1 #define HasBeenReturnedFromMCPCOop 0xFFFFFFFFU @@ -429,7 +428,6 @@ static void NoDbgRegParms addNewMethodToCache(sqInt classObj); extern usqInt argumentCountAddress(void); static CogMethod * NoDbgRegParms asCogHomeMethod(CogBlockMethod *aCogMethod); static void NoDbgRegParms assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln); -extern void assertValidMachineCodeFrame(sqInt instrPtr); static sqInt NoDbgRegParms assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln); static void NoDbgRegParms assertValidStackedInstructionPointers(sqInt ln); static void NoDbgRegParms attemptToSwitchToMachineCode(sqInt bcpc); @@ -456,7 +454,7 @@ extern sqInt ceNonLocalReturn(sqInt returnValue); extern void ceOuterSendreceiver(sqInt cacheAddress, sqInt methodReceiver); extern void ceReapAndResetErrorCodeFor(CogMethod *cogMethod); extern void ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver); -extern sqInt ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); +static sqInt NoDbgRegParms ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); extern sqInt ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC); extern sqInt ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize); extern sqInt ceSendMustBeBoolean(sqInt anObject); @@ -494,7 +492,7 @@ static sqInt NoDbgRegParms divorceAFrameIfin(sqInt (*criterion)(char *fp), Stack static sqInt NoDbgRegParms divorceAllFramesSuchThat(sqInt (*criterion)(char *fp)); static sqInt NoDbgRegParms divorceAMachineCodeFrameWithCogMethodin(CogMethod *cogMethod, StackPage *aStackPage); extern void dumpPrimTraceLog(void); -EXPORT(void) dumpPrimTraceLogOn(FILE *aStdioStream); +extern void dumpPrimTraceLogOn(FILE *aStdioStream); static void NoDbgRegParms ensureAllContextsHaveBytecodePCsIf(sqInt (*criterion)(sqInt methodOop)); static void NoDbgRegParms ensureContextHasBytecodePC(sqInt aContext); static void NoDbgRegParms ensureContextIsExecutionSafeAfterAssignToStackPointer(sqInt aContext); @@ -524,7 +522,6 @@ extern usqInt framePointerAddress(void); static sqInt NoDbgRegParms frameReceiver(char *theFP); extern void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto(sqInt methodObj, sqInt primitiveIndex, sqInt *flagsPtr))(void); extern sqInt getCurrentBytecode(void); -extern char * getFramePointer(void); static sqInt getImageHeaderFlags(void); static sqInt NoDbgRegParms handleForwardedSendFaultForReceiverstackDelta(sqInt forwardedReceiver, sqInt stackDelta); static sqInt NoDbgRegParms handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage); @@ -534,7 +531,6 @@ static usqInt NoDbgRegParms iframeSavedIP(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); extern usqInt instructionPointerAddress(void); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); -extern usqInt interpretAddress(void); static sqInt NeverInline interpreterAllocationReserveBytes(void); static sqInt interpretMethodFromMachineCode(void); extern sqInt isCogMethodReference(sqInt methodHeader); @@ -576,12 +572,10 @@ extern sqInt methodShouldBeCogged(sqInt aMethodObj); static sqInt NoDbgRegParms methodWithHeaderShouldBeCogged(sqInt methodHeader); static CogBlockMethod * NoDbgRegParms mframeCogMethod(char *theFP); extern CogMethod * mframeHomeMethodExport(void); -extern CogMethod * mframeHomeMethod(char *theFP); +static CogMethod * NoDbgRegParms mframeHomeMethod(char *theFP); static sqInt NoDbgRegParms mframeIsBlockActivation(char *theFP); static sqInt NoDbgRegParms mframeReceiver(char *theFP); static sqInt NeverInline minimumUnusedHeadroom(void); -extern sqInt mMethodClass(void); -extern void mnuCompilationBreakpointFor(sqInt selectorOop); static sqInt NoDbgRegParms mnuMethodOrNilFor(sqInt rcvr); static char * NoDbgRegParms moveFramesInthroughtoPage(StackPage *oldPage, char *theFP, StackPage *newPage); static sqInt NoDbgRegParms mustMapMachineCodePCcontext(sqInt theIP, sqInt aOnceMarriedContext); @@ -599,16 +593,15 @@ extern usqInt primFailCodeAddress(void); static void NoDbgRegParms primitiveBecomeReturn(sqInt ec); static void primitiveExecuteMethod(void); static void primitiveExecuteMethodArgsArray(void); -extern usqInt primitiveFailAddress(void); extern sqInt primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs); extern void * primTraceLogAddress(void); extern usqInt primTraceLogIndexAddress(void); -EXPORT(void) printCogMethod(CogMethod *cogMethod); +extern void printCogMethod(CogMethod *cogMethod); static void NoDbgRegParms printFrameFlagsForFP(char *theFP); static void NoDbgRegParms printFrameMethodFor(char *theFP); static void NoDbgRegParms printFrameThingatextra(char *name, char *address, sqInt extraValue); -EXPORT(sqInt) printFrameWithSP(char *theFP, char *theSP); -EXPORT(void) printMethodCacheFor(sqInt thing); +extern sqInt printFrameWithSP(char *theFP, char *theSP); +extern void printMethodCacheFor(sqInt thing); static sqInt NoDbgRegParms printPrimLogEntryAthasParameter(sqInt i, sqInt hasParameter); extern sqInt quickPrimitiveConstantFor(sqInt aQuickPrimitiveIndex); extern sqInt (*quickPrimitiveGeneratorFor(sqInt aQuickPrimitiveIndex))(void); @@ -619,13 +612,13 @@ extern size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredH extern sqInt recordFastCCallPrimTraceForMethod(sqInt aMethodObj); extern sqInt recordPrimTraceForMethod(sqInt aMethodObj); static void NeverInline reloadPrimitiveCalloutPointer(void); -EXPORT(void) reportMinimumUnusedHeadroom(void); -EXPORT(void) reportMinimumUnusedHeadroomOn(FILE *aStdioStream); +extern void reportMinimumUnusedHeadroom(void); +extern void reportMinimumUnusedHeadroomOn(FILE *aStdioStream); static sqInt NoDbgRegParms resumepreemptedYieldingIffrom(sqInt aProcess, sqInt yieldImplicitly, sqInt sourceCode); static sqInt NoDbgRegParms returnToExecutivepostContextSwitch(sqInt inInterpreter, sqInt switchedContext); static sqInt NoDbgRegParms returntoExecutive(sqInt returnValue, sqInt inInterpreter); static sqInt NoDbgRegParms roomToPushNArgs(sqInt n); -EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); +extern sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); static sqInt NoDbgRegParms shortPrintFrame(char *theFP); extern sqInt signed32BitIntegerFor(sqInt integerValue); extern int signed32BitValueOf(sqInt oop); @@ -647,7 +640,7 @@ static void NoDbgRegParms updateStateOfSpouseContextForFrameWithSP(char *theFP, extern sqInt validInstructionPointerinMethodframePointer(usqInt instrPointer, usqInt aMethod, char *fp); static sqInt NoDbgRegParms validStackPageBaseFrame(StackPage *aPage); static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); -EXPORT(char *) whereIs(sqInt anOop); +extern char * whereIs(sqInt anOop); static void NoDbgRegParms NeverInline widowOrForceToBytecodePC(sqInt ctxt); static sqInt NoDbgRegParms frameIsMarked(sqInt theFPInt); #if VMBenchmarks @@ -659,6 +652,9 @@ EXPORT(void) primitiveBenchmarkFollowForwardersOfReceiverAndTemporariesInStackZo #if VMBenchmarks EXPORT(sqInt) primitiveBenchmarkJITReceiver(void); #endif /* VMBenchmarks */ +#if VMBenchmarks +EXPORT(void) primitiveBenchmarkScavenge(void); +#endif /* VMBenchmarks */ static void primitiveClosureCopyWithCopiedValues(void); static void primitiveCollectCogCodeConstituents(void); static void primitiveContextXray(void); @@ -924,7 +920,7 @@ static sqInt NoDbgRegParms becomeEffectFlagsFor(sqInt objOop); extern void ceScheduleScavenge(void); static void clearLeakMapAndMapAccessibleObjects(void); extern void ensureNoForwardedLiteralsIn(sqInt aMethodObj); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern usqInt freeStartAddress(void); extern usqInt getScavengeThreshold(void); static sqLong NoDbgRegParms headerWhileForwardingOf(sqInt aCompiledMethodObjOop); @@ -952,9 +948,7 @@ static sqInt hasSixtyFourBitImmediates(void); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); static sqInt NoDbgRegParms initFreeChunkWithBytesat(usqLong numBytes, sqInt address); static void NoDbgRegParms initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt integerObjectOf(sqInt value); extern sqInt integerValueOf(sqInt oop); static sqInt NoDbgRegParms isFloatInstance(sqInt oop); @@ -1033,8 +1027,6 @@ extern void characterTable(void); extern usqInt characterValueOf(sqInt oop); static sqInt NoDbgRegParms cheapAddressCouldBeInHeap(sqInt address); extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); static sqInt checkHeapFreeSpaceIntegrity(void); static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt classIndicesShouldBeValid); extern sqInt checkOkayOop(usqInt oop); @@ -1078,13 +1070,13 @@ extern sqInt classWordArray(void); static void clearLeakMapAndMapAccessibleFreeSpace(void); static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning); extern sqInt cloneObject(sqInt objOop); -extern sqInt compactClassIndexOf(sqInt objOop); +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop); static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i); extern void countMarkedAndUnmarkdObjects(sqInt printFlags); static usqLong currentAllocatedBytes(void); extern sqInt displayObject(void); static void NoDbgRegParms doScavenge(sqInt tenuringCriterion); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); static void NoDbgRegParms emptyObjStack(sqInt objStack); static void NoDbgRegParms enableObjectEnumerationFrom(sqInt initialObject); @@ -1140,12 +1132,11 @@ static usqInt imageSegmentVersion(void); extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ extern void incrementalGC(void); -extern sqInt indexOfin(sqInt anElement, sqInt anObject); static void NoDbgRegParms inFreeTreeReplacewith(sqInt treeNode, sqInt newNode); static sqInt NoDbgRegParms initialInstanceOf(sqInt classObj); static void NeverInline initializeNewSpaceVariables(void); static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift); -EXPORT(void) inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); +extern void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); static void NoDbgRegParms NeverInline inPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag); extern sqInt instanceSizeOf(sqInt classObj); static sqInt NoDbgRegParms instantiateClass(sqInt classObj); @@ -1153,7 +1144,6 @@ extern sqInt instSpecOfClassFormat(sqInt classFormat); static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer); static void NoDbgRegParms invalidCompactClassError(const char *className); static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isArray(sqInt oop); static sqInt NoDbgRegParms isBridgeOrEnumerableObjectNoAssert(sqInt objOop); extern sqInt isBytes(sqInt oop); @@ -1191,7 +1181,7 @@ static sqInt NoDbgRegParms isMaybeFiredEphemeron(sqInt objOop); extern sqInt isNonImmediate(sqInt oop); static sqInt NoDbgRegParms isObjEphemeron(sqInt objOop); static sqInt NoDbgRegParms isObjImmutable(sqInt anOop); -extern sqInt isOldObject(sqInt objOop); +static sqInt NoDbgRegParms isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); extern sqInt isOopImmutable(sqInt oop); @@ -1199,12 +1189,11 @@ extern sqInt isOopMutable(sqInt oop); extern sqInt isPinned(sqInt objOop); extern sqInt isPointers(sqInt oop); static sqInt NoDbgRegParms isPureBitsFormat(sqInt format); -extern sqInt isReallyYoung(sqInt oop); static sqInt NoDbgRegParms isRemembered(sqInt objOop); static sqInt NoDbgRegParms isSegmentBridge(sqInt objOop); static sqInt NoDbgRegParms isSemaphoreOop(sqInt anOop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop); extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); static sqInt NoDbgRegParms isValidObjStackAt(sqInt objStackRootIndex); @@ -1225,20 +1214,18 @@ static sqInt NoDbgRegParms isonObjStack(sqInt oop, sqInt objStack); static sqInt NoDbgRegParms keyOfEphemeron(sqInt objOop); static sqInt NoDbgRegParms knownClassAtIndex(sqInt classIndex); static sqInt lastPointerFormat(void); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop); +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); static sqInt NoDbgRegParms lengthOfMaybeImmediate(sqInt oop); static sqInt NoDbgRegParms lengthOf(sqInt objOop); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); static sqInt NoDbgRegParms NeverInline loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray); -EXPORT(void) longPrintInstancesOf(sqInt aClassOop); -EXPORT(void) longPrintInstancesWithClassIndex(sqInt classIndex); -EXPORT(void) longPrintReferencesTo(sqInt anOop); +extern void longPrintInstancesOf(sqInt aClassOop); +extern void longPrintInstancesWithClassIndex(sqInt classIndex); +extern void longPrintReferencesTo(sqInt anOop); static void mapExtraRoots(void); static void NeverInline mapMournQueue(void); static sqInt NoDbgRegParms mapOopsFromtooutPointersoutHashes(sqInt segStart, sqInt segAddr, sqInt outPointerArray, sqInt savedOutHashes); @@ -1250,7 +1237,6 @@ static void NoDbgRegParms NeverInline markObjects(sqInt objectsShouldBeUnmarkedA static void markWeaklingsAndMarkAndFireEphemerons(void); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); extern sqInt minSlotsForShortening(void); static usqInt NoDbgRegParms newHashBitsOf(sqInt objOop); static usqInt newObjectHash(void); @@ -1268,12 +1254,11 @@ static sqInt noUnscannedEphemerons(void); static sqInt NoDbgRegParms numBytesOfBitsformat(sqInt objOop, sqInt format); static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numSlotsForBytes(sqInt numBytes); static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); extern sqInt objectBefore(sqInt objOop); static sqInt NoDbgRegParms objectInPastSpaceBefore(sqInt objOop); @@ -1288,45 +1273,46 @@ static sqInt NoDbgRegParms popObjStack(sqInt objStack); extern sqInt popRemappableOop(void); static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags); extern sqInt primitiveErrorTable(void); -EXPORT(void) printActivationsOf(sqInt aMethodObj); -EXPORT(void) printBogons(void); +extern void printActivationsOf(sqInt aMethodObj); +extern void printBogons(void); +static void NoDbgRegParms printBridgeon(sqInt oop, FILE *aStream); static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printContextReferencesTo(sqInt anOop); -EXPORT(void) printEntity(sqInt oop); -EXPORT(void) printForwarders(void); +extern void printContextReferencesTo(sqInt anOop); +extern void printEntity(sqInt oop); +extern void printForwarders(void); static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream); extern void printFreeChunks(void); -EXPORT(void) printFreeChunk(sqInt freeChunk); +extern void printFreeChunk(sqInt freeChunk); static void NoDbgRegParms printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode); -EXPORT(void) printFreeListHeads(void); -EXPORT(sqInt) printFreeList(sqInt chunkOrIndex); +extern void printFreeListHeads(void); +extern sqInt printFreeList(sqInt chunkOrIndex); static void NoDbgRegParms printFreeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printFreeTree(void); +extern void printFreeTree(void); static void NoDbgRegParms printFreeTreeChunk(sqInt chunkOrZero); -EXPORT(void) printHeaderOf(sqInt objOop); +extern void printHeaderOf(sqInt objOop); static void NoDbgRegParms printImmediateObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printInstancesOf(sqInt aClassOop); -EXPORT(void) printInstancesWithClassIndex(sqInt classIndex); +extern void printInstancesOf(sqInt aClassOop); +extern void printInstancesWithClassIndex(sqInt classIndex); extern void printInvalidClassTableEntries(void); #if LLDB -EXPORT(void) printMarkedOops(void); +extern void printMarkedOops(void); #endif /* LLDB */ -EXPORT(void) printMethodImplementorsOf(sqInt anOop); -EXPORT(void) printMethodReferencesTo(sqInt anOop); +extern void printMethodImplementorsOf(sqInt anOop); +extern void printMethodReferencesTo(sqInt anOop); static void NoDbgRegParms printNonPointerDataOfon(sqInt oop, FILE *aStream); -EXPORT(void) printObjectsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) printObjectsWithHash(sqInt hash); +extern void printObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void printObjectsWithHash(sqInt hash); +extern void printObjStackAndContents(sqInt objStack); static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents); static void NoDbgRegParms printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType); extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); -EXPORT(void) NeverInline printOopsExcept(sqInt (*function)(sqInt)); -EXPORT(void) printOopsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); -EXPORT(void) printReferencesTo(sqInt anOop); +extern void NeverInline printOopsExcept(sqInt (*function)(sqInt)); +extern void printOopsFromto(sqInt startAddress, sqInt endAddress); +extern void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); +extern void printReferencesTo(sqInt anOop); static void NoDbgRegParms printStringDataOfon(sqInt oop, FILE *aStream); #if LLDB -EXPORT(void) printUnmarkedOops(void); +extern void printUnmarkedOops(void); #endif /* LLDB */ static sqInt NoDbgRegParms pushOnUnscannedEphemeronsStack(sqInt anEphemeron); extern void pushRemappableOop(sqInt oop); @@ -1344,14 +1330,14 @@ static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedObjsclassIndicesShould static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion); static sqInt NoDbgRegParms NeverInline setHeapBasememoryLimitendOfMemory(sqInt baseOfHeap, sqInt memLimit, sqInt memEnd); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); -EXPORT(void) shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); extern sqInt shouldRemapOop(sqInt oop); static sqInt NoDbgRegParms sizeOfObjStack(sqInt objStack); static sqInt slidingCompactionInProgress(void); extern sqInt slotSizeOf(sqInt oop); extern sqInt splObj(sqInt index); static usqInt NoDbgRegParms startOfObject(sqInt objOop); -EXPORT(sqInt) statNumGCs(void); +extern sqInt statNumGCs(void); extern usqInt storeCheckBoundary(void); static sqInt NoDbgRegParms storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointerArrayArg, sqInt arrayOfRootsArg); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); @@ -1414,7 +1400,7 @@ static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i); static void postSnapshot(void); static void NeverInline prepareForSnapshot(void); static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes); -EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop); +extern SpurSegmentInfo * segmentContainingObj(sqInt objOop); static sqInt segmentOverlap(void); static sqInt NoDbgRegParms shrinkObjectMemory(usqInt delta); static sqInt someSegmentContainsPinned(void); @@ -1424,7 +1410,7 @@ static sqInt NoDbgRegParms writeImageSegmentsToFile(sqImageFile aBinaryStream); static sqInt NoDbgRegParms writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSegment, sqImageFile aBinaryStream); static sqInt NoDbgRegParms accessModifierOfMethod(sqInt methodObj); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -EXPORT(sqInt) activeProcess(void); +extern sqInt activeProcess(void); extern void addIdleUsecs(sqInt idleUsecs); static void NoDbgRegParms addLastLinktoList(sqInt proc, sqInt aList); static void NoDbgRegParms addNewMethodToNSCache(sqInt rule); @@ -1438,11 +1424,11 @@ static sqInt NoDbgRegParms asciiOfCharacter(sqInt characterObj); extern void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); static void NoDbgRegParms assertValidStackLimits(sqInt ln); extern sqInt booleanValueOf(sqInt obj); -EXPORT(sqInt) callbackEnter(sqInt *callbackID); -EXPORT(sqInt) callbackLeave(sqInt cbID); +extern sqInt callbackEnter(sqInt *callbackID); +extern sqInt callbackLeave(sqInt cbID); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); extern sqInt characterForAscii(sqInt ascii); -EXPORT(sqInt) checkAllAccessibleObjectsOkay(void); +extern sqInt checkAllAccessibleObjectsOkay(void); #if LRPCheck static sqInt NeverInline checkDeliveryOfLongRunningPrimitiveSignal(void); #endif /* LRPCheck */ @@ -1451,7 +1437,7 @@ static sqInt NoDbgRegParms checkForEventsMayContextSwitch(sqInt mayContextSwitch static sqInt NoDbgRegParms checkImageVersionFromstartingAt(sqImageFile f, squeakFileOffsetType imageOffset); static sqInt checkInterpreterIntegrity(void); static sqInt NoDbgRegParms checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP); -EXPORT(sqInt) checkOkayInterpreterObjects(sqInt writeBack); +extern sqInt checkOkayInterpreterObjects(sqInt writeBack); static sqInt NoDbgRegParms checkOkayStackPage(StackPage *thePage); static sqInt NoDbgRegParms checkOkayStackZone(sqInt writeBack); static void NoDbgRegParms checkProfileTick(sqInt aPrimitiveMethod); @@ -1460,8 +1446,7 @@ static sqInt NoDbgRegParms checkStackPointerIndexForFrame(char *theFP); static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className); static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext); static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern sqInt copyBits(void); extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y); static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop); @@ -1512,7 +1497,7 @@ static sqInt NoDbgRegParms frameStackedReceiverOffset(char *theFP); static sqInt NoDbgRegParms frameStackedReceivernumArgs(char *theFP, sqInt numArgs); static void freeUntracedStackPages(void); extern sqInt fullDisplayUpdate(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); +static void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); static sqInt getCogVMFeatureFlags(void); static sqInt getErrorObjectFromPrimFailCode(void); extern sqInt getFullScreenFlag(void); @@ -1570,7 +1555,7 @@ static sqInt NoDbgRegParms lengthOfNameOfClass(sqInt classOop); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt loadBitBltFrom(sqInt bb); extern void loadInitialContext(void); -EXPORT(void) longPrintOop(sqInt oop); +extern void longPrintOop(sqInt oop); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); static sqInt NoDbgRegParms lookupInMethodCacheSelclassTag(sqInt selector, sqInt classTag); static sqInt NoDbgRegParms lookupLexicalfromrule(sqInt selector, sqInt mixin, sqInt rule); @@ -1618,7 +1603,6 @@ static sqInt NoDbgRegParms objectequalsString(sqInt anOop, char *aCString); extern sqInt ownVM(sqInt threadIndexAndFlags); static sqInt NoDbgRegParms pcPreviousToinSqueakV3PlusClosuresMethod(sqInt theIP, sqInt aMethod); extern sqInt pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt pop(sqInt nItems); extern void popthenPush(sqInt nItems, sqInt oop); @@ -1634,44 +1618,43 @@ extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); static void NoDbgRegParms printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void NoDbgRegParms printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); -EXPORT(void) printAllStacks(void); -EXPORT(void) printAllStacksOn(FILE *aStdioStream); -EXPORT(void) printCallStack(void); +extern void printAllStacks(void); +extern void printAllStacksOn(FILE *aStdioStream); +extern void printCallStack(void); static sqInt NoDbgRegParms printCallStackFP(char *theFP); -EXPORT(sqInt) printCallStackOf(sqInt aContextOrProcessOrFrame); +extern sqInt printCallStackOf(sqInt aContextOrProcessOrFrame); static sqInt NoDbgRegParms printCallStackOfcurrentFP(sqInt aContext, char *currFP); -EXPORT(void) printCallStackOn(FILE *aStdioStream); +extern void printCallStackOn(FILE *aStdioStream); static sqInt NoDbgRegParms printContextCallStackOf(sqInt aContext); -EXPORT(void) printContext(sqInt aContext); +extern void printContext(sqInt aContext); static void NoDbgRegParms printDecodeMethodHeaderOop(sqInt methodHeaderOop); -EXPORT(void) printExternalHeadFrame(void); +extern void printExternalHeadFrame(void); static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort); static void NoDbgRegParms printFrameOopat(char *name, char *address); static void NoDbgRegParms printFrameOopindexat(char *name, sqInt idx, char *address); -EXPORT(void) printFramesInPage(StackPage *thePage); -EXPORT(void) printFramesOnStackPageListInUse(void); +extern void printFramesInPage(StackPage *thePage); +extern void printFramesOnStackPageListInUse(void); static void NoDbgRegParms printFrameThingandFrameat(char *name, char *theFP, char *address); static void NoDbgRegParms printFrameThingatextraString(char *name, char *address, char *extraStringOrNil); -EXPORT(sqInt) printFrame(char *theFP); -extern sqInt printHexnp(usqInt n); +extern sqInt printFrame(char *theFP); static sqInt NoDbgRegParms printHexPtrnp(void *p); extern void printHex(usqInt n); -EXPORT(void) printLikelyImplementorsOfSelector(sqInt selector); -EXPORT(void) printMethodCache(void); -EXPORT(void) printMethodDictionaryOf(sqInt behavior); -EXPORT(void) printMethodDictionary(sqInt dictionary); +extern void printLikelyImplementorsOfSelector(sqInt selector); +extern void printMethodCache(void); +extern void printMethodDictionaryOf(sqInt behavior); +extern void printMethodDictionary(sqInt dictionary); static void NoDbgRegParms printNameOfClasscount(sqInt classOop, sqInt cnt); static void NoDbgRegParms printOopShortInner(sqInt oop); -EXPORT(void) printOop(sqInt oop); -EXPORT(void) printProcessStack(sqInt aProcess); -EXPORT(sqInt) printProcsOnList(sqInt procList); -EXPORT(sqInt) printStackCallStackOf(sqInt aContextOrProcessOrFrame); -EXPORT(void) printStackPageList(void); -EXPORT(void) printStackPageListInUse(void); -EXPORT(void) printStackPages(void); -EXPORT(void) printStackPagesInUse(void); +extern void printOop(sqInt oop); +extern void printProcessStack(sqInt aProcess); +extern sqInt printProcsOnList(sqInt procList); +extern sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame); +extern void printStackPageList(void); +extern void printStackPageListInUse(void); +extern void printStackPages(void); +extern void printStackPagesInUse(void); static void NoDbgRegParms printStackPageuseCount(StackPage *page, sqInt n); -EXPORT(void) printStackReferencesTo(sqInt oop); +extern void printStackReferencesTo(sqInt oop); static void NoDbgRegParms printStringOf(sqInt oop); extern void print(char *s); extern void pushBool(sqInt trueOrFalse); @@ -1685,20 +1668,20 @@ static void NoDbgRegParms putToSleepyieldingIf(sqInt aProcess, sqInt yieldImplic static void NoDbgRegParms putWord32toFile(int aWord32, sqImageFile aFile); extern sqInt readableFormat(sqInt imageVersion); static void NoDbgRegParms NeverInline reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader); -EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext); +extern sqInt reestablishContextPriorToCallback(sqInt callbackContext); static sqInt NoDbgRegParms removeFirstLinkOfList(sqInt aList); static sqInt NoDbgRegParms removeProcessfromList(sqInt aProcess, sqInt aList); static sqInt retryPrimitiveOnFailure(void); -EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); +extern sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); static void NoDbgRegParms reverseDisplayFromto(sqInt startIndex, sqInt endIndex); static void NoDbgRegParms rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)()); static sqInt NoDbgRegParms safeMethodClassOf(sqInt methodPointer); static sqInt NoDbgRegParms saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex); static sqInt schedulerPointer(void); -EXPORT(void) setBreakMNUSelector(char *aString); -EXPORT(void) setBreakSelector(char *aString); +extern void setBreakMNUSelector(char *aString); +extern void setBreakSelector(char *aString); extern void setFullScreenFlag(sqInt value); -EXPORT(void *) setInterruptCheckChain(void (*aFunction)()); +extern void * setInterruptCheckChain(void (*aFunction)()); extern void setInterruptKeycode(sqInt value); extern void setInterruptPending(sqInt value); extern void setNextWakeupUsecs(usqLong value); @@ -1707,9 +1690,9 @@ static void setSignalLowSpaceFlagAndSaveProcess(void); static void NoDbgRegParms setTraceFlagOnContextsFramesPageIfNeeded(sqInt aContext); static sqInt NoDbgRegParms shortPrintContext(sqInt aContext); static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP); -EXPORT(void) shortPrintFramesInPage(StackPage *thePage); -EXPORT(void) shortPrintFramesOnStackPageListInUse(void); -EXPORT(void) shortPrintFrameAndNCallers(char *theFP, sqInt n); +extern void shortPrintFramesInPage(StackPage *thePage); +extern void shortPrintFramesOnStackPageListInUse(void); +extern void shortPrintFrameAndNCallers(char *theFP, sqInt n); static void NoDbgRegParms shortPrintOop(sqInt oop); static sqInt NoDbgRegParms shortReversePrintFrameAndCallers(char *aFramePointer); extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); @@ -1814,8 +1797,8 @@ _iss sqInt argumentCount; _iss sqLong nextProfileTick; _iss sqInt primTraceLog[256]; _iss sqInt nilObj; -_iss FILE * transcript; _iss StackPage * stackPage; +_iss FILE * transcript; _iss usqInt oldSpaceStart; _iss usqInt method; _iss sqInt bytecodeSetSelector; @@ -1827,10 +1810,10 @@ _iss char * stackBasePlus1; _iss usqInt totalFreeOldSpace; _iss sqInt trueObj; _iss sqInt lkupClassTag; -_iss SpurSegmentInfo * segments; _iss sqInt falseObj; _iss usqInt newSpaceStart; _iss sqInt hiddenRootsObj; +_iss SpurSegmentInfo * segments; _iss sqInt bytesPerPage; _iss sqInt numSegments; _iss sqInt localAbsentReceiver; @@ -1847,6 +1830,7 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; _iss sqInt numStackPages; _iss sqInt tempOop; @@ -1866,13 +1850,11 @@ _iss sqInt becomeEffectsFlags; _iss sqInt growHeadroom; _iss sqInt tenureThreshold; _iss char * objStackInvalidBecause; -_iss sqInt sweepIndex; _iss sqInt ephemeronList; #if LRPCheck _iss sqInt longRunningPrimitiveCheckMethod; #endif _iss sqInt tenureCriterion; -_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classNameIndex; _iss usqInt freeOldSpaceStart; _iss sqInt extraRootCount; @@ -1970,7 +1952,6 @@ _iss sqIntptr_t methodCache[MethodCacheSize + 1 /* 2049 */]; _iss sqInt traceLog[TraceBufferSize /* 768 */]; _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 65 */]; -_iss sqInt preferredPinningSegment; _iss sqInt statCoalesces; _iss sqInt theUnknownShort; #if LRPCheck @@ -2697,8 +2678,8 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 584 */])(void) = { 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */; -sqInt checkForLeaks; sqInt breakLookupClassTag; +sqInt checkForLeaks; sqInt breakSelectorLength = MinSmallInteger; sqInt debugCallbackPath; void * displayBits; @@ -2708,10 +2689,10 @@ sqInt desiredEdenBytes; sqInt desiredNumStackPages; sqInt extraVMMemory; int displayWidth; -char * breakSelector; sqInt desiredCogCodeSize; int displayDepth; sqInt eventTraceMask; +char * breakSelector; int displayHeight; usqInt maxOldSpaceSize; sqInt ffiExceptionResponse; @@ -2721,12 +2702,12 @@ sqInt upscaleDisplayIfHighDPI = -1; sqInt deferDisplayUpdates; struct VirtualMachine* interpreterProxy; sqInt sendWheelEvents; -sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.3310"; +const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.3329"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2757,13 +2738,6 @@ volatile int sendTrace; } while (0) #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize) #define heapBase() heapBase -#define mnuCompilationBreakpoint(sel, len) do { \ - if ((len) == -breakSelectorLength \ - && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, -breakSelectorLength)) { \ - suppressHeartbeatFlag = 1; \ - compilationBreakpointFor(sel); \ - } \ -} while (0) #define primTraceLogIndex(aValue) (GIV(primTraceLogIndex) = (aValue)) #define pageIndexForstackBasePlus1bytesPerPage(pointer,stkBasePlus1,pageByteSize) (((char *)(pointer) - (stkBasePlus1)) / (pageByteSize)) #define startOfMemory() heapBase @@ -14574,29 +14548,6 @@ assertl((methodUsesAlternateBytecodeSet(GIV(method))) == (GIV(bytecodeSetSelecto } } - /* CoInterpreter>>#assertValidMachineCodeFrame: */ -void -assertValidMachineCodeFrame(sqInt instrPtr) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - CogBlockMethod *cogMethod; - CogMethod *homeMethod; - - assert(isMachineCodeFrame(GIV(framePointer))); - /* begin mframeCogMethod: */ - cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask)); - /* begin asCogHomeMethod: */ - if (((cogMethod->cmType)) >= CMMethod) { - homeMethod = ((CogMethod *) cogMethod); - } - else { - /* begin cmHomeMethod */ - homeMethod = ((CogMethod *) ((((usqInt)cogMethod)) - ((cogMethod->homeOffset)))); - } - assert((methodFor(cogMethod)) == homeMethod); - assert((instrPtr > (((sqInt)cogMethod))) - && (instrPtr < ((((sqInt)homeMethod)) + ((homeMethod->blockSize))))); -} - /* Check that the stacked instruction pointers in the given page are correct. Checks the interpreter sender/machine code callee contract. */ @@ -15900,8 +15851,8 @@ ceInterpretMethodFromPICreceiver(sqInt aMethodObj, sqInt rcvr) /* pop off inner return and locate open or closed PIC */ pic = ((CogMethod *) ((popStack()) - (interpretOffset()))); - assert((isCMOpenPIC(pic)) - || (isCMClosedPIC(pic))); + assert((isCMOpenPIC(((CogBlockMethod *) pic))) + || (isCMClosedPIC(((CogBlockMethod *) pic)))); if (((pic->cmType)) == CMOpenPIC) { assert(!(methodHasCogMethod(aMethodObj))); if (methodShouldBeCogged(aMethodObj)) { @@ -15973,8 +15924,8 @@ ceMNUFromPICMNUMethodreceiver(sqInt aMethodObj, sqInt rcvr) : tagBits2) : (longAt(rcvr)) & (classIndexMask()))); cPIC = ((CogMethod *) ((popStack()) - (mnuOffset()))); - assert((isCMClosedPIC(cPIC)) - || (isCMOpenPIC(cPIC))); + assert((isCMClosedPIC(((CogBlockMethod *) cPIC))) + || (isCMOpenPIC(((CogBlockMethod *) cPIC)))); GIV(argumentCount) = (cPIC->cmNumArgs); GIV(messageSelector) = (cPIC->selector); if (aMethodObj != 0) { @@ -16645,7 +16596,7 @@ ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver) cogged or not. */ /* CoInterpreter>>#ceSendAbort:to:numArgs: */ -sqInt +static sqInt NoDbgRegParms ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt aMethodObj; @@ -18493,7 +18444,7 @@ dumpPrimTraceLog(void) */ /* CoInterpreter>>#dumpPrimTraceLogOn: */ -EXPORT(void) +void dumpPrimTraceLogOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -19886,20 +19837,14 @@ void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto( sqInt getCurrentBytecode(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - return (((((((usqInt)GIV(framePointer))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)GIV(framePointer))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)GIV(framePointer))) <= (((usqInt)GIV(pages))))))) + return (((GIV(stackBasePlus1) != null) + && ((((((usqInt)GIV(framePointer))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)GIV(framePointer))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)GIV(framePointer))) <= (((usqInt)GIV(pages)))))))) && (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))) ? byteAt(GIV(instructionPointer)) : -1); } - /* CoInterpreter>>#getFramePointer */ -char * -getFramePointer(void) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return GIV(framePointer); -} - /* Answer the flags that are contained in the 7th long of the image header. */ @@ -20084,12 +20029,14 @@ ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, if (savedSPP != 0) { savedSPP[0] = GIV(stackPointer); } - if ((((((usqInt)theCFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theCFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCFP)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)theCFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theCFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCFP)) <= (((usqInt)GIV(pages)))))))) { GIV(framePointer) = theCFP; } - if ((((((usqInt)theCSP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theCSP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCSP)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)theCSP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theCSP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCSP)) <= (((usqInt)GIV(pages)))))))) { GIV(stackPointer) = theCSP; } } @@ -20158,21 +20105,6 @@ instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sq } -/* This is used for asserts that check that inline cache editing results in - valid addresses. - In the C VM interpret is presumed to come before any primitives and so it - constitutes the lowest address in C code that machine code should be - linked. In the simulator - we just answer something not low. */ - - /* CoInterpreter>>#interpretAddress */ -usqInt -interpretAddress(void) -{ - return ((usqInt)((&interpret))); -} - - /* At a rough approximation we may need to allocate up to a couple of page's worth of contexts when switching stack pages, assigning to senders, etc. But the snapshot primitive voids all stack pages. @@ -21763,7 +21695,7 @@ mframeHomeMethodExport(void) method field. */ /* CoInterpreter>>#mframeHomeMethod: */ -CogMethod * +static CogMethod * NoDbgRegParms mframeHomeMethod(char *theFP) { sqInt methodField; @@ -21830,49 +21762,6 @@ minimumUnusedHeadroom(void) return minUnused; } - /* CoInterpreter>>#mMethodClass */ -sqInt -mMethodClass(void) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt literal; - sqInt methodPointer; - sqInt objOop; - sqInt objOop1; - sqInt offset; - - /* begin methodClassOf: */ - methodPointer = ((mframeHomeMethod(GIV(framePointer)))->methodObject); - /* begin followLiteral:ofMethod: */ - offset = (literalCountOf(methodPointer)) - 1; - /* begin followField:ofObject: */ - objOop1 = longAt((methodPointer + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); - if (((!(objOop1 & (tagMask())))) - && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { - objOop1 = fixFollowedFieldofObjectwithInitialValue(offset + LiteralStart, methodPointer, objOop1); - } - literal = objOop1; - return ((literal != GIV(nilObj)) - && (((!(literal & (tagMask())))) - && (((((usqInt)((longAt(literal)))) >> (formatShift())) & (formatMask())) <= 5 /* lastPointerFormat */)) - ? (assert((numSlotsOf(literal)) > ValueIndex), - /* begin followField:ofObject: */ - (objOop = longAt((literal + BaseHeaderSize) + (((int)((usqInt)(ValueIndex) << (shiftForWord())))))), - (((!(objOop & (tagMask())))) - && ((!((longAt(objOop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))) - ? (objOop = fixFollowedFieldofObjectwithInitialValue(ValueIndex, literal, objOop)) - : 0), - objOop) - : /* begin nilObject */ GIV(nilObj)); -} - - /* CoInterpreter>>#mnuCompilationBreakpointFor: */ -void -mnuCompilationBreakpointFor(sqInt selectorOop) -{ - suppressHeartbeatFlag = 1; - warning("compilation MNU break (heartbeat suppressed)"); -} - /* Lookup the doesNotUnderstand: selector in the class of the argument rcvr. Answer either the matching method (cogged if appropriate), or nil, if not @@ -21885,7 +21774,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -21934,7 +21823,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; @@ -21952,7 +21841,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); @@ -22853,22 +22742,6 @@ primitiveExecuteMethodArgsArray(void) } -/* This is used for asserts that check that inline cache editing results in - valid addresses. - In the C VM interpret is presumed to come before any primitives and so it - constitutes the lowest address in C code that machine code should be - linked, but optimizing - compilers change things around. In the simulator we just answer something - not low. */ - - /* CoInterpreter>>#primitiveFailAddress */ -usqInt -primitiveFailAddress(void) -{ - return ((usqInt)((&primitiveFail))); -} - - /* Answer any special requirements of the given primitive */ /* CoInterpreter>>#primitivePropertyFlags:numArgs: */ @@ -22912,11 +22785,8 @@ primTraceLogIndexAddress(void) return ((usqInt)((&GIV(primTraceLogIndex)))); } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CoInterpreter>>#printCogMethod: */ -EXPORT(void) +void printCogMethod(CogMethod *cogMethod) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -23096,12 +22966,10 @@ printFrameThingatextra(char *name, char *address, sqInt extraValue) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#printFrame:WithSP: */ -EXPORT(sqInt) +sqInt printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -23121,8 +22989,9 @@ printFrameWithSP(char *theFP, char *theSP) sqInt theMethodEnd; sqInt topThing; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { fprintf(GIV(transcript), "%p is not in the stack zone?!\n", theFP); @@ -23256,12 +23125,10 @@ printFrameWithSP(char *theFP, char *theSP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#printMethodCacheFor: */ -EXPORT(void) +void printMethodCacheFor(sqInt thing) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -24055,7 +23922,7 @@ reloadPrimitiveCalloutPointer(void) /* Report the stack page size and minimum unused headroom to stdout. */ /* CoInterpreter>>#reportMinimumUnusedHeadroom */ -EXPORT(void) +void reportMinimumUnusedHeadroom(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT fprintf(GIV(transcript), @@ -24069,7 +23936,7 @@ reportMinimumUnusedHeadroom(void) /* Report the stack page size and minimum unused headroom to a stream. */ /* CoInterpreter>>#reportMinimumUnusedHeadroomOn: */ -EXPORT(void) +void reportMinimumUnusedHeadroomOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -24304,7 +24171,7 @@ roomToPushNArgs(sqInt n) logged normally. */ /* CoInterpreter>>#sendInvokeCallbackContext: */ -EXPORT(sqInt) +sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt aMethodObj; @@ -24534,8 +24401,9 @@ shortPrintFrame(char *theFP) sqInt mthd; sqInt rcvr; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { /* begin print: */ fprintf(GIV(transcript), "invalid frame pointer"); cr(); @@ -25637,12 +25505,10 @@ voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#whereIs: */ -EXPORT(char *) +char * whereIs(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *somewhere; @@ -25811,6 +25677,29 @@ primitiveBenchmarkJITReceiver(void) } #endif /* VMBenchmarks */ + /* CoInterpreterPrimitives>>#primitiveBenchmarkScavenge */ +#if VMBenchmarks +EXPORT(void) +primitiveBenchmarkScavenge(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *sp; + usqLong then; + + /* begin primitiveReturnTimeTakenFor: */ + then = ioHighResClock(); + /* begin scavengingGC */ + scavengingGCTenuringIf(TenureByAge); + (((usqInt)(((((GIV(totalFreeOldSpace) + (GIV(scavengeThreshold) - GIV(freeStart))) - (interpreterAllocationReserveBytes())) < 0) ? 0 : ((GIV(totalFreeOldSpace) + (GIV(scavengeThreshold) - GIV(freeStart))) - (interpreterAllocationReserveBytes())))) << 1) | 1); + /* begin methodReturnValue: */ + oop = positive64BitIntegerFor((ioHighResClock()) - then); + assert(!((failed()))); + /* begin pop:thenPush: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; +} +#endif /* VMBenchmarks */ + /* This is optional old obsolete stuff tedious to implement in Cog because of the need to map from machine code pc to bytecode pc. So for now just fail. */ @@ -30898,6 +30787,7 @@ primitiveClosureValue(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -31159,6 +31049,7 @@ primitiveClosureValueNoContextSwitch(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -31452,6 +31343,7 @@ primitiveClosureValueWithArgs(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -35255,7 +35147,7 @@ primitiveInvokeObjectAsMethod(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; sqInt lookupClassTag; - sqInt runArgs; + usqInt runArgs; sqInt runReceiver; char *sp; char *sp1; @@ -36833,8 +36725,9 @@ primitivePathToUsing(void) stackp = 0; while (1) { while (((index -= 1)) >= -1) { - if ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages)))))))) { if (index >= 0) { next = fieldofFrame(index, ((char *) current)); } @@ -36855,8 +36748,9 @@ primitivePathToUsing(void) next = fetchClassOfNonImm(current); } } - if ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages)))))))) { assert(isFrameonPage(((char *) next), stackPageFor(((char *) next)))); } else { @@ -36889,8 +36783,9 @@ primitivePathToUsing(void) goto l8; } if (((next & 1) == 0) - && (((((((usqInt)next)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages)))))) + && (((GIV(stackBasePlus1) != null) + && ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) ? !(frameIsMarked(next)) : (next >= heapBase) && ((!(((((usqInt)((longAt(next + 4)))) >> (markedBitHalfShift())) & 1) != 0)) @@ -36915,8 +36810,9 @@ primitivePathToUsing(void) assert(!(isOopForwarded(stack))); longAtput((stack + BaseHeaderSize) + (((sqInt)((usqInt)((stackp + 1)) << (shiftForWord())))), (((usqInt)index << 1) | 1)); stackp += 2; - if ((((((usqInt)(((char *) next)))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)(((char *) next)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) next)))) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)(((char *) next)))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)(((char *) next)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) next)))) <= (((usqInt)GIV(pages)))))))) { /* begin markFrame: */ methodField = longAt(next + FoxMethod); if ((((usqInt)methodField)) < (startOfMemory())) { @@ -39525,10 +39421,8 @@ primitiveStoreImageSegment(void) && (((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) == (firstLongFormat())))))) { /* Must be indexable words */ - /* begin primitiveFail */ - if (!GIV(primFailCode)) { - GIV(primFailCode) = 1; - } + /* begin primitiveFailFor: */ + GIV(primFailCode) = PrimErrBadArgument; return; } ecode = storeImageSegmentIntooutPointersroots(segmentWordArray, outPointerArray, arrayOfRoots); @@ -40242,7 +40136,8 @@ primitiveStringReplace(void) replFmt = replFmt & -4; l10: /* end classFormatFromInstFormat: */; if (!((arrayFmt == replFmt) - && (arrayFmt < (firstCompiledMethodFormat())))) { + && ((arrayFmt >= (sixtyFourBitIndexableFormat())) + && (arrayFmt < (firstCompiledMethodFormat()))))) { /* begin primitiveFailFor: */ GIV(primFailCode) = PrimErrInappropriate; goto l17; @@ -41413,7 +41308,7 @@ ensureNoForwardedLiteralsIn(sqInt aMethodObj) need since depth is always finite. */ /* Spur32BitCoMemoryManager>>#followForwardedObjectFields:toDepth: */ -sqInt +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -42428,116 +42323,6 @@ initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur32BitMemoryManager>>#inOldSpaceInstantiatePinnedClass:indexableSize: */ -sqInt -inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt fillValue; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt numSlots; - usqInt p; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - fillValue = 0; - switch (instSpec) { - case 2 /* arrayFormat */: - numSlots = nElements; - fillValue = GIV(nilObj); - break; - case indexablePointersFormat(): - case weakArrayFormat(): - numSlots = (classFormat & ((1U << (fixedFieldsFieldWidth())) - 1)) + nElements; - fillValue = GIV(nilObj); - break; - case sixtyFourBitIndexableFormat(): - if (nElements > ((0x1FFFFFFF) / 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - numSlots = nElements * 2; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = nElements; - break; - case firstShortFormat(): - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstByteFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - default: - - /* non-indexable */ - /* Some Squeak images include funky fixed subclasses of abstract variable - superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection. - The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via - this method. - Hence allow fixed classes to be instantiated here iff nElements = 0. */ - if ((nElements != 0) - || (instSpec > 5 /* lastPointerFormat */)) { - return null; - } - numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); - fillValue = GIV(nilObj); - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > (0x1FFFFFFF)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsForPinningInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : ((numSlots + (numSlots & 1)) << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - if (!(newObj == null)) { - /* begin fillObj:numSlots:with: */ - assert(oopisLessThan(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1, addressAfter(newObj))); - for (p = (((usqInt)(newObj + BaseHeaderSize))); p <= (((usqInt)(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { - longAtput(p, fillValue); - longAtput(p + 4, fillValue); - } - } - return newObj; -} - - /* Allocate an instance of a variable class, excepting CompiledMethod. */ /* Spur32BitMemoryManager>>#instantiateClass:indexableSize: */ @@ -42690,131 +42475,6 @@ instantiateClassindexableSize(sqInt classObj, usqInt nElements) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur32BitMemoryManager>>#instantiateUninitializedClass:indexableSize: */ -sqInt -instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt newObj1; - usqInt numBytes; - usqInt numSlots; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - assert(isPureBitsFormat(instSpec)); - switch (instSpec) { - case sixtyFourBitIndexableFormat(): - if (nElements > ((0x1FFFFFFF) / 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - numSlots = nElements * 2; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = nElements; - break; - case firstShortFormat(): - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstByteFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - default: - - /* not bits indexable */ - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > ((1U << (fixedFieldsFieldWidth())) - 1)) { - if (numSlots > (0x1FFFFFFF)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : ((numSlots + (numSlots & 1)) << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - } - else { - /* begin allocateSlots:format:classIndex: */ - if (numSlots >= (numSlotsMask())) { - newObj1 = GIV(freeStart) + BaseHeaderSize; - numBytes = (BaseHeaderSize + BaseHeaderSize) + ((numSlots + (numSlots & 1)) * BytesPerOop); - } - else { - newObj1 = GIV(freeStart); - numBytes = BaseHeaderSize + ((numSlots <= 1 - ? /* begin allocationUnit */ 8 - : (numSlots + (numSlots & 1)) * BytesPerOop)); - } - if ((GIV(freeStart) + numBytes) > GIV(scavengeThreshold)) { - if (!GIV(needGCFlag)) { - /* begin scheduleScavenge */ - GIV(needGCFlag) = 1; - forceInterruptCheck(); - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, instSpec, classIndex); - goto l8; - } - if (numSlots >= (numSlotsMask())) { - - /* for header parsing we put a saturated slot count in the prepended overflow size word */ - flag("endianness"); - longAtput(GIV(freeStart), numSlots); - longAtput(GIV(freeStart) + 4, ((sqInt)((usqInt)((numSlotsMask())) << (numSlotsHalfShift())))); - long64Atput(newObj1, headerForSlotsformatclassIndex(numSlotsMask(), instSpec, classIndex)); - } - else { - long64Atput(newObj1, (((((usqLong) numSlots)) << (numSlotsFullShift())) + (((sqInt)((usqInt)(instSpec) << (formatShift()))))) + classIndex); - } - assert((numBytes % (allocationUnit())) == 0); - assert((newObj1 % (allocationUnit())) == 0); - GIV(freeStart) += numBytes; - newObj = newObj1; - l8: /* end allocateSlots:format:classIndex: */; - } - return newObj; -} - - /* Convert the integer value, assumed to be in SmallInteger range, into a tagged SmallInteger object. In C, use a shift and an add to set the tag bit. @@ -43257,8 +42917,8 @@ allWeakSurvivorsOnWeakList(void) writes code that stresses the remembered table. One might conclude that if the remembered table is full, then the right thing - to do is simply to tenure everything, emptying the remembered table. Bt in - some circumstances this + to do is simply to tenure everything, emptying the remembered table. But + in some circumstances this can be counter-productive, and result in the same situation arising soon after tenuring everything. Instead, we can try and selectively prune the remembered table, tenuring @@ -43652,6 +43312,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj3 == null)) { + assert(isPinned(obj3)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1, addressAfter(obj3))); for (p2 = (((usqInt)(obj3 + BaseHeaderSize))); p2 <= (((usqInt)(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1))); p2 += 8 /* allocationUnit */) { @@ -43669,6 +43330,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj2 == null)) { + assert(isPinned(obj2)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1, addressAfter(obj2))); for (p1 = (((usqInt)(obj2 + BaseHeaderSize))); p1 <= (((usqInt)(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1))); p1 += 8 /* allocationUnit */) { @@ -43689,6 +43351,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -43887,6 +43550,7 @@ openScavengeLog(void) /* Print the objects in the remembered set. */ +/* useful for debugging */ /* SpurGenerationScavenger>>#printRememberedSet */ void @@ -46179,6 +45843,7 @@ allocatePinnedSlots(sqInt nSlots) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj == null)) { + assert(isPinned(obj)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj))); for (p = (((usqInt)(obj + BaseHeaderSize))); p <= (((usqInt)(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -47196,30 +46861,6 @@ checkedLongAt(sqInt byteAddress) return longAt(byteAddress); } - /* SpurMemoryManager>>#checkFreeSpace: */ -void -checkFreeSpace(sqInt gcModes) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, null); - } -} - - /* SpurMemoryManager>>#checkFreeSpace:ignoring: */ -void -checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, anOopToIgnore); - } -} - /* Perform an integrity/leak check using the heapMap. Assume clearLeakMapAndMapAccessibleFreeSpace has set a bit at each free chunk's @@ -48184,6 +47825,7 @@ checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt cla /* Verify that the given oop is legitimate. Check address, header, and size but not class. Answer true if OK. Otherwise print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOkayOop: */ sqInt @@ -48278,6 +47920,7 @@ checkOkayOop(usqInt oop) or more fields. Finally, the instance specification field of the behavior must match that of the instance. If OK answer true. If not, print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOopHasOkayClass: */ sqInt @@ -49131,7 +48774,7 @@ cloneObject(sqInt objOop) } /* SpurMemoryManager>>#compactClassIndexOf: */ -sqInt +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop) { /* begin classIndexOf: */ @@ -49297,6 +48940,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS /* print the count of marked and unmarked objects. In addition if 1 is set in printFlags, short-print marked objects, and/or if 2 is set, short-print unmarked obejcts. */ +/* useful for debugging */ /* SpurMemoryManager>>#countMarkedAndUnmarkdObjects: */ void @@ -49394,7 +49038,8 @@ currentAllocatedBytes(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt use; - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); return (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); } @@ -49421,7 +49066,8 @@ doScavenge(sqInt tenuringCriterion) usqInt use; /* begin doAllocationAccountingForScavenge */ - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); GIV(statAllocatedBytes) = (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); GIV(gcPhaseInProgress) = ScavengeInProgress; /* begin scavenge: */ @@ -49472,7 +49118,8 @@ doScavenge(sqInt tenuringCriterion) GIV(freeStart) = ((eden()).start); GIV(gcPhaseInProgress) = 0; /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); } @@ -49486,7 +49133,7 @@ doScavenge(sqInt tenuringCriterion) was possible. */ /* SpurMemoryManager>>#doShorten:toIndexableSize: */ -sqInt +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt bytesBefore; @@ -50299,6 +49946,7 @@ findLargestFreeChunk(void) /* Print the oops of all string-like things that start with the same characters as aCString */ +/* useful for debugging */ /* SpurMemoryManager>>#findStringBeginningWith: */ void @@ -50960,7 +50608,6 @@ fullGC(void) runLeakCheckerForexcludeUnmarkedObjsclassIndicesShouldBeValid(GCModeFull, 1, 1); compactionStartUsecs = ioUTCMicrosecondsNow(); /* begin prepareForGlobalSweep */ - GIV(sweepIndex) = 0; for (i = 0; i < GIV(numSegments); i += 1) { ((GIV(segments)[i]).containsPinned = 0); } @@ -50973,9 +50620,11 @@ fullGC(void) GIV(statShrinkMemory) += 1; } /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); assert(validObjStacks()); assert(isEmptyObjStack(GIV(markStack))); assert(isEmptyObjStack(GIV(weaklingStack))); @@ -51032,12 +50681,10 @@ growOldSpaceByAtLeast(sqInt minAmmount) sqInt ammount; sqInt bytes; sqInt headroom; - sqInt i; sqInt interval; SpurSegmentInfo *segInfo; sqInt start; usqInt total; - usqInt total1; /* statGrowMemory counts attempts, not successes. */ @@ -51054,13 +50701,8 @@ growOldSpaceByAtLeast(sqInt minAmmount) /* Now apply the maxOldSpaceSize limit, if one is in effect. */ ammount = ((ammount < GIV(growHeadroom)) ? GIV(growHeadroom) : ammount); if (maxOldSpaceSize > 0) { - /* begin totalBytesInSegments */ - total1 = 0; - for (i = 0; i < GIV(numSegments); i += 1) { - total1 += ((GIV(segments)[i]).segSize); - } - assert(GIV(totalHeapSizeIncludingBridges) == total1); - total = total1; + assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)); + total = GIV(totalHeapSizeIncludingBridges); if (total >= maxOldSpaceSize) { GIV(needGCFlag) = 1; return null; @@ -51229,73 +50871,6 @@ incrementalGC(void) error("shouldNotImplement"); } - /* SpurMemoryManager>>#indexOf:in: */ -sqInt -indexOfin(sqInt anElement, sqInt anObject) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt fmt; - sqInt fmt1; - sqInt i; - usqInt numSlots; - usqInt numSlots1; - - /* begin formatOf: */ - fmt = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - if (fmt <= 5 /* lastPointerFormat */) { - /* begin numSlotsOf: */ - assert((classIndexOf(anObject)) > (isForwardedObjectClassIndexPun())); - numSlots1 = byteAt(anObject + 7); - numSlots = (numSlots1 == (numSlotsMask()) - ? longAt(anObject - BaseHeaderSize) - : numSlots1); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (longAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) { - return i; - } - } - } - if (fmt >= (firstByteFormat())) { - if (fmt >= (firstCompiledMethodFormat())) { - /* begin primitiveFailFor: */ - return (GIV(primFailCode) = PrimErrUnsupported); - } - /* begin numBytesOfBytes: */ - fmt1 = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - assert(fmt1 >= (firstByteFormat())); - numSlots = ((numSlotsOf(anObject)) << (shiftForWord())) - (fmt1 & 7); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (byteAt((anObject + BaseHeaderSize) + i))) { - return i; - } - } - } - if (fmt >= (firstShortFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 1; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (((unsigned short) (shortAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 1)))))))) { - return i; - } - } - } - if (fmt == (sixtyFourBitIndexableFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 3; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long64At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 3)))))) { - return i; - } - } - } - if (fmt >= (firstLongFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 2; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long32At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 2)))))) { - return i; - } - } - } - return -1; -} - /* Part of reorderReversedTreeList:. Switch treeNode with newNode in the tree, but do nothing to the list linked through freeChunkNextIndex. */ @@ -51757,6 +51332,7 @@ initializeObjectMemory(sqInt bytesToShift) /* begin allocatePinnedSlots: */ obj1 = allocateSlotsForPinningInOldSpacebytesformatclassIndex(0x400, (((int)((usqInt)((0x400 + (0x400 & 1))) << (shiftForWord())))) + (BaseHeaderSize + BaseHeaderSize), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -51773,7 +51349,7 @@ initializeObjectMemory(sqInt bytesToShift) else { /* The Spur32to64BitBootstrap failed to set the type of rememberedSetObj to 64-bit indexability. - This is unimportant except for simulation; rememberedSet is declared as sqInt *, but in to have + This is unimportant except for simulation; rememberedSet is declared as sqInt *, but to have firstIndexableField: below answer a suitable type the format must be wordIndexableFormat. */ /* begin setFormatOf:to: */ format = firstLongFormat(); @@ -51804,9 +51380,11 @@ initializeObjectMemory(sqInt bytesToShift) /* free space before shrinking */ GIV(shrinkThreshold) = 0x2000000; /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* By default GC after scavenge if heap has grown by a third since the last GC */ GIV(heapGrowthToSizeGCRatio) = 0.333333; @@ -51814,12 +51392,10 @@ initializeObjectMemory(sqInt bytesToShift) /* print free chunks in freeTree in order. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#inOrderPrintFreeTree:printList: */ -EXPORT(void) +void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList) { sqInt next; @@ -52072,18 +51648,6 @@ isAnyPointerFormat(sqInt format) } -/* Answer if this is an indexable object with pointer elements, e.g., an - array - */ - - /* SpurMemoryManager>>#isArrayNonImm: */ -sqInt -isArrayNonImm(sqInt oop) -{ - return ((((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask())) == 2 /* arrayFormat */; -} - - /* Answer true if this is an indexable object with pointer elements, e.g., an array */ @@ -52509,7 +52073,7 @@ isObjImmutable(sqInt anOop) /* Answer if obj is old. Require that obj is non-immediate. */ /* SpurMemoryManager>>#isOldObject: */ -sqInt +static sqInt NoDbgRegParms isOldObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(isNonImmediate(objOop)); @@ -52582,19 +52146,6 @@ isPureBitsFormat(sqInt format) && (format < (firstCompiledMethodFormat())); } - -/* Answer if oop is young. */ - - /* SpurMemoryManager>>#isReallyYoung: */ -sqInt -isReallyYoung(sqInt oop) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return ((!(oop & (tagMask())))) - && ((assert(isNonImmediate(oop)), - (oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart))))); -} - /* SpurMemoryManager>>#isRemembered: */ static sqInt NoDbgRegParms isRemembered(sqInt objOop) @@ -52635,10 +52186,10 @@ isShorts(sqInt oop) /* This version is private to SpurMemoryManager (for asserts, etc). It does - not take advantage of the power-of0two optimization in isForwarded:. */ + not take advantage of the power-of-two optimization in isForwarded:. */ /* SpurMemoryManager>>#isUnambiguouslyForwarder: */ -sqInt +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop) { return ((longAt(objOop)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()); @@ -53029,7 +52580,7 @@ lastPointerFormat(void) pointer, and the image contains no forwarders (see class comment). */ /* SpurMemoryManager>>#lastPointerOfWhileSwizzling: */ -sqInt +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fmt; @@ -53066,7 +52617,7 @@ lastPointerOfWhileSwizzling(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#lastPointerOf: */ -sqInt +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -53115,13 +52666,6 @@ lastPointerOf(sqInt objOop) ((header >> 1)) & AlternateHeaderNumLiteralsMask)) + LiteralStart) - 1) * BytesPerOop) + BaseHeaderSize; } - /* SpurMemoryManager>>#leakCheckBecome */ -sqInt -leakCheckBecome(void) -{ - return ((checkForLeaks & GCModeBecome) != 0); -} - /* SpurMemoryManager>>#leakCheckFullGC */ sqInt leakCheckFullGC(void) @@ -53129,13 +52673,6 @@ leakCheckFullGC(void) return ((checkForLeaks & GCModeFull) != 0); } - /* SpurMemoryManager>>#leakCheckIncremental */ -sqInt -leakCheckIncremental(void) -{ - return ((checkForLeaks & GCModeIncremental) != 0); -} - /* SpurMemoryManager>>#leakCheckNewSpaceGC */ sqInt leakCheckNewSpaceGC(void) @@ -53736,12 +53273,10 @@ loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesOf: */ -EXPORT(void) +void longPrintInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -53756,12 +53291,10 @@ longPrintInstancesOf(sqInt aClassOop) /* Scan the heap printing any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesWithClassIndex: */ -EXPORT(void) +void longPrintInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -53869,12 +53402,10 @@ longPrintInstancesWithClassIndex(sqInt classIndex) /* Scan the heap long printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintReferencesTo: */ -EXPORT(void) +void longPrintReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -55295,21 +54826,6 @@ maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format) } -/* Answer one of the objects in the SpecialObjectsArray, if in range, - otherwise answer nil. - */ - - /* SpurMemoryManager>>#maybeSplObj: */ -sqInt -maybeSplObj(sqInt index) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return (index < (numSlotsOf(GIV(specialObjectsOop))) - ? (/* begin fetchPointer:ofObject: */ - longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) - : 0); -} - - /* Answer the minimum number of additional slots to allocate in an object to always be able to shorten it. This is enough slots to allocate a minimum-sized object. */ @@ -55732,7 +55248,7 @@ numBytesOf(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#numPointerSlotsOf: */ -usqInt +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -55912,24 +55428,6 @@ numStrongSlotsOfInephemeral(sqInt objOop) } -/* Answer the number of strong pointer fields in the given weakling. */ - - /* SpurMemoryManager>>#numStrongSlotsOfWeakling: */ -sqInt -numStrongSlotsOfWeakling(sqInt objOop) -{ - sqInt classFormat; - sqInt objOop1; - - assert((formatOf(objOop)) == (weakArrayFormat())); - /* begin fixedFieldsOfClass: */ - objOop1 = fetchClassOfNonImm(objOop); - /* begin fixedFieldsOfClassFormat: */ - classFormat = ((longAt((objOop1 + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - return classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); -} - - /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -56001,6 +55499,9 @@ objectAfter(sqInt objOop) : followingWordAddress3); } + +/* useful for debugging */ + /* SpurMemoryManager>>#objectBefore: */ sqInt objectBefore(sqInt objOop) @@ -56572,6 +56073,7 @@ okayOop(sqInt signedOop) } +/* useful for debugging */ /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -56754,7 +56256,6 @@ pinObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt format; - sqInt i; sqInt oldClone; sqInt referent; SpurSegmentInfo *seg; @@ -56770,15 +56271,7 @@ pinObject(sqInt objOop) longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); return objOop; } - /* begin segmentContainingObj: */ - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - seg = (&(GIV(segments)[i])); - goto l1; - } - } - seg = null; - l1: /* end segmentContainingObj: */; + seg = segmentContainingObj(objOop); if ((seg->containsPinned)) { /* begin setIsPinnedOf:to: */ longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); @@ -57028,12 +56521,10 @@ primitiveErrorTable(void) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printActivationsOf: */ -EXPORT(void) +void printActivationsOf(sqInt aMethodObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -57101,12 +56592,10 @@ printActivationsOf(sqInt aMethodObj) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printBogons */ -EXPORT(void) +void printBogons(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT /* begin printTheBogons: */ @@ -57123,16 +56612,34 @@ printBogons(void) cr(); } + /* SpurMemoryManager>>#printBridge:on: */ +static void NoDbgRegParms +printBridgeon(sqInt oop, FILE *aStream) +{ + fprintf(aStream, + "%p is a bridge hdr%d slot size %ul\n", + ((void *)oop), + ((byteAt(oop + 7)) == (numSlotsMask()) + ? 16 + : 8), + numSlotsOfAny(oop)); +} + /* SpurMemoryManager>>#printCantBeObject:on: */ static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (((oop & (7)) == 0) - && (((oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) - && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))))) { - printForwarderon(oop, aStream); - return; + if ((oop & (7)) == 0) { + if (((oopisLessThan(oop, GIV(oldSpaceStart))) + && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) + && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { + printForwarderon(oop, aStream); + return; + } + if (oop == (bridgeAt((numSegments()) - 1))) { + printBridgeon(oop, aStream); + return; + } } fprintf(aStream, "%p%s\n", @@ -57146,12 +56653,10 @@ printCantBeObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printContextReferencesTo: */ -EXPORT(void) +void printContextReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -57231,12 +56736,10 @@ printContextReferencesTo(sqInt anOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printEntity: */ -EXPORT(void) +void printEntity(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -57370,12 +56873,10 @@ printEntity(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printForwarders */ -EXPORT(void) +void printForwarders(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -57484,7 +56985,7 @@ static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream) { fprintf(aStream, - "%p is a forwarded hdr%d slot size %ud object to %p\n", + "%p is a forwarded hdr%d slot size %ul object to %p\n", ((void *)oop), ((byteAt(oop + 7)) == (numSlotsMask()) ? 16 @@ -57497,6 +56998,7 @@ printForwarderon(sqInt oop, FILE *aStream) /* This version goes through memory, printing all free chunks. Other versions go through the free lists. This one will show all free chunks even if the free lists are corrupt. */ +/* useful for debugging */ /* SpurMemoryManager>>#printFreeChunks */ void @@ -57612,12 +57114,10 @@ printFreeChunks(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeChunk: */ -EXPORT(void) +void printFreeChunk(sqInt freeChunk) { printFreeChunkprintAsTreeNode(freeChunk, 1); @@ -57704,12 +57204,10 @@ printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeListHeads */ -EXPORT(void) +void printFreeListHeads(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt expectedMask; @@ -57745,12 +57243,10 @@ printFreeListHeads(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeList: */ -EXPORT(sqInt) +sqInt printFreeList(sqInt chunkOrIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fieldIndex; @@ -57783,12 +57279,10 @@ printFreeObjecton(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeTree */ -EXPORT(void) +void printFreeTree(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFreeTreeChunk(GIV(freeLists)[0]); @@ -57812,13 +57306,11 @@ printFreeTreeChunk(sqInt chunkOrZero) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* N.B. No safety bounds checks!! We need to look e.g. at corpses. */ /* SpurMemoryManager>>#printHeaderOf: */ -EXPORT(void) +void printHeaderOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -57931,12 +57423,10 @@ printImmediateObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesOf: */ -EXPORT(void) +void printInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -57951,12 +57441,10 @@ printInstancesOf(sqInt aClassOop) /* Scan the heap printing the oops of any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesWithClassIndex: */ -EXPORT(void) +void printInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58062,6 +57550,7 @@ printInstancesWithClassIndex(sqInt classIndex) /* Print the objects in the classTable that have bad hashes. */ +/* useful for debugging */ /* SpurMemoryManager>>#printInvalidClassTableEntries */ void @@ -58111,13 +57600,11 @@ printInvalidClassTableEntries(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMarkedOops */ #if LLDB -EXPORT(void) +void printMarkedOops(void) { printOopsSuchThat(isMarked); @@ -58128,12 +57615,10 @@ printMarkedOops(void) /* Scan the heap printing the oops of any and all methods that implement anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodImplementorsOf: */ -EXPORT(void) +void printMethodImplementorsOf(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -58199,12 +57684,10 @@ printMethodImplementorsOf(sqInt anOop) /* Scan the heap printing the oops of any and all methods that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodReferencesTo: */ -EXPORT(void) +void printMethodReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -58390,12 +57873,10 @@ printNonPointerDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsFrom:to: */ -EXPORT(void) +void printObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -58419,12 +57900,10 @@ printObjectsFromto(sqInt startAddress, sqInt endAddress) /* Scan the heap printing the oops of any and all objects whose hash equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsWithHash: */ -EXPORT(void) +void printObjectsWithHash(sqInt hash) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58526,6 +58005,21 @@ printObjectsWithHash(sqInt hash) l4: /* end allNewSpaceEntitiesDo: */; } + /* SpurMemoryManager>>#printObjStackAndContents: */ +void +printObjStackAndContents(sqInt objStack) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + /* begin printObjStack:printContents: */ + if (objStack == GIV(nilObj)) { + /* begin print: */ + fprintf(GIV(transcript), "nil"); + cr(); + } + else { + printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((int)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, 1); + } +} + /* SpurMemoryManager>>#printObjStackPage:myIndex:pageType:printContents: */ static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents) @@ -58688,6 +58182,9 @@ printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType) cr(); } + +/* useful for debugging */ + /* SpurMemoryManager>>#printObjStack: */ void printObjStack(sqInt objStack) @@ -58703,27 +58200,11 @@ printObjStack(sqInt objStack) } } - /* SpurMemoryManager>>#printObjStack:printContents: */ -void -printObjStackprintContents(sqInt objStack, sqInt printContents) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - if (objStack == GIV(nilObj)) { - /* begin print: */ - fprintf(GIV(transcript), "nil"); - cr(); - } - else { - printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((int)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, printContents); - } -} - -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsExcept: */ -EXPORT(void) NeverInline +void NeverInline printOopsExcept(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58841,12 +58322,10 @@ printOopsExcept(sqInt (*function)(sqInt)) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsFrom:to: */ -EXPORT(void) +void printOopsFromto(sqInt startAddress, sqInt endAddress) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstNonEntity; @@ -58899,12 +58378,10 @@ printOopsFromto(sqInt startAddress, sqInt endAddress) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsSuchThat: */ -EXPORT(void) NeverInline +void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59023,12 +58500,10 @@ printOopsSuchThat(sqInt (*function)(sqInt)) /* Scan the heap printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printReferencesTo: */ -EXPORT(void) +void printReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -59272,13 +58747,11 @@ printStringDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printUnmarkedOops */ #if LLDB -EXPORT(void) +void printUnmarkedOops(void) { printOopsExcept(isMarked); @@ -59934,12 +59407,10 @@ shortentoIndexableSize(sqInt objOop, sqInt indexableSize) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#shortPrintObjectsFrom:to: */ -EXPORT(void) +void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -60077,7 +59548,7 @@ startOfObject(sqInt objOop) /* Part of InterpreterProxy's 1.14 API */ /* SpurMemoryManager>>#statNumGCs */ -EXPORT(sqInt) +sqInt statNumGCs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT return (GIV(statScavenges) + GIV(statIncrGCs)) + GIV(statFullGCs); @@ -60119,13 +59590,21 @@ storeCheckBoundary(void) The primitive can fail for the following reasons with the specified failure codes: - PrimErrGenericError: the segmentWordArray is too small for the version - stamp PrimErrWritePastObject: the segmentWordArray is too small to contain - the reachable objects - PrimErrBadIndex: the outPointerArray is too small - PrimErrNoMemory: additional allocations failed + PrimErrGenericFailure: the segmentWordArray is too small for the version + stamp PrimErrWritePastObject: the segmentWordArray is too small to + contain the reachable objects + PrimErrBadIndex: the outPointerArray is too small + PrimErrNoMemory: there is insufficient free space to store the array + answered by objectsReachableFromRoots:, + or the savedFirstFields and savedOutHashes arrays. + PrimErrNeedCompaction: a GC is needed to make room for the array answered + by objectsReachableFromRoots: PrimErrLimitExceeded: there is no room in the hash field to store out - pointer indices or class references. */ + pointer indices or class references, + or the outPointerArray is larger than the max value of the hash field. + PrimErrNoModification: the segmentWordArrayArg or outPointerArrayArg are + immutable PrimErrObjectIsPinned: the segmentWordArrayArg or + outPointerArrayArg are pinned */ /* SpurMemoryManager>>#storeImageSegmentInto:outPointers:roots: */ static sqInt NoDbgRegParms @@ -60380,6 +59859,7 @@ storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt val /* Note must check here for stores of young objects into old ones. */ +/* See SistaCogit */ /* SpurMemoryManager>>#storePointer:ofObject:withValue: */ sqInt @@ -60474,7 +59954,8 @@ sufficientSpaceAfterGC(sqInt numBytes) assert(numBytes == 0); scavengingGCTenuringIf(TenureByAge); - heapSizePostGC = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + heapSizePostGC = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); if (((((double) (heapSizePostGC - GIV(heapSizeAtPreviousGC)) )) / GIV(heapSizeAtPreviousGC)) >= GIV(heapGrowthToSizeGCRatio)) { fullGC(); } @@ -61085,6 +60566,9 @@ validClassTableRootPages(void) return 1; } + +/* useful for debugging */ + /* SpurMemoryManager>>#validFreeTree */ sqInt validFreeTree(void) @@ -61480,6 +60964,7 @@ copyAndUnmarkMobileObjects(void) usqInt previousPin; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt start; usqInt startOfPreviousPin; usqInt toFinger; @@ -61557,19 +61042,16 @@ copyAndUnmarkMobileObjects(void) assert((isMarked(previousPin)) && (isPinned(previousPin))); /* begin unmarkPinned: */ - if (!(((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(previousPin)); + } + else { setIsMarkedOfto(previousPin, 0); /* begin notePinned: */ assert(isPinned(previousPin)); - if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(previousPin, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), previousPin)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(previousPin)))); + seg = segmentContainingObj(previousPin); + (seg->containsPinned = 1); } toFinger = addressAfter(previousPin); /* begin objectStartingAt: */ @@ -61810,6 +61292,7 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) usqInt numSlots; sqInt obj; usqInt objStart; + SpurSegmentInfo *seg; usqInt toFinger; toFinger = initialToFinger; @@ -61832,19 +61315,16 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) if ((((((usqInt)((longAt(obj + 4)))) >> (markedBitHalfShift())) & 1) != 0) && (((((usqInt)((longAt(obj)))) >> (pinnedBitShift())) & 1) != 0)) { /* begin unmarkPinned: */ - if (!(((longAt(obj)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(obj)); + } + else { setIsMarkedOfto(obj, 0); /* begin notePinned: */ assert(isPinned(obj)); - if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(obj, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), obj)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(obj)))); + seg = segmentContainingObj(obj); + (seg->containsPinned = 1); } if (toFinger < objStart) { /* begin addFreeChunkWithBytes:at: */ @@ -62257,6 +61737,7 @@ unmarkObjectsFromFirstFreeObject(void) sqInt objOop; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt startOfFree; startOfFree = 0; @@ -62279,19 +61760,16 @@ unmarkObjectsFromFirstFreeObject(void) } if (((((usqInt)((longAt(objOop)))) >> (pinnedBitShift())) & 1) != 0) { /* begin unmarkPinned: */ - if (!(((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(objOop)); + } + else { setIsMarkedOfto(objOop, 0); /* begin notePinned: */ assert(isPinned(objOop)); - if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(objOop, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), objOop)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(objOop)))); + seg = segmentContainingObj(objOop); + (seg->containsPinned = 1); } } else { @@ -62962,7 +62440,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: */ @@ -62992,7 +62470,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)) { @@ -63354,9 +62832,11 @@ collapseSegmentsPostSwizzle(void) GIV(canSwizzle) = 0; GIV(numSegments) = 1; + /* begin computeTotalHeapSizeIncludingBridges */ + GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()); cascade0 = (&(GIV(segments)[0])); (cascade0->segStart = oldSpaceStart()); - (cascade0->segSize = (GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()))); + (cascade0->segSize = GIV(totalHeapSizeIncludingBridges)); assert(isSegmentBridge(bridgeAt(0))); assert((numSlotsOfAny(bridgeAt(0))) == 0); } @@ -63538,7 +63018,6 @@ prepareForSnapshot(void) usqInt followingWordAddress; usqInt freeChunk; sqInt i; - sqInt i1; sqInt largeChild; sqInt limit; sqInt newEndOfMemory; @@ -63586,24 +63065,16 @@ prepareForSnapshot(void) followingWordAddress = addressAfter(node); if (oopisGreaterThanOrEqualTo(followingWordAddress, limit)) { next = limit; - goto l9; + goto l7; } flag("endianness"); followingWord = longAt(followingWordAddress + 4); next = ((((usqInt)(followingWord)) >> (numSlotsHalfShift())) == (numSlotsMask()) ? followingWordAddress + BaseHeaderSize : followingWordAddress); - l9: /* end objectAfter:limit: */; + l7: /* end objectAfter:limit: */; if (((longAt(next)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin segmentContainingObj: */ - for (i1 = (GIV(numSegments) - 1); i1 >= 0; i1 += -1) { - if (node >= (((GIV(segments)[i1]).segStart))) { - seg = (&(GIV(segments)[i1])); - goto l8; - } - } - seg = null; - l8: /* end segmentContainingObj: */; + seg = segmentContainingObj(node); (seg->lastFreeObject = node); node = 0; } @@ -63718,17 +63189,51 @@ readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes) return totalBytesRead; } + +/* Answer the segment containing an object. This is mostly for assert + checking, but + variations on the incremental GC may use it in anger. Binary search is (of + course) marginally slower than linear search for a single segment (e.g. in + a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every + old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or + 20% faster + in the same heap extended with enough large arrays to require 11 segments; + and this + is pessimal; there are fewer objects at high addresses since the large + arrays are there). */ + /* SpurSegmentManager>>#segmentContainingObj: */ -EXPORT(SpurSegmentInfo *) +SpurSegmentInfo * segmentContainingObj(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; + sqInt high; + sqInt low; + sqInt mid; + SpurSegmentInfo *seg; - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - return (&(GIV(segments)[i])); + low = 0; + mid = GIV(numSegments) / 2; + high = GIV(numSegments) - 1; + do { + seg = (&(GIV(segments)[mid])); + if (oopisGreaterThanOrEqualTo(objOop, (seg->segStart))) { + if (mid == high) { + return (oopisLessThan(objOop, ((seg->segSize)) + ((seg->segStart))) + ? seg + : 0); + } + else { + low = mid; + mid = ((mid + high) + 1) / 2; + } } - } + else { + high = mid - 1; + mid = (low + mid) / 2; + } + } while(low <= high); return null; } @@ -63905,6 +63410,9 @@ swizzleObj(sqInt objOop) return objOop + (((GIV(segments)[0]).swizzle)); } + +/* This ``slow'' count is for asserts only. */ + /* SpurSegmentManager>>#totalBytesInSegments */ static usqInt totalBytesInSegments(void) @@ -63916,7 +63424,6 @@ totalBytesInSegments(void) for (i = 0; i < GIV(numSegments); i += 1) { total += ((GIV(segments)[i]).segSize); } - assert(GIV(totalHeapSizeIncludingBridges) == total); return total; } @@ -64041,12 +63548,10 @@ accessorDepthForPrimitiveMethod(sqInt aMethodObj) /* Answer the current activeProcess. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#activeProcess */ -EXPORT(sqInt) +sqInt activeProcess(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt objOop; @@ -64379,7 +63884,7 @@ booleanValueOf(sqInt obj) /* Re-enter the interpreter to execute a (non-Alien) callback. */ /* StackInterpreter>>#callbackEnter: */ -EXPORT(sqInt) +sqInt callbackEnter(sqInt *callbackID) { warning("callbackEnter: is obsolete"); @@ -64390,7 +63895,7 @@ callbackEnter(sqInt *callbackID) /* Leave from a previous callback */ /* StackInterpreter>>#callbackLeave: */ -EXPORT(sqInt) +sqInt callbackLeave(sqInt cbID) { warning("callbackLeave: is obsolete"); @@ -64444,12 +63949,10 @@ characterForAscii(sqInt ascii) /* Ensure that all accessible objects in the heap are okay. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkAllAccessibleObjectsOkay */ -EXPORT(sqInt) +sqInt checkAllAccessibleObjectsOkay(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -64869,12 +64372,10 @@ checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkOkayInterpreterObjects: */ -EXPORT(sqInt) +sqInt checkOkayInterpreterObjects(sqInt writeBack) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -65222,19 +64723,10 @@ contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP) /* StackInterpreter>>#copiedValueCountOfClosure: */ sqInt -copiedValueCountOfClosure(sqInt closurePointer) -{ - return (numSlotsOf(closurePointer)) - ClosureFirstCopiedValueIndex; -} - - -/* for Cogit */ - - /* StackInterpreter>>#copiedValueCountOfFullClosure: */ -sqInt -copiedValueCountOfFullClosure(sqInt closurePointer) +copiedValueCountOfClosure(sqInt closureObj) { - return (numSlotsOf(closurePointer)) - FullClosureFirstCopiedValueIndex; + return (assert(isVanillaBlockClosure(closureObj)), + (numSlotsOf(closureObj)) - ClosureFirstCopiedValueIndex); } @@ -67514,7 +67006,7 @@ fullDisplayUpdate(void) example). Default for now is simply the entry in the base primitiveTable. */ /* StackInterpreter>>#functionPointerFor:inClass: */ -void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) +static void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) { return (primIdx > MaxPrimitiveIndex ? 0 @@ -67576,8 +67068,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; @@ -68956,12 +68448,10 @@ loadInitialContext(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#longPrintOop: */ -EXPORT(void) +void longPrintOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -70452,7 +69942,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; @@ -70496,7 +69986,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; @@ -70514,7 +70004,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); @@ -71799,19 +71289,6 @@ pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod return pcPreviousToinSqueakV3PlusClosuresMethod(theIP, aMethod); } - /* StackInterpreter>>#penultimateLiteralOf: */ -sqInt -penultimateLiteralOf(sqInt aMethodOop) -{ - sqInt offset; - - assert(isOopCompiledMethod(aMethodOop)); - /* begin literal:ofMethod: */ - offset = (literalCountOf(aMethodOop)) - 2; - /* begin fetchPointer:ofObject: */ - return longAt((aMethodOop + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); -} - /* In the StackInterpreter stacks grow down. */ @@ -72509,12 +71986,10 @@ printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObjec /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacks */ -EXPORT(void) +void printAllStacks(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -72713,12 +72188,10 @@ printAllStacks(void) /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacksOn: */ -EXPORT(void) +void printAllStacksOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -72733,12 +72206,10 @@ printAllStacksOn(FILE *aStdioStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStack */ -EXPORT(void) +void printCallStack(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (GIV(framePointer) == null) { @@ -72772,18 +72243,17 @@ printCallStackFP(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOf: */ -EXPORT(sqInt) +sqInt printCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; - if ((((((usqInt)aContextOrProcessOrFrame)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)aContextOrProcessOrFrame)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)aContextOrProcessOrFrame)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)aContextOrProcessOrFrame)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)aContextOrProcessOrFrame)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)aContextOrProcessOrFrame)) <= (((usqInt)GIV(pages)))))))) { return printCallStackFP(((char *) aContextOrProcessOrFrame)); } if (aContextOrProcessOrFrame == (activeProcess())) { @@ -72880,12 +72350,10 @@ printCallStackOfcurrentFP(sqInt aContext, char *currFP) /* Print the call stack on a specific output stream. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOn: */ -EXPORT(void) +void printCallStackOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -72919,12 +72387,10 @@ printContextCallStackOf(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printContext: */ -EXPORT(void) +void printContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -73020,7 +72486,7 @@ printContext(sqInt aContext) meth = longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - meth); + ((void *)meth)); printOopShortInner(meth); if (methodHasCogMethod(meth)) { fprintf(GIV(transcript), @@ -73123,12 +72589,10 @@ printDecodeMethodHeaderOop(sqInt methodHeaderOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printExternalHeadFrame */ -EXPORT(void) +void printExternalHeadFrame(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFrameWithSP(GIV(framePointer), GIV(stackPointer)); @@ -73138,8 +72602,9 @@ printExternalHeadFrame(void) static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { return null; } if (!((longAt(theFP + FoxSavedFP)) == 0)) { @@ -73188,7 +72653,7 @@ printFrameOopindexat(char *name, sqInt idx, char *address) "%10p:", ((void *)address)); fprintf(GIV(transcript), - "%s%10s%d: %10p\t", + "%s%10s%" PRIdSQINT ": %10p\t", (idx > 9 ? "" : " "), @@ -73200,19 +72665,20 @@ printFrameOopindexat(char *name, sqInt idx, char *address) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFramesInPage: */ -EXPORT(void) +void printFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 0); } + +/* useful for VM debugging */ + /* StackInterpreter>>#printFramesOnStackPageListInUse */ -EXPORT(void) +void printFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -73285,12 +72751,10 @@ printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame: */ -EXPORT(sqInt) +sqInt printFrame(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *aFrame; @@ -73300,8 +72764,9 @@ printFrame(char *theFP) StackPage *thePage; char *theSP; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { if ((addressCouldBeObj(((sqInt)theFP))) && ((isInMemory(((sqInt)theFP))) && ((((longAt(((sqInt)theFP))) & (classIndexMask())) == ClassMethodContextCompactIndex) @@ -73379,18 +72844,6 @@ printFrame(char *theFP) } -/* Print n in hex, in the form '0x1234', unpadded */ - - /* StackInterpreter>>#printHexnp: */ -sqInt -printHexnp(usqInt n) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return fprintf(GIV(transcript), - "%p", - ((void *)n)); -} - - /* Print p in hex, unpadded, in the form 0x1234 (C)/16r1234 (here) */ /* StackInterpreter>>#printHexPtrnp: */ @@ -73422,12 +72875,10 @@ printHex(usqInt n) /* Print all methods whose penultimate literal is either selector, or an object whose first inst var is the method and whose second is selector (e.g. an AdditionalMethodState). */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printLikelyImplementorsOfSelector: */ -EXPORT(void) +void printLikelyImplementorsOfSelector(sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -73505,12 +72956,10 @@ printLikelyImplementorsOfSelector(sqInt selector) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCache */ -EXPORT(void) +void printMethodCache(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -73595,12 +73044,10 @@ printMethodCache(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionaryOf: */ -EXPORT(void) +void printMethodDictionaryOf(sqInt behavior) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt dictionary; @@ -73643,12 +73090,10 @@ printMethodDictionaryOf(sqInt behavior) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionary: */ -EXPORT(void) +void printMethodDictionary(sqInt dictionary) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt index; @@ -73931,10 +73376,10 @@ printOopShortInner(sqInt oop) } -/* use export: not api, so it won't be written to cointerp.h */ +/* useful for VM debugging */ /* StackInterpreter>>#printOop: */ -EXPORT(void) +void printOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -74116,12 +73561,10 @@ printOop(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcessStack: */ -EXPORT(void) +void printProcessStack(sqInt aProcess) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ctx; @@ -74160,12 +73603,10 @@ printProcessStack(sqInt aProcess) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcsOnList: */ -EXPORT(sqInt) +sqInt printProcsOnList(sqInt procList) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstProc; @@ -74191,12 +73632,10 @@ printProcsOnList(sqInt procList) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackCallStackOf: */ -EXPORT(sqInt) +sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -74229,12 +73668,10 @@ printStackCallStackOf(sqInt aContextOrProcessOrFrame) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageList */ -EXPORT(void) +void printStackPageList(void) { StackPage *page; @@ -74248,12 +73685,10 @@ printStackPageList(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageListInUse */ -EXPORT(void) +void printStackPageListInUse(void) { sqInt n; @@ -74270,12 +73705,10 @@ printStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPages */ -EXPORT(void) +void printStackPages(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -74290,12 +73723,10 @@ printStackPages(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPagesInUse */ -EXPORT(void) +void printStackPagesInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -74424,12 +73855,10 @@ printStackPageuseCount(StackPage *page, sqInt n) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackReferencesTo: */ -EXPORT(void) +void printStackReferencesTo(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *callerFP; @@ -74811,7 +74240,7 @@ putWord32toFile(int aWord32, sqImageFile aFile) } -/* Anwer true if images of the given format are readable by this interpreter. +/* Anwer if images of the given format are readable by this interpreter. Allows a virtual machine to accept selected older image formats. */ /* StackInterpreter>>#readableFormat: */ @@ -74852,7 +74281,7 @@ reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader) and mark calloutContext as dead. */ /* StackInterpreter>>#reestablishContextPriorToCallback: */ -EXPORT(sqInt) +sqInt reestablishContextPriorToCallback(sqInt callbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; @@ -75389,7 +74818,7 @@ retryPrimitiveOnFailure(void) and mark callbackMethodContext as dead. */ /* StackInterpreter>>#returnAs:ThroughCallback:Context: */ -EXPORT(sqInt) +sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt aMethodObj; @@ -75717,12 +75146,10 @@ schedulerPointer(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakMNUSelector: */ -EXPORT(void) +void setBreakMNUSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -75736,12 +75163,10 @@ setBreakMNUSelector(char *aString) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakSelector: */ -EXPORT(void) +void setBreakSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -75762,7 +75187,7 @@ setFullScreenFlag(sqInt value) } /* StackInterpreter>>#setInterruptCheckChain: */ -EXPORT(void *) +void * setInterruptCheckChain(void (*aFunction)()) { void (*prevFunction)(); @@ -75885,6 +75310,7 @@ static sqInt NoDbgRegParms shortPrintContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt home; + sqInt rcvr; sqInt senderOop; char *theFP; @@ -75928,15 +75354,16 @@ shortPrintContext(sqInt aContext) if (home == null) { /* begin print: */ fprintf(GIV(transcript), " BOGUS CONTEXT (can't determine home)"); + cr(); } else { - printActivationNameForreceiverisBlockfirstTemporary(fetchPointerofObject(MethodIndex, (!(home) - ? aContext - : home)), (home == null - ? /* begin nilObject */ GIV(nilObj) - : (longAt((home + BaseHeaderSize) + (((int)((usqInt)(ReceiverIndex) << (shiftForWord()))))))), home != aContext, longAt((home + BaseHeaderSize) + (((int)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin fetchPointer:ofObject: */ + rcvr = longAt((home + BaseHeaderSize) + (((int)((usqInt)(ReceiverIndex) << (shiftForWord()))))); + printActivationNameForreceiverisBlockfirstTemporary(longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))), rcvr, home != aContext, longAt((home + BaseHeaderSize) + (((int)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin space */ + printChar(' '); + shortPrintOop(rcvr); } - cr(); return 0; } @@ -75944,8 +75371,9 @@ shortPrintContext(sqInt aContext) static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { return null; } shortPrintFrame(theFP); @@ -75956,19 +75384,20 @@ shortPrintFrameAndCallers(char *theFP) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFramesInPage: */ -EXPORT(void) +void shortPrintFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 1); } + +/* useful for VM debugging */ + /* StackInterpreter>>#shortPrintFramesOnStackPageListInUse */ -EXPORT(void) +void shortPrintFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -75987,17 +75416,16 @@ shortPrintFramesOnStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFrame:AndNCallers: */ -EXPORT(void) +void shortPrintFrameAndNCallers(char *theFP, sqInt n) { DECL_MAYBE_SQ_GLOBAL_STRUCT if ((n != 0) + && ((GIV(stackBasePlus1) != null) && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { shortPrintFrame(theFP); shortPrintFrameAndNCallers(pointerForOop(longAt(theFP + FoxSavedFP)), n - 1); } @@ -81690,7 +81118,8 @@ primitiveStoreStackp(void) 48 various header flags. See getImageHeaderFlags. 49 max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing) - 50 max literal count for JIT compile (stored in image file header; Cog + + 50 max literal count for JIT compile (stored in image file header; Cog only; otherwise nil) 51 nil; reserved for VM parameters that persist in the image (such as eden above) 52 root/remembered table capacity @@ -81837,7 +81266,8 @@ primitiveVMParameter(void) /* begin primitiveAllVMParameters: */ result1 = instantiateClassindexableSize(splObj(ClassArray), paramsArraySize); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer8 = positiveMachineIntegerFor(totalBytesInSegments()); + valuePointer8 = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (0U << (shiftForWord())), valuePointer8); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -81845,7 +81275,8 @@ primitiveVMParameter(void) assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (1U << (shiftForWord())), valuePointer9); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (2U << (shiftForWord())), valuePointer10); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -82181,7 +81612,8 @@ primitiveVMParameter(void) /* begin primitiveGetVMParameter: */ switch (index) { case 1: - result = positiveMachineIntegerFor(totalBytesInSegments()); + result = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); goto l88; break; case 2: @@ -82189,7 +81621,8 @@ primitiveVMParameter(void) goto l88; break; case 3: - result = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + result = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); goto l88; break; case 6: @@ -82947,8 +82380,9 @@ pruneStackstackp(sqInt stack, sqInt stackp) for (i = 2; i < stackp; i += 2) { /* begin fetchPointer:ofObject: */ objOrFP = longAt((stack + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))); - if ((((((usqInt)(((char *) objOrFP)))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)(((char *) objOrFP)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) objOrFP)))) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)(((char *) objOrFP)))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)(((char *) objOrFP)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) objOrFP)))) <= (((usqInt)GIV(pages)))))))) { /* begin withSmallIntegerTags: */ assert(((oopForPointer(((char *) objOrFP))) & (BytesPerWord - 1)) == 0); objOrFP = (oopForPointer(((char *) objOrFP))) + (smallIntegerTag()); @@ -83156,17 +82590,6 @@ unmarkAfterPathTo(void) static char _m[] = ""; void* vm_exports[][3] = { - {(void*)_m, "activeProcess", (void*)activeProcess}, - {(void*)_m, "callbackEnter", (void*)callbackEnter}, - {(void*)_m, "callbackLeave", (void*)callbackLeave}, - {(void*)_m, "checkAllAccessibleObjectsOkay", (void*)checkAllAccessibleObjectsOkay}, - {(void*)_m, "checkOkayInterpreterObjects", (void*)checkOkayInterpreterObjects}, - {(void*)_m, "dumpPrimTraceLogOn", (void*)dumpPrimTraceLogOn}, - {(void*)_m, "inOrderPrintFreeTreeprintList", (void*)inOrderPrintFreeTreeprintList}, - {(void*)_m, "longPrintInstancesOf", (void*)longPrintInstancesOf}, - {(void*)_m, "longPrintInstancesWithClassIndex", (void*)longPrintInstancesWithClassIndex}, - {(void*)_m, "longPrintOop", (void*)longPrintOop}, - {(void*)_m, "longPrintReferencesTo", (void*)longPrintReferencesTo}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, {(void*)_m, "primitiveAddLargeIntegers\000\000\001", (void*)primitiveAddLargeIntegers}, {(void*)_m, "primitiveAllInstances\000\000\000", (void*)primitiveAllInstances}, @@ -83179,6 +82602,9 @@ void* vm_exports[][3] = { #endif /* VMBenchmarks */ #if VMBenchmarks {(void*)_m, "primitiveBenchmarkJITReceiver\000\000\000", (void*)primitiveBenchmarkJITReceiver}, +#endif /* VMBenchmarks */ +#if VMBenchmarks + {(void*)_m, "primitiveBenchmarkScavenge\000\377\000", (void*)primitiveBenchmarkScavenge}, #endif /* VMBenchmarks */ {(void*)_m, "primitiveBitAndLargeIntegers\000\000\001", (void*)primitiveBitAndLargeIntegers}, {(void*)_m, "primitiveBitOrLargeIntegers\000\000\001", (void*)primitiveBitOrLargeIntegers}, @@ -83244,72 +82670,5 @@ void* vm_exports[][3] = { #endif /* TestingPrimitives */ {(void*)_m, "primitiveUtcWithOffset\000\001\000", (void*)primitiveUtcWithOffset}, {(void*)_m, "primitiveVoidReceiver\000\377\000", (void*)primitiveVoidReceiver}, - {(void*)_m, "printActivationsOf", (void*)printActivationsOf}, - {(void*)_m, "printAllStacks", (void*)printAllStacks}, - {(void*)_m, "printAllStacksOn", (void*)printAllStacksOn}, - {(void*)_m, "printBogons", (void*)printBogons}, - {(void*)_m, "printCallStack", (void*)printCallStack}, - {(void*)_m, "printCallStackOf", (void*)printCallStackOf}, - {(void*)_m, "printCallStackOn", (void*)printCallStackOn}, - {(void*)_m, "printCogMethod", (void*)printCogMethod}, - {(void*)_m, "printContextReferencesTo", (void*)printContextReferencesTo}, - {(void*)_m, "printContext", (void*)printContext}, - {(void*)_m, "printEntity", (void*)printEntity}, - {(void*)_m, "printExternalHeadFrame", (void*)printExternalHeadFrame}, - {(void*)_m, "printForwarders", (void*)printForwarders}, - {(void*)_m, "printFramesInPage", (void*)printFramesInPage}, - {(void*)_m, "printFramesOnStackPageListInUse", (void*)printFramesOnStackPageListInUse}, - {(void*)_m, "printFrame", (void*)printFrame}, - {(void*)_m, "printFrameWithSP", (void*)printFrameWithSP}, - {(void*)_m, "printFreeChunk", (void*)printFreeChunk}, - {(void*)_m, "printFreeListHeads", (void*)printFreeListHeads}, - {(void*)_m, "printFreeList", (void*)printFreeList}, - {(void*)_m, "printFreeTree", (void*)printFreeTree}, - {(void*)_m, "printHeaderOf", (void*)printHeaderOf}, - {(void*)_m, "printInstancesOf", (void*)printInstancesOf}, - {(void*)_m, "printInstancesWithClassIndex", (void*)printInstancesWithClassIndex}, - {(void*)_m, "printLikelyImplementorsOfSelector", (void*)printLikelyImplementorsOfSelector}, -#if LLDB - {(void*)_m, "printMarkedOops", (void*)printMarkedOops}, -#endif /* LLDB */ - {(void*)_m, "printMethodCache", (void*)printMethodCache}, - {(void*)_m, "printMethodCacheFor", (void*)printMethodCacheFor}, - {(void*)_m, "printMethodDictionaryOf", (void*)printMethodDictionaryOf}, - {(void*)_m, "printMethodDictionary", (void*)printMethodDictionary}, - {(void*)_m, "printMethodImplementorsOf", (void*)printMethodImplementorsOf}, - {(void*)_m, "printMethodReferencesTo", (void*)printMethodReferencesTo}, - {(void*)_m, "printObjectsFromto", (void*)printObjectsFromto}, - {(void*)_m, "printObjectsWithHash", (void*)printObjectsWithHash}, - {(void*)_m, "printOopsExcept", (void*)printOopsExcept}, - {(void*)_m, "printOopsFromto", (void*)printOopsFromto}, - {(void*)_m, "printOopsSuchThat", (void*)printOopsSuchThat}, - {(void*)_m, "printOop", (void*)printOop}, - {(void*)_m, "printProcessStack", (void*)printProcessStack}, - {(void*)_m, "printProcsOnList", (void*)printProcsOnList}, - {(void*)_m, "printReferencesTo", (void*)printReferencesTo}, - {(void*)_m, "printStackCallStackOf", (void*)printStackCallStackOf}, - {(void*)_m, "printStackPageList", (void*)printStackPageList}, - {(void*)_m, "printStackPageListInUse", (void*)printStackPageListInUse}, - {(void*)_m, "printStackPages", (void*)printStackPages}, - {(void*)_m, "printStackPagesInUse", (void*)printStackPagesInUse}, - {(void*)_m, "printStackReferencesTo", (void*)printStackReferencesTo}, -#if LLDB - {(void*)_m, "printUnmarkedOops", (void*)printUnmarkedOops}, -#endif /* LLDB */ - {(void*)_m, "reestablishContextPriorToCallback", (void*)reestablishContextPriorToCallback}, - {(void*)_m, "reportMinimumUnusedHeadroom", (void*)reportMinimumUnusedHeadroom}, - {(void*)_m, "reportMinimumUnusedHeadroomOn", (void*)reportMinimumUnusedHeadroomOn}, - {(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext}, - {(void*)_m, "segmentContainingObj", (void*)segmentContainingObj}, - {(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext}, - {(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector}, - {(void*)_m, "setBreakSelector", (void*)setBreakSelector}, - {(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain}, - {(void*)_m, "shortPrintFramesInPage", (void*)shortPrintFramesInPage}, - {(void*)_m, "shortPrintFramesOnStackPageListInUse", (void*)shortPrintFramesOnStackPageListInUse}, - {(void*)_m, "shortPrintFrameAndNCallers", (void*)shortPrintFrameAndNCallers}, - {(void*)_m, "shortPrintObjectsFromto", (void*)shortPrintObjectsFromto}, - {(void*)_m, "statNumGCs", (void*)statNumGCs}, - {(void*)_m, "whereIs", (void*)whereIs}, {NULL, NULL, NULL} }; diff --git a/src/spur32.cog.newspeak/cointerp.h b/src/spur32.cog.newspeak/cointerp.h index 0211c714a0..19bb01e1c5 100644 --- a/src/spur32.cog.newspeak/cointerp.h +++ b/src/spur32.cog.newspeak/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -22,7 +22,6 @@ extern sqInt accessorDepthForPrimitiveIndex(sqInt primIndex); extern usqInt argumentCountAddress(void); -extern void assertValidMachineCodeFrame(sqInt instrPtr); extern void callForCogCompiledCodeCompaction(void); extern void ceActivateFailingPrimitiveMethod(sqInt aPrimitiveMethod); extern sqInt ceBaseFrameReturn(sqInt returnValue); @@ -44,7 +43,6 @@ extern sqInt ceNonLocalReturn(sqInt returnValue); extern void ceOuterSendreceiver(sqInt cacheAddress, sqInt methodReceiver); extern void ceReapAndResetErrorCodeFor(CogMethod *cogMethod); extern void ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver); -extern sqInt ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); extern sqInt ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC); extern sqInt ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize); extern sqInt ceSendMustBeBoolean(sqInt anObject); @@ -57,29 +55,22 @@ extern void ceTraceBlockActivation(void); extern void ceTraceLinkedSend(sqInt theReceiver); extern void ceTraceStoreOfinto(sqInt aValue, sqInt anObject); extern usqInt cFramePointerAddress(void); -extern void checkAssertsEnabledInCoInterpreter(void); extern sqInt checkForAndFollowForwardedPrimitiveState(void); extern sqInt checkIfCFramePointerInUse(void); #if LRPCheck extern sqInt checkingLongRunningPrimitives(void); #endif /* LRPCheck */ -extern void clearTraceLog(void); -extern sqInt cogMethodHasTooManyLiterals(CogMethod *aCogMethod); extern CogMethod * cogMethodOf(sqInt aMethodOop); extern void compilationBreakpointFor(sqInt selectorOop); extern usqInt cReturnAddressAddress(void); extern usqInt cStackPointerAddress(void); extern sqInt defaultNativeStackFrameSize(void); -extern void dumpPrimTraceLog(void); extern void executeCogMethodfromLinkedSendWithReceiver(CogMethod *cogMethod, sqInt rcvr); extern void executeCogPICfromLinkedSendWithReceiverandCacheTag(CogMethod *cogPIC, sqInt rcvr, sqInt cacheTag); extern usqInt framePointerAddress(void); extern void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto(sqInt methodObj, sqInt primitiveIndex, sqInt *flagsPtr))(void); -extern char * getFramePointer(void); -extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); extern usqInt instructionPointerAddress(void); extern sqInt interpret(void); -extern usqInt interpretAddress(void); extern sqInt isCogMethodReference(sqInt methodHeader); extern sqInt isFullBlockMethod(sqInt aMethodObj); #if LRPCheck @@ -95,9 +86,6 @@ extern sqInt methodHasCogMethod(sqInt aMethodOop); extern sqInt methodNeedsLargeContext(sqInt methodObj); extern sqInt methodShouldBeCogged(sqInt aMethodObj); extern CogMethod * mframeHomeMethodExport(void); -extern CogMethod * mframeHomeMethod(char *theFP); -extern sqInt mMethodClass(void); -extern void mnuCompilationBreakpointFor(sqInt selectorOop); extern usqInt newMethodAddress(void); extern usqInt nextProfileTickAddress(void); extern sqInt noAssertHeaderOf(sqInt methodPointer); @@ -106,11 +94,10 @@ extern unsigned int positive32BitValueOf(sqInt oop); extern sqInt positive64BitIntegerFor(usqLong integerValue); extern usqLong positive64BitValueOf(sqInt oop); extern usqInt primFailCodeAddress(void); -extern usqInt primitiveFailAddress(void); extern sqInt primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs); extern void * primTraceLogAddress(void); extern usqInt primTraceLogIndexAddress(void); -EXPORT(void) printCogMethod(CogMethod *cogMethod); +extern void printCogMethod(CogMethod *cogMethod); extern sqInt quickPrimitiveConstantFor(sqInt aQuickPrimitiveIndex); extern sqInt (*quickPrimitiveGeneratorFor(sqInt aQuickPrimitiveIndex))(void); extern sqInt quickPrimitiveInstVarIndexFor(sqInt primIndex); @@ -129,23 +116,11 @@ extern sqInt startPCOfMethodHeader(sqInt aCompiledMethodHeader); extern sqInt startPCOrNilOfLiteralin(sqInt lit, sqInt aMethodObj); extern void updateStackZoneReferencesToCompiledCodePreCompaction(void); extern usqInt primitiveFunctionPointerAddress(void); -extern char * cStringOrNullFor(sqInt oop); -extern sqInt failed(void); -extern sqInt identityHashOf(sqInt anOop); extern void primitiveClosureValueNoContextSwitch(void); extern sqInt primitiveFail(void); -extern sqInt primitiveFailForFFIExceptionat(usqLong exceptionCode, usqInt pc); -extern sqInt primitiveFailForOSError(sqLong osErrorCode); -extern sqInt primitiveFailFor(sqInt reasonCode); -extern sqInt primitiveFailForwithSecondary(sqInt reasonCode, sqLong extraErrorCode); -extern sqInt primitiveFailureCode(void); EXPORT(sqInt) primitiveHighResClock(void); -extern sqInt signalNoResume(sqInt aSemaphore); -extern usqInt sizeOfAlienData(sqInt oop); -extern void * startOfAlienData(sqInt oop); extern void ceScheduleScavenge(void); extern void ensureNoForwardedLiteralsIn(sqInt aMethodObj); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern usqInt freeStartAddress(void); extern usqInt getScavengeThreshold(void); extern sqInt isForwardedClassIndex(sqInt maybeClassIndex); @@ -156,36 +131,23 @@ extern usqInt needGCFlagAddress(void); extern sqLong nullHeaderForMachineCodeMethod(void); extern usqInt scavengeThresholdAddress(void); extern sqInt withoutForwardingOnandwithsendToCogit(sqInt obj1, sqInt obj2, sqInt aBool, sqInt (*selector)(sqInt,sqInt,sqInt)); -extern sqInt byteSwapped(sqInt w); extern sqInt fetchClassTagOf(sqInt oop); extern usqInt floatObjectOf(double aFloat); extern double floatValueOf(sqInt oop); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt isIntegerValue(sqInt intValue); extern sqInt isMarked(sqInt objOop); extern usqInt smallObjectBytesForSlots(sqInt numSlots); -extern void openScavengeLog(void); -extern void printRememberedSet(void); extern sqInt remember(sqInt objOop); -extern sqInt addGCRoot(sqInt *varLoc); extern sqInt addressCouldBeObj(sqInt address); extern sqInt addressCouldBeOop(sqInt address); extern sqInt allocatePinnedSlots(sqInt nSlots); extern sqInt arrayFormat(void); -extern sqInt becomewith(sqInt array1, sqInt array2); extern void beRootIfOld(sqInt oop); extern sqInt byteSizeOf(sqInt oop); extern usqInt bytesPerElement(sqInt oop); extern sqInt characterObjectOf(sqInt characterCode); -extern usqInt characterValueOf(sqInt oop); -extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); -extern sqInt checkOkayOop(usqInt oop); -extern sqInt checkOopHasOkayClass(usqInt obj); extern sqInt classArray(void); extern sqInt classAtIndex(sqInt classIndex); extern sqInt classIndexOf(sqInt objOop); @@ -195,15 +157,10 @@ extern sqInt classTableMinorIndexMask(void); extern sqInt classTablePageSize(void); extern sqInt classTableRootObj(void); extern sqInt classTagForClass(sqInt classObj); -extern sqInt compactClassIndexOf(sqInt objOop); -extern void countMarkedAndUnmarkdObjects(sqInt printFlags); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); extern sqInt falseObject(void); extern sqInt fetchByteofObject(sqInt byteIndex, sqInt objOop); extern sqInt fetchPointerofObject(sqInt fieldIndex, sqInt objOop); -extern void findStringBeginningWith(char *aCString); -extern void findString(char *aCString); extern sqInt fixedFieldsOfClassFormatMask(void); extern sqInt fixedFieldsOfClassFormat(sqInt classFormat); extern sqInt followForwarded(sqInt objOop); @@ -213,12 +170,8 @@ extern usqLong headerForSlotsformatclassIndex(sqInt numSlots, sqInt formatField, #if IMMUTABILITY extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ -extern sqInt indexOfin(sqInt anElement, sqInt anObject); -extern sqInt instanceSizeOf(sqInt classObj); extern sqInt instSpecOfClassFormat(sqInt classFormat); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isCharacterObject(sqInt oop); -extern sqInt isCharacterValue(sqInt anInteger); extern sqInt isCompiledMethod(sqInt objOop); extern sqInt isFixedSizePointerFormat(sqInt format); extern sqInt isForwarded(sqInt objOop); @@ -226,116 +179,75 @@ extern sqInt isImmediate(sqInt oop); extern sqInt isInOldSpace(sqInt address); extern sqInt isLong64s(sqInt oop); extern sqInt isNonImmediate(sqInt oop); -extern sqInt isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); -extern sqInt isOopImmutable(sqInt oop); extern sqInt isOopMutable(sqInt oop); -extern sqInt isPinned(sqInt objOop); -extern sqInt isReallyYoung(sqInt oop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); -extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); -extern sqInt isWordsOrShorts(sqInt oop); extern sqInt isYoungObject(sqInt objOop); extern sqInt isYoung(sqInt oop); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); extern void NeverInline markAndTrace(sqInt objOop); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); extern sqInt minSlotsForShortening(void); extern sqInt nilObject(void); extern sqInt nonIndexablePointerFormat(void); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); -extern sqInt objectBefore(sqInt objOop); -extern sqInt oldSpaceObjectAfter(sqInt objOop); extern sqInt popRemappableOop(void); extern sqInt primitiveErrorTable(void); -extern void printFreeChunks(void); -extern void printInvalidClassTableEntries(void); -extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); +extern void printObjStackAndContents(sqInt objStack); extern void pushRemappableOop(sqInt oop); extern sqInt rawHashBitsOf(sqInt objOop); extern sqInt receiverTagBitsForMethod(sqInt aMethodObj); -extern sqInt removeGCRoot(sqInt *varLoc); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern sqInt shouldRemapOop(sqInt oop); extern sqInt splObj(sqInt index); extern usqInt storeCheckBoundary(void); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); extern sqInt storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer); +extern sqInt storePointerofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer); extern sqInt stringForCString(const char *aCString); extern void tenuringIncrementalGC(void); extern sqInt topRemappableOop(void); extern sqInt trueObject(void); -extern sqInt validFreeTree(void); -extern sqInt vmEndianness(void); extern sqInt remapObj(sqInt objOop); extern sqInt shouldRemapObj(sqInt objOop); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -extern void addIdleUsecs(sqInt idleUsecs); extern sqInt argumentCountOfClosure(sqInt closurePointer); extern sqInt argumentCountOfMethodHeader(sqInt header); extern sqInt argumentCountOf(sqInt methodPointer); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); -extern sqInt disownVM(sqInt flags); -extern sqInt doSignalSemaphoreWithIndex(sqInt index); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern void NeverInline eekcr(void); extern void flush(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); -extern usqLong getNextWakeupUsecs(void); -extern sqInt * getStackPointer(void); +extern sqInt getThisSessionID(void); extern FILE * getTranscript(void); extern sqInt highBit(usqInt anUnsignedValue); -extern sqInt isFloatObject(sqInt oop); -extern sqInt isKindOfInteger(sqInt oop); -extern sqInt isLargeIntegerObject(sqInt oop); -extern sqInt isLargeNegativeIntegerObject(sqInt oop); -extern sqInt isLargePositiveIntegerObject(sqInt oop); extern sqInt isQuickPrimitiveIndex(sqInt anInteger); extern sqInt isReadMediatedContextInstVarIndex(sqInt index); extern sqInt isWriteMediatedContextInstVarIndex(sqInt index); -extern sqInt isKindOfClass(sqInt oop, sqInt aClass); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); extern sqInt lookupSelectorinClass(sqInt selector, sqInt class); extern sqInt maybeSelectorOfMethod(sqInt methodObj); extern sqInt methodClassAssociationOf(sqInt methodPointer); extern sqInt methodClassOf(sqInt methodPointer); -extern sqInt methodPrimitiveIndex(void); extern sqInt methodUsesAlternateBytecodeSet(sqInt aMethodObj); extern sqInt objCouldBeClassObj(sqInt objOop); -extern sqInt ownVM(sqInt threadIndexAndFlags); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); -extern sqInt printHexnp(usqInt n); extern void printHex(usqInt n); extern void print(char *s); -extern sqInt readableFormat(sqInt imageVersion); -extern void setNextWakeupUsecs(usqLong value); extern sqInt sizeOfCallPrimitiveBytecode(sqInt methodHeader); extern sqInt sizeOfLongStoreTempBytecode(sqInt methodHeader); extern sqInt specialSelector(sqInt index); -extern usqIntptr_t stackPositiveMachineIntegerValue(sqInt offset); -extern sqIntptr_t stackSignedMachineIntegerValue(sqInt offset); extern sqInt stackTop(void); extern sqInt stackValue(sqInt offset); extern sqInt startPCOfMethod(sqInt aCompiledMethod); @@ -345,39 +257,11 @@ extern sqInt ultimateLiteralOf(sqInt aMethodOop); /*** Global Variables ***/ -extern sqInt breakLookupClassTag; extern char * breakSelector; extern sqInt breakSelectorLength ; -extern sqInt cannotDeferDisplayUpdates; -extern sqInt checkedPluginName; -extern sqInt checkForLeaks; -extern sqInt debugCallbackInvokes; -extern sqInt debugCallbackPath; -extern sqInt debugCallbackReturns; -extern sqInt deferDisplayUpdates; -extern sqInt desiredCogCodeSize; -extern sqInt desiredEdenBytes; -extern sqInt desiredNumStackPages; -extern void * displayBits; -extern int displayDepth; -extern int displayHeight; -extern int displayWidth; -extern sqInt eventTraceMask; -extern sqInt extraVMMemory; -extern sqInt ffiExceptionResponse; extern usqInt heapBase; -extern sqInt inIOProcessEvents; -extern struct VirtualMachine* interpreterProxy; -extern sqInt maxLiteralCountForCompile ; -extern usqInt maxOldSpaceSize; -extern sqInt minBackwardJumpCountForCompile ; extern sqInt primitiveDoMixedArithmetic ; -extern char * primTracePluginName; -extern volatile int sendTrace; -extern sqInt sendWheelEvents; -extern int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); extern sqInt suppressHeartbeatFlag; -extern sqInt upscaleDisplayIfHighDPI ; /*** Macros ***/ @@ -395,13 +279,6 @@ extern sqInt upscaleDisplayIfHighDPI ; compilationBreakpointFor(sel); \ } \ } while (0) -#define mnuCompilationBreakpoint(sel, len) do { \ - if ((len) == -breakSelectorLength \ - && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, -breakSelectorLength)) { \ - suppressHeartbeatFlag = 1; \ - compilationBreakpointFor(sel); \ - } \ -} while (0) #define startOfMemory() heapBase #define numTagBits() 2 #define shiftForWord() 2 diff --git a/src/spur32.cog.newspeak/gcc3x-cointerp.c b/src/spur32.cog.newspeak/gcc3x-cointerp.c index 1b5a145ab3..cee2721c85 100644 --- a/src/spur32.cog.newspeak/gcc3x-cointerp.c +++ b/src/spur32.cog.newspeak/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - CoInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CoInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -173,7 +173,6 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define GCCheckShorten 64 #define GCModeBecome 8 #define GCModeFull 1 -#define GCModeIncremental 4 #define GCModeNewSpace 2 #define HasBeenReturnedFromMCPC -1 #define HasBeenReturnedFromMCPCOop 0xFFFFFFFFU @@ -432,7 +431,6 @@ static void NoDbgRegParms addNewMethodToCache(sqInt classObj); extern usqInt argumentCountAddress(void); static CogMethod * NoDbgRegParms asCogHomeMethod(CogBlockMethod *aCogMethod); static void NoDbgRegParms assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln); -extern void assertValidMachineCodeFrame(sqInt instrPtr); static sqInt NoDbgRegParms assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln); static void NoDbgRegParms assertValidStackedInstructionPointers(sqInt ln); static void NoDbgRegParms attemptToSwitchToMachineCode(sqInt bcpc); @@ -459,7 +457,7 @@ extern sqInt ceNonLocalReturn(sqInt returnValue); extern void ceOuterSendreceiver(sqInt cacheAddress, sqInt methodReceiver); extern void ceReapAndResetErrorCodeFor(CogMethod *cogMethod); extern void ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver); -extern sqInt ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); +static sqInt NoDbgRegParms ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); extern sqInt ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC); extern sqInt ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize); extern sqInt ceSendMustBeBoolean(sqInt anObject); @@ -497,7 +495,7 @@ static sqInt NoDbgRegParms divorceAFrameIfin(sqInt (*criterion)(char *fp), Stack static sqInt NoDbgRegParms divorceAllFramesSuchThat(sqInt (*criterion)(char *fp)); static sqInt NoDbgRegParms divorceAMachineCodeFrameWithCogMethodin(CogMethod *cogMethod, StackPage *aStackPage); extern void dumpPrimTraceLog(void); -EXPORT(void) dumpPrimTraceLogOn(FILE *aStdioStream); +extern void dumpPrimTraceLogOn(FILE *aStdioStream); static void NoDbgRegParms ensureAllContextsHaveBytecodePCsIf(sqInt (*criterion)(sqInt methodOop)); static void NoDbgRegParms ensureContextHasBytecodePC(sqInt aContext); static void NoDbgRegParms ensureContextIsExecutionSafeAfterAssignToStackPointer(sqInt aContext); @@ -527,7 +525,6 @@ extern usqInt framePointerAddress(void); static sqInt NoDbgRegParms frameReceiver(char *theFP); extern void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto(sqInt methodObj, sqInt primitiveIndex, sqInt *flagsPtr))(void); extern sqInt getCurrentBytecode(void); -extern char * getFramePointer(void); static sqInt getImageHeaderFlags(void); static sqInt NoDbgRegParms handleForwardedSendFaultForReceiverstackDelta(sqInt forwardedReceiver, sqInt stackDelta); static sqInt NoDbgRegParms handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage); @@ -537,7 +534,6 @@ static usqInt NoDbgRegParms iframeSavedIP(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); extern usqInt instructionPointerAddress(void); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); -extern usqInt interpretAddress(void); static sqInt NeverInline interpreterAllocationReserveBytes(void); static sqInt interpretMethodFromMachineCode(void); extern sqInt isCogMethodReference(sqInt methodHeader); @@ -579,12 +575,10 @@ extern sqInt methodShouldBeCogged(sqInt aMethodObj); static sqInt NoDbgRegParms methodWithHeaderShouldBeCogged(sqInt methodHeader); static CogBlockMethod * NoDbgRegParms mframeCogMethod(char *theFP); extern CogMethod * mframeHomeMethodExport(void); -extern CogMethod * mframeHomeMethod(char *theFP); +static CogMethod * NoDbgRegParms mframeHomeMethod(char *theFP); static sqInt NoDbgRegParms mframeIsBlockActivation(char *theFP); static sqInt NoDbgRegParms mframeReceiver(char *theFP); static sqInt NeverInline minimumUnusedHeadroom(void); -extern sqInt mMethodClass(void); -extern void mnuCompilationBreakpointFor(sqInt selectorOop); static sqInt NoDbgRegParms mnuMethodOrNilFor(sqInt rcvr); static char * NoDbgRegParms moveFramesInthroughtoPage(StackPage *oldPage, char *theFP, StackPage *newPage); static sqInt NoDbgRegParms mustMapMachineCodePCcontext(sqInt theIP, sqInt aOnceMarriedContext); @@ -602,16 +596,15 @@ extern usqInt primFailCodeAddress(void); static void NoDbgRegParms primitiveBecomeReturn(sqInt ec); static void primitiveExecuteMethod(void); static void primitiveExecuteMethodArgsArray(void); -extern usqInt primitiveFailAddress(void); extern sqInt primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs); extern void * primTraceLogAddress(void); extern usqInt primTraceLogIndexAddress(void); -EXPORT(void) printCogMethod(CogMethod *cogMethod); +extern void printCogMethod(CogMethod *cogMethod); static void NoDbgRegParms printFrameFlagsForFP(char *theFP); static void NoDbgRegParms printFrameMethodFor(char *theFP); static void NoDbgRegParms printFrameThingatextra(char *name, char *address, sqInt extraValue); -EXPORT(sqInt) printFrameWithSP(char *theFP, char *theSP); -EXPORT(void) printMethodCacheFor(sqInt thing); +extern sqInt printFrameWithSP(char *theFP, char *theSP); +extern void printMethodCacheFor(sqInt thing); static sqInt NoDbgRegParms printPrimLogEntryAthasParameter(sqInt i, sqInt hasParameter); extern sqInt quickPrimitiveConstantFor(sqInt aQuickPrimitiveIndex); extern sqInt (*quickPrimitiveGeneratorFor(sqInt aQuickPrimitiveIndex))(void); @@ -622,13 +615,13 @@ extern size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredH extern sqInt recordFastCCallPrimTraceForMethod(sqInt aMethodObj); extern sqInt recordPrimTraceForMethod(sqInt aMethodObj); static void NeverInline reloadPrimitiveCalloutPointer(void); -EXPORT(void) reportMinimumUnusedHeadroom(void); -EXPORT(void) reportMinimumUnusedHeadroomOn(FILE *aStdioStream); +extern void reportMinimumUnusedHeadroom(void); +extern void reportMinimumUnusedHeadroomOn(FILE *aStdioStream); static sqInt NoDbgRegParms resumepreemptedYieldingIffrom(sqInt aProcess, sqInt yieldImplicitly, sqInt sourceCode); static sqInt NoDbgRegParms returnToExecutivepostContextSwitch(sqInt inInterpreter, sqInt switchedContext); static sqInt NoDbgRegParms returntoExecutive(sqInt returnValue, sqInt inInterpreter); static sqInt NoDbgRegParms roomToPushNArgs(sqInt n); -EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); +extern sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); static sqInt NoDbgRegParms shortPrintFrame(char *theFP); extern sqInt signed32BitIntegerFor(sqInt integerValue); extern int signed32BitValueOf(sqInt oop); @@ -650,7 +643,7 @@ static void NoDbgRegParms updateStateOfSpouseContextForFrameWithSP(char *theFP, extern sqInt validInstructionPointerinMethodframePointer(usqInt instrPointer, usqInt aMethod, char *fp); static sqInt NoDbgRegParms validStackPageBaseFrame(StackPage *aPage); static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); -EXPORT(char *) whereIs(sqInt anOop); +extern char * whereIs(sqInt anOop); static void NoDbgRegParms NeverInline widowOrForceToBytecodePC(sqInt ctxt); static sqInt NoDbgRegParms frameIsMarked(sqInt theFPInt); #if VMBenchmarks @@ -662,6 +655,9 @@ EXPORT(void) primitiveBenchmarkFollowForwardersOfReceiverAndTemporariesInStackZo #if VMBenchmarks EXPORT(sqInt) primitiveBenchmarkJITReceiver(void); #endif /* VMBenchmarks */ +#if VMBenchmarks +EXPORT(void) primitiveBenchmarkScavenge(void); +#endif /* VMBenchmarks */ static void primitiveClosureCopyWithCopiedValues(void); static void primitiveCollectCogCodeConstituents(void); static void primitiveContextXray(void); @@ -927,7 +923,7 @@ static sqInt NoDbgRegParms becomeEffectFlagsFor(sqInt objOop); extern void ceScheduleScavenge(void); static void clearLeakMapAndMapAccessibleObjects(void); extern void ensureNoForwardedLiteralsIn(sqInt aMethodObj); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern usqInt freeStartAddress(void); extern usqInt getScavengeThreshold(void); static sqLong NoDbgRegParms headerWhileForwardingOf(sqInt aCompiledMethodObjOop); @@ -955,9 +951,7 @@ static sqInt hasSixtyFourBitImmediates(void); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); static sqInt NoDbgRegParms initFreeChunkWithBytesat(usqLong numBytes, sqInt address); static void NoDbgRegParms initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt integerObjectOf(sqInt value); extern sqInt integerValueOf(sqInt oop); static sqInt NoDbgRegParms isFloatInstance(sqInt oop); @@ -1036,8 +1030,6 @@ extern void characterTable(void); extern usqInt characterValueOf(sqInt oop); static sqInt NoDbgRegParms cheapAddressCouldBeInHeap(sqInt address); extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); static sqInt checkHeapFreeSpaceIntegrity(void); static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt classIndicesShouldBeValid); extern sqInt checkOkayOop(usqInt oop); @@ -1081,13 +1073,13 @@ extern sqInt classWordArray(void); static void clearLeakMapAndMapAccessibleFreeSpace(void); static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning); extern sqInt cloneObject(sqInt objOop); -extern sqInt compactClassIndexOf(sqInt objOop); +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop); static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i); extern void countMarkedAndUnmarkdObjects(sqInt printFlags); static usqLong currentAllocatedBytes(void); extern sqInt displayObject(void); static void NoDbgRegParms doScavenge(sqInt tenuringCriterion); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); static void NoDbgRegParms emptyObjStack(sqInt objStack); static void NoDbgRegParms enableObjectEnumerationFrom(sqInt initialObject); @@ -1143,12 +1135,11 @@ static usqInt imageSegmentVersion(void); extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ extern void incrementalGC(void); -extern sqInt indexOfin(sqInt anElement, sqInt anObject); static void NoDbgRegParms inFreeTreeReplacewith(sqInt treeNode, sqInt newNode); static sqInt NoDbgRegParms initialInstanceOf(sqInt classObj); static void NeverInline initializeNewSpaceVariables(void); static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift); -EXPORT(void) inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); +extern void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); static void NoDbgRegParms NeverInline inPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag); extern sqInt instanceSizeOf(sqInt classObj); static sqInt NoDbgRegParms instantiateClass(sqInt classObj); @@ -1156,7 +1147,6 @@ extern sqInt instSpecOfClassFormat(sqInt classFormat); static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer); static void NoDbgRegParms invalidCompactClassError(const char *className); static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isArray(sqInt oop); static sqInt NoDbgRegParms isBridgeOrEnumerableObjectNoAssert(sqInt objOop); extern sqInt isBytes(sqInt oop); @@ -1194,7 +1184,7 @@ static sqInt NoDbgRegParms isMaybeFiredEphemeron(sqInt objOop); extern sqInt isNonImmediate(sqInt oop); static sqInt NoDbgRegParms isObjEphemeron(sqInt objOop); static sqInt NoDbgRegParms isObjImmutable(sqInt anOop); -extern sqInt isOldObject(sqInt objOop); +static sqInt NoDbgRegParms isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); extern sqInt isOopImmutable(sqInt oop); @@ -1202,12 +1192,11 @@ extern sqInt isOopMutable(sqInt oop); extern sqInt isPinned(sqInt objOop); extern sqInt isPointers(sqInt oop); static sqInt NoDbgRegParms isPureBitsFormat(sqInt format); -extern sqInt isReallyYoung(sqInt oop); static sqInt NoDbgRegParms isRemembered(sqInt objOop); static sqInt NoDbgRegParms isSegmentBridge(sqInt objOop); static sqInt NoDbgRegParms isSemaphoreOop(sqInt anOop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop); extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); static sqInt NoDbgRegParms isValidObjStackAt(sqInt objStackRootIndex); @@ -1228,20 +1217,18 @@ static sqInt NoDbgRegParms isonObjStack(sqInt oop, sqInt objStack); static sqInt NoDbgRegParms keyOfEphemeron(sqInt objOop); static sqInt NoDbgRegParms knownClassAtIndex(sqInt classIndex); static sqInt lastPointerFormat(void); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop); +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); static sqInt NoDbgRegParms lengthOfMaybeImmediate(sqInt oop); static sqInt NoDbgRegParms lengthOf(sqInt objOop); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); static sqInt NoDbgRegParms NeverInline loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray); -EXPORT(void) longPrintInstancesOf(sqInt aClassOop); -EXPORT(void) longPrintInstancesWithClassIndex(sqInt classIndex); -EXPORT(void) longPrintReferencesTo(sqInt anOop); +extern void longPrintInstancesOf(sqInt aClassOop); +extern void longPrintInstancesWithClassIndex(sqInt classIndex); +extern void longPrintReferencesTo(sqInt anOop); static void mapExtraRoots(void); static void NeverInline mapMournQueue(void); static sqInt NoDbgRegParms mapOopsFromtooutPointersoutHashes(sqInt segStart, sqInt segAddr, sqInt outPointerArray, sqInt savedOutHashes); @@ -1253,7 +1240,6 @@ static void NoDbgRegParms NeverInline markObjects(sqInt objectsShouldBeUnmarkedA static void markWeaklingsAndMarkAndFireEphemerons(void); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); extern sqInt minSlotsForShortening(void); static usqInt NoDbgRegParms newHashBitsOf(sqInt objOop); static usqInt newObjectHash(void); @@ -1271,12 +1257,11 @@ static sqInt noUnscannedEphemerons(void); static sqInt NoDbgRegParms numBytesOfBitsformat(sqInt objOop, sqInt format); static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numSlotsForBytes(sqInt numBytes); static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); extern sqInt objectBefore(sqInt objOop); static sqInt NoDbgRegParms objectInPastSpaceBefore(sqInt objOop); @@ -1291,45 +1276,46 @@ static sqInt NoDbgRegParms popObjStack(sqInt objStack); extern sqInt popRemappableOop(void); static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags); extern sqInt primitiveErrorTable(void); -EXPORT(void) printActivationsOf(sqInt aMethodObj); -EXPORT(void) printBogons(void); +extern void printActivationsOf(sqInt aMethodObj); +extern void printBogons(void); +static void NoDbgRegParms printBridgeon(sqInt oop, FILE *aStream); static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printContextReferencesTo(sqInt anOop); -EXPORT(void) printEntity(sqInt oop); -EXPORT(void) printForwarders(void); +extern void printContextReferencesTo(sqInt anOop); +extern void printEntity(sqInt oop); +extern void printForwarders(void); static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream); extern void printFreeChunks(void); -EXPORT(void) printFreeChunk(sqInt freeChunk); +extern void printFreeChunk(sqInt freeChunk); static void NoDbgRegParms printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode); -EXPORT(void) printFreeListHeads(void); -EXPORT(sqInt) printFreeList(sqInt chunkOrIndex); +extern void printFreeListHeads(void); +extern sqInt printFreeList(sqInt chunkOrIndex); static void NoDbgRegParms printFreeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printFreeTree(void); +extern void printFreeTree(void); static void NoDbgRegParms printFreeTreeChunk(sqInt chunkOrZero); -EXPORT(void) printHeaderOf(sqInt objOop); +extern void printHeaderOf(sqInt objOop); static void NoDbgRegParms printImmediateObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printInstancesOf(sqInt aClassOop); -EXPORT(void) printInstancesWithClassIndex(sqInt classIndex); +extern void printInstancesOf(sqInt aClassOop); +extern void printInstancesWithClassIndex(sqInt classIndex); extern void printInvalidClassTableEntries(void); #if LLDB -EXPORT(void) printMarkedOops(void); +extern void printMarkedOops(void); #endif /* LLDB */ -EXPORT(void) printMethodImplementorsOf(sqInt anOop); -EXPORT(void) printMethodReferencesTo(sqInt anOop); +extern void printMethodImplementorsOf(sqInt anOop); +extern void printMethodReferencesTo(sqInt anOop); static void NoDbgRegParms printNonPointerDataOfon(sqInt oop, FILE *aStream); -EXPORT(void) printObjectsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) printObjectsWithHash(sqInt hash); +extern void printObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void printObjectsWithHash(sqInt hash); +extern void printObjStackAndContents(sqInt objStack); static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents); static void NoDbgRegParms printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType); extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); -EXPORT(void) NeverInline printOopsExcept(sqInt (*function)(sqInt)); -EXPORT(void) printOopsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); -EXPORT(void) printReferencesTo(sqInt anOop); +extern void NeverInline printOopsExcept(sqInt (*function)(sqInt)); +extern void printOopsFromto(sqInt startAddress, sqInt endAddress); +extern void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); +extern void printReferencesTo(sqInt anOop); static void NoDbgRegParms printStringDataOfon(sqInt oop, FILE *aStream); #if LLDB -EXPORT(void) printUnmarkedOops(void); +extern void printUnmarkedOops(void); #endif /* LLDB */ static sqInt NoDbgRegParms pushOnUnscannedEphemeronsStack(sqInt anEphemeron); extern void pushRemappableOop(sqInt oop); @@ -1347,14 +1333,14 @@ static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedObjsclassIndicesShould static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion); static sqInt NoDbgRegParms NeverInline setHeapBasememoryLimitendOfMemory(sqInt baseOfHeap, sqInt memLimit, sqInt memEnd); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); -EXPORT(void) shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); extern sqInt shouldRemapOop(sqInt oop); static sqInt NoDbgRegParms sizeOfObjStack(sqInt objStack); static sqInt slidingCompactionInProgress(void); extern sqInt slotSizeOf(sqInt oop); extern sqInt splObj(sqInt index); static usqInt NoDbgRegParms startOfObject(sqInt objOop); -EXPORT(sqInt) statNumGCs(void); +extern sqInt statNumGCs(void); extern usqInt storeCheckBoundary(void); static sqInt NoDbgRegParms storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointerArrayArg, sqInt arrayOfRootsArg); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); @@ -1417,7 +1403,7 @@ static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i); static void postSnapshot(void); static void NeverInline prepareForSnapshot(void); static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes); -EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop); +extern SpurSegmentInfo * segmentContainingObj(sqInt objOop); static sqInt segmentOverlap(void); static sqInt NoDbgRegParms shrinkObjectMemory(usqInt delta); static sqInt someSegmentContainsPinned(void); @@ -1427,7 +1413,7 @@ static sqInt NoDbgRegParms writeImageSegmentsToFile(sqImageFile aBinaryStream); static sqInt NoDbgRegParms writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSegment, sqImageFile aBinaryStream); static sqInt NoDbgRegParms accessModifierOfMethod(sqInt methodObj); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -EXPORT(sqInt) activeProcess(void); +extern sqInt activeProcess(void); extern void addIdleUsecs(sqInt idleUsecs); static void NoDbgRegParms addLastLinktoList(sqInt proc, sqInt aList); static void NoDbgRegParms addNewMethodToNSCache(sqInt rule); @@ -1441,11 +1427,11 @@ static sqInt NoDbgRegParms asciiOfCharacter(sqInt characterObj); extern void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); static void NoDbgRegParms assertValidStackLimits(sqInt ln); extern sqInt booleanValueOf(sqInt obj); -EXPORT(sqInt) callbackEnter(sqInt *callbackID); -EXPORT(sqInt) callbackLeave(sqInt cbID); +extern sqInt callbackEnter(sqInt *callbackID); +extern sqInt callbackLeave(sqInt cbID); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); extern sqInt characterForAscii(sqInt ascii); -EXPORT(sqInt) checkAllAccessibleObjectsOkay(void); +extern sqInt checkAllAccessibleObjectsOkay(void); #if LRPCheck static sqInt NeverInline checkDeliveryOfLongRunningPrimitiveSignal(void); #endif /* LRPCheck */ @@ -1454,7 +1440,7 @@ static sqInt NoDbgRegParms checkForEventsMayContextSwitch(sqInt mayContextSwitch static sqInt NoDbgRegParms checkImageVersionFromstartingAt(sqImageFile f, squeakFileOffsetType imageOffset); static sqInt checkInterpreterIntegrity(void); static sqInt NoDbgRegParms checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP); -EXPORT(sqInt) checkOkayInterpreterObjects(sqInt writeBack); +extern sqInt checkOkayInterpreterObjects(sqInt writeBack); static sqInt NoDbgRegParms checkOkayStackPage(StackPage *thePage); static sqInt NoDbgRegParms checkOkayStackZone(sqInt writeBack); static void NoDbgRegParms checkProfileTick(sqInt aPrimitiveMethod); @@ -1463,8 +1449,7 @@ static sqInt NoDbgRegParms checkStackPointerIndexForFrame(char *theFP); static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className); static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext); static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern sqInt copyBits(void); extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y); static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop); @@ -1515,7 +1500,7 @@ static sqInt NoDbgRegParms frameStackedReceiverOffset(char *theFP); static sqInt NoDbgRegParms frameStackedReceivernumArgs(char *theFP, sqInt numArgs); static void freeUntracedStackPages(void); extern sqInt fullDisplayUpdate(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); +static void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); static sqInt getCogVMFeatureFlags(void); static sqInt getErrorObjectFromPrimFailCode(void); extern sqInt getFullScreenFlag(void); @@ -1573,7 +1558,7 @@ static sqInt NoDbgRegParms lengthOfNameOfClass(sqInt classOop); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt loadBitBltFrom(sqInt bb); extern void loadInitialContext(void); -EXPORT(void) longPrintOop(sqInt oop); +extern void longPrintOop(sqInt oop); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); static sqInt NoDbgRegParms lookupInMethodCacheSelclassTag(sqInt selector, sqInt classTag); static sqInt NoDbgRegParms lookupLexicalfromrule(sqInt selector, sqInt mixin, sqInt rule); @@ -1621,7 +1606,6 @@ static sqInt NoDbgRegParms objectequalsString(sqInt anOop, char *aCString); extern sqInt ownVM(sqInt threadIndexAndFlags); static sqInt NoDbgRegParms pcPreviousToinSqueakV3PlusClosuresMethod(sqInt theIP, sqInt aMethod); extern sqInt pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt pop(sqInt nItems); extern void popthenPush(sqInt nItems, sqInt oop); @@ -1637,44 +1621,43 @@ extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); static void NoDbgRegParms printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void NoDbgRegParms printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); -EXPORT(void) printAllStacks(void); -EXPORT(void) printAllStacksOn(FILE *aStdioStream); -EXPORT(void) printCallStack(void); +extern void printAllStacks(void); +extern void printAllStacksOn(FILE *aStdioStream); +extern void printCallStack(void); static sqInt NoDbgRegParms printCallStackFP(char *theFP); -EXPORT(sqInt) printCallStackOf(sqInt aContextOrProcessOrFrame); +extern sqInt printCallStackOf(sqInt aContextOrProcessOrFrame); static sqInt NoDbgRegParms printCallStackOfcurrentFP(sqInt aContext, char *currFP); -EXPORT(void) printCallStackOn(FILE *aStdioStream); +extern void printCallStackOn(FILE *aStdioStream); static sqInt NoDbgRegParms printContextCallStackOf(sqInt aContext); -EXPORT(void) printContext(sqInt aContext); +extern void printContext(sqInt aContext); static void NoDbgRegParms printDecodeMethodHeaderOop(sqInt methodHeaderOop); -EXPORT(void) printExternalHeadFrame(void); +extern void printExternalHeadFrame(void); static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort); static void NoDbgRegParms printFrameOopat(char *name, char *address); static void NoDbgRegParms printFrameOopindexat(char *name, sqInt idx, char *address); -EXPORT(void) printFramesInPage(StackPage *thePage); -EXPORT(void) printFramesOnStackPageListInUse(void); +extern void printFramesInPage(StackPage *thePage); +extern void printFramesOnStackPageListInUse(void); static void NoDbgRegParms printFrameThingandFrameat(char *name, char *theFP, char *address); static void NoDbgRegParms printFrameThingatextraString(char *name, char *address, char *extraStringOrNil); -EXPORT(sqInt) printFrame(char *theFP); -extern sqInt printHexnp(usqInt n); +extern sqInt printFrame(char *theFP); static sqInt NoDbgRegParms printHexPtrnp(void *p); extern void printHex(usqInt n); -EXPORT(void) printLikelyImplementorsOfSelector(sqInt selector); -EXPORT(void) printMethodCache(void); -EXPORT(void) printMethodDictionaryOf(sqInt behavior); -EXPORT(void) printMethodDictionary(sqInt dictionary); +extern void printLikelyImplementorsOfSelector(sqInt selector); +extern void printMethodCache(void); +extern void printMethodDictionaryOf(sqInt behavior); +extern void printMethodDictionary(sqInt dictionary); static void NoDbgRegParms printNameOfClasscount(sqInt classOop, sqInt cnt); static void NoDbgRegParms printOopShortInner(sqInt oop); -EXPORT(void) printOop(sqInt oop); -EXPORT(void) printProcessStack(sqInt aProcess); -EXPORT(sqInt) printProcsOnList(sqInt procList); -EXPORT(sqInt) printStackCallStackOf(sqInt aContextOrProcessOrFrame); -EXPORT(void) printStackPageList(void); -EXPORT(void) printStackPageListInUse(void); -EXPORT(void) printStackPages(void); -EXPORT(void) printStackPagesInUse(void); +extern void printOop(sqInt oop); +extern void printProcessStack(sqInt aProcess); +extern sqInt printProcsOnList(sqInt procList); +extern sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame); +extern void printStackPageList(void); +extern void printStackPageListInUse(void); +extern void printStackPages(void); +extern void printStackPagesInUse(void); static void NoDbgRegParms printStackPageuseCount(StackPage *page, sqInt n); -EXPORT(void) printStackReferencesTo(sqInt oop); +extern void printStackReferencesTo(sqInt oop); static void NoDbgRegParms printStringOf(sqInt oop); extern void print(char *s); extern void pushBool(sqInt trueOrFalse); @@ -1688,20 +1671,20 @@ static void NoDbgRegParms putToSleepyieldingIf(sqInt aProcess, sqInt yieldImplic static void NoDbgRegParms putWord32toFile(int aWord32, sqImageFile aFile); extern sqInt readableFormat(sqInt imageVersion); static void NoDbgRegParms NeverInline reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader); -EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext); +extern sqInt reestablishContextPriorToCallback(sqInt callbackContext); static sqInt NoDbgRegParms removeFirstLinkOfList(sqInt aList); static sqInt NoDbgRegParms removeProcessfromList(sqInt aProcess, sqInt aList); static sqInt retryPrimitiveOnFailure(void); -EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); +extern sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); static void NoDbgRegParms reverseDisplayFromto(sqInt startIndex, sqInt endIndex); static void NoDbgRegParms rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)()); static sqInt NoDbgRegParms safeMethodClassOf(sqInt methodPointer); static sqInt NoDbgRegParms saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex); static sqInt schedulerPointer(void); -EXPORT(void) setBreakMNUSelector(char *aString); -EXPORT(void) setBreakSelector(char *aString); +extern void setBreakMNUSelector(char *aString); +extern void setBreakSelector(char *aString); extern void setFullScreenFlag(sqInt value); -EXPORT(void *) setInterruptCheckChain(void (*aFunction)()); +extern void * setInterruptCheckChain(void (*aFunction)()); extern void setInterruptKeycode(sqInt value); extern void setInterruptPending(sqInt value); extern void setNextWakeupUsecs(usqLong value); @@ -1710,9 +1693,9 @@ static void setSignalLowSpaceFlagAndSaveProcess(void); static void NoDbgRegParms setTraceFlagOnContextsFramesPageIfNeeded(sqInt aContext); static sqInt NoDbgRegParms shortPrintContext(sqInt aContext); static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP); -EXPORT(void) shortPrintFramesInPage(StackPage *thePage); -EXPORT(void) shortPrintFramesOnStackPageListInUse(void); -EXPORT(void) shortPrintFrameAndNCallers(char *theFP, sqInt n); +extern void shortPrintFramesInPage(StackPage *thePage); +extern void shortPrintFramesOnStackPageListInUse(void); +extern void shortPrintFrameAndNCallers(char *theFP, sqInt n); static void NoDbgRegParms shortPrintOop(sqInt oop); static sqInt NoDbgRegParms shortReversePrintFrameAndCallers(char *aFramePointer); extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); @@ -1817,8 +1800,8 @@ _iss sqInt argumentCount; _iss sqLong nextProfileTick; _iss sqInt primTraceLog[256]; _iss sqInt nilObj; -_iss FILE * transcript; _iss StackPage * stackPage; +_iss FILE * transcript; _iss usqInt oldSpaceStart; _iss usqInt method; _iss sqInt bytecodeSetSelector; @@ -1830,10 +1813,10 @@ _iss char * stackBasePlus1; _iss usqInt totalFreeOldSpace; _iss sqInt trueObj; _iss sqInt lkupClassTag; -_iss SpurSegmentInfo * segments; _iss sqInt falseObj; _iss usqInt newSpaceStart; _iss sqInt hiddenRootsObj; +_iss SpurSegmentInfo * segments; _iss sqInt bytesPerPage; _iss sqInt numSegments; _iss sqInt localAbsentReceiver; @@ -1850,6 +1833,7 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; _iss sqInt numStackPages; _iss sqInt tempOop; @@ -1869,13 +1853,11 @@ _iss sqInt becomeEffectsFlags; _iss sqInt growHeadroom; _iss sqInt tenureThreshold; _iss char * objStackInvalidBecause; -_iss sqInt sweepIndex; _iss sqInt ephemeronList; #if LRPCheck _iss sqInt longRunningPrimitiveCheckMethod; #endif _iss sqInt tenureCriterion; -_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classNameIndex; _iss usqInt freeOldSpaceStart; _iss sqInt extraRootCount; @@ -1973,7 +1955,6 @@ _iss sqIntptr_t methodCache[MethodCacheSize + 1 /* 2049 */]; _iss sqInt traceLog[TraceBufferSize /* 768 */]; _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 65 */]; -_iss sqInt preferredPinningSegment; _iss sqInt statCoalesces; _iss sqInt theUnknownShort; #if LRPCheck @@ -2700,8 +2681,8 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 584 */])(void) = { 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */; -sqInt checkForLeaks; sqInt breakLookupClassTag; +sqInt checkForLeaks; sqInt breakSelectorLength = MinSmallInteger; sqInt debugCallbackPath; void * displayBits; @@ -2711,10 +2692,10 @@ sqInt desiredEdenBytes; sqInt desiredNumStackPages; sqInt extraVMMemory; int displayWidth; -char * breakSelector; sqInt desiredCogCodeSize; int displayDepth; sqInt eventTraceMask; +char * breakSelector; int displayHeight; usqInt maxOldSpaceSize; sqInt ffiExceptionResponse; @@ -2724,12 +2705,12 @@ sqInt upscaleDisplayIfHighDPI = -1; sqInt deferDisplayUpdates; struct VirtualMachine* interpreterProxy; sqInt sendWheelEvents; -sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.3310"; +const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.3329"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -2760,13 +2741,6 @@ volatile int sendTrace; } while (0) #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize) #define heapBase() heapBase -#define mnuCompilationBreakpoint(sel, len) do { \ - if ((len) == -breakSelectorLength \ - && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, -breakSelectorLength)) { \ - suppressHeartbeatFlag = 1; \ - compilationBreakpointFor(sel); \ - } \ -} while (0) #define primTraceLogIndex(aValue) (GIV(primTraceLogIndex) = (aValue)) #define pageIndexForstackBasePlus1bytesPerPage(pointer,stkBasePlus1,pageByteSize) (((char *)(pointer) - (stkBasePlus1)) / (pageByteSize)) #define startOfMemory() heapBase @@ -14583,29 +14557,6 @@ assertl((methodUsesAlternateBytecodeSet(GIV(method))) == (GIV(bytecodeSetSelecto } } - /* CoInterpreter>>#assertValidMachineCodeFrame: */ -void -assertValidMachineCodeFrame(sqInt instrPtr) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - CogBlockMethod *cogMethod; - CogMethod *homeMethod; - - assert(isMachineCodeFrame(GIV(framePointer))); - /* begin mframeCogMethod: */ - cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask)); - /* begin asCogHomeMethod: */ - if (((cogMethod->cmType)) >= CMMethod) { - homeMethod = ((CogMethod *) cogMethod); - } - else { - /* begin cmHomeMethod */ - homeMethod = ((CogMethod *) ((((usqInt)cogMethod)) - ((cogMethod->homeOffset)))); - } - assert((methodFor(cogMethod)) == homeMethod); - assert((instrPtr > (((sqInt)cogMethod))) - && (instrPtr < ((((sqInt)homeMethod)) + ((homeMethod->blockSize))))); -} - /* Check that the stacked instruction pointers in the given page are correct. Checks the interpreter sender/machine code callee contract. */ @@ -15909,8 +15860,8 @@ ceInterpretMethodFromPICreceiver(sqInt aMethodObj, sqInt rcvr) /* pop off inner return and locate open or closed PIC */ pic = ((CogMethod *) ((popStack()) - (interpretOffset()))); - assert((isCMOpenPIC(pic)) - || (isCMClosedPIC(pic))); + assert((isCMOpenPIC(((CogBlockMethod *) pic))) + || (isCMClosedPIC(((CogBlockMethod *) pic)))); if (((pic->cmType)) == CMOpenPIC) { assert(!(methodHasCogMethod(aMethodObj))); if (methodShouldBeCogged(aMethodObj)) { @@ -15982,8 +15933,8 @@ ceMNUFromPICMNUMethodreceiver(sqInt aMethodObj, sqInt rcvr) : tagBits2) : (longAt(rcvr)) & (classIndexMask()))); cPIC = ((CogMethod *) ((popStack()) - (mnuOffset()))); - assert((isCMClosedPIC(cPIC)) - || (isCMOpenPIC(cPIC))); + assert((isCMClosedPIC(((CogBlockMethod *) cPIC))) + || (isCMOpenPIC(((CogBlockMethod *) cPIC)))); GIV(argumentCount) = (cPIC->cmNumArgs); GIV(messageSelector) = (cPIC->selector); if (aMethodObj != 0) { @@ -16654,7 +16605,7 @@ ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver) cogged or not. */ /* CoInterpreter>>#ceSendAbort:to:numArgs: */ -sqInt +static sqInt NoDbgRegParms ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt aMethodObj; @@ -18502,7 +18453,7 @@ dumpPrimTraceLog(void) */ /* CoInterpreter>>#dumpPrimTraceLogOn: */ -EXPORT(void) +void dumpPrimTraceLogOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -19895,20 +19846,14 @@ void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto( sqInt getCurrentBytecode(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - return (((((((usqInt)GIV(framePointer))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)GIV(framePointer))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)GIV(framePointer))) <= (((usqInt)GIV(pages))))))) + return (((GIV(stackBasePlus1) != null) + && ((((((usqInt)GIV(framePointer))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)GIV(framePointer))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)GIV(framePointer))) <= (((usqInt)GIV(pages)))))))) && (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))) ? byteAt(GIV(instructionPointer)) : -1); } - /* CoInterpreter>>#getFramePointer */ -char * -getFramePointer(void) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return GIV(framePointer); -} - /* Answer the flags that are contained in the 7th long of the image header. */ @@ -20093,12 +20038,14 @@ ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, if (savedSPP != 0) { savedSPP[0] = GIV(stackPointer); } - if ((((((usqInt)theCFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theCFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCFP)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)theCFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theCFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCFP)) <= (((usqInt)GIV(pages)))))))) { GIV(framePointer) = theCFP; } - if ((((((usqInt)theCSP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theCSP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCSP)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)theCSP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theCSP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCSP)) <= (((usqInt)GIV(pages)))))))) { GIV(stackPointer) = theCSP; } } @@ -20167,21 +20114,6 @@ instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sq } -/* This is used for asserts that check that inline cache editing results in - valid addresses. - In the C VM interpret is presumed to come before any primitives and so it - constitutes the lowest address in C code that machine code should be - linked. In the simulator - we just answer something not low. */ - - /* CoInterpreter>>#interpretAddress */ -usqInt -interpretAddress(void) -{ - return ((usqInt)((&interpret))); -} - - /* At a rough approximation we may need to allocate up to a couple of page's worth of contexts when switching stack pages, assigning to senders, etc. But the snapshot primitive voids all stack pages. @@ -21772,7 +21704,7 @@ mframeHomeMethodExport(void) method field. */ /* CoInterpreter>>#mframeHomeMethod: */ -CogMethod * +static CogMethod * NoDbgRegParms mframeHomeMethod(char *theFP) { sqInt methodField; @@ -21839,49 +21771,6 @@ minimumUnusedHeadroom(void) return minUnused; } - /* CoInterpreter>>#mMethodClass */ -sqInt -mMethodClass(void) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt literal; - sqInt methodPointer; - sqInt objOop; - sqInt objOop1; - sqInt offset; - - /* begin methodClassOf: */ - methodPointer = ((mframeHomeMethod(GIV(framePointer)))->methodObject); - /* begin followLiteral:ofMethod: */ - offset = (literalCountOf(methodPointer)) - 1; - /* begin followField:ofObject: */ - objOop1 = longAt((methodPointer + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); - if (((!(objOop1 & (tagMask())))) - && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { - objOop1 = fixFollowedFieldofObjectwithInitialValue(offset + LiteralStart, methodPointer, objOop1); - } - literal = objOop1; - return ((literal != GIV(nilObj)) - && (((!(literal & (tagMask())))) - && (((((usqInt)((longAt(literal)))) >> (formatShift())) & (formatMask())) <= 5 /* lastPointerFormat */)) - ? (assert((numSlotsOf(literal)) > ValueIndex), - /* begin followField:ofObject: */ - (objOop = longAt((literal + BaseHeaderSize) + (((int)((usqInt)(ValueIndex) << (shiftForWord())))))), - (((!(objOop & (tagMask())))) - && ((!((longAt(objOop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))) - ? (objOop = fixFollowedFieldofObjectwithInitialValue(ValueIndex, literal, objOop)) - : 0), - objOop) - : /* begin nilObject */ GIV(nilObj)); -} - - /* CoInterpreter>>#mnuCompilationBreakpointFor: */ -void -mnuCompilationBreakpointFor(sqInt selectorOop) -{ - suppressHeartbeatFlag = 1; - warning("compilation MNU break (heartbeat suppressed)"); -} - /* Lookup the doesNotUnderstand: selector in the class of the argument rcvr. Answer either the matching method (cogged if appropriate), or nil, if not @@ -21894,7 +21783,7 @@ mnuMethodOrNilFor(sqInt rcvr) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt currentClass; sqInt dictionary; - sqInt index; + usqInt index; usqInt length; sqInt mask; sqInt methodArray; @@ -21943,7 +21832,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; @@ -21961,7 +21850,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); @@ -22862,22 +22751,6 @@ primitiveExecuteMethodArgsArray(void) } -/* This is used for asserts that check that inline cache editing results in - valid addresses. - In the C VM interpret is presumed to come before any primitives and so it - constitutes the lowest address in C code that machine code should be - linked, but optimizing - compilers change things around. In the simulator we just answer something - not low. */ - - /* CoInterpreter>>#primitiveFailAddress */ -usqInt -primitiveFailAddress(void) -{ - return ((usqInt)((&primitiveFail))); -} - - /* Answer any special requirements of the given primitive */ /* CoInterpreter>>#primitivePropertyFlags:numArgs: */ @@ -22921,11 +22794,8 @@ primTraceLogIndexAddress(void) return ((usqInt)((&GIV(primTraceLogIndex)))); } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CoInterpreter>>#printCogMethod: */ -EXPORT(void) +void printCogMethod(CogMethod *cogMethod) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -23105,12 +22975,10 @@ printFrameThingatextra(char *name, char *address, sqInt extraValue) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#printFrame:WithSP: */ -EXPORT(sqInt) +sqInt printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -23130,8 +22998,9 @@ printFrameWithSP(char *theFP, char *theSP) sqInt theMethodEnd; sqInt topThing; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { fprintf(GIV(transcript), "%p is not in the stack zone?!\n", theFP); @@ -23265,12 +23134,10 @@ printFrameWithSP(char *theFP, char *theSP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#printMethodCacheFor: */ -EXPORT(void) +void printMethodCacheFor(sqInt thing) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -24064,7 +23931,7 @@ reloadPrimitiveCalloutPointer(void) /* Report the stack page size and minimum unused headroom to stdout. */ /* CoInterpreter>>#reportMinimumUnusedHeadroom */ -EXPORT(void) +void reportMinimumUnusedHeadroom(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT fprintf(GIV(transcript), @@ -24078,7 +23945,7 @@ reportMinimumUnusedHeadroom(void) /* Report the stack page size and minimum unused headroom to a stream. */ /* CoInterpreter>>#reportMinimumUnusedHeadroomOn: */ -EXPORT(void) +void reportMinimumUnusedHeadroomOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -24313,7 +24180,7 @@ roomToPushNArgs(sqInt n) logged normally. */ /* CoInterpreter>>#sendInvokeCallbackContext: */ -EXPORT(sqInt) +sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt aMethodObj; @@ -24543,8 +24410,9 @@ shortPrintFrame(char *theFP) sqInt mthd; sqInt rcvr; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { /* begin print: */ fprintf(GIV(transcript), "invalid frame pointer"); cr(); @@ -25646,12 +25514,10 @@ voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#whereIs: */ -EXPORT(char *) +char * whereIs(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *somewhere; @@ -25820,6 +25686,29 @@ primitiveBenchmarkJITReceiver(void) } #endif /* VMBenchmarks */ + /* CoInterpreterPrimitives>>#primitiveBenchmarkScavenge */ +#if VMBenchmarks +EXPORT(void) +primitiveBenchmarkScavenge(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *sp; + usqLong then; + + /* begin primitiveReturnTimeTakenFor: */ + then = ioHighResClock(); + /* begin scavengingGC */ + scavengingGCTenuringIf(TenureByAge); + (((usqInt)(((((GIV(totalFreeOldSpace) + (GIV(scavengeThreshold) - GIV(freeStart))) - (interpreterAllocationReserveBytes())) < 0) ? 0 : ((GIV(totalFreeOldSpace) + (GIV(scavengeThreshold) - GIV(freeStart))) - (interpreterAllocationReserveBytes())))) << 1) | 1); + /* begin methodReturnValue: */ + oop = positive64BitIntegerFor((ioHighResClock()) - then); + assert(!((failed()))); + /* begin pop:thenPush: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; +} +#endif /* VMBenchmarks */ + /* This is optional old obsolete stuff tedious to implement in Cog because of the need to map from machine code pc to bytecode pc. So for now just fail. */ @@ -30907,6 +30796,7 @@ primitiveClosureValue(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -31168,6 +31058,7 @@ primitiveClosureValueNoContextSwitch(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -31461,6 +31352,7 @@ primitiveClosureValueWithArgs(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -35264,7 +35156,7 @@ primitiveInvokeObjectAsMethod(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; sqInt lookupClassTag; - sqInt runArgs; + usqInt runArgs; sqInt runReceiver; char *sp; char *sp1; @@ -36842,8 +36734,9 @@ primitivePathToUsing(void) stackp = 0; while (1) { while (((index -= 1)) >= -1) { - if ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages)))))))) { if (index >= 0) { next = fieldofFrame(index, ((char *) current)); } @@ -36864,8 +36757,9 @@ primitivePathToUsing(void) next = fetchClassOfNonImm(current); } } - if ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages)))))))) { assert(isFrameonPage(((char *) next), stackPageFor(((char *) next)))); } else { @@ -36898,8 +36792,9 @@ primitivePathToUsing(void) goto l8; } if (((next & 1) == 0) - && (((((((usqInt)next)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages)))))) + && (((GIV(stackBasePlus1) != null) + && ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) ? !(frameIsMarked(next)) : (next >= heapBase) && ((!(((((usqInt)((longAt(next + 4)))) >> (markedBitHalfShift())) & 1) != 0)) @@ -36924,8 +36819,9 @@ primitivePathToUsing(void) assert(!(isOopForwarded(stack))); longAtput((stack + BaseHeaderSize) + (((sqInt)((usqInt)((stackp + 1)) << (shiftForWord())))), (((usqInt)index << 1) | 1)); stackp += 2; - if ((((((usqInt)(((char *) next)))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)(((char *) next)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) next)))) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)(((char *) next)))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)(((char *) next)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) next)))) <= (((usqInt)GIV(pages)))))))) { /* begin markFrame: */ methodField = longAt(next + FoxMethod); if ((((usqInt)methodField)) < (startOfMemory())) { @@ -39534,10 +39430,8 @@ primitiveStoreImageSegment(void) && (((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) == (firstLongFormat())))))) { /* Must be indexable words */ - /* begin primitiveFail */ - if (!GIV(primFailCode)) { - GIV(primFailCode) = 1; - } + /* begin primitiveFailFor: */ + GIV(primFailCode) = PrimErrBadArgument; return; } ecode = storeImageSegmentIntooutPointersroots(segmentWordArray, outPointerArray, arrayOfRoots); @@ -40251,7 +40145,8 @@ primitiveStringReplace(void) replFmt = replFmt & -4; l10: /* end classFormatFromInstFormat: */; if (!((arrayFmt == replFmt) - && (arrayFmt < (firstCompiledMethodFormat())))) { + && ((arrayFmt >= (sixtyFourBitIndexableFormat())) + && (arrayFmt < (firstCompiledMethodFormat()))))) { /* begin primitiveFailFor: */ GIV(primFailCode) = PrimErrInappropriate; goto l17; @@ -41422,7 +41317,7 @@ ensureNoForwardedLiteralsIn(sqInt aMethodObj) need since depth is always finite. */ /* Spur32BitCoMemoryManager>>#followForwardedObjectFields:toDepth: */ -sqInt +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -42437,116 +42332,6 @@ initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur32BitMemoryManager>>#inOldSpaceInstantiatePinnedClass:indexableSize: */ -sqInt -inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt fillValue; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt numSlots; - usqInt p; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - fillValue = 0; - switch (instSpec) { - case 2 /* arrayFormat */: - numSlots = nElements; - fillValue = GIV(nilObj); - break; - case indexablePointersFormat(): - case weakArrayFormat(): - numSlots = (classFormat & ((1U << (fixedFieldsFieldWidth())) - 1)) + nElements; - fillValue = GIV(nilObj); - break; - case sixtyFourBitIndexableFormat(): - if (nElements > ((0x1FFFFFFF) / 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - numSlots = nElements * 2; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = nElements; - break; - case firstShortFormat(): - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstByteFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - default: - - /* non-indexable */ - /* Some Squeak images include funky fixed subclasses of abstract variable - superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection. - The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via - this method. - Hence allow fixed classes to be instantiated here iff nElements = 0. */ - if ((nElements != 0) - || (instSpec > 5 /* lastPointerFormat */)) { - return null; - } - numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); - fillValue = GIV(nilObj); - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > (0x1FFFFFFF)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsForPinningInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : ((numSlots + (numSlots & 1)) << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - if (!(newObj == null)) { - /* begin fillObj:numSlots:with: */ - assert(oopisLessThan(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1, addressAfter(newObj))); - for (p = (((usqInt)(newObj + BaseHeaderSize))); p <= (((usqInt)(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { - longAtput(p, fillValue); - longAtput(p + 4, fillValue); - } - } - return newObj; -} - - /* Allocate an instance of a variable class, excepting CompiledMethod. */ /* Spur32BitMemoryManager>>#instantiateClass:indexableSize: */ @@ -42699,131 +42484,6 @@ instantiateClassindexableSize(sqInt classObj, usqInt nElements) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur32BitMemoryManager>>#instantiateUninitializedClass:indexableSize: */ -sqInt -instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt newObj1; - usqInt numBytes; - usqInt numSlots; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - assert(isPureBitsFormat(instSpec)); - switch (instSpec) { - case sixtyFourBitIndexableFormat(): - if (nElements > ((0x1FFFFFFF) / 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - numSlots = nElements * 2; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = nElements; - break; - case firstShortFormat(): - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstByteFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - default: - - /* not bits indexable */ - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > ((1U << (fixedFieldsFieldWidth())) - 1)) { - if (numSlots > (0x1FFFFFFF)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : ((numSlots + (numSlots & 1)) << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - } - else { - /* begin allocateSlots:format:classIndex: */ - if (numSlots >= (numSlotsMask())) { - newObj1 = GIV(freeStart) + BaseHeaderSize; - numBytes = (BaseHeaderSize + BaseHeaderSize) + ((numSlots + (numSlots & 1)) * BytesPerOop); - } - else { - newObj1 = GIV(freeStart); - numBytes = BaseHeaderSize + ((numSlots <= 1 - ? /* begin allocationUnit */ 8 - : (numSlots + (numSlots & 1)) * BytesPerOop)); - } - if ((GIV(freeStart) + numBytes) > GIV(scavengeThreshold)) { - if (!GIV(needGCFlag)) { - /* begin scheduleScavenge */ - GIV(needGCFlag) = 1; - forceInterruptCheck(); - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, instSpec, classIndex); - goto l8; - } - if (numSlots >= (numSlotsMask())) { - - /* for header parsing we put a saturated slot count in the prepended overflow size word */ - flag("endianness"); - longAtput(GIV(freeStart), numSlots); - longAtput(GIV(freeStart) + 4, ((sqInt)((usqInt)((numSlotsMask())) << (numSlotsHalfShift())))); - long64Atput(newObj1, headerForSlotsformatclassIndex(numSlotsMask(), instSpec, classIndex)); - } - else { - long64Atput(newObj1, (((((usqLong) numSlots)) << (numSlotsFullShift())) + (((sqInt)((usqInt)(instSpec) << (formatShift()))))) + classIndex); - } - assert((numBytes % (allocationUnit())) == 0); - assert((newObj1 % (allocationUnit())) == 0); - GIV(freeStart) += numBytes; - newObj = newObj1; - l8: /* end allocateSlots:format:classIndex: */; - } - return newObj; -} - - /* Convert the integer value, assumed to be in SmallInteger range, into a tagged SmallInteger object. In C, use a shift and an add to set the tag bit. @@ -43266,8 +42926,8 @@ allWeakSurvivorsOnWeakList(void) writes code that stresses the remembered table. One might conclude that if the remembered table is full, then the right thing - to do is simply to tenure everything, emptying the remembered table. Bt in - some circumstances this + to do is simply to tenure everything, emptying the remembered table. But + in some circumstances this can be counter-productive, and result in the same situation arising soon after tenuring everything. Instead, we can try and selectively prune the remembered table, tenuring @@ -43661,6 +43321,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj3 == null)) { + assert(isPinned(obj3)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1, addressAfter(obj3))); for (p2 = (((usqInt)(obj3 + BaseHeaderSize))); p2 <= (((usqInt)(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1))); p2 += 8 /* allocationUnit */) { @@ -43678,6 +43339,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj2 == null)) { + assert(isPinned(obj2)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1, addressAfter(obj2))); for (p1 = (((usqInt)(obj2 + BaseHeaderSize))); p1 <= (((usqInt)(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1))); p1 += 8 /* allocationUnit */) { @@ -43698,6 +43360,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -43896,6 +43559,7 @@ openScavengeLog(void) /* Print the objects in the remembered set. */ +/* useful for debugging */ /* SpurGenerationScavenger>>#printRememberedSet */ void @@ -46188,6 +45852,7 @@ allocatePinnedSlots(sqInt nSlots) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj == null)) { + assert(isPinned(obj)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj))); for (p = (((usqInt)(obj + BaseHeaderSize))); p <= (((usqInt)(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -47205,30 +46870,6 @@ checkedLongAt(sqInt byteAddress) return longAt(byteAddress); } - /* SpurMemoryManager>>#checkFreeSpace: */ -void -checkFreeSpace(sqInt gcModes) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, null); - } -} - - /* SpurMemoryManager>>#checkFreeSpace:ignoring: */ -void -checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, anOopToIgnore); - } -} - /* Perform an integrity/leak check using the heapMap. Assume clearLeakMapAndMapAccessibleFreeSpace has set a bit at each free chunk's @@ -48193,6 +47834,7 @@ checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt cla /* Verify that the given oop is legitimate. Check address, header, and size but not class. Answer true if OK. Otherwise print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOkayOop: */ sqInt @@ -48287,6 +47929,7 @@ checkOkayOop(usqInt oop) or more fields. Finally, the instance specification field of the behavior must match that of the instance. If OK answer true. If not, print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOopHasOkayClass: */ sqInt @@ -49140,7 +48783,7 @@ cloneObject(sqInt objOop) } /* SpurMemoryManager>>#compactClassIndexOf: */ -sqInt +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop) { /* begin classIndexOf: */ @@ -49306,6 +48949,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS /* print the count of marked and unmarked objects. In addition if 1 is set in printFlags, short-print marked objects, and/or if 2 is set, short-print unmarked obejcts. */ +/* useful for debugging */ /* SpurMemoryManager>>#countMarkedAndUnmarkdObjects: */ void @@ -49403,7 +49047,8 @@ currentAllocatedBytes(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt use; - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); return (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); } @@ -49430,7 +49075,8 @@ doScavenge(sqInt tenuringCriterion) usqInt use; /* begin doAllocationAccountingForScavenge */ - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); GIV(statAllocatedBytes) = (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); GIV(gcPhaseInProgress) = ScavengeInProgress; /* begin scavenge: */ @@ -49481,7 +49127,8 @@ doScavenge(sqInt tenuringCriterion) GIV(freeStart) = ((eden()).start); GIV(gcPhaseInProgress) = 0; /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); } @@ -49495,7 +49142,7 @@ doScavenge(sqInt tenuringCriterion) was possible. */ /* SpurMemoryManager>>#doShorten:toIndexableSize: */ -sqInt +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt bytesBefore; @@ -50308,6 +49955,7 @@ findLargestFreeChunk(void) /* Print the oops of all string-like things that start with the same characters as aCString */ +/* useful for debugging */ /* SpurMemoryManager>>#findStringBeginningWith: */ void @@ -50969,7 +50617,6 @@ fullGC(void) runLeakCheckerForexcludeUnmarkedObjsclassIndicesShouldBeValid(GCModeFull, 1, 1); compactionStartUsecs = ioUTCMicrosecondsNow(); /* begin prepareForGlobalSweep */ - GIV(sweepIndex) = 0; for (i = 0; i < GIV(numSegments); i += 1) { ((GIV(segments)[i]).containsPinned = 0); } @@ -50982,9 +50629,11 @@ fullGC(void) GIV(statShrinkMemory) += 1; } /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); assert(validObjStacks()); assert(isEmptyObjStack(GIV(markStack))); assert(isEmptyObjStack(GIV(weaklingStack))); @@ -51041,12 +50690,10 @@ growOldSpaceByAtLeast(sqInt minAmmount) sqInt ammount; sqInt bytes; sqInt headroom; - sqInt i; sqInt interval; SpurSegmentInfo *segInfo; sqInt start; usqInt total; - usqInt total1; /* statGrowMemory counts attempts, not successes. */ @@ -51063,13 +50710,8 @@ growOldSpaceByAtLeast(sqInt minAmmount) /* Now apply the maxOldSpaceSize limit, if one is in effect. */ ammount = ((ammount < GIV(growHeadroom)) ? GIV(growHeadroom) : ammount); if (maxOldSpaceSize > 0) { - /* begin totalBytesInSegments */ - total1 = 0; - for (i = 0; i < GIV(numSegments); i += 1) { - total1 += ((GIV(segments)[i]).segSize); - } - assert(GIV(totalHeapSizeIncludingBridges) == total1); - total = total1; + assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)); + total = GIV(totalHeapSizeIncludingBridges); if (total >= maxOldSpaceSize) { GIV(needGCFlag) = 1; return null; @@ -51238,73 +50880,6 @@ incrementalGC(void) error("shouldNotImplement"); } - /* SpurMemoryManager>>#indexOf:in: */ -sqInt -indexOfin(sqInt anElement, sqInt anObject) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt fmt; - sqInt fmt1; - sqInt i; - usqInt numSlots; - usqInt numSlots1; - - /* begin formatOf: */ - fmt = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - if (fmt <= 5 /* lastPointerFormat */) { - /* begin numSlotsOf: */ - assert((classIndexOf(anObject)) > (isForwardedObjectClassIndexPun())); - numSlots1 = byteAt(anObject + 7); - numSlots = (numSlots1 == (numSlotsMask()) - ? longAt(anObject - BaseHeaderSize) - : numSlots1); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (longAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) { - return i; - } - } - } - if (fmt >= (firstByteFormat())) { - if (fmt >= (firstCompiledMethodFormat())) { - /* begin primitiveFailFor: */ - return (GIV(primFailCode) = PrimErrUnsupported); - } - /* begin numBytesOfBytes: */ - fmt1 = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - assert(fmt1 >= (firstByteFormat())); - numSlots = ((numSlotsOf(anObject)) << (shiftForWord())) - (fmt1 & 7); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (byteAt((anObject + BaseHeaderSize) + i))) { - return i; - } - } - } - if (fmt >= (firstShortFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 1; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (((unsigned short) (shortAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 1)))))))) { - return i; - } - } - } - if (fmt == (sixtyFourBitIndexableFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 3; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long64At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 3)))))) { - return i; - } - } - } - if (fmt >= (firstLongFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 2; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long32At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 2)))))) { - return i; - } - } - } - return -1; -} - /* Part of reorderReversedTreeList:. Switch treeNode with newNode in the tree, but do nothing to the list linked through freeChunkNextIndex. */ @@ -51766,6 +51341,7 @@ initializeObjectMemory(sqInt bytesToShift) /* begin allocatePinnedSlots: */ obj1 = allocateSlotsForPinningInOldSpacebytesformatclassIndex(0x400, (((int)((usqInt)((0x400 + (0x400 & 1))) << (shiftForWord())))) + (BaseHeaderSize + BaseHeaderSize), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -51782,7 +51358,7 @@ initializeObjectMemory(sqInt bytesToShift) else { /* The Spur32to64BitBootstrap failed to set the type of rememberedSetObj to 64-bit indexability. - This is unimportant except for simulation; rememberedSet is declared as sqInt *, but in to have + This is unimportant except for simulation; rememberedSet is declared as sqInt *, but to have firstIndexableField: below answer a suitable type the format must be wordIndexableFormat. */ /* begin setFormatOf:to: */ format = firstLongFormat(); @@ -51813,9 +51389,11 @@ initializeObjectMemory(sqInt bytesToShift) /* free space before shrinking */ GIV(shrinkThreshold) = 0x2000000; /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* By default GC after scavenge if heap has grown by a third since the last GC */ GIV(heapGrowthToSizeGCRatio) = 0.333333; @@ -51823,12 +51401,10 @@ initializeObjectMemory(sqInt bytesToShift) /* print free chunks in freeTree in order. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#inOrderPrintFreeTree:printList: */ -EXPORT(void) +void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList) { sqInt next; @@ -52081,18 +51657,6 @@ isAnyPointerFormat(sqInt format) } -/* Answer if this is an indexable object with pointer elements, e.g., an - array - */ - - /* SpurMemoryManager>>#isArrayNonImm: */ -sqInt -isArrayNonImm(sqInt oop) -{ - return ((((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask())) == 2 /* arrayFormat */; -} - - /* Answer true if this is an indexable object with pointer elements, e.g., an array */ @@ -52518,7 +52082,7 @@ isObjImmutable(sqInt anOop) /* Answer if obj is old. Require that obj is non-immediate. */ /* SpurMemoryManager>>#isOldObject: */ -sqInt +static sqInt NoDbgRegParms isOldObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(isNonImmediate(objOop)); @@ -52591,19 +52155,6 @@ isPureBitsFormat(sqInt format) && (format < (firstCompiledMethodFormat())); } - -/* Answer if oop is young. */ - - /* SpurMemoryManager>>#isReallyYoung: */ -sqInt -isReallyYoung(sqInt oop) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return ((!(oop & (tagMask())))) - && ((assert(isNonImmediate(oop)), - (oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart))))); -} - /* SpurMemoryManager>>#isRemembered: */ static sqInt NoDbgRegParms isRemembered(sqInt objOop) @@ -52644,10 +52195,10 @@ isShorts(sqInt oop) /* This version is private to SpurMemoryManager (for asserts, etc). It does - not take advantage of the power-of0two optimization in isForwarded:. */ + not take advantage of the power-of-two optimization in isForwarded:. */ /* SpurMemoryManager>>#isUnambiguouslyForwarder: */ -sqInt +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop) { return ((longAt(objOop)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()); @@ -53038,7 +52589,7 @@ lastPointerFormat(void) pointer, and the image contains no forwarders (see class comment). */ /* SpurMemoryManager>>#lastPointerOfWhileSwizzling: */ -sqInt +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fmt; @@ -53075,7 +52626,7 @@ lastPointerOfWhileSwizzling(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#lastPointerOf: */ -sqInt +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -53124,13 +52675,6 @@ lastPointerOf(sqInt objOop) ((header >> 1)) & AlternateHeaderNumLiteralsMask)) + LiteralStart) - 1) * BytesPerOop) + BaseHeaderSize; } - /* SpurMemoryManager>>#leakCheckBecome */ -sqInt -leakCheckBecome(void) -{ - return ((checkForLeaks & GCModeBecome) != 0); -} - /* SpurMemoryManager>>#leakCheckFullGC */ sqInt leakCheckFullGC(void) @@ -53138,13 +52682,6 @@ leakCheckFullGC(void) return ((checkForLeaks & GCModeFull) != 0); } - /* SpurMemoryManager>>#leakCheckIncremental */ -sqInt -leakCheckIncremental(void) -{ - return ((checkForLeaks & GCModeIncremental) != 0); -} - /* SpurMemoryManager>>#leakCheckNewSpaceGC */ sqInt leakCheckNewSpaceGC(void) @@ -53745,12 +53282,10 @@ loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesOf: */ -EXPORT(void) +void longPrintInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -53765,12 +53300,10 @@ longPrintInstancesOf(sqInt aClassOop) /* Scan the heap printing any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesWithClassIndex: */ -EXPORT(void) +void longPrintInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -53878,12 +53411,10 @@ longPrintInstancesWithClassIndex(sqInt classIndex) /* Scan the heap long printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintReferencesTo: */ -EXPORT(void) +void longPrintReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -55304,21 +54835,6 @@ maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format) } -/* Answer one of the objects in the SpecialObjectsArray, if in range, - otherwise answer nil. - */ - - /* SpurMemoryManager>>#maybeSplObj: */ -sqInt -maybeSplObj(sqInt index) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return (index < (numSlotsOf(GIV(specialObjectsOop))) - ? (/* begin fetchPointer:ofObject: */ - longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) - : 0); -} - - /* Answer the minimum number of additional slots to allocate in an object to always be able to shorten it. This is enough slots to allocate a minimum-sized object. */ @@ -55741,7 +55257,7 @@ numBytesOf(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#numPointerSlotsOf: */ -usqInt +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -55921,24 +55437,6 @@ numStrongSlotsOfInephemeral(sqInt objOop) } -/* Answer the number of strong pointer fields in the given weakling. */ - - /* SpurMemoryManager>>#numStrongSlotsOfWeakling: */ -sqInt -numStrongSlotsOfWeakling(sqInt objOop) -{ - sqInt classFormat; - sqInt objOop1; - - assert((formatOf(objOop)) == (weakArrayFormat())); - /* begin fixedFieldsOfClass: */ - objOop1 = fetchClassOfNonImm(objOop); - /* begin fixedFieldsOfClassFormat: */ - classFormat = ((longAt((objOop1 + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - return classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); -} - - /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -56010,6 +55508,9 @@ objectAfter(sqInt objOop) : followingWordAddress3); } + +/* useful for debugging */ + /* SpurMemoryManager>>#objectBefore: */ sqInt objectBefore(sqInt objOop) @@ -56581,6 +56082,7 @@ okayOop(sqInt signedOop) } +/* useful for debugging */ /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -56763,7 +56265,6 @@ pinObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt format; - sqInt i; sqInt oldClone; sqInt referent; SpurSegmentInfo *seg; @@ -56779,15 +56280,7 @@ pinObject(sqInt objOop) longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); return objOop; } - /* begin segmentContainingObj: */ - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - seg = (&(GIV(segments)[i])); - goto l1; - } - } - seg = null; - l1: /* end segmentContainingObj: */; + seg = segmentContainingObj(objOop); if ((seg->containsPinned)) { /* begin setIsPinnedOf:to: */ longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); @@ -57037,12 +56530,10 @@ primitiveErrorTable(void) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printActivationsOf: */ -EXPORT(void) +void printActivationsOf(sqInt aMethodObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -57110,12 +56601,10 @@ printActivationsOf(sqInt aMethodObj) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printBogons */ -EXPORT(void) +void printBogons(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT /* begin printTheBogons: */ @@ -57132,16 +56621,34 @@ printBogons(void) cr(); } + /* SpurMemoryManager>>#printBridge:on: */ +static void NoDbgRegParms +printBridgeon(sqInt oop, FILE *aStream) +{ + fprintf(aStream, + "%p is a bridge hdr%d slot size %ul\n", + ((void *)oop), + ((byteAt(oop + 7)) == (numSlotsMask()) + ? 16 + : 8), + numSlotsOfAny(oop)); +} + /* SpurMemoryManager>>#printCantBeObject:on: */ static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (((oop & (7)) == 0) - && (((oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) - && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))))) { - printForwarderon(oop, aStream); - return; + if ((oop & (7)) == 0) { + if (((oopisLessThan(oop, GIV(oldSpaceStart))) + && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) + && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { + printForwarderon(oop, aStream); + return; + } + if (oop == (bridgeAt((numSegments()) - 1))) { + printBridgeon(oop, aStream); + return; + } } fprintf(aStream, "%p%s\n", @@ -57155,12 +56662,10 @@ printCantBeObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printContextReferencesTo: */ -EXPORT(void) +void printContextReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -57240,12 +56745,10 @@ printContextReferencesTo(sqInt anOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printEntity: */ -EXPORT(void) +void printEntity(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -57379,12 +56882,10 @@ printEntity(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printForwarders */ -EXPORT(void) +void printForwarders(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -57493,7 +56994,7 @@ static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream) { fprintf(aStream, - "%p is a forwarded hdr%d slot size %ud object to %p\n", + "%p is a forwarded hdr%d slot size %ul object to %p\n", ((void *)oop), ((byteAt(oop + 7)) == (numSlotsMask()) ? 16 @@ -57506,6 +57007,7 @@ printForwarderon(sqInt oop, FILE *aStream) /* This version goes through memory, printing all free chunks. Other versions go through the free lists. This one will show all free chunks even if the free lists are corrupt. */ +/* useful for debugging */ /* SpurMemoryManager>>#printFreeChunks */ void @@ -57621,12 +57123,10 @@ printFreeChunks(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeChunk: */ -EXPORT(void) +void printFreeChunk(sqInt freeChunk) { printFreeChunkprintAsTreeNode(freeChunk, 1); @@ -57713,12 +57213,10 @@ printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeListHeads */ -EXPORT(void) +void printFreeListHeads(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt expectedMask; @@ -57754,12 +57252,10 @@ printFreeListHeads(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeList: */ -EXPORT(sqInt) +sqInt printFreeList(sqInt chunkOrIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fieldIndex; @@ -57792,12 +57288,10 @@ printFreeObjecton(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeTree */ -EXPORT(void) +void printFreeTree(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFreeTreeChunk(GIV(freeLists)[0]); @@ -57821,13 +57315,11 @@ printFreeTreeChunk(sqInt chunkOrZero) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* N.B. No safety bounds checks!! We need to look e.g. at corpses. */ /* SpurMemoryManager>>#printHeaderOf: */ -EXPORT(void) +void printHeaderOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -57940,12 +57432,10 @@ printImmediateObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesOf: */ -EXPORT(void) +void printInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -57960,12 +57450,10 @@ printInstancesOf(sqInt aClassOop) /* Scan the heap printing the oops of any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesWithClassIndex: */ -EXPORT(void) +void printInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58071,6 +57559,7 @@ printInstancesWithClassIndex(sqInt classIndex) /* Print the objects in the classTable that have bad hashes. */ +/* useful for debugging */ /* SpurMemoryManager>>#printInvalidClassTableEntries */ void @@ -58120,13 +57609,11 @@ printInvalidClassTableEntries(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMarkedOops */ #if LLDB -EXPORT(void) +void printMarkedOops(void) { printOopsSuchThat(isMarked); @@ -58137,12 +57624,10 @@ printMarkedOops(void) /* Scan the heap printing the oops of any and all methods that implement anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodImplementorsOf: */ -EXPORT(void) +void printMethodImplementorsOf(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -58208,12 +57693,10 @@ printMethodImplementorsOf(sqInt anOop) /* Scan the heap printing the oops of any and all methods that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodReferencesTo: */ -EXPORT(void) +void printMethodReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -58399,12 +57882,10 @@ printNonPointerDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsFrom:to: */ -EXPORT(void) +void printObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -58428,12 +57909,10 @@ printObjectsFromto(sqInt startAddress, sqInt endAddress) /* Scan the heap printing the oops of any and all objects whose hash equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsWithHash: */ -EXPORT(void) +void printObjectsWithHash(sqInt hash) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58535,6 +58014,21 @@ printObjectsWithHash(sqInt hash) l4: /* end allNewSpaceEntitiesDo: */; } + /* SpurMemoryManager>>#printObjStackAndContents: */ +void +printObjStackAndContents(sqInt objStack) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + /* begin printObjStack:printContents: */ + if (objStack == GIV(nilObj)) { + /* begin print: */ + fprintf(GIV(transcript), "nil"); + cr(); + } + else { + printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((int)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, 1); + } +} + /* SpurMemoryManager>>#printObjStackPage:myIndex:pageType:printContents: */ static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents) @@ -58697,6 +58191,9 @@ printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType) cr(); } + +/* useful for debugging */ + /* SpurMemoryManager>>#printObjStack: */ void printObjStack(sqInt objStack) @@ -58712,27 +58209,11 @@ printObjStack(sqInt objStack) } } - /* SpurMemoryManager>>#printObjStack:printContents: */ -void -printObjStackprintContents(sqInt objStack, sqInt printContents) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - if (objStack == GIV(nilObj)) { - /* begin print: */ - fprintf(GIV(transcript), "nil"); - cr(); - } - else { - printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((int)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, printContents); - } -} - -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsExcept: */ -EXPORT(void) NeverInline +void NeverInline printOopsExcept(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58850,12 +58331,10 @@ printOopsExcept(sqInt (*function)(sqInt)) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsFrom:to: */ -EXPORT(void) +void printOopsFromto(sqInt startAddress, sqInt endAddress) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstNonEntity; @@ -58908,12 +58387,10 @@ printOopsFromto(sqInt startAddress, sqInt endAddress) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsSuchThat: */ -EXPORT(void) NeverInline +void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59032,12 +58509,10 @@ printOopsSuchThat(sqInt (*function)(sqInt)) /* Scan the heap printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printReferencesTo: */ -EXPORT(void) +void printReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -59281,13 +58756,11 @@ printStringDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printUnmarkedOops */ #if LLDB -EXPORT(void) +void printUnmarkedOops(void) { printOopsExcept(isMarked); @@ -59943,12 +59416,10 @@ shortentoIndexableSize(sqInt objOop, sqInt indexableSize) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#shortPrintObjectsFrom:to: */ -EXPORT(void) +void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -60086,7 +59557,7 @@ startOfObject(sqInt objOop) /* Part of InterpreterProxy's 1.14 API */ /* SpurMemoryManager>>#statNumGCs */ -EXPORT(sqInt) +sqInt statNumGCs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT return (GIV(statScavenges) + GIV(statIncrGCs)) + GIV(statFullGCs); @@ -60128,13 +59599,21 @@ storeCheckBoundary(void) The primitive can fail for the following reasons with the specified failure codes: - PrimErrGenericError: the segmentWordArray is too small for the version - stamp PrimErrWritePastObject: the segmentWordArray is too small to contain - the reachable objects - PrimErrBadIndex: the outPointerArray is too small - PrimErrNoMemory: additional allocations failed + PrimErrGenericFailure: the segmentWordArray is too small for the version + stamp PrimErrWritePastObject: the segmentWordArray is too small to + contain the reachable objects + PrimErrBadIndex: the outPointerArray is too small + PrimErrNoMemory: there is insufficient free space to store the array + answered by objectsReachableFromRoots:, + or the savedFirstFields and savedOutHashes arrays. + PrimErrNeedCompaction: a GC is needed to make room for the array answered + by objectsReachableFromRoots: PrimErrLimitExceeded: there is no room in the hash field to store out - pointer indices or class references. */ + pointer indices or class references, + or the outPointerArray is larger than the max value of the hash field. + PrimErrNoModification: the segmentWordArrayArg or outPointerArrayArg are + immutable PrimErrObjectIsPinned: the segmentWordArrayArg or + outPointerArrayArg are pinned */ /* SpurMemoryManager>>#storeImageSegmentInto:outPointers:roots: */ static sqInt NoDbgRegParms @@ -60389,6 +59868,7 @@ storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt val /* Note must check here for stores of young objects into old ones. */ +/* See SistaCogit */ /* SpurMemoryManager>>#storePointer:ofObject:withValue: */ sqInt @@ -60483,7 +59963,8 @@ sufficientSpaceAfterGC(sqInt numBytes) assert(numBytes == 0); scavengingGCTenuringIf(TenureByAge); - heapSizePostGC = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + heapSizePostGC = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); if (((((double) (heapSizePostGC - GIV(heapSizeAtPreviousGC)) )) / GIV(heapSizeAtPreviousGC)) >= GIV(heapGrowthToSizeGCRatio)) { fullGC(); } @@ -61094,6 +60575,9 @@ validClassTableRootPages(void) return 1; } + +/* useful for debugging */ + /* SpurMemoryManager>>#validFreeTree */ sqInt validFreeTree(void) @@ -61489,6 +60973,7 @@ copyAndUnmarkMobileObjects(void) usqInt previousPin; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt start; usqInt startOfPreviousPin; usqInt toFinger; @@ -61566,19 +61051,16 @@ copyAndUnmarkMobileObjects(void) assert((isMarked(previousPin)) && (isPinned(previousPin))); /* begin unmarkPinned: */ - if (!(((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(previousPin)); + } + else { setIsMarkedOfto(previousPin, 0); /* begin notePinned: */ assert(isPinned(previousPin)); - if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(previousPin, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), previousPin)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(previousPin)))); + seg = segmentContainingObj(previousPin); + (seg->containsPinned = 1); } toFinger = addressAfter(previousPin); /* begin objectStartingAt: */ @@ -61819,6 +61301,7 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) usqInt numSlots; sqInt obj; usqInt objStart; + SpurSegmentInfo *seg; usqInt toFinger; toFinger = initialToFinger; @@ -61841,19 +61324,16 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) if ((((((usqInt)((longAt(obj + 4)))) >> (markedBitHalfShift())) & 1) != 0) && (((((usqInt)((longAt(obj)))) >> (pinnedBitShift())) & 1) != 0)) { /* begin unmarkPinned: */ - if (!(((longAt(obj)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(obj)); + } + else { setIsMarkedOfto(obj, 0); /* begin notePinned: */ assert(isPinned(obj)); - if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(obj, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), obj)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(obj)))); + seg = segmentContainingObj(obj); + (seg->containsPinned = 1); } if (toFinger < objStart) { /* begin addFreeChunkWithBytes:at: */ @@ -62266,6 +61746,7 @@ unmarkObjectsFromFirstFreeObject(void) sqInt objOop; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt startOfFree; startOfFree = 0; @@ -62288,19 +61769,16 @@ unmarkObjectsFromFirstFreeObject(void) } if (((((usqInt)((longAt(objOop)))) >> (pinnedBitShift())) & 1) != 0) { /* begin unmarkPinned: */ - if (!(((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(objOop)); + } + else { setIsMarkedOfto(objOop, 0); /* begin notePinned: */ assert(isPinned(objOop)); - if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(objOop, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), objOop)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(objOop)))); + seg = segmentContainingObj(objOop); + (seg->containsPinned = 1); } } else { @@ -62971,7 +62449,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: */ @@ -63001,7 +62479,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)) { @@ -63363,9 +62841,11 @@ collapseSegmentsPostSwizzle(void) GIV(canSwizzle) = 0; GIV(numSegments) = 1; + /* begin computeTotalHeapSizeIncludingBridges */ + GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()); cascade0 = (&(GIV(segments)[0])); (cascade0->segStart = oldSpaceStart()); - (cascade0->segSize = (GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()))); + (cascade0->segSize = GIV(totalHeapSizeIncludingBridges)); assert(isSegmentBridge(bridgeAt(0))); assert((numSlotsOfAny(bridgeAt(0))) == 0); } @@ -63547,7 +63027,6 @@ prepareForSnapshot(void) usqInt followingWordAddress; usqInt freeChunk; sqInt i; - sqInt i1; sqInt largeChild; sqInt limit; sqInt newEndOfMemory; @@ -63595,24 +63074,16 @@ prepareForSnapshot(void) followingWordAddress = addressAfter(node); if (oopisGreaterThanOrEqualTo(followingWordAddress, limit)) { next = limit; - goto l9; + goto l7; } flag("endianness"); followingWord = longAt(followingWordAddress + 4); next = ((((usqInt)(followingWord)) >> (numSlotsHalfShift())) == (numSlotsMask()) ? followingWordAddress + BaseHeaderSize : followingWordAddress); - l9: /* end objectAfter:limit: */; + l7: /* end objectAfter:limit: */; if (((longAt(next)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin segmentContainingObj: */ - for (i1 = (GIV(numSegments) - 1); i1 >= 0; i1 += -1) { - if (node >= (((GIV(segments)[i1]).segStart))) { - seg = (&(GIV(segments)[i1])); - goto l8; - } - } - seg = null; - l8: /* end segmentContainingObj: */; + seg = segmentContainingObj(node); (seg->lastFreeObject = node); node = 0; } @@ -63727,17 +63198,51 @@ readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes) return totalBytesRead; } + +/* Answer the segment containing an object. This is mostly for assert + checking, but + variations on the incremental GC may use it in anger. Binary search is (of + course) marginally slower than linear search for a single segment (e.g. in + a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every + old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or + 20% faster + in the same heap extended with enough large arrays to require 11 segments; + and this + is pessimal; there are fewer objects at high addresses since the large + arrays are there). */ + /* SpurSegmentManager>>#segmentContainingObj: */ -EXPORT(SpurSegmentInfo *) +SpurSegmentInfo * segmentContainingObj(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; + sqInt high; + sqInt low; + sqInt mid; + SpurSegmentInfo *seg; - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - return (&(GIV(segments)[i])); + low = 0; + mid = GIV(numSegments) / 2; + high = GIV(numSegments) - 1; + do { + seg = (&(GIV(segments)[mid])); + if (oopisGreaterThanOrEqualTo(objOop, (seg->segStart))) { + if (mid == high) { + return (oopisLessThan(objOop, ((seg->segSize)) + ((seg->segStart))) + ? seg + : 0); + } + else { + low = mid; + mid = ((mid + high) + 1) / 2; + } } - } + else { + high = mid - 1; + mid = (low + mid) / 2; + } + } while(low <= high); return null; } @@ -63914,6 +63419,9 @@ swizzleObj(sqInt objOop) return objOop + (((GIV(segments)[0]).swizzle)); } + +/* This ``slow'' count is for asserts only. */ + /* SpurSegmentManager>>#totalBytesInSegments */ static usqInt totalBytesInSegments(void) @@ -63925,7 +63433,6 @@ totalBytesInSegments(void) for (i = 0; i < GIV(numSegments); i += 1) { total += ((GIV(segments)[i]).segSize); } - assert(GIV(totalHeapSizeIncludingBridges) == total); return total; } @@ -64050,12 +63557,10 @@ accessorDepthForPrimitiveMethod(sqInt aMethodObj) /* Answer the current activeProcess. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#activeProcess */ -EXPORT(sqInt) +sqInt activeProcess(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt objOop; @@ -64388,7 +63893,7 @@ booleanValueOf(sqInt obj) /* Re-enter the interpreter to execute a (non-Alien) callback. */ /* StackInterpreter>>#callbackEnter: */ -EXPORT(sqInt) +sqInt callbackEnter(sqInt *callbackID) { warning("callbackEnter: is obsolete"); @@ -64399,7 +63904,7 @@ callbackEnter(sqInt *callbackID) /* Leave from a previous callback */ /* StackInterpreter>>#callbackLeave: */ -EXPORT(sqInt) +sqInt callbackLeave(sqInt cbID) { warning("callbackLeave: is obsolete"); @@ -64453,12 +63958,10 @@ characterForAscii(sqInt ascii) /* Ensure that all accessible objects in the heap are okay. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkAllAccessibleObjectsOkay */ -EXPORT(sqInt) +sqInt checkAllAccessibleObjectsOkay(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -64878,12 +64381,10 @@ checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkOkayInterpreterObjects: */ -EXPORT(sqInt) +sqInt checkOkayInterpreterObjects(sqInt writeBack) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -65231,19 +64732,10 @@ contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP) /* StackInterpreter>>#copiedValueCountOfClosure: */ sqInt -copiedValueCountOfClosure(sqInt closurePointer) -{ - return (numSlotsOf(closurePointer)) - ClosureFirstCopiedValueIndex; -} - - -/* for Cogit */ - - /* StackInterpreter>>#copiedValueCountOfFullClosure: */ -sqInt -copiedValueCountOfFullClosure(sqInt closurePointer) +copiedValueCountOfClosure(sqInt closureObj) { - return (numSlotsOf(closurePointer)) - FullClosureFirstCopiedValueIndex; + return (assert(isVanillaBlockClosure(closureObj)), + (numSlotsOf(closureObj)) - ClosureFirstCopiedValueIndex); } @@ -67523,7 +67015,7 @@ fullDisplayUpdate(void) example). Default for now is simply the entry in the base primitiveTable. */ /* StackInterpreter>>#functionPointerFor:inClass: */ -void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) +static void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) { return (primIdx > MaxPrimitiveIndex ? 0 @@ -67585,8 +67077,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; @@ -68965,12 +68457,10 @@ loadInitialContext(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#longPrintOop: */ -EXPORT(void) +void longPrintOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -70461,7 +69951,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; @@ -70505,7 +69995,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; @@ -70523,7 +70013,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); @@ -71808,19 +71298,6 @@ pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod return pcPreviousToinSqueakV3PlusClosuresMethod(theIP, aMethod); } - /* StackInterpreter>>#penultimateLiteralOf: */ -sqInt -penultimateLiteralOf(sqInt aMethodOop) -{ - sqInt offset; - - assert(isOopCompiledMethod(aMethodOop)); - /* begin literal:ofMethod: */ - offset = (literalCountOf(aMethodOop)) - 2; - /* begin fetchPointer:ofObject: */ - return longAt((aMethodOop + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); -} - /* In the StackInterpreter stacks grow down. */ @@ -72518,12 +71995,10 @@ printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObjec /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacks */ -EXPORT(void) +void printAllStacks(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -72722,12 +72197,10 @@ printAllStacks(void) /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacksOn: */ -EXPORT(void) +void printAllStacksOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -72742,12 +72215,10 @@ printAllStacksOn(FILE *aStdioStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStack */ -EXPORT(void) +void printCallStack(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (GIV(framePointer) == null) { @@ -72781,18 +72252,17 @@ printCallStackFP(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOf: */ -EXPORT(sqInt) +sqInt printCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; - if ((((((usqInt)aContextOrProcessOrFrame)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)aContextOrProcessOrFrame)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)aContextOrProcessOrFrame)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)aContextOrProcessOrFrame)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)aContextOrProcessOrFrame)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)aContextOrProcessOrFrame)) <= (((usqInt)GIV(pages)))))))) { return printCallStackFP(((char *) aContextOrProcessOrFrame)); } if (aContextOrProcessOrFrame == (activeProcess())) { @@ -72889,12 +72359,10 @@ printCallStackOfcurrentFP(sqInt aContext, char *currFP) /* Print the call stack on a specific output stream. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOn: */ -EXPORT(void) +void printCallStackOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -72928,12 +72396,10 @@ printContextCallStackOf(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printContext: */ -EXPORT(void) +void printContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -73029,7 +72495,7 @@ printContext(sqInt aContext) meth = longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - meth); + ((void *)meth)); printOopShortInner(meth); if (methodHasCogMethod(meth)) { fprintf(GIV(transcript), @@ -73132,12 +72598,10 @@ printDecodeMethodHeaderOop(sqInt methodHeaderOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printExternalHeadFrame */ -EXPORT(void) +void printExternalHeadFrame(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFrameWithSP(GIV(framePointer), GIV(stackPointer)); @@ -73147,8 +72611,9 @@ printExternalHeadFrame(void) static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { return null; } if (!((longAt(theFP + FoxSavedFP)) == 0)) { @@ -73197,7 +72662,7 @@ printFrameOopindexat(char *name, sqInt idx, char *address) "%10p:", ((void *)address)); fprintf(GIV(transcript), - "%s%10s%d: %10p\t", + "%s%10s%" PRIdSQINT ": %10p\t", (idx > 9 ? "" : " "), @@ -73209,19 +72674,20 @@ printFrameOopindexat(char *name, sqInt idx, char *address) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFramesInPage: */ -EXPORT(void) +void printFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 0); } + +/* useful for VM debugging */ + /* StackInterpreter>>#printFramesOnStackPageListInUse */ -EXPORT(void) +void printFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -73294,12 +72760,10 @@ printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame: */ -EXPORT(sqInt) +sqInt printFrame(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *aFrame; @@ -73309,8 +72773,9 @@ printFrame(char *theFP) StackPage *thePage; char *theSP; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { if ((addressCouldBeObj(((sqInt)theFP))) && ((isInMemory(((sqInt)theFP))) && ((((longAt(((sqInt)theFP))) & (classIndexMask())) == ClassMethodContextCompactIndex) @@ -73388,18 +72853,6 @@ printFrame(char *theFP) } -/* Print n in hex, in the form '0x1234', unpadded */ - - /* StackInterpreter>>#printHexnp: */ -sqInt -printHexnp(usqInt n) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return fprintf(GIV(transcript), - "%p", - ((void *)n)); -} - - /* Print p in hex, unpadded, in the form 0x1234 (C)/16r1234 (here) */ /* StackInterpreter>>#printHexPtrnp: */ @@ -73431,12 +72884,10 @@ printHex(usqInt n) /* Print all methods whose penultimate literal is either selector, or an object whose first inst var is the method and whose second is selector (e.g. an AdditionalMethodState). */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printLikelyImplementorsOfSelector: */ -EXPORT(void) +void printLikelyImplementorsOfSelector(sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -73514,12 +72965,10 @@ printLikelyImplementorsOfSelector(sqInt selector) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCache */ -EXPORT(void) +void printMethodCache(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -73604,12 +73053,10 @@ printMethodCache(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionaryOf: */ -EXPORT(void) +void printMethodDictionaryOf(sqInt behavior) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt dictionary; @@ -73652,12 +73099,10 @@ printMethodDictionaryOf(sqInt behavior) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionary: */ -EXPORT(void) +void printMethodDictionary(sqInt dictionary) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt index; @@ -73940,10 +73385,10 @@ printOopShortInner(sqInt oop) } -/* use export: not api, so it won't be written to cointerp.h */ +/* useful for VM debugging */ /* StackInterpreter>>#printOop: */ -EXPORT(void) +void printOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -74125,12 +73570,10 @@ printOop(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcessStack: */ -EXPORT(void) +void printProcessStack(sqInt aProcess) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ctx; @@ -74169,12 +73612,10 @@ printProcessStack(sqInt aProcess) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcsOnList: */ -EXPORT(sqInt) +sqInt printProcsOnList(sqInt procList) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstProc; @@ -74200,12 +73641,10 @@ printProcsOnList(sqInt procList) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackCallStackOf: */ -EXPORT(sqInt) +sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -74238,12 +73677,10 @@ printStackCallStackOf(sqInt aContextOrProcessOrFrame) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageList */ -EXPORT(void) +void printStackPageList(void) { StackPage *page; @@ -74257,12 +73694,10 @@ printStackPageList(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageListInUse */ -EXPORT(void) +void printStackPageListInUse(void) { sqInt n; @@ -74279,12 +73714,10 @@ printStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPages */ -EXPORT(void) +void printStackPages(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -74299,12 +73732,10 @@ printStackPages(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPagesInUse */ -EXPORT(void) +void printStackPagesInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -74433,12 +73864,10 @@ printStackPageuseCount(StackPage *page, sqInt n) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackReferencesTo: */ -EXPORT(void) +void printStackReferencesTo(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *callerFP; @@ -74820,7 +74249,7 @@ putWord32toFile(int aWord32, sqImageFile aFile) } -/* Anwer true if images of the given format are readable by this interpreter. +/* Anwer if images of the given format are readable by this interpreter. Allows a virtual machine to accept selected older image formats. */ /* StackInterpreter>>#readableFormat: */ @@ -74861,7 +74290,7 @@ reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader) and mark calloutContext as dead. */ /* StackInterpreter>>#reestablishContextPriorToCallback: */ -EXPORT(sqInt) +sqInt reestablishContextPriorToCallback(sqInt callbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; @@ -75398,7 +74827,7 @@ retryPrimitiveOnFailure(void) and mark callbackMethodContext as dead. */ /* StackInterpreter>>#returnAs:ThroughCallback:Context: */ -EXPORT(sqInt) +sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt aMethodObj; @@ -75726,12 +75155,10 @@ schedulerPointer(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakMNUSelector: */ -EXPORT(void) +void setBreakMNUSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -75745,12 +75172,10 @@ setBreakMNUSelector(char *aString) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakSelector: */ -EXPORT(void) +void setBreakSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -75771,7 +75196,7 @@ setFullScreenFlag(sqInt value) } /* StackInterpreter>>#setInterruptCheckChain: */ -EXPORT(void *) +void * setInterruptCheckChain(void (*aFunction)()) { void (*prevFunction)(); @@ -75894,6 +75319,7 @@ static sqInt NoDbgRegParms shortPrintContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt home; + sqInt rcvr; sqInt senderOop; char *theFP; @@ -75937,15 +75363,16 @@ shortPrintContext(sqInt aContext) if (home == null) { /* begin print: */ fprintf(GIV(transcript), " BOGUS CONTEXT (can't determine home)"); + cr(); } else { - printActivationNameForreceiverisBlockfirstTemporary(fetchPointerofObject(MethodIndex, (!(home) - ? aContext - : home)), (home == null - ? /* begin nilObject */ GIV(nilObj) - : (longAt((home + BaseHeaderSize) + (((int)((usqInt)(ReceiverIndex) << (shiftForWord()))))))), home != aContext, longAt((home + BaseHeaderSize) + (((int)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin fetchPointer:ofObject: */ + rcvr = longAt((home + BaseHeaderSize) + (((int)((usqInt)(ReceiverIndex) << (shiftForWord()))))); + printActivationNameForreceiverisBlockfirstTemporary(longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))), rcvr, home != aContext, longAt((home + BaseHeaderSize) + (((int)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin space */ + printChar(' '); + shortPrintOop(rcvr); } - cr(); return 0; } @@ -75953,8 +75380,9 @@ shortPrintContext(sqInt aContext) static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { return null; } shortPrintFrame(theFP); @@ -75965,19 +75393,20 @@ shortPrintFrameAndCallers(char *theFP) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFramesInPage: */ -EXPORT(void) +void shortPrintFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 1); } + +/* useful for VM debugging */ + /* StackInterpreter>>#shortPrintFramesOnStackPageListInUse */ -EXPORT(void) +void shortPrintFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -75996,17 +75425,16 @@ shortPrintFramesOnStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFrame:AndNCallers: */ -EXPORT(void) +void shortPrintFrameAndNCallers(char *theFP, sqInt n) { DECL_MAYBE_SQ_GLOBAL_STRUCT if ((n != 0) + && ((GIV(stackBasePlus1) != null) && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { shortPrintFrame(theFP); shortPrintFrameAndNCallers(pointerForOop(longAt(theFP + FoxSavedFP)), n - 1); } @@ -81699,7 +81127,8 @@ primitiveStoreStackp(void) 48 various header flags. See getImageHeaderFlags. 49 max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing) - 50 max literal count for JIT compile (stored in image file header; Cog + + 50 max literal count for JIT compile (stored in image file header; Cog only; otherwise nil) 51 nil; reserved for VM parameters that persist in the image (such as eden above) 52 root/remembered table capacity @@ -81846,7 +81275,8 @@ primitiveVMParameter(void) /* begin primitiveAllVMParameters: */ result1 = instantiateClassindexableSize(splObj(ClassArray), paramsArraySize); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer8 = positiveMachineIntegerFor(totalBytesInSegments()); + valuePointer8 = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (0U << (shiftForWord())), valuePointer8); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -81854,7 +81284,8 @@ primitiveVMParameter(void) assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (1U << (shiftForWord())), valuePointer9); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (2U << (shiftForWord())), valuePointer10); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -82190,7 +81621,8 @@ primitiveVMParameter(void) /* begin primitiveGetVMParameter: */ switch (index) { case 1: - result = positiveMachineIntegerFor(totalBytesInSegments()); + result = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); goto l88; break; case 2: @@ -82198,7 +81630,8 @@ primitiveVMParameter(void) goto l88; break; case 3: - result = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + result = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); goto l88; break; case 6: @@ -82956,8 +82389,9 @@ pruneStackstackp(sqInt stack, sqInt stackp) for (i = 2; i < stackp; i += 2) { /* begin fetchPointer:ofObject: */ objOrFP = longAt((stack + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))); - if ((((((usqInt)(((char *) objOrFP)))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)(((char *) objOrFP)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) objOrFP)))) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)(((char *) objOrFP)))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)(((char *) objOrFP)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) objOrFP)))) <= (((usqInt)GIV(pages)))))))) { /* begin withSmallIntegerTags: */ assert(((oopForPointer(((char *) objOrFP))) & (BytesPerWord - 1)) == 0); objOrFP = (oopForPointer(((char *) objOrFP))) + (smallIntegerTag()); @@ -83165,17 +82599,6 @@ unmarkAfterPathTo(void) static char _m[] = ""; void* vm_exports[][3] = { - {(void*)_m, "activeProcess", (void*)activeProcess}, - {(void*)_m, "callbackEnter", (void*)callbackEnter}, - {(void*)_m, "callbackLeave", (void*)callbackLeave}, - {(void*)_m, "checkAllAccessibleObjectsOkay", (void*)checkAllAccessibleObjectsOkay}, - {(void*)_m, "checkOkayInterpreterObjects", (void*)checkOkayInterpreterObjects}, - {(void*)_m, "dumpPrimTraceLogOn", (void*)dumpPrimTraceLogOn}, - {(void*)_m, "inOrderPrintFreeTreeprintList", (void*)inOrderPrintFreeTreeprintList}, - {(void*)_m, "longPrintInstancesOf", (void*)longPrintInstancesOf}, - {(void*)_m, "longPrintInstancesWithClassIndex", (void*)longPrintInstancesWithClassIndex}, - {(void*)_m, "longPrintOop", (void*)longPrintOop}, - {(void*)_m, "longPrintReferencesTo", (void*)longPrintReferencesTo}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, {(void*)_m, "primitiveAddLargeIntegers\000\000\001", (void*)primitiveAddLargeIntegers}, {(void*)_m, "primitiveAllInstances\000\000\000", (void*)primitiveAllInstances}, @@ -83188,6 +82611,9 @@ void* vm_exports[][3] = { #endif /* VMBenchmarks */ #if VMBenchmarks {(void*)_m, "primitiveBenchmarkJITReceiver\000\000\000", (void*)primitiveBenchmarkJITReceiver}, +#endif /* VMBenchmarks */ +#if VMBenchmarks + {(void*)_m, "primitiveBenchmarkScavenge\000\377\000", (void*)primitiveBenchmarkScavenge}, #endif /* VMBenchmarks */ {(void*)_m, "primitiveBitAndLargeIntegers\000\000\001", (void*)primitiveBitAndLargeIntegers}, {(void*)_m, "primitiveBitOrLargeIntegers\000\000\001", (void*)primitiveBitOrLargeIntegers}, @@ -83253,72 +82679,5 @@ void* vm_exports[][3] = { #endif /* TestingPrimitives */ {(void*)_m, "primitiveUtcWithOffset\000\001\000", (void*)primitiveUtcWithOffset}, {(void*)_m, "primitiveVoidReceiver\000\377\000", (void*)primitiveVoidReceiver}, - {(void*)_m, "printActivationsOf", (void*)printActivationsOf}, - {(void*)_m, "printAllStacks", (void*)printAllStacks}, - {(void*)_m, "printAllStacksOn", (void*)printAllStacksOn}, - {(void*)_m, "printBogons", (void*)printBogons}, - {(void*)_m, "printCallStack", (void*)printCallStack}, - {(void*)_m, "printCallStackOf", (void*)printCallStackOf}, - {(void*)_m, "printCallStackOn", (void*)printCallStackOn}, - {(void*)_m, "printCogMethod", (void*)printCogMethod}, - {(void*)_m, "printContextReferencesTo", (void*)printContextReferencesTo}, - {(void*)_m, "printContext", (void*)printContext}, - {(void*)_m, "printEntity", (void*)printEntity}, - {(void*)_m, "printExternalHeadFrame", (void*)printExternalHeadFrame}, - {(void*)_m, "printForwarders", (void*)printForwarders}, - {(void*)_m, "printFramesInPage", (void*)printFramesInPage}, - {(void*)_m, "printFramesOnStackPageListInUse", (void*)printFramesOnStackPageListInUse}, - {(void*)_m, "printFrame", (void*)printFrame}, - {(void*)_m, "printFrameWithSP", (void*)printFrameWithSP}, - {(void*)_m, "printFreeChunk", (void*)printFreeChunk}, - {(void*)_m, "printFreeListHeads", (void*)printFreeListHeads}, - {(void*)_m, "printFreeList", (void*)printFreeList}, - {(void*)_m, "printFreeTree", (void*)printFreeTree}, - {(void*)_m, "printHeaderOf", (void*)printHeaderOf}, - {(void*)_m, "printInstancesOf", (void*)printInstancesOf}, - {(void*)_m, "printInstancesWithClassIndex", (void*)printInstancesWithClassIndex}, - {(void*)_m, "printLikelyImplementorsOfSelector", (void*)printLikelyImplementorsOfSelector}, -#if LLDB - {(void*)_m, "printMarkedOops", (void*)printMarkedOops}, -#endif /* LLDB */ - {(void*)_m, "printMethodCache", (void*)printMethodCache}, - {(void*)_m, "printMethodCacheFor", (void*)printMethodCacheFor}, - {(void*)_m, "printMethodDictionaryOf", (void*)printMethodDictionaryOf}, - {(void*)_m, "printMethodDictionary", (void*)printMethodDictionary}, - {(void*)_m, "printMethodImplementorsOf", (void*)printMethodImplementorsOf}, - {(void*)_m, "printMethodReferencesTo", (void*)printMethodReferencesTo}, - {(void*)_m, "printObjectsFromto", (void*)printObjectsFromto}, - {(void*)_m, "printObjectsWithHash", (void*)printObjectsWithHash}, - {(void*)_m, "printOopsExcept", (void*)printOopsExcept}, - {(void*)_m, "printOopsFromto", (void*)printOopsFromto}, - {(void*)_m, "printOopsSuchThat", (void*)printOopsSuchThat}, - {(void*)_m, "printOop", (void*)printOop}, - {(void*)_m, "printProcessStack", (void*)printProcessStack}, - {(void*)_m, "printProcsOnList", (void*)printProcsOnList}, - {(void*)_m, "printReferencesTo", (void*)printReferencesTo}, - {(void*)_m, "printStackCallStackOf", (void*)printStackCallStackOf}, - {(void*)_m, "printStackPageList", (void*)printStackPageList}, - {(void*)_m, "printStackPageListInUse", (void*)printStackPageListInUse}, - {(void*)_m, "printStackPages", (void*)printStackPages}, - {(void*)_m, "printStackPagesInUse", (void*)printStackPagesInUse}, - {(void*)_m, "printStackReferencesTo", (void*)printStackReferencesTo}, -#if LLDB - {(void*)_m, "printUnmarkedOops", (void*)printUnmarkedOops}, -#endif /* LLDB */ - {(void*)_m, "reestablishContextPriorToCallback", (void*)reestablishContextPriorToCallback}, - {(void*)_m, "reportMinimumUnusedHeadroom", (void*)reportMinimumUnusedHeadroom}, - {(void*)_m, "reportMinimumUnusedHeadroomOn", (void*)reportMinimumUnusedHeadroomOn}, - {(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext}, - {(void*)_m, "segmentContainingObj", (void*)segmentContainingObj}, - {(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext}, - {(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector}, - {(void*)_m, "setBreakSelector", (void*)setBreakSelector}, - {(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain}, - {(void*)_m, "shortPrintFramesInPage", (void*)shortPrintFramesInPage}, - {(void*)_m, "shortPrintFramesOnStackPageListInUse", (void*)shortPrintFramesOnStackPageListInUse}, - {(void*)_m, "shortPrintFrameAndNCallers", (void*)shortPrintFrameAndNCallers}, - {(void*)_m, "shortPrintObjectsFromto", (void*)shortPrintObjectsFromto}, - {(void*)_m, "statNumGCs", (void*)statNumGCs}, - {(void*)_m, "whereIs", (void*)whereIs}, {NULL, NULL, NULL} }; diff --git a/src/spur32.cog/cogit.h b/src/spur32.cog/cogit.h index c55e7a6792..92f95613cf 100644 --- a/src/spur32.cog/cogit.h +++ b/src/spur32.cog/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -26,6 +26,7 @@ extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMetho extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); +extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern CogMethod * cogFullBlockMethodnumCopied(sqInt aMethodObj, sqInt numCopied); extern void cogitPostGCAction(sqInt gcMode); diff --git a/src/spur32.cog/cogitARMv5.c b/src/spur32.cog/cogitARMv5.c index 56bcf5f363..20b62d2793 100644 --- a/src/spur32.cog/cogitARMv5.c +++ b/src/spur32.cog/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -9217,7 +9217,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur32.cog/cogitIA32.c b/src/spur32.cog/cogitIA32.c index 34cbb7b281..2d7b0bccb6 100644 --- a/src/spur32.cog/cogitIA32.c +++ b/src/spur32.cog/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -8858,7 +8858,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur32.sista/cogit.h b/src/spur32.sista/cogit.h index a55c7d3e91..8524a2d6bc 100644 --- a/src/spur32.sista/cogit.h +++ b/src/spur32.sista/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -26,6 +26,7 @@ extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMetho extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); +extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern CogMethod * cogFullBlockMethodnumCopied(sqInt aMethodObj, sqInt numCopied); extern void cogitPostGCAction(sqInt gcMode); diff --git a/src/spur32.sista/cogitARMv5.c b/src/spur32.sista/cogitARMv5.c index d8bc27fb53..5ed4d352a3 100644 --- a/src/spur32.sista/cogitARMv5.c +++ b/src/spur32.sista/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -9357,7 +9357,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur32.sista/cogitIA32.c b/src/spur32.sista/cogitIA32.c index c34308be71..c1a3e73a5e 100644 --- a/src/spur32.sista/cogitIA32.c +++ b/src/spur32.sista/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -8997,7 +8997,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur32.stack.newspeak/gcc3x-interp.c b/src/spur32.stack.newspeak/gcc3x-interp.c index 7d3f0a2f35..9709d929dc 100644 --- a/src/spur32.stack.newspeak/gcc3x-interp.c +++ b/src/spur32.stack.newspeak/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -160,7 +160,6 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define GCCheckShorten 64 #define GCModeBecome 8 #define GCModeFull 1 -#define GCModeIncremental 4 #define GCModeNewSpace 2 #define HashMultiplyConstant 1664525 #define HeaderIndex 0 @@ -253,6 +252,7 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define SelectorStart 2 #define SelectorUnknownBytecode 57 #define SenderIndex 0 +#define SistaV1BytecodeSet 0 #define SlidingCompactionInProgress 2 #define SmallContextSlots 22 #define SpecialSelectors 23 @@ -627,9 +627,7 @@ static sqInt hasSixtyFourBitImmediates(void); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); static sqInt NoDbgRegParms initFreeChunkWithBytesat(usqLong numBytes, sqInt address); static void NoDbgRegParms initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt integerObjectOf(sqInt value); extern sqInt integerValueOf(sqInt oop); static sqInt NoDbgRegParms isFloatInstance(sqInt oop); @@ -708,8 +706,6 @@ extern sqInt characterObjectOf(sqInt characterCode); extern void characterTable(void); extern usqInt characterValueOf(sqInt oop); extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); static sqInt checkHeapFreeSpaceIntegrity(void); static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt classIndicesShouldBeValid); extern sqInt checkOkayOop(usqInt oop); @@ -753,13 +749,13 @@ static void clearLeakMapAndMapAccessibleFreeSpace(void); static void clearLeakMapAndMapAccessibleObjects(void); static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning); extern sqInt cloneObject(sqInt objOop); -extern sqInt compactClassIndexOf(sqInt objOop); +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop); static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i); extern void countMarkedAndUnmarkdObjects(sqInt printFlags); static usqLong currentAllocatedBytes(void); extern sqInt displayObject(void); static void NoDbgRegParms doScavenge(sqInt tenuringCriterion); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); static void NoDbgRegParms emptyObjStack(sqInt objStack); static void NoDbgRegParms enableObjectEnumerationFrom(sqInt initialObject); @@ -791,7 +787,7 @@ static sqInt NoDbgRegParms fixedFieldsOfClass(sqInt objOop); static sqInt NoDbgRegParms fixedFieldsOfformatlength(sqInt objOop, sqInt fmt, sqInt wordLength); static sqInt NoDbgRegParms NeverInline fixFollowedFieldofObjectwithInitialValue(sqInt fieldIndex, sqInt anObject, sqInt initialValue); static sqInt NoDbgRegParms followFieldofObject(sqInt fieldIndex, sqInt anObject); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern sqInt followForwarded(sqInt objOop); static sqInt NoDbgRegParms followMaybeForwarded(sqInt objOop); static sqInt NoDbgRegParms followObjFieldofObject(sqInt fieldIndex, sqInt anObject); @@ -817,12 +813,11 @@ static usqInt imageSegmentVersion(void); extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ extern void incrementalGC(void); -extern sqInt indexOfin(sqInt anElement, sqInt anObject); static void NoDbgRegParms inFreeTreeReplacewith(sqInt treeNode, sqInt newNode); static sqInt NoDbgRegParms initialInstanceOf(sqInt classObj); static void NeverInline initializeNewSpaceVariables(void); static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift); -EXPORT(void) inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); +extern void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); static void NoDbgRegParms NeverInline inPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag); extern sqInt instanceSizeOf(sqInt classObj); static sqInt NoDbgRegParms instantiateClass(sqInt classObj); @@ -830,7 +825,6 @@ extern sqInt instSpecOfClassFormat(sqInt classFormat); static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer); static void NoDbgRegParms invalidCompactClassError(const char *className); static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isArray(sqInt oop); static sqInt NoDbgRegParms isBridgeOrEnumerableObjectNoAssert(sqInt objOop); extern sqInt isBytes(sqInt oop); @@ -868,7 +862,7 @@ static sqInt NoDbgRegParms isMaybeFiredEphemeron(sqInt objOop); extern sqInt isNonImmediate(sqInt oop); static sqInt NoDbgRegParms isObjEphemeron(sqInt objOop); static sqInt NoDbgRegParms isObjImmutable(sqInt anOop); -extern sqInt isOldObject(sqInt objOop); +static sqInt NoDbgRegParms isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); extern sqInt isOopImmutable(sqInt oop); @@ -877,11 +871,10 @@ extern sqInt isPinned(sqInt objOop); extern sqInt isPointers(sqInt oop); static sqInt NoDbgRegParms isPureBitsFormat(sqInt format); extern sqInt isReallyYoungObject(sqInt obj); -extern sqInt isReallyYoung(sqInt oop); static sqInt NoDbgRegParms isRemembered(sqInt objOop); static sqInt NoDbgRegParms isSegmentBridge(sqInt objOop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop); extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); static sqInt NoDbgRegParms isValidObjStackAt(sqInt objStackRootIndex); @@ -902,20 +895,18 @@ static sqInt NoDbgRegParms isonObjStack(sqInt oop, sqInt objStack); static sqInt NoDbgRegParms keyOfEphemeron(sqInt objOop); static sqInt NoDbgRegParms knownClassAtIndex(sqInt classIndex); static sqInt lastPointerFormat(void); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop); +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); static sqInt NoDbgRegParms lengthOfMaybeImmediate(sqInt oop); static sqInt NoDbgRegParms lengthOf(sqInt objOop); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); static sqInt NoDbgRegParms NeverInline loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray); -EXPORT(void) longPrintInstancesOf(sqInt aClassOop); -EXPORT(void) longPrintInstancesWithClassIndex(sqInt classIndex); -EXPORT(void) longPrintReferencesTo(sqInt anOop); +extern void longPrintInstancesOf(sqInt aClassOop); +extern void longPrintInstancesWithClassIndex(sqInt classIndex); +extern void longPrintReferencesTo(sqInt anOop); static void mapExtraRoots(void); static void NeverInline mapMournQueue(void); static sqInt NoDbgRegParms mapOopsFromtooutPointersoutHashes(sqInt segStart, sqInt segAddr, sqInt outPointerArray, sqInt savedOutHashes); @@ -927,7 +918,6 @@ static void NoDbgRegParms NeverInline markObjects(sqInt objectsShouldBeUnmarkedA static void markWeaklingsAndMarkAndFireEphemerons(void); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); static sqInt NoDbgRegParms methodHeaderOf(sqInt methodObj); extern sqInt minSlotsForShortening(void); static usqInt newObjectHash(void); @@ -945,12 +935,11 @@ static sqInt noUnscannedEphemerons(void); static sqInt NoDbgRegParms numBytesOfBitsformat(sqInt objOop, sqInt format); static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numSlotsForBytes(sqInt numBytes); static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); extern sqInt objectBefore(sqInt objOop); static sqInt NoDbgRegParms objectInPastSpaceBefore(sqInt objOop); @@ -965,45 +954,46 @@ static sqInt NoDbgRegParms popObjStack(sqInt objStack); extern sqInt popRemappableOop(void); static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags); extern sqInt primitiveErrorTable(void); -EXPORT(void) printActivationsOf(sqInt aMethodObj); -EXPORT(void) printBogons(void); +extern void printActivationsOf(sqInt aMethodObj); +extern void printBogons(void); +static void NoDbgRegParms printBridgeon(sqInt oop, FILE *aStream); static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printContextReferencesTo(sqInt anOop); -EXPORT(void) printEntity(sqInt oop); -EXPORT(void) printForwarders(void); +extern void printContextReferencesTo(sqInt anOop); +extern void printEntity(sqInt oop); +extern void printForwarders(void); static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream); extern void printFreeChunks(void); -EXPORT(void) printFreeChunk(sqInt freeChunk); +extern void printFreeChunk(sqInt freeChunk); static void NoDbgRegParms printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode); -EXPORT(void) printFreeListHeads(void); -EXPORT(sqInt) printFreeList(sqInt chunkOrIndex); +extern void printFreeListHeads(void); +extern sqInt printFreeList(sqInt chunkOrIndex); static void NoDbgRegParms printFreeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printFreeTree(void); +extern void printFreeTree(void); static void NoDbgRegParms printFreeTreeChunk(sqInt chunkOrZero); -EXPORT(void) printHeaderOf(sqInt objOop); +extern void printHeaderOf(sqInt objOop); static void NoDbgRegParms printImmediateObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printInstancesOf(sqInt aClassOop); -EXPORT(void) printInstancesWithClassIndex(sqInt classIndex); +extern void printInstancesOf(sqInt aClassOop); +extern void printInstancesWithClassIndex(sqInt classIndex); extern void printInvalidClassTableEntries(void); #if LLDB -EXPORT(void) printMarkedOops(void); +extern void printMarkedOops(void); #endif /* LLDB */ -EXPORT(void) printMethodImplementorsOf(sqInt anOop); -EXPORT(void) printMethodReferencesTo(sqInt anOop); +extern void printMethodImplementorsOf(sqInt anOop); +extern void printMethodReferencesTo(sqInt anOop); static void NoDbgRegParms printNonPointerDataOfon(sqInt oop, FILE *aStream); -EXPORT(void) printObjectsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) printObjectsWithHash(sqInt hash); +extern void printObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void printObjectsWithHash(sqInt hash); +extern void printObjStackAndContents(sqInt objStack); static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents); static void NoDbgRegParms printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType); extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); -EXPORT(void) NeverInline printOopsExcept(sqInt (*function)(sqInt)); -EXPORT(void) printOopsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); -EXPORT(void) printReferencesTo(sqInt anOop); +extern void NeverInline printOopsExcept(sqInt (*function)(sqInt)); +extern void printOopsFromto(sqInt startAddress, sqInt endAddress); +extern void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); +extern void printReferencesTo(sqInt anOop); static void NoDbgRegParms printStringDataOfon(sqInt oop, FILE *aStream); #if LLDB -EXPORT(void) printUnmarkedOops(void); +extern void printUnmarkedOops(void); #endif /* LLDB */ static sqInt NoDbgRegParms pushOnUnscannedEphemeronsStack(sqInt anEphemeron); extern void pushRemappableOop(sqInt oop); @@ -1020,14 +1010,14 @@ static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedObjsclassIndicesShould static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion); static sqInt NoDbgRegParms NeverInline setHeapBasememoryLimitendOfMemory(sqInt baseOfHeap, sqInt memLimit, sqInt memEnd); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); -EXPORT(void) shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); extern sqInt shouldRemapOop(sqInt oop); static sqInt NoDbgRegParms sizeOfObjStack(sqInt objStack); static sqInt slidingCompactionInProgress(void); extern sqInt slotSizeOf(sqInt oop); extern sqInt splObj(sqInt index); static usqInt NoDbgRegParms startOfObject(sqInt objOop); -EXPORT(sqInt) statNumGCs(void); +extern sqInt statNumGCs(void); extern usqInt storeCheckBoundary(void); static sqInt NoDbgRegParms storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointerArrayArg, sqInt arrayOfRootsArg); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); @@ -1091,7 +1081,7 @@ static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i); static void postSnapshot(void); static void NeverInline prepareForSnapshot(void); static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes); -EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop); +extern SpurSegmentInfo * segmentContainingObj(sqInt objOop); static sqInt segmentOverlap(void); static sqInt NoDbgRegParms shrinkObjectMemory(usqInt delta); static sqInt someSegmentContainsPinned(void); @@ -1101,7 +1091,7 @@ static sqInt NoDbgRegParms writeImageSegmentsToFile(sqImageFile aBinaryStream); static sqInt NoDbgRegParms writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSegment, sqImageFile aBinaryStream); static sqInt NoDbgRegParms accessModifierOfMethod(sqInt methodObj); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -EXPORT(sqInt) activeProcess(void); +extern sqInt activeProcess(void); extern void addIdleUsecs(sqInt idleUsecs); static void NoDbgRegParms addLastLinktoList(sqInt proc, sqInt aList); static void NoDbgRegParms addNewMethodToCache(sqInt classObj); @@ -1117,11 +1107,11 @@ extern void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); static void NoDbgRegParms assertValidExecutionPointersimbarline(usqInt lip, char *lfp, char *lsp, sqInt inInterpreter, sqInt ln); static void NoDbgRegParms backupContexttoBlockingSendTo(sqInt suspendedContext, sqInt conditionVariable); extern sqInt booleanValueOf(sqInt obj); -EXPORT(sqInt) callbackEnter(sqInt *callbackID); -EXPORT(sqInt) callbackLeave(sqInt cbID); +extern sqInt callbackEnter(sqInt *callbackID); +extern sqInt callbackLeave(sqInt cbID); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); extern sqInt characterForAscii(sqInt ascii); -EXPORT(sqInt) checkAllAccessibleObjectsOkay(void); +extern sqInt checkAllAccessibleObjectsOkay(void); static sqInt NoDbgRegParms checkCodeIntegrity(sqInt fullGCFlag); #if LRPCheck static sqInt NeverInline checkDeliveryOfLongRunningPrimitiveSignal(void); @@ -1132,7 +1122,7 @@ static sqInt NoDbgRegParms checkImageVersionFromstartingAt(sqImageFile f, squeak static sqInt checkInterpreterIntegrity(void); static sqInt NoDbgRegParms checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP); static sqInt NoDbgRegParms checkOkayFields(sqInt oop); -EXPORT(sqInt) checkOkayInterpreterObjects(sqInt writeBack); +extern sqInt checkOkayInterpreterObjects(sqInt writeBack); static sqInt NoDbgRegParms checkOkayStackPage(StackPage *thePage); static sqInt NoDbgRegParms checkOkayStackZone(sqInt writeBack); static void NoDbgRegParms checkProfileTick(sqInt aPrimitiveMethod); @@ -1142,8 +1132,7 @@ static sqInt NoDbgRegParms checkStackPointerIndexForFrame(char *theFP); static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className); static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext); static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern sqInt copyBits(void); extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y); static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop); @@ -1157,7 +1146,7 @@ static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); static void dummyReferToProxy(void); extern void dumpPrimTraceLog(void); -EXPORT(void) dumpPrimTraceLogOn(FILE *aStdioStream); +extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); @@ -1204,7 +1193,6 @@ static sqInt NoDbgRegParms frameReceiver(char *theFP); static sqInt NoDbgRegParms frameStackedReceiverOffset(char *theFP); static void freeUntracedStackPages(void); extern sqInt fullDisplayUpdate(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); static sqInt getCogVMFeatureFlags(void); extern sqInt getCurrentBytecode(void); static sqInt getDesiredCogCodeSize(void); @@ -1254,6 +1242,7 @@ static sqInt isPrimitiveFunctionPointerAnIndex(void); extern sqInt isQuickPrimitiveIndex(sqInt anInteger); extern sqInt isReadMediatedContextInstVarIndex(sqInt index); static sqInt NoDbgRegParms isSingleContext(sqInt aContext); +static sqInt NoDbgRegParms isVanillaBlockClosure(sqInt aClosure); static sqInt NoDbgRegParms isWidowedContextDuringGC(sqInt aOnceMarriedContext); static sqInt NoDbgRegParms isWidowedContextNoConvert(sqInt aOnceMarriedContext); static sqInt NoDbgRegParms isWidowedContext(sqInt aOnceMarriedContext); @@ -1265,7 +1254,7 @@ static sqInt NoDbgRegParms lengthOfNameOfClass(sqInt classOop); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt loadBitBltFrom(sqInt bb); extern void loadInitialContext(void); -EXPORT(void) longPrintOop(sqInt oop); +extern void longPrintOop(sqInt oop); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); static sqInt NoDbgRegParms lookupInMethodCacheSelclassTag(sqInt selector, sqInt classTag); static sqInt NoDbgRegParms lookupLexicalfromrule(sqInt selector, sqInt mixin, sqInt rule); @@ -1316,7 +1305,6 @@ static sqInt NoDbgRegParms objectequalsString(sqInt anOop, char *aCString); extern sqInt ownVM(sqInt threadIndexAndFlags); static sqInt NoDbgRegParms pcPreviousToinSqueakV3PlusClosuresMethod(sqInt theIP, sqInt aMethod); extern sqInt pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt pop(sqInt nItems); extern void popthenPush(sqInt nItems, sqInt oop); @@ -1334,45 +1322,44 @@ extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); static void NoDbgRegParms printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void NoDbgRegParms printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); -EXPORT(void) printAllStacks(void); -EXPORT(void) printAllStacksOn(FILE *aStdioStream); -EXPORT(void) printCallStack(void); +extern void printAllStacks(void); +extern void printAllStacksOn(FILE *aStdioStream); +extern void printCallStack(void); static sqInt NoDbgRegParms printCallStackFP(char *theFP); -EXPORT(sqInt) printCallStackOf(sqInt aContextOrProcessOrFrame); +extern sqInt printCallStackOf(sqInt aContextOrProcessOrFrame); static sqInt NoDbgRegParms printCallStackOfcurrentFP(sqInt aContext, char *currFP); -EXPORT(void) printCallStackOn(FILE *aStdioStream); +extern void printCallStackOn(FILE *aStdioStream); static sqInt NoDbgRegParms printContextCallStackOf(sqInt aContext); -EXPORT(void) printContext(sqInt aContext); -EXPORT(void) printExternalHeadFrame(void); +extern void printContext(sqInt aContext); +extern void printExternalHeadFrame(void); static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort); static void NoDbgRegParms printFrameFlagsForFP(char *theFP); static void NoDbgRegParms printFrameOopat(char *name, char *address); -EXPORT(void) printFramesInPage(StackPage *thePage); -EXPORT(void) printFramesOnStackPageListInUse(void); +extern void printFramesInPage(StackPage *thePage); +extern void printFramesOnStackPageListInUse(void); static void NoDbgRegParms printFrameThingandFrameat(char *name, char *theFP, char *address); static void NoDbgRegParms printFrameThingatextraString(char *name, char *address, char *extraStringOrNil); -EXPORT(sqInt) printFrame(char *theFP); -EXPORT(sqInt) printFrameWithSP(char *theFP, char *theSP); -extern sqInt printHexnp(usqInt n); +extern sqInt printFrame(char *theFP); +extern sqInt printFrameWithSP(char *theFP, char *theSP); static sqInt NoDbgRegParms printHexPtrnp(void *p); extern void printHex(usqInt n); -EXPORT(void) printLikelyImplementorsOfSelector(sqInt selector); -EXPORT(void) printMethodCache(void); -EXPORT(void) printMethodCacheFor(sqInt thing); -EXPORT(void) printMethodDictionaryOf(sqInt behavior); -EXPORT(void) printMethodDictionary(sqInt dictionary); +extern void printLikelyImplementorsOfSelector(sqInt selector); +extern void printMethodCache(void); +extern void printMethodCacheFor(sqInt thing); +extern void printMethodDictionaryOf(sqInt behavior); +extern void printMethodDictionary(sqInt dictionary); static void NoDbgRegParms printNameOfClasscount(sqInt classOop, sqInt cnt); static void NoDbgRegParms printOopShortInner(sqInt oop); -EXPORT(void) printOop(sqInt oop); -EXPORT(void) printProcessStack(sqInt aProcess); -EXPORT(sqInt) printProcsOnList(sqInt procList); -EXPORT(sqInt) printStackCallStackOf(sqInt aContextOrProcessOrFrame); -EXPORT(void) printStackPageList(void); -EXPORT(void) printStackPageListInUse(void); -EXPORT(void) printStackPages(void); -EXPORT(void) printStackPagesInUse(void); +extern void printOop(sqInt oop); +extern void printProcessStack(sqInt aProcess); +extern sqInt printProcsOnList(sqInt procList); +extern sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame); +extern void printStackPageList(void); +extern void printStackPageListInUse(void); +extern void printStackPages(void); +extern void printStackPagesInUse(void); static void NoDbgRegParms printStackPageuseCount(StackPage *page, sqInt n); -EXPORT(void) printStackReferencesTo(sqInt oop); +extern void printStackReferencesTo(sqInt oop); static void NoDbgRegParms printStringOf(sqInt oop); extern void print(char *s); extern void pushBool(sqInt trueOrFalse); @@ -1387,22 +1374,22 @@ static void NoDbgRegParms putWord32toFile(int aWord32, sqImageFile aFile); extern sqInt readableFormat(sqInt imageVersion); extern size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset); static void NoDbgRegParms NeverInline reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader); -EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext); +extern sqInt reestablishContextPriorToCallback(sqInt callbackContext); static sqInt NoDbgRegParms removeFirstLinkOfList(sqInt aList); static sqInt NoDbgRegParms removeProcessfromList(sqInt aProcess, sqInt aList); static sqInt NoDbgRegParms resumepreemptedYieldingIf(sqInt aProcess, sqInt yieldImplicitly); static sqInt retryPrimitiveOnFailure(void); -EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); +extern sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); static void NoDbgRegParms reverseDisplayFromto(sqInt startIndex, sqInt endIndex); static void NoDbgRegParms rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)()); static sqInt NoDbgRegParms roomToPushNArgs(sqInt n); static sqInt NoDbgRegParms safeMethodClassOf(sqInt methodPointer); static sqInt NoDbgRegParms saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex); -EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); -EXPORT(void) setBreakMNUSelector(char *aString); -EXPORT(void) setBreakSelector(char *aString); +extern sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); +extern void setBreakMNUSelector(char *aString); +extern void setBreakSelector(char *aString); extern void setFullScreenFlag(sqInt value); -EXPORT(void *) setInterruptCheckChain(void (*aFunction)()); +extern void * setInterruptCheckChain(void (*aFunction)()); extern void setInterruptKeycode(sqInt value); extern void setInterruptPending(sqInt value); extern void setNextWakeupUsecs(usqLong value); @@ -1411,10 +1398,10 @@ static void setSignalLowSpaceFlagAndSaveProcess(void); static void NoDbgRegParms setTraceFlagOnContextsFramesPageIfNeeded(sqInt aContext); static sqInt NoDbgRegParms shortPrintContext(sqInt aContext); static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP); -EXPORT(void) shortPrintFramesInPage(StackPage *thePage); -EXPORT(void) shortPrintFramesOnStackPageListInUse(void); +extern void shortPrintFramesInPage(StackPage *thePage); +extern void shortPrintFramesOnStackPageListInUse(void); static sqInt NoDbgRegParms shortPrintFrame(char *theFP); -EXPORT(void) shortPrintFrameAndNCallers(char *theFP, sqInt n); +extern void shortPrintFrameAndNCallers(char *theFP, sqInt n); static void NoDbgRegParms shortPrintOop(sqInt oop); static sqInt NoDbgRegParms shortReversePrintFrameAndCallers(char *aFramePointer); extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); @@ -1464,7 +1451,7 @@ static void NoDbgRegParms NeverInline voidLongRunningPrimitive(char *reason); #endif /* LRPCheck */ static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); static sqInt wakeHighestPriority(void); -EXPORT(char *) whereIs(sqInt anOop); +extern char * whereIs(sqInt anOop); static sqInt NeverInline writeImageFileIO(void); static usqInt NoDbgRegParms cloneContext(sqInt aContext); static sqInt NoDbgRegParms fieldOrSenderFPofContext(sqInt index, sqInt contextObj); @@ -1546,14 +1533,14 @@ _iss usqInt pastSpaceStart; _iss usqInt instructionPointer; _iss sqInt needGCFlag; _iss usqInt totalFreeOldSpace; -_iss SpurSegmentInfo * segments; _iss sqInt lkupClassTag; _iss sqInt trueObj; _iss sqInt falseObj; +_iss SpurSegmentInfo * segments; _iss sqInt hiddenRootsObj; -_iss sqInt numSegments; _iss StackPage * pages; _iss usqInt scavengeThreshold; +_iss sqInt numSegments; _iss sqInt * freeLists; _iss char * stackMemory; _iss sqInt markStack; @@ -1570,6 +1557,7 @@ _iss StackPage * mostRecentlyUsedPage; _iss sqInt lkupClass; _iss sqInt remapBufferCount; _iss usqInt newSpaceStart; +_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; _iss sqInt tempOop; _iss usqInt lastMobileObject; @@ -1586,7 +1574,6 @@ _iss sqInt becomeEffectsFlags; _iss sqInt growHeadroom; _iss sqInt tenureThreshold; _iss char * objStackInvalidBecause; -_iss sqInt sweepIndex; _iss sqInt ephemeronList; _iss sqInt imageHeaderFlags; #if LRPCheck @@ -1597,7 +1584,6 @@ _iss sqInt longRunningPrimitiveCheckSemaphore; #endif _iss sqInt profileSemaphore; _iss sqInt tenureCriterion; -_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classNameIndex; _iss usqInt freeOldSpaceStart; _iss sqInt extraRootCount; @@ -1685,7 +1671,6 @@ _iss sqIntptr_t nsMethodCache[NSMethodCacheSize + 1 /* 4097 */]; _iss sqInt atCache[AtCacheTotalSize + 1 /* 65 */]; _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 65 */]; -_iss sqInt preferredPinningSegment; _iss sqInt statCoalesces; _iss sqLong nextProfileTick; _iss usqLong nextWakeupUsecs; @@ -2405,7 +2390,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] StackInterpreterPrimitives_VMMaker.oscog-eem.3310"; +const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] StackInterpreterPrimitives_VMMaker.oscog-eem.3329"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -17594,6 +17579,7 @@ primitiveClosureValue(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -17712,6 +17698,7 @@ primitiveClosureValueNoContextSwitch(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -17862,6 +17849,7 @@ primitiveClosureValueWithArgs(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -26437,10 +26425,8 @@ primitiveStoreImageSegment(void) && (((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) == (firstLongFormat())))))) { /* Must be indexable words */ - /* begin primitiveFail */ - if (!GIV(primFailCode)) { - GIV(primFailCode) = 1; - } + /* begin primitiveFailFor: */ + GIV(primFailCode) = PrimErrBadArgument; return; } ecode = storeImageSegmentIntooutPointersroots(segmentWordArray, outPointerArray, arrayOfRoots); @@ -27154,7 +27140,8 @@ primitiveStringReplace(void) replFmt = replFmt & -4; l10: /* end classFormatFromInstFormat: */; if (!((arrayFmt == replFmt) - && (arrayFmt < (firstCompiledMethodFormat())))) { + && ((arrayFmt >= (sixtyFourBitIndexableFormat())) + && (arrayFmt < (firstCompiledMethodFormat()))))) { /* begin primitiveFailFor: */ GIV(primFailCode) = PrimErrInappropriate; goto l17; @@ -29198,116 +29185,6 @@ initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur32BitMemoryManager>>#inOldSpaceInstantiatePinnedClass:indexableSize: */ -sqInt -inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt fillValue; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt numSlots; - usqInt p; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - fillValue = 0; - switch (instSpec) { - case 2 /* arrayFormat */: - numSlots = nElements; - fillValue = GIV(nilObj); - break; - case indexablePointersFormat(): - case weakArrayFormat(): - numSlots = (classFormat & ((1U << (fixedFieldsFieldWidth())) - 1)) + nElements; - fillValue = GIV(nilObj); - break; - case sixtyFourBitIndexableFormat(): - if (nElements > ((0x1FFFFFFF) / 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - numSlots = nElements * 2; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = nElements; - break; - case firstShortFormat(): - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstByteFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - default: - - /* non-indexable */ - /* Some Squeak images include funky fixed subclasses of abstract variable - superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection. - The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via - this method. - Hence allow fixed classes to be instantiated here iff nElements = 0. */ - if ((nElements != 0) - || (instSpec > 5 /* lastPointerFormat */)) { - return null; - } - numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); - fillValue = GIV(nilObj); - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > (0x1FFFFFFF)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsForPinningInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : ((numSlots + (numSlots & 1)) << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - if (!(newObj == null)) { - /* begin fillObj:numSlots:with: */ - assert(oopisLessThan(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1, addressAfter(newObj))); - for (p = (((usqInt)(newObj + BaseHeaderSize))); p <= (((usqInt)(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { - longAtput(p, fillValue); - longAtput(p + 4, fillValue); - } - } - return newObj; -} - - /* Allocate an instance of a variable class, excepting CompiledMethod. */ /* Spur32BitMemoryManager>>#instantiateClass:indexableSize: */ @@ -29460,131 +29337,6 @@ instantiateClassindexableSize(sqInt classObj, usqInt nElements) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur32BitMemoryManager>>#instantiateUninitializedClass:indexableSize: */ -sqInt -instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt newObj1; - usqInt numBytes; - usqInt numSlots; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - assert(isPureBitsFormat(instSpec)); - switch (instSpec) { - case sixtyFourBitIndexableFormat(): - if (nElements > ((0x1FFFFFFF) / 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - numSlots = nElements * 2; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = nElements; - break; - case firstShortFormat(): - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstByteFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - default: - - /* not bits indexable */ - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > ((1U << (fixedFieldsFieldWidth())) - 1)) { - if (numSlots > (0x1FFFFFFF)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : ((numSlots + (numSlots & 1)) << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - } - else { - /* begin allocateSlots:format:classIndex: */ - if (numSlots >= (numSlotsMask())) { - newObj1 = GIV(freeStart) + BaseHeaderSize; - numBytes = (BaseHeaderSize + BaseHeaderSize) + ((numSlots + (numSlots & 1)) * BytesPerOop); - } - else { - newObj1 = GIV(freeStart); - numBytes = BaseHeaderSize + ((numSlots <= 1 - ? /* begin allocationUnit */ 8 - : (numSlots + (numSlots & 1)) * BytesPerOop)); - } - if ((GIV(freeStart) + numBytes) > GIV(scavengeThreshold)) { - if (!GIV(needGCFlag)) { - /* begin scheduleScavenge */ - GIV(needGCFlag) = 1; - forceInterruptCheck(); - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, instSpec, classIndex); - goto l8; - } - if (numSlots >= (numSlotsMask())) { - - /* for header parsing we put a saturated slot count in the prepended overflow size word */ - flag("endianness"); - longAtput(GIV(freeStart), numSlots); - longAtput(GIV(freeStart) + 4, ((sqInt)((usqInt)((numSlotsMask())) << (numSlotsHalfShift())))); - long64Atput(newObj1, headerForSlotsformatclassIndex(numSlotsMask(), instSpec, classIndex)); - } - else { - long64Atput(newObj1, (((((usqLong) numSlots)) << (numSlotsFullShift())) + (((sqInt)((usqInt)(instSpec) << (formatShift()))))) + classIndex); - } - assert((numBytes % (allocationUnit())) == 0); - assert((newObj1 % (allocationUnit())) == 0); - GIV(freeStart) += numBytes; - newObj = newObj1; - l8: /* end allocateSlots:format:classIndex: */; - } - return newObj; -} - - /* Convert the integer value, assumed to be in SmallInteger range, into a tagged SmallInteger object. In C, use a shift and an add to set the tag bit. @@ -30027,8 +29779,8 @@ allWeakSurvivorsOnWeakList(void) writes code that stresses the remembered table. One might conclude that if the remembered table is full, then the right thing - to do is simply to tenure everything, emptying the remembered table. Bt in - some circumstances this + to do is simply to tenure everything, emptying the remembered table. But + in some circumstances this can be counter-productive, and result in the same situation arising soon after tenuring everything. Instead, we can try and selectively prune the remembered table, tenuring @@ -30420,6 +30172,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj3 == null)) { + assert(isPinned(obj3)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1, addressAfter(obj3))); for (p2 = (((usqInt)(obj3 + BaseHeaderSize))); p2 <= (((usqInt)(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1))); p2 += 8 /* allocationUnit */) { @@ -30437,6 +30190,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj2 == null)) { + assert(isPinned(obj2)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1, addressAfter(obj2))); for (p1 = (((usqInt)(obj2 + BaseHeaderSize))); p1 <= (((usqInt)(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1))); p1 += 8 /* allocationUnit */) { @@ -30457,6 +30211,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -30654,6 +30409,7 @@ openScavengeLog(void) /* Print the objects in the remembered set. */ +/* useful for debugging */ /* SpurGenerationScavenger>>#printRememberedSet */ void @@ -32937,6 +32693,7 @@ allocatePinnedSlots(sqInt nSlots) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj == null)) { + assert(isPinned(obj)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj))); for (p = (((usqInt)(obj + BaseHeaderSize))); p <= (((usqInt)(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -33905,30 +33662,6 @@ checkedLongAt(sqInt byteAddress) return longAt(byteAddress); } - /* SpurMemoryManager>>#checkFreeSpace: */ -void -checkFreeSpace(sqInt gcModes) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, null); - } -} - - /* SpurMemoryManager>>#checkFreeSpace:ignoring: */ -void -checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, anOopToIgnore); - } -} - /* Perform an integrity/leak check using the heapMap. Assume clearLeakMapAndMapAccessibleFreeSpace has set a bit at each free chunk's @@ -34891,6 +34624,7 @@ checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt cla /* Verify that the given oop is legitimate. Check address, header, and size but not class. Answer true if OK. Otherwise print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOkayOop: */ sqInt @@ -34985,6 +34719,7 @@ checkOkayOop(usqInt oop) or more fields. Finally, the instance specification field of the behavior must match that of the instance. If OK answer true. If not, print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOopHasOkayClass: */ sqInt @@ -35841,7 +35576,7 @@ cloneObject(sqInt objOop) } /* SpurMemoryManager>>#compactClassIndexOf: */ -sqInt +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop) { /* begin classIndexOf: */ @@ -35988,6 +35723,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS /* print the count of marked and unmarked objects. In addition if 1 is set in printFlags, short-print marked objects, and/or if 2 is set, short-print unmarked obejcts. */ +/* useful for debugging */ /* SpurMemoryManager>>#countMarkedAndUnmarkdObjects: */ void @@ -36085,7 +35821,8 @@ currentAllocatedBytes(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt use; - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); return (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); } @@ -36112,7 +35849,8 @@ doScavenge(sqInt tenuringCriterion) usqInt use; /* begin doAllocationAccountingForScavenge */ - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); GIV(statAllocatedBytes) = (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); GIV(gcPhaseInProgress) = ScavengeInProgress; /* begin scavenge: */ @@ -36163,7 +35901,8 @@ doScavenge(sqInt tenuringCriterion) GIV(freeStart) = ((eden()).start); GIV(gcPhaseInProgress) = 0; /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); } @@ -36177,7 +35916,7 @@ doScavenge(sqInt tenuringCriterion) was possible. */ /* SpurMemoryManager>>#doShorten:toIndexableSize: */ -sqInt +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt bytesBefore; @@ -36990,6 +36729,7 @@ findLargestFreeChunk(void) /* Print the oops of all string-like things that start with the same characters as aCString */ +/* useful for debugging */ /* SpurMemoryManager>>#findStringBeginningWith: */ void @@ -37377,7 +37117,7 @@ followFieldofObject(sqInt fieldIndex, sqInt anObject) need since depth is always finite. */ /* SpurMemoryManager>>#followForwardedObjectFields:toDepth: */ -sqInt +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -37791,7 +37531,6 @@ fullGC(void) runLeakCheckerForexcludeUnmarkedObjsclassIndicesShouldBeValid(GCModeFull, 1, 1); compactionStartUsecs = ioUTCMicrosecondsNow(); /* begin prepareForGlobalSweep */ - GIV(sweepIndex) = 0; for (i = 0; i < GIV(numSegments); i += 1) { ((GIV(segments)[i]).containsPinned = 0); } @@ -37804,9 +37543,11 @@ fullGC(void) GIV(statShrinkMemory) += 1; } /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); assert(validObjStacks()); assert(isEmptyObjStack(GIV(markStack))); assert(isEmptyObjStack(GIV(weaklingStack))); @@ -37865,12 +37606,10 @@ growOldSpaceByAtLeast(sqInt minAmmount) sqInt ammount; sqInt bytes; sqInt headroom; - sqInt i; sqInt interval; SpurSegmentInfo *segInfo; sqInt start; usqInt total; - usqInt total1; /* statGrowMemory counts attempts, not successes. */ @@ -37887,13 +37626,8 @@ growOldSpaceByAtLeast(sqInt minAmmount) /* Now apply the maxOldSpaceSize limit, if one is in effect. */ ammount = ((ammount < GIV(growHeadroom)) ? GIV(growHeadroom) : ammount); if (maxOldSpaceSize > 0) { - /* begin totalBytesInSegments */ - total1 = 0; - for (i = 0; i < GIV(numSegments); i += 1) { - total1 += ((GIV(segments)[i]).segSize); - } - assert(GIV(totalHeapSizeIncludingBridges) == total1); - total = total1; + assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)); + total = GIV(totalHeapSizeIncludingBridges); if (total >= maxOldSpaceSize) { GIV(needGCFlag) = 1; return null; @@ -38062,73 +37796,6 @@ incrementalGC(void) error("shouldNotImplement"); } - /* SpurMemoryManager>>#indexOf:in: */ -sqInt -indexOfin(sqInt anElement, sqInt anObject) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt fmt; - sqInt fmt1; - sqInt i; - usqInt numSlots; - usqInt numSlots1; - - /* begin formatOf: */ - fmt = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - if (fmt <= 5 /* lastPointerFormat */) { - /* begin numSlotsOf: */ - assert((classIndexOf(anObject)) > (isForwardedObjectClassIndexPun())); - numSlots1 = byteAt(anObject + 7); - numSlots = (numSlots1 == (numSlotsMask()) - ? longAt(anObject - BaseHeaderSize) - : numSlots1); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (longAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) { - return i; - } - } - } - if (fmt >= (firstByteFormat())) { - if (fmt >= (firstCompiledMethodFormat())) { - /* begin primitiveFailFor: */ - return (GIV(primFailCode) = PrimErrUnsupported); - } - /* begin numBytesOfBytes: */ - fmt1 = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - assert(fmt1 >= (firstByteFormat())); - numSlots = ((numSlotsOf(anObject)) << (shiftForWord())) - (fmt1 & 7); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (byteAt((anObject + BaseHeaderSize) + i))) { - return i; - } - } - } - if (fmt >= (firstShortFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 1; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (((unsigned short) (shortAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 1)))))))) { - return i; - } - } - } - if (fmt == (sixtyFourBitIndexableFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 3; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long64At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 3)))))) { - return i; - } - } - } - if (fmt >= (firstLongFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 2; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long32At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 2)))))) { - return i; - } - } - } - return -1; -} - /* Part of reorderReversedTreeList:. Switch treeNode with newNode in the tree, but do nothing to the list linked through freeChunkNextIndex. */ @@ -38590,6 +38257,7 @@ initializeObjectMemory(sqInt bytesToShift) /* begin allocatePinnedSlots: */ obj1 = allocateSlotsForPinningInOldSpacebytesformatclassIndex(0x400, (((int)((usqInt)((0x400 + (0x400 & 1))) << (shiftForWord())))) + (BaseHeaderSize + BaseHeaderSize), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -38606,7 +38274,7 @@ initializeObjectMemory(sqInt bytesToShift) else { /* The Spur32to64BitBootstrap failed to set the type of rememberedSetObj to 64-bit indexability. - This is unimportant except for simulation; rememberedSet is declared as sqInt *, but in to have + This is unimportant except for simulation; rememberedSet is declared as sqInt *, but to have firstIndexableField: below answer a suitable type the format must be wordIndexableFormat. */ /* begin setFormatOf:to: */ format = firstLongFormat(); @@ -38637,9 +38305,11 @@ initializeObjectMemory(sqInt bytesToShift) /* free space before shrinking */ GIV(shrinkThreshold) = 0x2000000; /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* By default GC after scavenge if heap has grown by a third since the last GC */ GIV(heapGrowthToSizeGCRatio) = 0.333333; @@ -38647,12 +38317,10 @@ initializeObjectMemory(sqInt bytesToShift) /* print free chunks in freeTree in order. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#inOrderPrintFreeTree:printList: */ -EXPORT(void) +void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList) { sqInt next; @@ -38905,18 +38573,6 @@ isAnyPointerFormat(sqInt format) } -/* Answer if this is an indexable object with pointer elements, e.g., an - array - */ - - /* SpurMemoryManager>>#isArrayNonImm: */ -sqInt -isArrayNonImm(sqInt oop) -{ - return ((((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask())) == 2 /* arrayFormat */; -} - - /* Answer true if this is an indexable object with pointer elements, e.g., an array */ @@ -39339,7 +38995,7 @@ isObjImmutable(sqInt anOop) /* Answer if obj is old. Require that obj is non-immediate. */ /* SpurMemoryManager>>#isOldObject: */ -sqInt +static sqInt NoDbgRegParms isOldObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(isNonImmediate(objOop)); @@ -39424,18 +39080,6 @@ isReallyYoungObject(sqInt obj) oopisLessThan(obj, GIV(oldSpaceStart))); } - -/* Answer if oop is young. */ - - /* SpurMemoryManager>>#isReallyYoung: */ -sqInt -isReallyYoung(sqInt oop) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return ((!(oop & (tagMask())))) - && ((assert(isNonImmediate(oop)), - oopisLessThan(oop, GIV(oldSpaceStart)))); -} - /* SpurMemoryManager>>#isRemembered: */ static sqInt NoDbgRegParms isRemembered(sqInt objOop) @@ -39468,10 +39112,10 @@ isShorts(sqInt oop) /* This version is private to SpurMemoryManager (for asserts, etc). It does - not take advantage of the power-of0two optimization in isForwarded:. */ + not take advantage of the power-of-two optimization in isForwarded:. */ /* SpurMemoryManager>>#isUnambiguouslyForwarder: */ -sqInt +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop) { return ((longAt(objOop)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()); @@ -39862,7 +39506,7 @@ lastPointerFormat(void) pointer, and the image contains no forwarders (see class comment). */ /* SpurMemoryManager>>#lastPointerOfWhileSwizzling: */ -sqInt +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop) { sqInt fmt; @@ -39890,7 +39534,7 @@ lastPointerOfWhileSwizzling(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#lastPointerOf: */ -sqInt +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop) { sqInt contextSize; @@ -39930,13 +39574,6 @@ lastPointerOf(sqInt objOop) ((header >> 1)) & AlternateHeaderNumLiteralsMask)) + LiteralStart) - 1) * BytesPerOop) + BaseHeaderSize; } - /* SpurMemoryManager>>#leakCheckBecome */ -sqInt -leakCheckBecome(void) -{ - return ((checkForLeaks & GCModeBecome) != 0); -} - /* SpurMemoryManager>>#leakCheckFullGC */ sqInt leakCheckFullGC(void) @@ -39944,13 +39581,6 @@ leakCheckFullGC(void) return ((checkForLeaks & GCModeFull) != 0); } - /* SpurMemoryManager>>#leakCheckIncremental */ -sqInt -leakCheckIncremental(void) -{ - return ((checkForLeaks & GCModeIncremental) != 0); -} - /* SpurMemoryManager>>#leakCheckNewSpaceGC */ sqInt leakCheckNewSpaceGC(void) @@ -40543,12 +40173,10 @@ loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesOf: */ -EXPORT(void) +void longPrintInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -40563,12 +40191,10 @@ longPrintInstancesOf(sqInt aClassOop) /* Scan the heap printing any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesWithClassIndex: */ -EXPORT(void) +void longPrintInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -40676,12 +40302,10 @@ longPrintInstancesWithClassIndex(sqInt classIndex) /* Scan the heap long printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintReferencesTo: */ -EXPORT(void) +void longPrintReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -42089,21 +41713,6 @@ maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format) } -/* Answer one of the objects in the SpecialObjectsArray, if in range, - otherwise answer nil. - */ - - /* SpurMemoryManager>>#maybeSplObj: */ -sqInt -maybeSplObj(sqInt index) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return (index < (numSlotsOf(GIV(specialObjectsOop))) - ? (/* begin fetchPointer:ofObject: */ - longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) - : 0); -} - - /* Answer the method header of a CompiledMethod object. */ /* SpurMemoryManager>>#methodHeaderOf: */ @@ -42525,7 +42134,7 @@ numBytesOf(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#numPointerSlotsOf: */ -usqInt +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop) { sqInt contextSize; @@ -42689,24 +42298,6 @@ numStrongSlotsOfInephemeral(sqInt objOop) } -/* Answer the number of strong pointer fields in the given weakling. */ - - /* SpurMemoryManager>>#numStrongSlotsOfWeakling: */ -sqInt -numStrongSlotsOfWeakling(sqInt objOop) -{ - sqInt classFormat; - sqInt objOop1; - - assert((formatOf(objOop)) == (weakArrayFormat())); - /* begin fixedFieldsOfClass: */ - objOop1 = fetchClassOfNonImm(objOop); - /* begin fixedFieldsOfClassFormat: */ - classFormat = ((longAt((objOop1 + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - return classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); -} - - /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -42778,6 +42369,9 @@ objectAfter(sqInt objOop) : followingWordAddress3); } + +/* useful for debugging */ + /* SpurMemoryManager>>#objectBefore: */ sqInt objectBefore(sqInt objOop) @@ -43349,6 +42943,7 @@ okayOop(sqInt signedOop) } +/* useful for debugging */ /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -43531,7 +43126,6 @@ pinObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt format; - sqInt i; sqInt oldClone; sqInt referent; SpurSegmentInfo *seg; @@ -43546,15 +43140,7 @@ pinObject(sqInt objOop) longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); return objOop; } - /* begin segmentContainingObj: */ - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - seg = (&(GIV(segments)[i])); - goto l1; - } - } - seg = null; - l1: /* end segmentContainingObj: */; + seg = segmentContainingObj(objOop); if ((seg->containsPinned)) { /* begin setIsPinnedOf:to: */ longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); @@ -43795,12 +43381,10 @@ primitiveErrorTable(void) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printActivationsOf: */ -EXPORT(void) +void printActivationsOf(sqInt aMethodObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -43868,12 +43452,10 @@ printActivationsOf(sqInt aMethodObj) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printBogons */ -EXPORT(void) +void printBogons(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT /* begin printTheBogons: */ @@ -43890,16 +43472,34 @@ printBogons(void) cr(); } + /* SpurMemoryManager>>#printBridge:on: */ +static void NoDbgRegParms +printBridgeon(sqInt oop, FILE *aStream) +{ + fprintf(aStream, + "%p is a bridge hdr%d slot size %ul\n", + ((void *)oop), + ((byteAt(oop + 7)) == (numSlotsMask()) + ? 16 + : 8), + numSlotsOfAny(oop)); +} + /* SpurMemoryManager>>#printCantBeObject:on: */ static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (((oop & (7)) == 0) - && (((oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) - && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))))) { - printForwarderon(oop, aStream); - return; + if ((oop & (7)) == 0) { + if (((oopisLessThan(oop, GIV(oldSpaceStart))) + && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) + && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { + printForwarderon(oop, aStream); + return; + } + if (oop == (bridgeAt((numSegments()) - 1))) { + printBridgeon(oop, aStream); + return; + } } fprintf(aStream, "%p%s\n", @@ -43913,12 +43513,10 @@ printCantBeObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printContextReferencesTo: */ -EXPORT(void) +void printContextReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -43998,12 +43596,10 @@ printContextReferencesTo(sqInt anOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printEntity: */ -EXPORT(void) +void printEntity(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -44137,12 +43733,10 @@ printEntity(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printForwarders */ -EXPORT(void) +void printForwarders(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -44251,7 +43845,7 @@ static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream) { fprintf(aStream, - "%p is a forwarded hdr%d slot size %ud object to %p\n", + "%p is a forwarded hdr%d slot size %ul object to %p\n", ((void *)oop), ((byteAt(oop + 7)) == (numSlotsMask()) ? 16 @@ -44264,6 +43858,7 @@ printForwarderon(sqInt oop, FILE *aStream) /* This version goes through memory, printing all free chunks. Other versions go through the free lists. This one will show all free chunks even if the free lists are corrupt. */ +/* useful for debugging */ /* SpurMemoryManager>>#printFreeChunks */ void @@ -44379,12 +43974,10 @@ printFreeChunks(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeChunk: */ -EXPORT(void) +void printFreeChunk(sqInt freeChunk) { printFreeChunkprintAsTreeNode(freeChunk, 1); @@ -44471,12 +44064,10 @@ printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeListHeads */ -EXPORT(void) +void printFreeListHeads(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt expectedMask; @@ -44512,12 +44103,10 @@ printFreeListHeads(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeList: */ -EXPORT(sqInt) +sqInt printFreeList(sqInt chunkOrIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fieldIndex; @@ -44550,12 +44139,10 @@ printFreeObjecton(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeTree */ -EXPORT(void) +void printFreeTree(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFreeTreeChunk(GIV(freeLists)[0]); @@ -44579,13 +44166,11 @@ printFreeTreeChunk(sqInt chunkOrZero) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* N.B. No safety bounds checks!! We need to look e.g. at corpses. */ /* SpurMemoryManager>>#printHeaderOf: */ -EXPORT(void) +void printHeaderOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -44698,12 +44283,10 @@ printImmediateObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesOf: */ -EXPORT(void) +void printInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -44718,12 +44301,10 @@ printInstancesOf(sqInt aClassOop) /* Scan the heap printing the oops of any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesWithClassIndex: */ -EXPORT(void) +void printInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -44829,6 +44410,7 @@ printInstancesWithClassIndex(sqInt classIndex) /* Print the objects in the classTable that have bad hashes. */ +/* useful for debugging */ /* SpurMemoryManager>>#printInvalidClassTableEntries */ void @@ -44878,13 +44460,11 @@ printInvalidClassTableEntries(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMarkedOops */ #if LLDB -EXPORT(void) +void printMarkedOops(void) { printOopsSuchThat(isMarked); @@ -44895,12 +44475,10 @@ printMarkedOops(void) /* Scan the heap printing the oops of any and all methods that implement anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodImplementorsOf: */ -EXPORT(void) +void printMethodImplementorsOf(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -44966,12 +44544,10 @@ printMethodImplementorsOf(sqInt anOop) /* Scan the heap printing the oops of any and all methods that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodReferencesTo: */ -EXPORT(void) +void printMethodReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -45157,12 +44733,10 @@ printNonPointerDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsFrom:to: */ -EXPORT(void) +void printObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -45186,12 +44760,10 @@ printObjectsFromto(sqInt startAddress, sqInt endAddress) /* Scan the heap printing the oops of any and all objects whose hash equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsWithHash: */ -EXPORT(void) +void printObjectsWithHash(sqInt hash) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45293,6 +44865,21 @@ printObjectsWithHash(sqInt hash) l4: /* end allNewSpaceEntitiesDo: */; } + /* SpurMemoryManager>>#printObjStackAndContents: */ +void +printObjStackAndContents(sqInt objStack) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + /* begin printObjStack:printContents: */ + if (objStack == GIV(nilObj)) { + /* begin print: */ + fprintf(GIV(transcript), "nil"); + cr(); + } + else { + printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((int)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, 1); + } +} + /* SpurMemoryManager>>#printObjStackPage:myIndex:pageType:printContents: */ static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents) @@ -45455,6 +45042,9 @@ printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType) cr(); } + +/* useful for debugging */ + /* SpurMemoryManager>>#printObjStack: */ void printObjStack(sqInt objStack) @@ -45470,27 +45060,11 @@ printObjStack(sqInt objStack) } } - /* SpurMemoryManager>>#printObjStack:printContents: */ -void -printObjStackprintContents(sqInt objStack, sqInt printContents) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - if (objStack == GIV(nilObj)) { - /* begin print: */ - fprintf(GIV(transcript), "nil"); - cr(); - } - else { - printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((int)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, printContents); - } -} - -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsExcept: */ -EXPORT(void) NeverInline +void NeverInline printOopsExcept(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45608,12 +45182,10 @@ printOopsExcept(sqInt (*function)(sqInt)) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsFrom:to: */ -EXPORT(void) +void printOopsFromto(sqInt startAddress, sqInt endAddress) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstNonEntity; @@ -45666,12 +45238,10 @@ printOopsFromto(sqInt startAddress, sqInt endAddress) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsSuchThat: */ -EXPORT(void) NeverInline +void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45790,12 +45360,10 @@ printOopsSuchThat(sqInt (*function)(sqInt)) /* Scan the heap printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printReferencesTo: */ -EXPORT(void) +void printReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -46031,13 +45599,11 @@ printStringDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printUnmarkedOops */ #if LLDB -EXPORT(void) +void printUnmarkedOops(void) { printOopsExcept(isMarked); @@ -46639,12 +46205,10 @@ shortentoIndexableSize(sqInt objOop, sqInt indexableSize) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#shortPrintObjectsFrom:to: */ -EXPORT(void) +void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -46782,7 +46346,7 @@ startOfObject(sqInt objOop) /* Part of InterpreterProxy's 1.14 API */ /* SpurMemoryManager>>#statNumGCs */ -EXPORT(sqInt) +sqInt statNumGCs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT return (GIV(statScavenges) + GIV(statIncrGCs)) + GIV(statFullGCs); @@ -46824,13 +46388,21 @@ storeCheckBoundary(void) The primitive can fail for the following reasons with the specified failure codes: - PrimErrGenericError: the segmentWordArray is too small for the version - stamp PrimErrWritePastObject: the segmentWordArray is too small to contain - the reachable objects - PrimErrBadIndex: the outPointerArray is too small - PrimErrNoMemory: additional allocations failed + PrimErrGenericFailure: the segmentWordArray is too small for the version + stamp PrimErrWritePastObject: the segmentWordArray is too small to + contain the reachable objects + PrimErrBadIndex: the outPointerArray is too small + PrimErrNoMemory: there is insufficient free space to store the array + answered by objectsReachableFromRoots:, + or the savedFirstFields and savedOutHashes arrays. + PrimErrNeedCompaction: a GC is needed to make room for the array answered + by objectsReachableFromRoots: PrimErrLimitExceeded: there is no room in the hash field to store out - pointer indices or class references. */ + pointer indices or class references, + or the outPointerArray is larger than the max value of the hash field. + PrimErrNoModification: the segmentWordArrayArg or outPointerArrayArg are + immutable PrimErrObjectIsPinned: the segmentWordArrayArg or + outPointerArrayArg are pinned */ /* SpurMemoryManager>>#storeImageSegmentInto:outPointers:roots: */ static sqInt NoDbgRegParms @@ -47085,6 +46657,7 @@ storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt val /* Note must check here for stores of young objects into old ones. */ +/* See SistaCogit */ /* SpurMemoryManager>>#storePointer:ofObject:withValue: */ sqInt @@ -47179,7 +46752,8 @@ sufficientSpaceAfterGC(sqInt numBytes) assert(numBytes == 0); scavengingGCTenuringIf(TenureByAge); - heapSizePostGC = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + heapSizePostGC = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); if (((((double) (heapSizePostGC - GIV(heapSizeAtPreviousGC)) )) / GIV(heapSizeAtPreviousGC)) >= GIV(heapGrowthToSizeGCRatio)) { fullGC(); } @@ -47790,6 +47364,9 @@ validClassTableRootPages(void) return 1; } + +/* useful for debugging */ + /* SpurMemoryManager>>#validFreeTree */ sqInt validFreeTree(void) @@ -48196,6 +47773,7 @@ copyAndUnmarkMobileObjects(void) usqInt previousPin; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt start; usqInt startOfPreviousPin; usqInt toFinger; @@ -48273,19 +47851,16 @@ copyAndUnmarkMobileObjects(void) assert((isMarked(previousPin)) && (isPinned(previousPin))); /* begin unmarkPinned: */ - if (!(((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(previousPin)); + } + else { setIsMarkedOfto(previousPin, 0); /* begin notePinned: */ assert(isPinned(previousPin)); - if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(previousPin, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), previousPin)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(previousPin)))); + seg = segmentContainingObj(previousPin); + (seg->containsPinned = 1); } toFinger = addressAfter(previousPin); /* begin objectStartingAt: */ @@ -48526,6 +48101,7 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) usqInt numSlots; sqInt obj; usqInt objStart; + SpurSegmentInfo *seg; usqInt toFinger; toFinger = initialToFinger; @@ -48548,19 +48124,16 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) if ((((((usqInt)((longAt(obj + 4)))) >> (markedBitHalfShift())) & 1) != 0) && (((((usqInt)((longAt(obj)))) >> (pinnedBitShift())) & 1) != 0)) { /* begin unmarkPinned: */ - if (!(((longAt(obj)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(obj)); + } + else { setIsMarkedOfto(obj, 0); /* begin notePinned: */ assert(isPinned(obj)); - if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(obj, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), obj)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(obj)))); + seg = segmentContainingObj(obj); + (seg->containsPinned = 1); } if (toFinger < objStart) { /* begin addFreeChunkWithBytes:at: */ @@ -48971,6 +48544,7 @@ unmarkObjectsFromFirstFreeObject(void) sqInt objOop; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt startOfFree; startOfFree = 0; @@ -48993,19 +48567,16 @@ unmarkObjectsFromFirstFreeObject(void) } if (((((usqInt)((longAt(objOop)))) >> (pinnedBitShift())) & 1) != 0) { /* begin unmarkPinned: */ - if (!(((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(objOop)); + } + else { setIsMarkedOfto(objOop, 0); /* begin notePinned: */ assert(isPinned(objOop)); - if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(objOop, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), objOop)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(objOop)))); + seg = segmentContainingObj(objOop); + (seg->containsPinned = 1); } } else { @@ -50029,9 +49600,11 @@ collapseSegmentsPostSwizzle(void) GIV(canSwizzle) = 0; GIV(numSegments) = 1; + /* begin computeTotalHeapSizeIncludingBridges */ + GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()); cascade0 = (&(GIV(segments)[0])); (cascade0->segStart = oldSpaceStart()); - (cascade0->segSize = (GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()))); + (cascade0->segSize = GIV(totalHeapSizeIncludingBridges)); assert(isSegmentBridge(bridgeAt(0))); assert((numSlotsOfAny(bridgeAt(0))) == 0); } @@ -50213,7 +49786,6 @@ prepareForSnapshot(void) usqInt followingWordAddress; usqInt freeChunk; sqInt i; - sqInt i1; sqInt largeChild; sqInt limit; sqInt newEndOfMemory; @@ -50261,24 +49833,16 @@ prepareForSnapshot(void) followingWordAddress = addressAfter(node); if (oopisGreaterThanOrEqualTo(followingWordAddress, limit)) { next = limit; - goto l9; + goto l7; } flag("endianness"); followingWord = longAt(followingWordAddress + 4); next = ((((usqInt)(followingWord)) >> (numSlotsHalfShift())) == (numSlotsMask()) ? followingWordAddress + BaseHeaderSize : followingWordAddress); - l9: /* end objectAfter:limit: */; + l7: /* end objectAfter:limit: */; if (((longAt(next)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin segmentContainingObj: */ - for (i1 = (GIV(numSegments) - 1); i1 >= 0; i1 += -1) { - if (node >= (((GIV(segments)[i1]).segStart))) { - seg = (&(GIV(segments)[i1])); - goto l8; - } - } - seg = null; - l8: /* end segmentContainingObj: */; + seg = segmentContainingObj(node); (seg->lastFreeObject = node); node = 0; } @@ -50393,17 +49957,51 @@ readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes) return totalBytesRead; } + +/* Answer the segment containing an object. This is mostly for assert + checking, but + variations on the incremental GC may use it in anger. Binary search is (of + course) marginally slower than linear search for a single segment (e.g. in + a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every + old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or + 20% faster + in the same heap extended with enough large arrays to require 11 segments; + and this + is pessimal; there are fewer objects at high addresses since the large + arrays are there). */ + /* SpurSegmentManager>>#segmentContainingObj: */ -EXPORT(SpurSegmentInfo *) +SpurSegmentInfo * segmentContainingObj(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; + sqInt high; + sqInt low; + sqInt mid; + SpurSegmentInfo *seg; - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - return (&(GIV(segments)[i])); + low = 0; + mid = GIV(numSegments) / 2; + high = GIV(numSegments) - 1; + do { + seg = (&(GIV(segments)[mid])); + if (oopisGreaterThanOrEqualTo(objOop, (seg->segStart))) { + if (mid == high) { + return (oopisLessThan(objOop, ((seg->segSize)) + ((seg->segStart))) + ? seg + : 0); + } + else { + low = mid; + mid = ((mid + high) + 1) / 2; + } } - } + else { + high = mid - 1; + mid = (low + mid) / 2; + } + } while(low <= high); return null; } @@ -50580,6 +50178,9 @@ swizzleObj(sqInt objOop) return objOop + (((GIV(segments)[0]).swizzle)); } + +/* This ``slow'' count is for asserts only. */ + /* SpurSegmentManager>>#totalBytesInSegments */ static usqInt totalBytesInSegments(void) @@ -50591,7 +50192,6 @@ totalBytesInSegments(void) for (i = 0; i < GIV(numSegments); i += 1) { total += ((GIV(segments)[i]).segSize); } - assert(GIV(totalHeapSizeIncludingBridges) == total); return total; } @@ -50700,12 +50300,10 @@ accessorDepthForPrimitiveMethod(sqInt aMethodObj) /* Answer the current activeProcess. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#activeProcess */ -EXPORT(sqInt) +sqInt activeProcess(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt objOop; @@ -51207,7 +50805,7 @@ booleanValueOf(sqInt obj) /* Re-enter the interpreter to execute a (non-Alien) callback. */ /* StackInterpreter>>#callbackEnter: */ -EXPORT(sqInt) +sqInt callbackEnter(sqInt *callbackID) { warning("callbackEnter: is obsolete"); @@ -51218,7 +50816,7 @@ callbackEnter(sqInt *callbackID) /* Leave from a previous callback */ /* StackInterpreter>>#callbackLeave: */ -EXPORT(sqInt) +sqInt callbackLeave(sqInt cbID) { warning("callbackLeave: is obsolete"); @@ -51272,12 +50870,10 @@ characterForAscii(sqInt ascii) /* Ensure that all accessible objects in the heap are okay. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkAllAccessibleObjectsOkay */ -EXPORT(sqInt) +sqInt checkAllAccessibleObjectsOkay(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -51779,12 +51375,10 @@ checkOkayFields(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkOkayInterpreterObjects: */ -EXPORT(sqInt) +sqInt checkOkayInterpreterObjects(sqInt writeBack) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -52207,19 +51801,10 @@ contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP) /* StackInterpreter>>#copiedValueCountOfClosure: */ sqInt -copiedValueCountOfClosure(sqInt closurePointer) -{ - return (numSlotsOf(closurePointer)) - ClosureFirstCopiedValueIndex; -} - - -/* for Cogit */ - - /* StackInterpreter>>#copiedValueCountOfFullClosure: */ -sqInt -copiedValueCountOfFullClosure(sqInt closurePointer) +copiedValueCountOfClosure(sqInt closureObj) { - return (numSlotsOf(closurePointer)) - FullClosureFirstCopiedValueIndex; + return (assert(isVanillaBlockClosure(closureObj)), + (numSlotsOf(closureObj)) - ClosureFirstCopiedValueIndex); } @@ -52749,7 +52334,7 @@ dumpPrimTraceLog(void) */ /* StackInterpreter>>#dumpPrimTraceLogOn: */ -EXPORT(void) +void dumpPrimTraceLogOn(FILE *aStdioStream) { } @@ -54579,19 +54164,6 @@ fullDisplayUpdate(void) } -/* Find an actual function pointer for this primitiveIndex. This is an - opportunity to specialise the prim for the relevant class (format for - example). Default for now is simply the entry in the base primitiveTable. */ - - /* StackInterpreter>>#functionPointerFor:inClass: */ -void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) -{ - return (primIdx > MaxPrimitiveIndex - ? 0 - : primitiveTable[primIdx]); -} - - /* Answer an array of flags indicating various optional features of the Cog VM. If the bit is set then... Bit 0: supports two bytecode sets (MULTIPLEBYTECODESETS) @@ -55634,6 +55206,21 @@ isSingleContext(sqInt aContext) } +/* Answer if aClosure is a vanilla BlockClosure as in the first Cog release, + BlockClosure laid out as + 'outerContext, startpc, numArgs. FullBlockClosure is laid out as + outerContext, method, numArgs, receiver. + So either answer true if we're not supporting FullBlockClosure, or test + the startpc/method field. */ + + /* StackInterpreter>>#isVanillaBlockClosure: */ +static sqInt NoDbgRegParms +isVanillaBlockClosure(sqInt aClosure) +{ + return 1; +} + + /* See if the argument is married to a live frame or not. i.e. see if there is a matching frame whose frameContext field is aOnceMarriedContext, or a forwarder to @@ -56050,12 +55637,10 @@ loadInitialContext(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#longPrintOop: */ -EXPORT(void) +void longPrintOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -59065,19 +58650,6 @@ pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod return pcPreviousToinSqueakV3PlusClosuresMethod(theIP, aMethod); } - /* StackInterpreter>>#penultimateLiteralOf: */ -sqInt -penultimateLiteralOf(sqInt aMethodOop) -{ - sqInt offset; - - assert(isOopCompiledMethod(aMethodOop)); - /* begin literal:ofMethod: */ - offset = (literalCountOf(aMethodOop)) - 2; - /* begin fetchPointer:ofObject: */ - return longAt((aMethodOop + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); -} - /* In the StackInterpreter stacks grow down. */ @@ -59938,12 +59510,10 @@ printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObjec /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacks */ -EXPORT(void) +void printAllStacks(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -60142,12 +59712,10 @@ printAllStacks(void) /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacksOn: */ -EXPORT(void) +void printAllStacksOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -60162,12 +59730,10 @@ printAllStacksOn(FILE *aStdioStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStack */ -EXPORT(void) +void printCallStack(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (GIV(framePointer) == null) { @@ -60201,12 +59767,10 @@ printCallStackFP(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOf: */ -EXPORT(sqInt) +sqInt printCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -60298,12 +59862,10 @@ printCallStackOfcurrentFP(sqInt aContext, char *currFP) /* Print the call stack on a specific output stream. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOn: */ -EXPORT(void) +void printCallStackOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -60337,12 +59899,10 @@ printContextCallStackOf(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printContext: */ -EXPORT(void) +void printContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -60462,12 +60022,10 @@ printContext(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printExternalHeadFrame */ -EXPORT(void) +void printExternalHeadFrame(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFrameWithSP(GIV(framePointer), GIV(stackPointer)); @@ -60548,19 +60106,20 @@ printFrameOopat(char *name, char *address) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFramesInPage: */ -EXPORT(void) +void printFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 0); } + +/* useful for VM debugging */ + /* StackInterpreter>>#printFramesOnStackPageListInUse */ -EXPORT(void) +void printFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -60633,12 +60192,10 @@ printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame: */ -EXPORT(sqInt) +sqInt printFrame(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *aFrame; @@ -60722,12 +60279,10 @@ printFrame(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame:WithSP: */ -EXPORT(sqInt) +sqInt printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -60781,18 +60336,6 @@ printFrameWithSP(char *theFP, char *theSP) } -/* Print n in hex, in the form '0x1234', unpadded */ - - /* StackInterpreter>>#printHexnp: */ -sqInt -printHexnp(usqInt n) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return fprintf(GIV(transcript), - "%p", - ((void *)n)); -} - - /* Print p in hex, unpadded, in the form 0x1234 (C)/16r1234 (here) */ /* StackInterpreter>>#printHexPtrnp: */ @@ -60824,12 +60367,10 @@ printHex(usqInt n) /* Print all methods whose penultimate literal is either selector, or an object whose first inst var is the method and whose second is selector (e.g. an AdditionalMethodState). */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printLikelyImplementorsOfSelector: */ -EXPORT(void) +void printLikelyImplementorsOfSelector(sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -60907,12 +60448,10 @@ printLikelyImplementorsOfSelector(sqInt selector) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCache */ -EXPORT(void) +void printMethodCache(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -61002,12 +60541,10 @@ printMethodCache(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCacheFor: */ -EXPORT(void) +void printMethodCacheFor(sqInt thing) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -61101,12 +60638,10 @@ printMethodCacheFor(sqInt thing) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionaryOf: */ -EXPORT(void) +void printMethodDictionaryOf(sqInt behavior) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt dictionary; @@ -61149,12 +60684,10 @@ printMethodDictionaryOf(sqInt behavior) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionary: */ -EXPORT(void) +void printMethodDictionary(sqInt dictionary) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt index; @@ -61437,10 +60970,10 @@ printOopShortInner(sqInt oop) } -/* use export: not api, so it won't be written to cointerp.h */ +/* useful for VM debugging */ /* StackInterpreter>>#printOop: */ -EXPORT(void) +void printOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -61622,12 +61155,10 @@ printOop(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcessStack: */ -EXPORT(void) +void printProcessStack(sqInt aProcess) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ctx; @@ -61666,12 +61197,10 @@ printProcessStack(sqInt aProcess) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcsOnList: */ -EXPORT(sqInt) +sqInt printProcsOnList(sqInt procList) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstProc; @@ -61697,12 +61226,10 @@ printProcsOnList(sqInt procList) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackCallStackOf: */ -EXPORT(sqInt) +sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -61735,12 +61262,10 @@ printStackCallStackOf(sqInt aContextOrProcessOrFrame) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageList */ -EXPORT(void) +void printStackPageList(void) { StackPage *page; @@ -61754,12 +61279,10 @@ printStackPageList(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageListInUse */ -EXPORT(void) +void printStackPageListInUse(void) { sqInt n; @@ -61776,12 +61299,10 @@ printStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPages */ -EXPORT(void) +void printStackPages(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -61796,12 +61317,10 @@ printStackPages(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPagesInUse */ -EXPORT(void) +void printStackPagesInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -61927,12 +61446,10 @@ printStackPageuseCount(StackPage *page, sqInt n) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackReferencesTo: */ -EXPORT(void) +void printStackReferencesTo(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *callerFP; @@ -62310,7 +61827,7 @@ putWord32toFile(int aWord32, sqImageFile aFile) } -/* Anwer true if images of the given format are readable by this interpreter. +/* Anwer if images of the given format are readable by this interpreter. Allows a virtual machine to accept selected older image formats. */ /* StackInterpreter>>#readableFormat: */ @@ -62761,7 +62278,7 @@ reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader) and mark calloutContext as dead. */ /* StackInterpreter>>#reestablishContextPriorToCallback: */ -EXPORT(sqInt) +sqInt reestablishContextPriorToCallback(sqInt callbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; @@ -63293,7 +62810,7 @@ retryPrimitiveOnFailure(void) and mark callbackMethodContext as dead. */ /* StackInterpreter>>#returnAs:ThroughCallback:Context: */ -EXPORT(sqInt) +sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutMethodContext; @@ -63624,7 +63141,7 @@ saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex) arguments on primitive return. */ /* StackInterpreter>>#sendInvokeCallbackContext: */ -EXPORT(sqInt) +sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classTag; @@ -63769,12 +63286,10 @@ GIV(bytecodeSetSelector) = ((((int) methodHeader)) < 0 } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakMNUSelector: */ -EXPORT(void) +void setBreakMNUSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -63788,12 +63303,10 @@ setBreakMNUSelector(char *aString) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakSelector: */ -EXPORT(void) +void setBreakSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -63814,7 +63327,7 @@ setFullScreenFlag(sqInt value) } /* StackInterpreter>>#setInterruptCheckChain: */ -EXPORT(void *) +void * setInterruptCheckChain(void (*aFunction)()) { void (*prevFunction)(); @@ -63936,6 +63449,7 @@ static sqInt NoDbgRegParms shortPrintContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt home; + sqInt rcvr; sqInt senderOop; char *theFP; @@ -63973,15 +63487,16 @@ shortPrintContext(sqInt aContext) if (home == null) { /* begin print: */ fprintf(GIV(transcript), " BOGUS CONTEXT (can't determine home)"); + cr(); } else { - printActivationNameForreceiverisBlockfirstTemporary(fetchPointerofObject(MethodIndex, (!(home) - ? aContext - : home)), (home == null - ? /* begin nilObject */ GIV(nilObj) - : (longAt((home + BaseHeaderSize) + (((int)((usqInt)(ReceiverIndex) << (shiftForWord()))))))), home != aContext, longAt((home + BaseHeaderSize) + (((int)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin fetchPointer:ofObject: */ + rcvr = longAt((home + BaseHeaderSize) + (((int)((usqInt)(ReceiverIndex) << (shiftForWord()))))); + printActivationNameForreceiverisBlockfirstTemporary(longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))), rcvr, home != aContext, longAt((home + BaseHeaderSize) + (((int)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin space */ + printChar(' '); + shortPrintOop(rcvr); } - cr(); return 0; } @@ -64001,19 +63516,20 @@ shortPrintFrameAndCallers(char *theFP) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFramesInPage: */ -EXPORT(void) +void shortPrintFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 1); } + +/* useful for VM debugging */ + /* StackInterpreter>>#shortPrintFramesOnStackPageListInUse */ -EXPORT(void) +void shortPrintFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -64060,12 +63576,10 @@ shortPrintFrame(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFrame:AndNCallers: */ -EXPORT(void) +void shortPrintFrameAndNCallers(char *theFP, sqInt n) { DECL_MAYBE_SQ_GLOBAL_STRUCT if ((n != 0) @@ -66538,12 +66052,10 @@ wakeHighestPriority(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#whereIs: */ -EXPORT(char *) +char * whereIs(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *where; @@ -71491,7 +71003,8 @@ primitiveUnloadModule(void) 48 various header flags. See getImageHeaderFlags. 49 max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing) - 50 max literal count for JIT compile (stored in image file header; Cog + + 50 max literal count for JIT compile (stored in image file header; Cog only; otherwise nil) 51 nil; reserved for VM parameters that persist in the image (such as eden above) 52 root/remembered table capacity @@ -71631,7 +71144,8 @@ primitiveVMParameter(void) /* begin primitiveAllVMParameters: */ result1 = instantiateClassindexableSize(splObj(ClassArray), paramsArraySize); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer8 = positiveMachineIntegerFor(totalBytesInSegments()); + valuePointer8 = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (0U << (shiftForWord())), valuePointer8); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -71639,7 +71153,8 @@ primitiveVMParameter(void) assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (1U << (shiftForWord())), valuePointer9); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (2U << (shiftForWord())), valuePointer10); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -71975,7 +71490,8 @@ primitiveVMParameter(void) /* begin primitiveGetVMParameter: */ switch (index) { case 1: - result = positiveMachineIntegerFor(totalBytesInSegments()); + result = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); goto l93; break; case 2: @@ -71983,7 +71499,8 @@ primitiveVMParameter(void) goto l93; break; case 3: - result = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + result = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); goto l93; break; case 6: @@ -72936,17 +72453,6 @@ unmarkAllFrames(void) static char _m[] = ""; void* vm_exports[][3] = { - {(void*)_m, "activeProcess", (void*)activeProcess}, - {(void*)_m, "callbackEnter", (void*)callbackEnter}, - {(void*)_m, "callbackLeave", (void*)callbackLeave}, - {(void*)_m, "checkAllAccessibleObjectsOkay", (void*)checkAllAccessibleObjectsOkay}, - {(void*)_m, "checkOkayInterpreterObjects", (void*)checkOkayInterpreterObjects}, - {(void*)_m, "dumpPrimTraceLogOn", (void*)dumpPrimTraceLogOn}, - {(void*)_m, "inOrderPrintFreeTreeprintList", (void*)inOrderPrintFreeTreeprintList}, - {(void*)_m, "longPrintInstancesOf", (void*)longPrintInstancesOf}, - {(void*)_m, "longPrintInstancesWithClassIndex", (void*)longPrintInstancesWithClassIndex}, - {(void*)_m, "longPrintOop", (void*)longPrintOop}, - {(void*)_m, "longPrintReferencesTo", (void*)longPrintReferencesTo}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, {(void*)_m, "primitiveAddLargeIntegers\000\000\001", (void*)primitiveAddLargeIntegers}, {(void*)_m, "primitiveAllInstances\000\000\000", (void*)primitiveAllInstances}, @@ -73010,69 +72516,5 @@ void* vm_exports[][3] = { #endif /* TestingPrimitives */ {(void*)_m, "primitiveUtcWithOffset\000\001\000", (void*)primitiveUtcWithOffset}, {(void*)_m, "primitiveVoidReceiver\000\377\000", (void*)primitiveVoidReceiver}, - {(void*)_m, "printActivationsOf", (void*)printActivationsOf}, - {(void*)_m, "printAllStacks", (void*)printAllStacks}, - {(void*)_m, "printAllStacksOn", (void*)printAllStacksOn}, - {(void*)_m, "printBogons", (void*)printBogons}, - {(void*)_m, "printCallStack", (void*)printCallStack}, - {(void*)_m, "printCallStackOf", (void*)printCallStackOf}, - {(void*)_m, "printCallStackOn", (void*)printCallStackOn}, - {(void*)_m, "printContextReferencesTo", (void*)printContextReferencesTo}, - {(void*)_m, "printContext", (void*)printContext}, - {(void*)_m, "printEntity", (void*)printEntity}, - {(void*)_m, "printExternalHeadFrame", (void*)printExternalHeadFrame}, - {(void*)_m, "printForwarders", (void*)printForwarders}, - {(void*)_m, "printFramesInPage", (void*)printFramesInPage}, - {(void*)_m, "printFramesOnStackPageListInUse", (void*)printFramesOnStackPageListInUse}, - {(void*)_m, "printFrame", (void*)printFrame}, - {(void*)_m, "printFrameWithSP", (void*)printFrameWithSP}, - {(void*)_m, "printFreeChunk", (void*)printFreeChunk}, - {(void*)_m, "printFreeListHeads", (void*)printFreeListHeads}, - {(void*)_m, "printFreeList", (void*)printFreeList}, - {(void*)_m, "printFreeTree", (void*)printFreeTree}, - {(void*)_m, "printHeaderOf", (void*)printHeaderOf}, - {(void*)_m, "printInstancesOf", (void*)printInstancesOf}, - {(void*)_m, "printInstancesWithClassIndex", (void*)printInstancesWithClassIndex}, - {(void*)_m, "printLikelyImplementorsOfSelector", (void*)printLikelyImplementorsOfSelector}, -#if LLDB - {(void*)_m, "printMarkedOops", (void*)printMarkedOops}, -#endif /* LLDB */ - {(void*)_m, "printMethodCache", (void*)printMethodCache}, - {(void*)_m, "printMethodCacheFor", (void*)printMethodCacheFor}, - {(void*)_m, "printMethodDictionaryOf", (void*)printMethodDictionaryOf}, - {(void*)_m, "printMethodDictionary", (void*)printMethodDictionary}, - {(void*)_m, "printMethodImplementorsOf", (void*)printMethodImplementorsOf}, - {(void*)_m, "printMethodReferencesTo", (void*)printMethodReferencesTo}, - {(void*)_m, "printObjectsFromto", (void*)printObjectsFromto}, - {(void*)_m, "printObjectsWithHash", (void*)printObjectsWithHash}, - {(void*)_m, "printOopsExcept", (void*)printOopsExcept}, - {(void*)_m, "printOopsFromto", (void*)printOopsFromto}, - {(void*)_m, "printOopsSuchThat", (void*)printOopsSuchThat}, - {(void*)_m, "printOop", (void*)printOop}, - {(void*)_m, "printProcessStack", (void*)printProcessStack}, - {(void*)_m, "printProcsOnList", (void*)printProcsOnList}, - {(void*)_m, "printReferencesTo", (void*)printReferencesTo}, - {(void*)_m, "printStackCallStackOf", (void*)printStackCallStackOf}, - {(void*)_m, "printStackPageList", (void*)printStackPageList}, - {(void*)_m, "printStackPageListInUse", (void*)printStackPageListInUse}, - {(void*)_m, "printStackPages", (void*)printStackPages}, - {(void*)_m, "printStackPagesInUse", (void*)printStackPagesInUse}, - {(void*)_m, "printStackReferencesTo", (void*)printStackReferencesTo}, -#if LLDB - {(void*)_m, "printUnmarkedOops", (void*)printUnmarkedOops}, -#endif /* LLDB */ - {(void*)_m, "reestablishContextPriorToCallback", (void*)reestablishContextPriorToCallback}, - {(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext}, - {(void*)_m, "segmentContainingObj", (void*)segmentContainingObj}, - {(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext}, - {(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector}, - {(void*)_m, "setBreakSelector", (void*)setBreakSelector}, - {(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain}, - {(void*)_m, "shortPrintFramesInPage", (void*)shortPrintFramesInPage}, - {(void*)_m, "shortPrintFramesOnStackPageListInUse", (void*)shortPrintFramesOnStackPageListInUse}, - {(void*)_m, "shortPrintFrameAndNCallers", (void*)shortPrintFrameAndNCallers}, - {(void*)_m, "shortPrintObjectsFromto", (void*)shortPrintObjectsFromto}, - {(void*)_m, "statNumGCs", (void*)statNumGCs}, - {(void*)_m, "whereIs", (void*)whereIs}, {NULL, NULL, NULL} }; diff --git a/src/spur32.stack.newspeak/interp.c b/src/spur32.stack.newspeak/interp.c index c4c2ae2497..7ddad894a7 100644 --- a/src/spur32.stack.newspeak/interp.c +++ b/src/spur32.stack.newspeak/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -157,7 +157,6 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define GCCheckShorten 64 #define GCModeBecome 8 #define GCModeFull 1 -#define GCModeIncremental 4 #define GCModeNewSpace 2 #define HashMultiplyConstant 1664525 #define HeaderIndex 0 @@ -250,6 +249,7 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define SelectorStart 2 #define SelectorUnknownBytecode 57 #define SenderIndex 0 +#define SistaV1BytecodeSet 0 #define SlidingCompactionInProgress 2 #define SmallContextSlots 22 #define SpecialSelectors 23 @@ -624,9 +624,7 @@ static sqInt hasSixtyFourBitImmediates(void); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); static sqInt NoDbgRegParms initFreeChunkWithBytesat(usqLong numBytes, sqInt address); static void NoDbgRegParms initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt integerObjectOf(sqInt value); extern sqInt integerValueOf(sqInt oop); static sqInt NoDbgRegParms isFloatInstance(sqInt oop); @@ -705,8 +703,6 @@ extern sqInt characterObjectOf(sqInt characterCode); extern void characterTable(void); extern usqInt characterValueOf(sqInt oop); extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); static sqInt checkHeapFreeSpaceIntegrity(void); static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt classIndicesShouldBeValid); extern sqInt checkOkayOop(usqInt oop); @@ -750,13 +746,13 @@ static void clearLeakMapAndMapAccessibleFreeSpace(void); static void clearLeakMapAndMapAccessibleObjects(void); static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning); extern sqInt cloneObject(sqInt objOop); -extern sqInt compactClassIndexOf(sqInt objOop); +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop); static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i); extern void countMarkedAndUnmarkdObjects(sqInt printFlags); static usqLong currentAllocatedBytes(void); extern sqInt displayObject(void); static void NoDbgRegParms doScavenge(sqInt tenuringCriterion); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); static void NoDbgRegParms emptyObjStack(sqInt objStack); static void NoDbgRegParms enableObjectEnumerationFrom(sqInt initialObject); @@ -788,7 +784,7 @@ static sqInt NoDbgRegParms fixedFieldsOfClass(sqInt objOop); static sqInt NoDbgRegParms fixedFieldsOfformatlength(sqInt objOop, sqInt fmt, sqInt wordLength); static sqInt NoDbgRegParms NeverInline fixFollowedFieldofObjectwithInitialValue(sqInt fieldIndex, sqInt anObject, sqInt initialValue); static sqInt NoDbgRegParms followFieldofObject(sqInt fieldIndex, sqInt anObject); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern sqInt followForwarded(sqInt objOop); static sqInt NoDbgRegParms followMaybeForwarded(sqInt objOop); static sqInt NoDbgRegParms followObjFieldofObject(sqInt fieldIndex, sqInt anObject); @@ -814,12 +810,11 @@ static usqInt imageSegmentVersion(void); extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ extern void incrementalGC(void); -extern sqInt indexOfin(sqInt anElement, sqInt anObject); static void NoDbgRegParms inFreeTreeReplacewith(sqInt treeNode, sqInt newNode); static sqInt NoDbgRegParms initialInstanceOf(sqInt classObj); static void NeverInline initializeNewSpaceVariables(void); static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift); -EXPORT(void) inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); +extern void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); static void NoDbgRegParms NeverInline inPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag); extern sqInt instanceSizeOf(sqInt classObj); static sqInt NoDbgRegParms instantiateClass(sqInt classObj); @@ -827,7 +822,6 @@ extern sqInt instSpecOfClassFormat(sqInt classFormat); static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer); static void NoDbgRegParms invalidCompactClassError(const char *className); static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isArray(sqInt oop); static sqInt NoDbgRegParms isBridgeOrEnumerableObjectNoAssert(sqInt objOop); extern sqInt isBytes(sqInt oop); @@ -865,7 +859,7 @@ static sqInt NoDbgRegParms isMaybeFiredEphemeron(sqInt objOop); extern sqInt isNonImmediate(sqInt oop); static sqInt NoDbgRegParms isObjEphemeron(sqInt objOop); static sqInt NoDbgRegParms isObjImmutable(sqInt anOop); -extern sqInt isOldObject(sqInt objOop); +static sqInt NoDbgRegParms isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); extern sqInt isOopImmutable(sqInt oop); @@ -874,11 +868,10 @@ extern sqInt isPinned(sqInt objOop); extern sqInt isPointers(sqInt oop); static sqInt NoDbgRegParms isPureBitsFormat(sqInt format); extern sqInt isReallyYoungObject(sqInt obj); -extern sqInt isReallyYoung(sqInt oop); static sqInt NoDbgRegParms isRemembered(sqInt objOop); static sqInt NoDbgRegParms isSegmentBridge(sqInt objOop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop); extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); static sqInt NoDbgRegParms isValidObjStackAt(sqInt objStackRootIndex); @@ -899,20 +892,18 @@ static sqInt NoDbgRegParms isonObjStack(sqInt oop, sqInt objStack); static sqInt NoDbgRegParms keyOfEphemeron(sqInt objOop); static sqInt NoDbgRegParms knownClassAtIndex(sqInt classIndex); static sqInt lastPointerFormat(void); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop); +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); static sqInt NoDbgRegParms lengthOfMaybeImmediate(sqInt oop); static sqInt NoDbgRegParms lengthOf(sqInt objOop); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); static sqInt NoDbgRegParms NeverInline loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray); -EXPORT(void) longPrintInstancesOf(sqInt aClassOop); -EXPORT(void) longPrintInstancesWithClassIndex(sqInt classIndex); -EXPORT(void) longPrintReferencesTo(sqInt anOop); +extern void longPrintInstancesOf(sqInt aClassOop); +extern void longPrintInstancesWithClassIndex(sqInt classIndex); +extern void longPrintReferencesTo(sqInt anOop); static void mapExtraRoots(void); static void NeverInline mapMournQueue(void); static sqInt NoDbgRegParms mapOopsFromtooutPointersoutHashes(sqInt segStart, sqInt segAddr, sqInt outPointerArray, sqInt savedOutHashes); @@ -924,7 +915,6 @@ static void NoDbgRegParms NeverInline markObjects(sqInt objectsShouldBeUnmarkedA static void markWeaklingsAndMarkAndFireEphemerons(void); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); static sqInt NoDbgRegParms methodHeaderOf(sqInt methodObj); extern sqInt minSlotsForShortening(void); static usqInt newObjectHash(void); @@ -942,12 +932,11 @@ static sqInt noUnscannedEphemerons(void); static sqInt NoDbgRegParms numBytesOfBitsformat(sqInt objOop, sqInt format); static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numSlotsForBytes(sqInt numBytes); static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); extern sqInt objectBefore(sqInt objOop); static sqInt NoDbgRegParms objectInPastSpaceBefore(sqInt objOop); @@ -962,45 +951,46 @@ static sqInt NoDbgRegParms popObjStack(sqInt objStack); extern sqInt popRemappableOop(void); static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags); extern sqInt primitiveErrorTable(void); -EXPORT(void) printActivationsOf(sqInt aMethodObj); -EXPORT(void) printBogons(void); +extern void printActivationsOf(sqInt aMethodObj); +extern void printBogons(void); +static void NoDbgRegParms printBridgeon(sqInt oop, FILE *aStream); static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printContextReferencesTo(sqInt anOop); -EXPORT(void) printEntity(sqInt oop); -EXPORT(void) printForwarders(void); +extern void printContextReferencesTo(sqInt anOop); +extern void printEntity(sqInt oop); +extern void printForwarders(void); static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream); extern void printFreeChunks(void); -EXPORT(void) printFreeChunk(sqInt freeChunk); +extern void printFreeChunk(sqInt freeChunk); static void NoDbgRegParms printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode); -EXPORT(void) printFreeListHeads(void); -EXPORT(sqInt) printFreeList(sqInt chunkOrIndex); +extern void printFreeListHeads(void); +extern sqInt printFreeList(sqInt chunkOrIndex); static void NoDbgRegParms printFreeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printFreeTree(void); +extern void printFreeTree(void); static void NoDbgRegParms printFreeTreeChunk(sqInt chunkOrZero); -EXPORT(void) printHeaderOf(sqInt objOop); +extern void printHeaderOf(sqInt objOop); static void NoDbgRegParms printImmediateObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printInstancesOf(sqInt aClassOop); -EXPORT(void) printInstancesWithClassIndex(sqInt classIndex); +extern void printInstancesOf(sqInt aClassOop); +extern void printInstancesWithClassIndex(sqInt classIndex); extern void printInvalidClassTableEntries(void); #if LLDB -EXPORT(void) printMarkedOops(void); +extern void printMarkedOops(void); #endif /* LLDB */ -EXPORT(void) printMethodImplementorsOf(sqInt anOop); -EXPORT(void) printMethodReferencesTo(sqInt anOop); +extern void printMethodImplementorsOf(sqInt anOop); +extern void printMethodReferencesTo(sqInt anOop); static void NoDbgRegParms printNonPointerDataOfon(sqInt oop, FILE *aStream); -EXPORT(void) printObjectsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) printObjectsWithHash(sqInt hash); +extern void printObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void printObjectsWithHash(sqInt hash); +extern void printObjStackAndContents(sqInt objStack); static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents); static void NoDbgRegParms printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType); extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); -EXPORT(void) NeverInline printOopsExcept(sqInt (*function)(sqInt)); -EXPORT(void) printOopsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); -EXPORT(void) printReferencesTo(sqInt anOop); +extern void NeverInline printOopsExcept(sqInt (*function)(sqInt)); +extern void printOopsFromto(sqInt startAddress, sqInt endAddress); +extern void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); +extern void printReferencesTo(sqInt anOop); static void NoDbgRegParms printStringDataOfon(sqInt oop, FILE *aStream); #if LLDB -EXPORT(void) printUnmarkedOops(void); +extern void printUnmarkedOops(void); #endif /* LLDB */ static sqInt NoDbgRegParms pushOnUnscannedEphemeronsStack(sqInt anEphemeron); extern void pushRemappableOop(sqInt oop); @@ -1017,14 +1007,14 @@ static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedObjsclassIndicesShould static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion); static sqInt NoDbgRegParms NeverInline setHeapBasememoryLimitendOfMemory(sqInt baseOfHeap, sqInt memLimit, sqInt memEnd); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); -EXPORT(void) shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); extern sqInt shouldRemapOop(sqInt oop); static sqInt NoDbgRegParms sizeOfObjStack(sqInt objStack); static sqInt slidingCompactionInProgress(void); extern sqInt slotSizeOf(sqInt oop); extern sqInt splObj(sqInt index); static usqInt NoDbgRegParms startOfObject(sqInt objOop); -EXPORT(sqInt) statNumGCs(void); +extern sqInt statNumGCs(void); extern usqInt storeCheckBoundary(void); static sqInt NoDbgRegParms storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointerArrayArg, sqInt arrayOfRootsArg); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); @@ -1088,7 +1078,7 @@ static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i); static void postSnapshot(void); static void NeverInline prepareForSnapshot(void); static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes); -EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop); +extern SpurSegmentInfo * segmentContainingObj(sqInt objOop); static sqInt segmentOverlap(void); static sqInt NoDbgRegParms shrinkObjectMemory(usqInt delta); static sqInt someSegmentContainsPinned(void); @@ -1098,7 +1088,7 @@ static sqInt NoDbgRegParms writeImageSegmentsToFile(sqImageFile aBinaryStream); static sqInt NoDbgRegParms writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSegment, sqImageFile aBinaryStream); static sqInt NoDbgRegParms accessModifierOfMethod(sqInt methodObj); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -EXPORT(sqInt) activeProcess(void); +extern sqInt activeProcess(void); extern void addIdleUsecs(sqInt idleUsecs); static void NoDbgRegParms addLastLinktoList(sqInt proc, sqInt aList); static void NoDbgRegParms addNewMethodToCache(sqInt classObj); @@ -1114,11 +1104,11 @@ extern void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); static void NoDbgRegParms assertValidExecutionPointersimbarline(usqInt lip, char *lfp, char *lsp, sqInt inInterpreter, sqInt ln); static void NoDbgRegParms backupContexttoBlockingSendTo(sqInt suspendedContext, sqInt conditionVariable); extern sqInt booleanValueOf(sqInt obj); -EXPORT(sqInt) callbackEnter(sqInt *callbackID); -EXPORT(sqInt) callbackLeave(sqInt cbID); +extern sqInt callbackEnter(sqInt *callbackID); +extern sqInt callbackLeave(sqInt cbID); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); extern sqInt characterForAscii(sqInt ascii); -EXPORT(sqInt) checkAllAccessibleObjectsOkay(void); +extern sqInt checkAllAccessibleObjectsOkay(void); static sqInt NoDbgRegParms checkCodeIntegrity(sqInt fullGCFlag); #if LRPCheck static sqInt NeverInline checkDeliveryOfLongRunningPrimitiveSignal(void); @@ -1129,7 +1119,7 @@ static sqInt NoDbgRegParms checkImageVersionFromstartingAt(sqImageFile f, squeak static sqInt checkInterpreterIntegrity(void); static sqInt NoDbgRegParms checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP); static sqInt NoDbgRegParms checkOkayFields(sqInt oop); -EXPORT(sqInt) checkOkayInterpreterObjects(sqInt writeBack); +extern sqInt checkOkayInterpreterObjects(sqInt writeBack); static sqInt NoDbgRegParms checkOkayStackPage(StackPage *thePage); static sqInt NoDbgRegParms checkOkayStackZone(sqInt writeBack); static void NoDbgRegParms checkProfileTick(sqInt aPrimitiveMethod); @@ -1139,8 +1129,7 @@ static sqInt NoDbgRegParms checkStackPointerIndexForFrame(char *theFP); static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className); static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext); static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern sqInt copyBits(void); extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y); static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop); @@ -1154,7 +1143,7 @@ static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); static void dummyReferToProxy(void); extern void dumpPrimTraceLog(void); -EXPORT(void) dumpPrimTraceLogOn(FILE *aStdioStream); +extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); @@ -1201,7 +1190,6 @@ static sqInt NoDbgRegParms frameReceiver(char *theFP); static sqInt NoDbgRegParms frameStackedReceiverOffset(char *theFP); static void freeUntracedStackPages(void); extern sqInt fullDisplayUpdate(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); static sqInt getCogVMFeatureFlags(void); extern sqInt getCurrentBytecode(void); static sqInt getDesiredCogCodeSize(void); @@ -1251,6 +1239,7 @@ static sqInt isPrimitiveFunctionPointerAnIndex(void); extern sqInt isQuickPrimitiveIndex(sqInt anInteger); extern sqInt isReadMediatedContextInstVarIndex(sqInt index); static sqInt NoDbgRegParms isSingleContext(sqInt aContext); +static sqInt NoDbgRegParms isVanillaBlockClosure(sqInt aClosure); static sqInt NoDbgRegParms isWidowedContextDuringGC(sqInt aOnceMarriedContext); static sqInt NoDbgRegParms isWidowedContextNoConvert(sqInt aOnceMarriedContext); static sqInt NoDbgRegParms isWidowedContext(sqInt aOnceMarriedContext); @@ -1262,7 +1251,7 @@ static sqInt NoDbgRegParms lengthOfNameOfClass(sqInt classOop); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt loadBitBltFrom(sqInt bb); extern void loadInitialContext(void); -EXPORT(void) longPrintOop(sqInt oop); +extern void longPrintOop(sqInt oop); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); static sqInt NoDbgRegParms lookupInMethodCacheSelclassTag(sqInt selector, sqInt classTag); static sqInt NoDbgRegParms lookupLexicalfromrule(sqInt selector, sqInt mixin, sqInt rule); @@ -1313,7 +1302,6 @@ static sqInt NoDbgRegParms objectequalsString(sqInt anOop, char *aCString); extern sqInt ownVM(sqInt threadIndexAndFlags); static sqInt NoDbgRegParms pcPreviousToinSqueakV3PlusClosuresMethod(sqInt theIP, sqInt aMethod); extern sqInt pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt pop(sqInt nItems); extern void popthenPush(sqInt nItems, sqInt oop); @@ -1331,45 +1319,44 @@ extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); static void NoDbgRegParms printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void NoDbgRegParms printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); -EXPORT(void) printAllStacks(void); -EXPORT(void) printAllStacksOn(FILE *aStdioStream); -EXPORT(void) printCallStack(void); +extern void printAllStacks(void); +extern void printAllStacksOn(FILE *aStdioStream); +extern void printCallStack(void); static sqInt NoDbgRegParms printCallStackFP(char *theFP); -EXPORT(sqInt) printCallStackOf(sqInt aContextOrProcessOrFrame); +extern sqInt printCallStackOf(sqInt aContextOrProcessOrFrame); static sqInt NoDbgRegParms printCallStackOfcurrentFP(sqInt aContext, char *currFP); -EXPORT(void) printCallStackOn(FILE *aStdioStream); +extern void printCallStackOn(FILE *aStdioStream); static sqInt NoDbgRegParms printContextCallStackOf(sqInt aContext); -EXPORT(void) printContext(sqInt aContext); -EXPORT(void) printExternalHeadFrame(void); +extern void printContext(sqInt aContext); +extern void printExternalHeadFrame(void); static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort); static void NoDbgRegParms printFrameFlagsForFP(char *theFP); static void NoDbgRegParms printFrameOopat(char *name, char *address); -EXPORT(void) printFramesInPage(StackPage *thePage); -EXPORT(void) printFramesOnStackPageListInUse(void); +extern void printFramesInPage(StackPage *thePage); +extern void printFramesOnStackPageListInUse(void); static void NoDbgRegParms printFrameThingandFrameat(char *name, char *theFP, char *address); static void NoDbgRegParms printFrameThingatextraString(char *name, char *address, char *extraStringOrNil); -EXPORT(sqInt) printFrame(char *theFP); -EXPORT(sqInt) printFrameWithSP(char *theFP, char *theSP); -extern sqInt printHexnp(usqInt n); +extern sqInt printFrame(char *theFP); +extern sqInt printFrameWithSP(char *theFP, char *theSP); static sqInt NoDbgRegParms printHexPtrnp(void *p); extern void printHex(usqInt n); -EXPORT(void) printLikelyImplementorsOfSelector(sqInt selector); -EXPORT(void) printMethodCache(void); -EXPORT(void) printMethodCacheFor(sqInt thing); -EXPORT(void) printMethodDictionaryOf(sqInt behavior); -EXPORT(void) printMethodDictionary(sqInt dictionary); +extern void printLikelyImplementorsOfSelector(sqInt selector); +extern void printMethodCache(void); +extern void printMethodCacheFor(sqInt thing); +extern void printMethodDictionaryOf(sqInt behavior); +extern void printMethodDictionary(sqInt dictionary); static void NoDbgRegParms printNameOfClasscount(sqInt classOop, sqInt cnt); static void NoDbgRegParms printOopShortInner(sqInt oop); -EXPORT(void) printOop(sqInt oop); -EXPORT(void) printProcessStack(sqInt aProcess); -EXPORT(sqInt) printProcsOnList(sqInt procList); -EXPORT(sqInt) printStackCallStackOf(sqInt aContextOrProcessOrFrame); -EXPORT(void) printStackPageList(void); -EXPORT(void) printStackPageListInUse(void); -EXPORT(void) printStackPages(void); -EXPORT(void) printStackPagesInUse(void); +extern void printOop(sqInt oop); +extern void printProcessStack(sqInt aProcess); +extern sqInt printProcsOnList(sqInt procList); +extern sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame); +extern void printStackPageList(void); +extern void printStackPageListInUse(void); +extern void printStackPages(void); +extern void printStackPagesInUse(void); static void NoDbgRegParms printStackPageuseCount(StackPage *page, sqInt n); -EXPORT(void) printStackReferencesTo(sqInt oop); +extern void printStackReferencesTo(sqInt oop); static void NoDbgRegParms printStringOf(sqInt oop); extern void print(char *s); extern void pushBool(sqInt trueOrFalse); @@ -1384,22 +1371,22 @@ static void NoDbgRegParms putWord32toFile(int aWord32, sqImageFile aFile); extern sqInt readableFormat(sqInt imageVersion); extern size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset); static void NoDbgRegParms NeverInline reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader); -EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext); +extern sqInt reestablishContextPriorToCallback(sqInt callbackContext); static sqInt NoDbgRegParms removeFirstLinkOfList(sqInt aList); static sqInt NoDbgRegParms removeProcessfromList(sqInt aProcess, sqInt aList); static sqInt NoDbgRegParms resumepreemptedYieldingIf(sqInt aProcess, sqInt yieldImplicitly); static sqInt retryPrimitiveOnFailure(void); -EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); +extern sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); static void NoDbgRegParms reverseDisplayFromto(sqInt startIndex, sqInt endIndex); static void NoDbgRegParms rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)()); static sqInt NoDbgRegParms roomToPushNArgs(sqInt n); static sqInt NoDbgRegParms safeMethodClassOf(sqInt methodPointer); static sqInt NoDbgRegParms saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex); -EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); -EXPORT(void) setBreakMNUSelector(char *aString); -EXPORT(void) setBreakSelector(char *aString); +extern sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); +extern void setBreakMNUSelector(char *aString); +extern void setBreakSelector(char *aString); extern void setFullScreenFlag(sqInt value); -EXPORT(void *) setInterruptCheckChain(void (*aFunction)()); +extern void * setInterruptCheckChain(void (*aFunction)()); extern void setInterruptKeycode(sqInt value); extern void setInterruptPending(sqInt value); extern void setNextWakeupUsecs(usqLong value); @@ -1408,10 +1395,10 @@ static void setSignalLowSpaceFlagAndSaveProcess(void); static void NoDbgRegParms setTraceFlagOnContextsFramesPageIfNeeded(sqInt aContext); static sqInt NoDbgRegParms shortPrintContext(sqInt aContext); static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP); -EXPORT(void) shortPrintFramesInPage(StackPage *thePage); -EXPORT(void) shortPrintFramesOnStackPageListInUse(void); +extern void shortPrintFramesInPage(StackPage *thePage); +extern void shortPrintFramesOnStackPageListInUse(void); static sqInt NoDbgRegParms shortPrintFrame(char *theFP); -EXPORT(void) shortPrintFrameAndNCallers(char *theFP, sqInt n); +extern void shortPrintFrameAndNCallers(char *theFP, sqInt n); static void NoDbgRegParms shortPrintOop(sqInt oop); static sqInt NoDbgRegParms shortReversePrintFrameAndCallers(char *aFramePointer); extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); @@ -1461,7 +1448,7 @@ static void NoDbgRegParms NeverInline voidLongRunningPrimitive(char *reason); #endif /* LRPCheck */ static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); static sqInt wakeHighestPriority(void); -EXPORT(char *) whereIs(sqInt anOop); +extern char * whereIs(sqInt anOop); static sqInt NeverInline writeImageFileIO(void); static usqInt NoDbgRegParms cloneContext(sqInt aContext); static sqInt NoDbgRegParms fieldOrSenderFPofContext(sqInt index, sqInt contextObj); @@ -1543,14 +1530,14 @@ _iss usqInt pastSpaceStart; _iss usqInt instructionPointer; _iss sqInt needGCFlag; _iss usqInt totalFreeOldSpace; -_iss SpurSegmentInfo * segments; _iss sqInt lkupClassTag; _iss sqInt trueObj; _iss sqInt falseObj; +_iss SpurSegmentInfo * segments; _iss sqInt hiddenRootsObj; -_iss sqInt numSegments; _iss StackPage * pages; _iss usqInt scavengeThreshold; +_iss sqInt numSegments; _iss sqInt * freeLists; _iss char * stackMemory; _iss sqInt markStack; @@ -1567,6 +1554,7 @@ _iss StackPage * mostRecentlyUsedPage; _iss sqInt lkupClass; _iss sqInt remapBufferCount; _iss usqInt newSpaceStart; +_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; _iss sqInt tempOop; _iss usqInt lastMobileObject; @@ -1583,7 +1571,6 @@ _iss sqInt becomeEffectsFlags; _iss sqInt growHeadroom; _iss sqInt tenureThreshold; _iss char * objStackInvalidBecause; -_iss sqInt sweepIndex; _iss sqInt ephemeronList; _iss sqInt imageHeaderFlags; #if LRPCheck @@ -1594,7 +1581,6 @@ _iss sqInt longRunningPrimitiveCheckSemaphore; #endif _iss sqInt profileSemaphore; _iss sqInt tenureCriterion; -_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classNameIndex; _iss usqInt freeOldSpaceStart; _iss sqInt extraRootCount; @@ -1682,7 +1668,6 @@ _iss sqIntptr_t nsMethodCache[NSMethodCacheSize + 1 /* 4097 */]; _iss sqInt atCache[AtCacheTotalSize + 1 /* 65 */]; _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 65 */]; -_iss sqInt preferredPinningSegment; _iss sqInt statCoalesces; _iss sqLong nextProfileTick; _iss usqLong nextWakeupUsecs; @@ -2402,7 +2387,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] StackInterpreterPrimitives_VMMaker.oscog-eem.3310"; +const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] StackInterpreterPrimitives_VMMaker.oscog-eem.3329"; sqInt suppressHeartbeatFlag; char expensiveAsserts = 0; int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); @@ -17585,6 +17570,7 @@ primitiveClosureValue(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -17703,6 +17689,7 @@ primitiveClosureValueNoContextSwitch(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -17853,6 +17840,7 @@ primitiveClosureValueWithArgs(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -26428,10 +26416,8 @@ primitiveStoreImageSegment(void) && (((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) == (firstLongFormat())))))) { /* Must be indexable words */ - /* begin primitiveFail */ - if (!GIV(primFailCode)) { - GIV(primFailCode) = 1; - } + /* begin primitiveFailFor: */ + GIV(primFailCode) = PrimErrBadArgument; return; } ecode = storeImageSegmentIntooutPointersroots(segmentWordArray, outPointerArray, arrayOfRoots); @@ -27145,7 +27131,8 @@ primitiveStringReplace(void) replFmt = replFmt & -4; l10: /* end classFormatFromInstFormat: */; if (!((arrayFmt == replFmt) - && (arrayFmt < (firstCompiledMethodFormat())))) { + && ((arrayFmt >= (sixtyFourBitIndexableFormat())) + && (arrayFmt < (firstCompiledMethodFormat()))))) { /* begin primitiveFailFor: */ GIV(primFailCode) = PrimErrInappropriate; goto l17; @@ -29189,116 +29176,6 @@ initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur32BitMemoryManager>>#inOldSpaceInstantiatePinnedClass:indexableSize: */ -sqInt -inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt fillValue; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt numSlots; - usqInt p; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - fillValue = 0; - switch (instSpec) { - case 2 /* arrayFormat */: - numSlots = nElements; - fillValue = GIV(nilObj); - break; - case indexablePointersFormat(): - case weakArrayFormat(): - numSlots = (classFormat & ((1U << (fixedFieldsFieldWidth())) - 1)) + nElements; - fillValue = GIV(nilObj); - break; - case sixtyFourBitIndexableFormat(): - if (nElements > ((0x1FFFFFFF) / 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - numSlots = nElements * 2; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = nElements; - break; - case firstShortFormat(): - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstByteFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - default: - - /* non-indexable */ - /* Some Squeak images include funky fixed subclasses of abstract variable - superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection. - The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via - this method. - Hence allow fixed classes to be instantiated here iff nElements = 0. */ - if ((nElements != 0) - || (instSpec > 5 /* lastPointerFormat */)) { - return null; - } - numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); - fillValue = GIV(nilObj); - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > (0x1FFFFFFF)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsForPinningInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : ((numSlots + (numSlots & 1)) << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - if (!(newObj == null)) { - /* begin fillObj:numSlots:with: */ - assert(oopisLessThan(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1, addressAfter(newObj))); - for (p = (((usqInt)(newObj + BaseHeaderSize))); p <= (((usqInt)(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { - longAtput(p, fillValue); - longAtput(p + 4, fillValue); - } - } - return newObj; -} - - /* Allocate an instance of a variable class, excepting CompiledMethod. */ /* Spur32BitMemoryManager>>#instantiateClass:indexableSize: */ @@ -29451,131 +29328,6 @@ instantiateClassindexableSize(sqInt classObj, usqInt nElements) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur32BitMemoryManager>>#instantiateUninitializedClass:indexableSize: */ -sqInt -instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt newObj1; - usqInt numBytes; - usqInt numSlots; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - assert(isPureBitsFormat(instSpec)); - switch (instSpec) { - case sixtyFourBitIndexableFormat(): - if (nElements > ((0x1FFFFFFF) / 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - numSlots = nElements * 2; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = nElements; - break; - case firstShortFormat(): - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstByteFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - default: - - /* not bits indexable */ - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > ((1U << (fixedFieldsFieldWidth())) - 1)) { - if (numSlots > (0x1FFFFFFF)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : ((numSlots + (numSlots & 1)) << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - } - else { - /* begin allocateSlots:format:classIndex: */ - if (numSlots >= (numSlotsMask())) { - newObj1 = GIV(freeStart) + BaseHeaderSize; - numBytes = (BaseHeaderSize + BaseHeaderSize) + ((numSlots + (numSlots & 1)) * BytesPerOop); - } - else { - newObj1 = GIV(freeStart); - numBytes = BaseHeaderSize + ((numSlots <= 1 - ? /* begin allocationUnit */ 8 - : (numSlots + (numSlots & 1)) * BytesPerOop)); - } - if ((GIV(freeStart) + numBytes) > GIV(scavengeThreshold)) { - if (!GIV(needGCFlag)) { - /* begin scheduleScavenge */ - GIV(needGCFlag) = 1; - forceInterruptCheck(); - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, instSpec, classIndex); - goto l8; - } - if (numSlots >= (numSlotsMask())) { - - /* for header parsing we put a saturated slot count in the prepended overflow size word */ - flag("endianness"); - longAtput(GIV(freeStart), numSlots); - longAtput(GIV(freeStart) + 4, ((sqInt)((usqInt)((numSlotsMask())) << (numSlotsHalfShift())))); - long64Atput(newObj1, headerForSlotsformatclassIndex(numSlotsMask(), instSpec, classIndex)); - } - else { - long64Atput(newObj1, (((((usqLong) numSlots)) << (numSlotsFullShift())) + (((sqInt)((usqInt)(instSpec) << (formatShift()))))) + classIndex); - } - assert((numBytes % (allocationUnit())) == 0); - assert((newObj1 % (allocationUnit())) == 0); - GIV(freeStart) += numBytes; - newObj = newObj1; - l8: /* end allocateSlots:format:classIndex: */; - } - return newObj; -} - - /* Convert the integer value, assumed to be in SmallInteger range, into a tagged SmallInteger object. In C, use a shift and an add to set the tag bit. @@ -30018,8 +29770,8 @@ allWeakSurvivorsOnWeakList(void) writes code that stresses the remembered table. One might conclude that if the remembered table is full, then the right thing - to do is simply to tenure everything, emptying the remembered table. Bt in - some circumstances this + to do is simply to tenure everything, emptying the remembered table. But + in some circumstances this can be counter-productive, and result in the same situation arising soon after tenuring everything. Instead, we can try and selectively prune the remembered table, tenuring @@ -30411,6 +30163,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj3 == null)) { + assert(isPinned(obj3)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1, addressAfter(obj3))); for (p2 = (((usqInt)(obj3 + BaseHeaderSize))); p2 <= (((usqInt)(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1))); p2 += 8 /* allocationUnit */) { @@ -30428,6 +30181,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj2 == null)) { + assert(isPinned(obj2)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1, addressAfter(obj2))); for (p1 = (((usqInt)(obj2 + BaseHeaderSize))); p1 <= (((usqInt)(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1))); p1 += 8 /* allocationUnit */) { @@ -30448,6 +30202,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -30645,6 +30400,7 @@ openScavengeLog(void) /* Print the objects in the remembered set. */ +/* useful for debugging */ /* SpurGenerationScavenger>>#printRememberedSet */ void @@ -32928,6 +32684,7 @@ allocatePinnedSlots(sqInt nSlots) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj == null)) { + assert(isPinned(obj)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj))); for (p = (((usqInt)(obj + BaseHeaderSize))); p <= (((usqInt)(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -33896,30 +33653,6 @@ checkedLongAt(sqInt byteAddress) return longAt(byteAddress); } - /* SpurMemoryManager>>#checkFreeSpace: */ -void -checkFreeSpace(sqInt gcModes) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, null); - } -} - - /* SpurMemoryManager>>#checkFreeSpace:ignoring: */ -void -checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, anOopToIgnore); - } -} - /* Perform an integrity/leak check using the heapMap. Assume clearLeakMapAndMapAccessibleFreeSpace has set a bit at each free chunk's @@ -34882,6 +34615,7 @@ checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt cla /* Verify that the given oop is legitimate. Check address, header, and size but not class. Answer true if OK. Otherwise print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOkayOop: */ sqInt @@ -34976,6 +34710,7 @@ checkOkayOop(usqInt oop) or more fields. Finally, the instance specification field of the behavior must match that of the instance. If OK answer true. If not, print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOopHasOkayClass: */ sqInt @@ -35832,7 +35567,7 @@ cloneObject(sqInt objOop) } /* SpurMemoryManager>>#compactClassIndexOf: */ -sqInt +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop) { /* begin classIndexOf: */ @@ -35979,6 +35714,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS /* print the count of marked and unmarked objects. In addition if 1 is set in printFlags, short-print marked objects, and/or if 2 is set, short-print unmarked obejcts. */ +/* useful for debugging */ /* SpurMemoryManager>>#countMarkedAndUnmarkdObjects: */ void @@ -36076,7 +35812,8 @@ currentAllocatedBytes(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt use; - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); return (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); } @@ -36103,7 +35840,8 @@ doScavenge(sqInt tenuringCriterion) usqInt use; /* begin doAllocationAccountingForScavenge */ - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); GIV(statAllocatedBytes) = (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); GIV(gcPhaseInProgress) = ScavengeInProgress; /* begin scavenge: */ @@ -36154,7 +35892,8 @@ doScavenge(sqInt tenuringCriterion) GIV(freeStart) = ((eden()).start); GIV(gcPhaseInProgress) = 0; /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); } @@ -36168,7 +35907,7 @@ doScavenge(sqInt tenuringCriterion) was possible. */ /* SpurMemoryManager>>#doShorten:toIndexableSize: */ -sqInt +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt bytesBefore; @@ -36981,6 +36720,7 @@ findLargestFreeChunk(void) /* Print the oops of all string-like things that start with the same characters as aCString */ +/* useful for debugging */ /* SpurMemoryManager>>#findStringBeginningWith: */ void @@ -37368,7 +37108,7 @@ followFieldofObject(sqInt fieldIndex, sqInt anObject) need since depth is always finite. */ /* SpurMemoryManager>>#followForwardedObjectFields:toDepth: */ -sqInt +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -37782,7 +37522,6 @@ fullGC(void) runLeakCheckerForexcludeUnmarkedObjsclassIndicesShouldBeValid(GCModeFull, 1, 1); compactionStartUsecs = ioUTCMicrosecondsNow(); /* begin prepareForGlobalSweep */ - GIV(sweepIndex) = 0; for (i = 0; i < GIV(numSegments); i += 1) { ((GIV(segments)[i]).containsPinned = 0); } @@ -37795,9 +37534,11 @@ fullGC(void) GIV(statShrinkMemory) += 1; } /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); assert(validObjStacks()); assert(isEmptyObjStack(GIV(markStack))); assert(isEmptyObjStack(GIV(weaklingStack))); @@ -37856,12 +37597,10 @@ growOldSpaceByAtLeast(sqInt minAmmount) sqInt ammount; sqInt bytes; sqInt headroom; - sqInt i; sqInt interval; SpurSegmentInfo *segInfo; sqInt start; usqInt total; - usqInt total1; /* statGrowMemory counts attempts, not successes. */ @@ -37878,13 +37617,8 @@ growOldSpaceByAtLeast(sqInt minAmmount) /* Now apply the maxOldSpaceSize limit, if one is in effect. */ ammount = ((ammount < GIV(growHeadroom)) ? GIV(growHeadroom) : ammount); if (maxOldSpaceSize > 0) { - /* begin totalBytesInSegments */ - total1 = 0; - for (i = 0; i < GIV(numSegments); i += 1) { - total1 += ((GIV(segments)[i]).segSize); - } - assert(GIV(totalHeapSizeIncludingBridges) == total1); - total = total1; + assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)); + total = GIV(totalHeapSizeIncludingBridges); if (total >= maxOldSpaceSize) { GIV(needGCFlag) = 1; return null; @@ -38053,73 +37787,6 @@ incrementalGC(void) error("shouldNotImplement"); } - /* SpurMemoryManager>>#indexOf:in: */ -sqInt -indexOfin(sqInt anElement, sqInt anObject) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt fmt; - sqInt fmt1; - sqInt i; - usqInt numSlots; - usqInt numSlots1; - - /* begin formatOf: */ - fmt = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - if (fmt <= 5 /* lastPointerFormat */) { - /* begin numSlotsOf: */ - assert((classIndexOf(anObject)) > (isForwardedObjectClassIndexPun())); - numSlots1 = byteAt(anObject + 7); - numSlots = (numSlots1 == (numSlotsMask()) - ? longAt(anObject - BaseHeaderSize) - : numSlots1); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (longAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) { - return i; - } - } - } - if (fmt >= (firstByteFormat())) { - if (fmt >= (firstCompiledMethodFormat())) { - /* begin primitiveFailFor: */ - return (GIV(primFailCode) = PrimErrUnsupported); - } - /* begin numBytesOfBytes: */ - fmt1 = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - assert(fmt1 >= (firstByteFormat())); - numSlots = ((numSlotsOf(anObject)) << (shiftForWord())) - (fmt1 & 7); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (byteAt((anObject + BaseHeaderSize) + i))) { - return i; - } - } - } - if (fmt >= (firstShortFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 1; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (((unsigned short) (shortAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 1)))))))) { - return i; - } - } - } - if (fmt == (sixtyFourBitIndexableFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 3; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long64At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 3)))))) { - return i; - } - } - } - if (fmt >= (firstLongFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 2; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long32At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 2)))))) { - return i; - } - } - } - return -1; -} - /* Part of reorderReversedTreeList:. Switch treeNode with newNode in the tree, but do nothing to the list linked through freeChunkNextIndex. */ @@ -38581,6 +38248,7 @@ initializeObjectMemory(sqInt bytesToShift) /* begin allocatePinnedSlots: */ obj1 = allocateSlotsForPinningInOldSpacebytesformatclassIndex(0x400, (((int)((usqInt)((0x400 + (0x400 & 1))) << (shiftForWord())))) + (BaseHeaderSize + BaseHeaderSize), firstLongFormat(), thirtyTwoBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -38597,7 +38265,7 @@ initializeObjectMemory(sqInt bytesToShift) else { /* The Spur32to64BitBootstrap failed to set the type of rememberedSetObj to 64-bit indexability. - This is unimportant except for simulation; rememberedSet is declared as sqInt *, but in to have + This is unimportant except for simulation; rememberedSet is declared as sqInt *, but to have firstIndexableField: below answer a suitable type the format must be wordIndexableFormat. */ /* begin setFormatOf:to: */ format = firstLongFormat(); @@ -38628,9 +38296,11 @@ initializeObjectMemory(sqInt bytesToShift) /* free space before shrinking */ GIV(shrinkThreshold) = 0x2000000; /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* By default GC after scavenge if heap has grown by a third since the last GC */ GIV(heapGrowthToSizeGCRatio) = 0.333333; @@ -38638,12 +38308,10 @@ initializeObjectMemory(sqInt bytesToShift) /* print free chunks in freeTree in order. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#inOrderPrintFreeTree:printList: */ -EXPORT(void) +void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList) { sqInt next; @@ -38896,18 +38564,6 @@ isAnyPointerFormat(sqInt format) } -/* Answer if this is an indexable object with pointer elements, e.g., an - array - */ - - /* SpurMemoryManager>>#isArrayNonImm: */ -sqInt -isArrayNonImm(sqInt oop) -{ - return ((((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask())) == 2 /* arrayFormat */; -} - - /* Answer true if this is an indexable object with pointer elements, e.g., an array */ @@ -39330,7 +38986,7 @@ isObjImmutable(sqInt anOop) /* Answer if obj is old. Require that obj is non-immediate. */ /* SpurMemoryManager>>#isOldObject: */ -sqInt +static sqInt NoDbgRegParms isOldObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(isNonImmediate(objOop)); @@ -39415,18 +39071,6 @@ isReallyYoungObject(sqInt obj) oopisLessThan(obj, GIV(oldSpaceStart))); } - -/* Answer if oop is young. */ - - /* SpurMemoryManager>>#isReallyYoung: */ -sqInt -isReallyYoung(sqInt oop) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return ((!(oop & (tagMask())))) - && ((assert(isNonImmediate(oop)), - oopisLessThan(oop, GIV(oldSpaceStart)))); -} - /* SpurMemoryManager>>#isRemembered: */ static sqInt NoDbgRegParms isRemembered(sqInt objOop) @@ -39459,10 +39103,10 @@ isShorts(sqInt oop) /* This version is private to SpurMemoryManager (for asserts, etc). It does - not take advantage of the power-of0two optimization in isForwarded:. */ + not take advantage of the power-of-two optimization in isForwarded:. */ /* SpurMemoryManager>>#isUnambiguouslyForwarder: */ -sqInt +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop) { return ((longAt(objOop)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()); @@ -39853,7 +39497,7 @@ lastPointerFormat(void) pointer, and the image contains no forwarders (see class comment). */ /* SpurMemoryManager>>#lastPointerOfWhileSwizzling: */ -sqInt +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop) { sqInt fmt; @@ -39881,7 +39525,7 @@ lastPointerOfWhileSwizzling(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#lastPointerOf: */ -sqInt +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop) { sqInt contextSize; @@ -39921,13 +39565,6 @@ lastPointerOf(sqInt objOop) ((header >> 1)) & AlternateHeaderNumLiteralsMask)) + LiteralStart) - 1) * BytesPerOop) + BaseHeaderSize; } - /* SpurMemoryManager>>#leakCheckBecome */ -sqInt -leakCheckBecome(void) -{ - return ((checkForLeaks & GCModeBecome) != 0); -} - /* SpurMemoryManager>>#leakCheckFullGC */ sqInt leakCheckFullGC(void) @@ -39935,13 +39572,6 @@ leakCheckFullGC(void) return ((checkForLeaks & GCModeFull) != 0); } - /* SpurMemoryManager>>#leakCheckIncremental */ -sqInt -leakCheckIncremental(void) -{ - return ((checkForLeaks & GCModeIncremental) != 0); -} - /* SpurMemoryManager>>#leakCheckNewSpaceGC */ sqInt leakCheckNewSpaceGC(void) @@ -40534,12 +40164,10 @@ loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesOf: */ -EXPORT(void) +void longPrintInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -40554,12 +40182,10 @@ longPrintInstancesOf(sqInt aClassOop) /* Scan the heap printing any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesWithClassIndex: */ -EXPORT(void) +void longPrintInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -40667,12 +40293,10 @@ longPrintInstancesWithClassIndex(sqInt classIndex) /* Scan the heap long printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintReferencesTo: */ -EXPORT(void) +void longPrintReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -42080,21 +41704,6 @@ maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format) } -/* Answer one of the objects in the SpecialObjectsArray, if in range, - otherwise answer nil. - */ - - /* SpurMemoryManager>>#maybeSplObj: */ -sqInt -maybeSplObj(sqInt index) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return (index < (numSlotsOf(GIV(specialObjectsOop))) - ? (/* begin fetchPointer:ofObject: */ - longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) - : 0); -} - - /* Answer the method header of a CompiledMethod object. */ /* SpurMemoryManager>>#methodHeaderOf: */ @@ -42516,7 +42125,7 @@ numBytesOf(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#numPointerSlotsOf: */ -usqInt +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop) { sqInt contextSize; @@ -42680,24 +42289,6 @@ numStrongSlotsOfInephemeral(sqInt objOop) } -/* Answer the number of strong pointer fields in the given weakling. */ - - /* SpurMemoryManager>>#numStrongSlotsOfWeakling: */ -sqInt -numStrongSlotsOfWeakling(sqInt objOop) -{ - sqInt classFormat; - sqInt objOop1; - - assert((formatOf(objOop)) == (weakArrayFormat())); - /* begin fixedFieldsOfClass: */ - objOop1 = fetchClassOfNonImm(objOop); - /* begin fixedFieldsOfClassFormat: */ - classFormat = ((longAt((objOop1 + BaseHeaderSize) + (((int)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 1); - return classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); -} - - /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -42769,6 +42360,9 @@ objectAfter(sqInt objOop) : followingWordAddress3); } + +/* useful for debugging */ + /* SpurMemoryManager>>#objectBefore: */ sqInt objectBefore(sqInt objOop) @@ -43340,6 +42934,7 @@ okayOop(sqInt signedOop) } +/* useful for debugging */ /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -43522,7 +43117,6 @@ pinObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt format; - sqInt i; sqInt oldClone; sqInt referent; SpurSegmentInfo *seg; @@ -43537,15 +43131,7 @@ pinObject(sqInt objOop) longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); return objOop; } - /* begin segmentContainingObj: */ - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - seg = (&(GIV(segments)[i])); - goto l1; - } - } - seg = null; - l1: /* end segmentContainingObj: */; + seg = segmentContainingObj(objOop); if ((seg->containsPinned)) { /* begin setIsPinnedOf:to: */ longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); @@ -43786,12 +43372,10 @@ primitiveErrorTable(void) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printActivationsOf: */ -EXPORT(void) +void printActivationsOf(sqInt aMethodObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -43859,12 +43443,10 @@ printActivationsOf(sqInt aMethodObj) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printBogons */ -EXPORT(void) +void printBogons(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT /* begin printTheBogons: */ @@ -43881,16 +43463,34 @@ printBogons(void) cr(); } + /* SpurMemoryManager>>#printBridge:on: */ +static void NoDbgRegParms +printBridgeon(sqInt oop, FILE *aStream) +{ + fprintf(aStream, + "%p is a bridge hdr%d slot size %ul\n", + ((void *)oop), + ((byteAt(oop + 7)) == (numSlotsMask()) + ? 16 + : 8), + numSlotsOfAny(oop)); +} + /* SpurMemoryManager>>#printCantBeObject:on: */ static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (((oop & (7)) == 0) - && (((oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) - && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))))) { - printForwarderon(oop, aStream); - return; + if ((oop & (7)) == 0) { + if (((oopisLessThan(oop, GIV(oldSpaceStart))) + && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) + && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { + printForwarderon(oop, aStream); + return; + } + if (oop == (bridgeAt((numSegments()) - 1))) { + printBridgeon(oop, aStream); + return; + } } fprintf(aStream, "%p%s\n", @@ -43904,12 +43504,10 @@ printCantBeObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printContextReferencesTo: */ -EXPORT(void) +void printContextReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -43989,12 +43587,10 @@ printContextReferencesTo(sqInt anOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printEntity: */ -EXPORT(void) +void printEntity(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -44128,12 +43724,10 @@ printEntity(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printForwarders */ -EXPORT(void) +void printForwarders(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -44242,7 +43836,7 @@ static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream) { fprintf(aStream, - "%p is a forwarded hdr%d slot size %ud object to %p\n", + "%p is a forwarded hdr%d slot size %ul object to %p\n", ((void *)oop), ((byteAt(oop + 7)) == (numSlotsMask()) ? 16 @@ -44255,6 +43849,7 @@ printForwarderon(sqInt oop, FILE *aStream) /* This version goes through memory, printing all free chunks. Other versions go through the free lists. This one will show all free chunks even if the free lists are corrupt. */ +/* useful for debugging */ /* SpurMemoryManager>>#printFreeChunks */ void @@ -44370,12 +43965,10 @@ printFreeChunks(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeChunk: */ -EXPORT(void) +void printFreeChunk(sqInt freeChunk) { printFreeChunkprintAsTreeNode(freeChunk, 1); @@ -44462,12 +44055,10 @@ printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeListHeads */ -EXPORT(void) +void printFreeListHeads(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt expectedMask; @@ -44503,12 +44094,10 @@ printFreeListHeads(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeList: */ -EXPORT(sqInt) +sqInt printFreeList(sqInt chunkOrIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fieldIndex; @@ -44541,12 +44130,10 @@ printFreeObjecton(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeTree */ -EXPORT(void) +void printFreeTree(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFreeTreeChunk(GIV(freeLists)[0]); @@ -44570,13 +44157,11 @@ printFreeTreeChunk(sqInt chunkOrZero) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* N.B. No safety bounds checks!! We need to look e.g. at corpses. */ /* SpurMemoryManager>>#printHeaderOf: */ -EXPORT(void) +void printHeaderOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -44689,12 +44274,10 @@ printImmediateObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesOf: */ -EXPORT(void) +void printInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -44709,12 +44292,10 @@ printInstancesOf(sqInt aClassOop) /* Scan the heap printing the oops of any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesWithClassIndex: */ -EXPORT(void) +void printInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -44820,6 +44401,7 @@ printInstancesWithClassIndex(sqInt classIndex) /* Print the objects in the classTable that have bad hashes. */ +/* useful for debugging */ /* SpurMemoryManager>>#printInvalidClassTableEntries */ void @@ -44869,13 +44451,11 @@ printInvalidClassTableEntries(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMarkedOops */ #if LLDB -EXPORT(void) +void printMarkedOops(void) { printOopsSuchThat(isMarked); @@ -44886,12 +44466,10 @@ printMarkedOops(void) /* Scan the heap printing the oops of any and all methods that implement anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodImplementorsOf: */ -EXPORT(void) +void printMethodImplementorsOf(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -44957,12 +44535,10 @@ printMethodImplementorsOf(sqInt anOop) /* Scan the heap printing the oops of any and all methods that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodReferencesTo: */ -EXPORT(void) +void printMethodReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -45148,12 +44724,10 @@ printNonPointerDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsFrom:to: */ -EXPORT(void) +void printObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -45177,12 +44751,10 @@ printObjectsFromto(sqInt startAddress, sqInt endAddress) /* Scan the heap printing the oops of any and all objects whose hash equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsWithHash: */ -EXPORT(void) +void printObjectsWithHash(sqInt hash) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45284,6 +44856,21 @@ printObjectsWithHash(sqInt hash) l4: /* end allNewSpaceEntitiesDo: */; } + /* SpurMemoryManager>>#printObjStackAndContents: */ +void +printObjStackAndContents(sqInt objStack) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + /* begin printObjStack:printContents: */ + if (objStack == GIV(nilObj)) { + /* begin print: */ + fprintf(GIV(transcript), "nil"); + cr(); + } + else { + printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((int)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, 1); + } +} + /* SpurMemoryManager>>#printObjStackPage:myIndex:pageType:printContents: */ static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents) @@ -45446,6 +45033,9 @@ printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType) cr(); } + +/* useful for debugging */ + /* SpurMemoryManager>>#printObjStack: */ void printObjStack(sqInt objStack) @@ -45461,27 +45051,11 @@ printObjStack(sqInt objStack) } } - /* SpurMemoryManager>>#printObjStack:printContents: */ -void -printObjStackprintContents(sqInt objStack, sqInt printContents) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - if (objStack == GIV(nilObj)) { - /* begin print: */ - fprintf(GIV(transcript), "nil"); - cr(); - } - else { - printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((int)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, printContents); - } -} - -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsExcept: */ -EXPORT(void) NeverInline +void NeverInline printOopsExcept(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45599,12 +45173,10 @@ printOopsExcept(sqInt (*function)(sqInt)) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsFrom:to: */ -EXPORT(void) +void printOopsFromto(sqInt startAddress, sqInt endAddress) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstNonEntity; @@ -45657,12 +45229,10 @@ printOopsFromto(sqInt startAddress, sqInt endAddress) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsSuchThat: */ -EXPORT(void) NeverInline +void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45781,12 +45351,10 @@ printOopsSuchThat(sqInt (*function)(sqInt)) /* Scan the heap printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printReferencesTo: */ -EXPORT(void) +void printReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -46022,13 +45590,11 @@ printStringDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printUnmarkedOops */ #if LLDB -EXPORT(void) +void printUnmarkedOops(void) { printOopsExcept(isMarked); @@ -46630,12 +46196,10 @@ shortentoIndexableSize(sqInt objOop, sqInt indexableSize) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#shortPrintObjectsFrom:to: */ -EXPORT(void) +void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -46773,7 +46337,7 @@ startOfObject(sqInt objOop) /* Part of InterpreterProxy's 1.14 API */ /* SpurMemoryManager>>#statNumGCs */ -EXPORT(sqInt) +sqInt statNumGCs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT return (GIV(statScavenges) + GIV(statIncrGCs)) + GIV(statFullGCs); @@ -46815,13 +46379,21 @@ storeCheckBoundary(void) The primitive can fail for the following reasons with the specified failure codes: - PrimErrGenericError: the segmentWordArray is too small for the version - stamp PrimErrWritePastObject: the segmentWordArray is too small to contain - the reachable objects - PrimErrBadIndex: the outPointerArray is too small - PrimErrNoMemory: additional allocations failed + PrimErrGenericFailure: the segmentWordArray is too small for the version + stamp PrimErrWritePastObject: the segmentWordArray is too small to + contain the reachable objects + PrimErrBadIndex: the outPointerArray is too small + PrimErrNoMemory: there is insufficient free space to store the array + answered by objectsReachableFromRoots:, + or the savedFirstFields and savedOutHashes arrays. + PrimErrNeedCompaction: a GC is needed to make room for the array answered + by objectsReachableFromRoots: PrimErrLimitExceeded: there is no room in the hash field to store out - pointer indices or class references. */ + pointer indices or class references, + or the outPointerArray is larger than the max value of the hash field. + PrimErrNoModification: the segmentWordArrayArg or outPointerArrayArg are + immutable PrimErrObjectIsPinned: the segmentWordArrayArg or + outPointerArrayArg are pinned */ /* SpurMemoryManager>>#storeImageSegmentInto:outPointers:roots: */ static sqInt NoDbgRegParms @@ -47076,6 +46648,7 @@ storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt val /* Note must check here for stores of young objects into old ones. */ +/* See SistaCogit */ /* SpurMemoryManager>>#storePointer:ofObject:withValue: */ sqInt @@ -47170,7 +46743,8 @@ sufficientSpaceAfterGC(sqInt numBytes) assert(numBytes == 0); scavengingGCTenuringIf(TenureByAge); - heapSizePostGC = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + heapSizePostGC = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); if (((((double) (heapSizePostGC - GIV(heapSizeAtPreviousGC)) )) / GIV(heapSizeAtPreviousGC)) >= GIV(heapGrowthToSizeGCRatio)) { fullGC(); } @@ -47781,6 +47355,9 @@ validClassTableRootPages(void) return 1; } + +/* useful for debugging */ + /* SpurMemoryManager>>#validFreeTree */ sqInt validFreeTree(void) @@ -48187,6 +47764,7 @@ copyAndUnmarkMobileObjects(void) usqInt previousPin; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt start; usqInt startOfPreviousPin; usqInt toFinger; @@ -48264,19 +47842,16 @@ copyAndUnmarkMobileObjects(void) assert((isMarked(previousPin)) && (isPinned(previousPin))); /* begin unmarkPinned: */ - if (!(((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(previousPin)); + } + else { setIsMarkedOfto(previousPin, 0); /* begin notePinned: */ assert(isPinned(previousPin)); - if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(previousPin, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), previousPin)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(previousPin)))); + seg = segmentContainingObj(previousPin); + (seg->containsPinned = 1); } toFinger = addressAfter(previousPin); /* begin objectStartingAt: */ @@ -48517,6 +48092,7 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) usqInt numSlots; sqInt obj; usqInt objStart; + SpurSegmentInfo *seg; usqInt toFinger; toFinger = initialToFinger; @@ -48539,19 +48115,16 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) if ((((((usqInt)((longAt(obj + 4)))) >> (markedBitHalfShift())) & 1) != 0) && (((((usqInt)((longAt(obj)))) >> (pinnedBitShift())) & 1) != 0)) { /* begin unmarkPinned: */ - if (!(((longAt(obj)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(obj)); + } + else { setIsMarkedOfto(obj, 0); /* begin notePinned: */ assert(isPinned(obj)); - if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(obj, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), obj)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(obj)))); + seg = segmentContainingObj(obj); + (seg->containsPinned = 1); } if (toFinger < objStart) { /* begin addFreeChunkWithBytes:at: */ @@ -48962,6 +48535,7 @@ unmarkObjectsFromFirstFreeObject(void) sqInt objOop; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt startOfFree; startOfFree = 0; @@ -48984,19 +48558,16 @@ unmarkObjectsFromFirstFreeObject(void) } if (((((usqInt)((longAt(objOop)))) >> (pinnedBitShift())) & 1) != 0) { /* begin unmarkPinned: */ - if (!(((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(objOop)); + } + else { setIsMarkedOfto(objOop, 0); /* begin notePinned: */ assert(isPinned(objOop)); - if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { - setIsMarkedOfto(objOop, 1); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), objOop)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(objOop)))); + seg = segmentContainingObj(objOop); + (seg->containsPinned = 1); } } else { @@ -50020,9 +49591,11 @@ collapseSegmentsPostSwizzle(void) GIV(canSwizzle) = 0; GIV(numSegments) = 1; + /* begin computeTotalHeapSizeIncludingBridges */ + GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()); cascade0 = (&(GIV(segments)[0])); (cascade0->segStart = oldSpaceStart()); - (cascade0->segSize = (GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()))); + (cascade0->segSize = GIV(totalHeapSizeIncludingBridges)); assert(isSegmentBridge(bridgeAt(0))); assert((numSlotsOfAny(bridgeAt(0))) == 0); } @@ -50204,7 +49777,6 @@ prepareForSnapshot(void) usqInt followingWordAddress; usqInt freeChunk; sqInt i; - sqInt i1; sqInt largeChild; sqInt limit; sqInt newEndOfMemory; @@ -50252,24 +49824,16 @@ prepareForSnapshot(void) followingWordAddress = addressAfter(node); if (oopisGreaterThanOrEqualTo(followingWordAddress, limit)) { next = limit; - goto l9; + goto l7; } flag("endianness"); followingWord = longAt(followingWordAddress + 4); next = ((((usqInt)(followingWord)) >> (numSlotsHalfShift())) == (numSlotsMask()) ? followingWordAddress + BaseHeaderSize : followingWordAddress); - l9: /* end objectAfter:limit: */; + l7: /* end objectAfter:limit: */; if (((longAt(next)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin segmentContainingObj: */ - for (i1 = (GIV(numSegments) - 1); i1 >= 0; i1 += -1) { - if (node >= (((GIV(segments)[i1]).segStart))) { - seg = (&(GIV(segments)[i1])); - goto l8; - } - } - seg = null; - l8: /* end segmentContainingObj: */; + seg = segmentContainingObj(node); (seg->lastFreeObject = node); node = 0; } @@ -50384,17 +49948,51 @@ readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes) return totalBytesRead; } + +/* Answer the segment containing an object. This is mostly for assert + checking, but + variations on the incremental GC may use it in anger. Binary search is (of + course) marginally slower than linear search for a single segment (e.g. in + a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every + old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or + 20% faster + in the same heap extended with enough large arrays to require 11 segments; + and this + is pessimal; there are fewer objects at high addresses since the large + arrays are there). */ + /* SpurSegmentManager>>#segmentContainingObj: */ -EXPORT(SpurSegmentInfo *) +SpurSegmentInfo * segmentContainingObj(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; + sqInt high; + sqInt low; + sqInt mid; + SpurSegmentInfo *seg; - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - return (&(GIV(segments)[i])); + low = 0; + mid = GIV(numSegments) / 2; + high = GIV(numSegments) - 1; + do { + seg = (&(GIV(segments)[mid])); + if (oopisGreaterThanOrEqualTo(objOop, (seg->segStart))) { + if (mid == high) { + return (oopisLessThan(objOop, ((seg->segSize)) + ((seg->segStart))) + ? seg + : 0); + } + else { + low = mid; + mid = ((mid + high) + 1) / 2; + } } - } + else { + high = mid - 1; + mid = (low + mid) / 2; + } + } while(low <= high); return null; } @@ -50571,6 +50169,9 @@ swizzleObj(sqInt objOop) return objOop + (((GIV(segments)[0]).swizzle)); } + +/* This ``slow'' count is for asserts only. */ + /* SpurSegmentManager>>#totalBytesInSegments */ static usqInt totalBytesInSegments(void) @@ -50582,7 +50183,6 @@ totalBytesInSegments(void) for (i = 0; i < GIV(numSegments); i += 1) { total += ((GIV(segments)[i]).segSize); } - assert(GIV(totalHeapSizeIncludingBridges) == total); return total; } @@ -50691,12 +50291,10 @@ accessorDepthForPrimitiveMethod(sqInt aMethodObj) /* Answer the current activeProcess. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#activeProcess */ -EXPORT(sqInt) +sqInt activeProcess(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt objOop; @@ -51198,7 +50796,7 @@ booleanValueOf(sqInt obj) /* Re-enter the interpreter to execute a (non-Alien) callback. */ /* StackInterpreter>>#callbackEnter: */ -EXPORT(sqInt) +sqInt callbackEnter(sqInt *callbackID) { warning("callbackEnter: is obsolete"); @@ -51209,7 +50807,7 @@ callbackEnter(sqInt *callbackID) /* Leave from a previous callback */ /* StackInterpreter>>#callbackLeave: */ -EXPORT(sqInt) +sqInt callbackLeave(sqInt cbID) { warning("callbackLeave: is obsolete"); @@ -51263,12 +50861,10 @@ characterForAscii(sqInt ascii) /* Ensure that all accessible objects in the heap are okay. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkAllAccessibleObjectsOkay */ -EXPORT(sqInt) +sqInt checkAllAccessibleObjectsOkay(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -51770,12 +51366,10 @@ checkOkayFields(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkOkayInterpreterObjects: */ -EXPORT(sqInt) +sqInt checkOkayInterpreterObjects(sqInt writeBack) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -52198,19 +51792,10 @@ contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP) /* StackInterpreter>>#copiedValueCountOfClosure: */ sqInt -copiedValueCountOfClosure(sqInt closurePointer) -{ - return (numSlotsOf(closurePointer)) - ClosureFirstCopiedValueIndex; -} - - -/* for Cogit */ - - /* StackInterpreter>>#copiedValueCountOfFullClosure: */ -sqInt -copiedValueCountOfFullClosure(sqInt closurePointer) +copiedValueCountOfClosure(sqInt closureObj) { - return (numSlotsOf(closurePointer)) - FullClosureFirstCopiedValueIndex; + return (assert(isVanillaBlockClosure(closureObj)), + (numSlotsOf(closureObj)) - ClosureFirstCopiedValueIndex); } @@ -52740,7 +52325,7 @@ dumpPrimTraceLog(void) */ /* StackInterpreter>>#dumpPrimTraceLogOn: */ -EXPORT(void) +void dumpPrimTraceLogOn(FILE *aStdioStream) { } @@ -54570,19 +54155,6 @@ fullDisplayUpdate(void) } -/* Find an actual function pointer for this primitiveIndex. This is an - opportunity to specialise the prim for the relevant class (format for - example). Default for now is simply the entry in the base primitiveTable. */ - - /* StackInterpreter>>#functionPointerFor:inClass: */ -void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) -{ - return (primIdx > MaxPrimitiveIndex - ? 0 - : primitiveTable[primIdx]); -} - - /* Answer an array of flags indicating various optional features of the Cog VM. If the bit is set then... Bit 0: supports two bytecode sets (MULTIPLEBYTECODESETS) @@ -55625,6 +55197,21 @@ isSingleContext(sqInt aContext) } +/* Answer if aClosure is a vanilla BlockClosure as in the first Cog release, + BlockClosure laid out as + 'outerContext, startpc, numArgs. FullBlockClosure is laid out as + outerContext, method, numArgs, receiver. + So either answer true if we're not supporting FullBlockClosure, or test + the startpc/method field. */ + + /* StackInterpreter>>#isVanillaBlockClosure: */ +static sqInt NoDbgRegParms +isVanillaBlockClosure(sqInt aClosure) +{ + return 1; +} + + /* See if the argument is married to a live frame or not. i.e. see if there is a matching frame whose frameContext field is aOnceMarriedContext, or a forwarder to @@ -56041,12 +55628,10 @@ loadInitialContext(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#longPrintOop: */ -EXPORT(void) +void longPrintOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -59056,19 +58641,6 @@ pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod return pcPreviousToinSqueakV3PlusClosuresMethod(theIP, aMethod); } - /* StackInterpreter>>#penultimateLiteralOf: */ -sqInt -penultimateLiteralOf(sqInt aMethodOop) -{ - sqInt offset; - - assert(isOopCompiledMethod(aMethodOop)); - /* begin literal:ofMethod: */ - offset = (literalCountOf(aMethodOop)) - 2; - /* begin fetchPointer:ofObject: */ - return longAt((aMethodOop + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); -} - /* In the StackInterpreter stacks grow down. */ @@ -59929,12 +59501,10 @@ printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObjec /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacks */ -EXPORT(void) +void printAllStacks(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -60133,12 +59703,10 @@ printAllStacks(void) /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacksOn: */ -EXPORT(void) +void printAllStacksOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -60153,12 +59721,10 @@ printAllStacksOn(FILE *aStdioStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStack */ -EXPORT(void) +void printCallStack(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (GIV(framePointer) == null) { @@ -60192,12 +59758,10 @@ printCallStackFP(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOf: */ -EXPORT(sqInt) +sqInt printCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -60289,12 +59853,10 @@ printCallStackOfcurrentFP(sqInt aContext, char *currFP) /* Print the call stack on a specific output stream. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOn: */ -EXPORT(void) +void printCallStackOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -60328,12 +59890,10 @@ printContextCallStackOf(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printContext: */ -EXPORT(void) +void printContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -60453,12 +60013,10 @@ printContext(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printExternalHeadFrame */ -EXPORT(void) +void printExternalHeadFrame(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFrameWithSP(GIV(framePointer), GIV(stackPointer)); @@ -60539,19 +60097,20 @@ printFrameOopat(char *name, char *address) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFramesInPage: */ -EXPORT(void) +void printFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 0); } + +/* useful for VM debugging */ + /* StackInterpreter>>#printFramesOnStackPageListInUse */ -EXPORT(void) +void printFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -60624,12 +60183,10 @@ printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame: */ -EXPORT(sqInt) +sqInt printFrame(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *aFrame; @@ -60713,12 +60270,10 @@ printFrame(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame:WithSP: */ -EXPORT(sqInt) +sqInt printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -60772,18 +60327,6 @@ printFrameWithSP(char *theFP, char *theSP) } -/* Print n in hex, in the form '0x1234', unpadded */ - - /* StackInterpreter>>#printHexnp: */ -sqInt -printHexnp(usqInt n) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return fprintf(GIV(transcript), - "%p", - ((void *)n)); -} - - /* Print p in hex, unpadded, in the form 0x1234 (C)/16r1234 (here) */ /* StackInterpreter>>#printHexPtrnp: */ @@ -60815,12 +60358,10 @@ printHex(usqInt n) /* Print all methods whose penultimate literal is either selector, or an object whose first inst var is the method and whose second is selector (e.g. an AdditionalMethodState). */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printLikelyImplementorsOfSelector: */ -EXPORT(void) +void printLikelyImplementorsOfSelector(sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -60898,12 +60439,10 @@ printLikelyImplementorsOfSelector(sqInt selector) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCache */ -EXPORT(void) +void printMethodCache(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -60993,12 +60532,10 @@ printMethodCache(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCacheFor: */ -EXPORT(void) +void printMethodCacheFor(sqInt thing) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -61092,12 +60629,10 @@ printMethodCacheFor(sqInt thing) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionaryOf: */ -EXPORT(void) +void printMethodDictionaryOf(sqInt behavior) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt dictionary; @@ -61140,12 +60675,10 @@ printMethodDictionaryOf(sqInt behavior) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionary: */ -EXPORT(void) +void printMethodDictionary(sqInt dictionary) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt index; @@ -61428,10 +60961,10 @@ printOopShortInner(sqInt oop) } -/* use export: not api, so it won't be written to cointerp.h */ +/* useful for VM debugging */ /* StackInterpreter>>#printOop: */ -EXPORT(void) +void printOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -61613,12 +61146,10 @@ printOop(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcessStack: */ -EXPORT(void) +void printProcessStack(sqInt aProcess) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ctx; @@ -61657,12 +61188,10 @@ printProcessStack(sqInt aProcess) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcsOnList: */ -EXPORT(sqInt) +sqInt printProcsOnList(sqInt procList) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstProc; @@ -61688,12 +61217,10 @@ printProcsOnList(sqInt procList) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackCallStackOf: */ -EXPORT(sqInt) +sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -61726,12 +61253,10 @@ printStackCallStackOf(sqInt aContextOrProcessOrFrame) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageList */ -EXPORT(void) +void printStackPageList(void) { StackPage *page; @@ -61745,12 +61270,10 @@ printStackPageList(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageListInUse */ -EXPORT(void) +void printStackPageListInUse(void) { sqInt n; @@ -61767,12 +61290,10 @@ printStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPages */ -EXPORT(void) +void printStackPages(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -61787,12 +61308,10 @@ printStackPages(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPagesInUse */ -EXPORT(void) +void printStackPagesInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -61918,12 +61437,10 @@ printStackPageuseCount(StackPage *page, sqInt n) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackReferencesTo: */ -EXPORT(void) +void printStackReferencesTo(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *callerFP; @@ -62301,7 +61818,7 @@ putWord32toFile(int aWord32, sqImageFile aFile) } -/* Anwer true if images of the given format are readable by this interpreter. +/* Anwer if images of the given format are readable by this interpreter. Allows a virtual machine to accept selected older image formats. */ /* StackInterpreter>>#readableFormat: */ @@ -62752,7 +62269,7 @@ reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader) and mark calloutContext as dead. */ /* StackInterpreter>>#reestablishContextPriorToCallback: */ -EXPORT(sqInt) +sqInt reestablishContextPriorToCallback(sqInt callbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; @@ -63284,7 +62801,7 @@ retryPrimitiveOnFailure(void) and mark callbackMethodContext as dead. */ /* StackInterpreter>>#returnAs:ThroughCallback:Context: */ -EXPORT(sqInt) +sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutMethodContext; @@ -63615,7 +63132,7 @@ saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex) arguments on primitive return. */ /* StackInterpreter>>#sendInvokeCallbackContext: */ -EXPORT(sqInt) +sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classTag; @@ -63760,12 +63277,10 @@ GIV(bytecodeSetSelector) = ((((int) methodHeader)) < 0 } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakMNUSelector: */ -EXPORT(void) +void setBreakMNUSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -63779,12 +63294,10 @@ setBreakMNUSelector(char *aString) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakSelector: */ -EXPORT(void) +void setBreakSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -63805,7 +63318,7 @@ setFullScreenFlag(sqInt value) } /* StackInterpreter>>#setInterruptCheckChain: */ -EXPORT(void *) +void * setInterruptCheckChain(void (*aFunction)()) { void (*prevFunction)(); @@ -63927,6 +63440,7 @@ static sqInt NoDbgRegParms shortPrintContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt home; + sqInt rcvr; sqInt senderOop; char *theFP; @@ -63964,15 +63478,16 @@ shortPrintContext(sqInt aContext) if (home == null) { /* begin print: */ fprintf(GIV(transcript), " BOGUS CONTEXT (can't determine home)"); + cr(); } else { - printActivationNameForreceiverisBlockfirstTemporary(fetchPointerofObject(MethodIndex, (!(home) - ? aContext - : home)), (home == null - ? /* begin nilObject */ GIV(nilObj) - : (longAt((home + BaseHeaderSize) + (((int)((usqInt)(ReceiverIndex) << (shiftForWord()))))))), home != aContext, longAt((home + BaseHeaderSize) + (((int)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin fetchPointer:ofObject: */ + rcvr = longAt((home + BaseHeaderSize) + (((int)((usqInt)(ReceiverIndex) << (shiftForWord()))))); + printActivationNameForreceiverisBlockfirstTemporary(longAt((aContext + BaseHeaderSize) + (((int)((usqInt)(MethodIndex) << (shiftForWord()))))), rcvr, home != aContext, longAt((home + BaseHeaderSize) + (((int)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin space */ + printChar(' '); + shortPrintOop(rcvr); } - cr(); return 0; } @@ -63992,19 +63507,20 @@ shortPrintFrameAndCallers(char *theFP) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFramesInPage: */ -EXPORT(void) +void shortPrintFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 1); } + +/* useful for VM debugging */ + /* StackInterpreter>>#shortPrintFramesOnStackPageListInUse */ -EXPORT(void) +void shortPrintFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -64051,12 +63567,10 @@ shortPrintFrame(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFrame:AndNCallers: */ -EXPORT(void) +void shortPrintFrameAndNCallers(char *theFP, sqInt n) { DECL_MAYBE_SQ_GLOBAL_STRUCT if ((n != 0) @@ -66529,12 +66043,10 @@ wakeHighestPriority(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#whereIs: */ -EXPORT(char *) +char * whereIs(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *where; @@ -71482,7 +70994,8 @@ primitiveUnloadModule(void) 48 various header flags. See getImageHeaderFlags. 49 max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing) - 50 max literal count for JIT compile (stored in image file header; Cog + + 50 max literal count for JIT compile (stored in image file header; Cog only; otherwise nil) 51 nil; reserved for VM parameters that persist in the image (such as eden above) 52 root/remembered table capacity @@ -71622,7 +71135,8 @@ primitiveVMParameter(void) /* begin primitiveAllVMParameters: */ result1 = instantiateClassindexableSize(splObj(ClassArray), paramsArraySize); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer8 = positiveMachineIntegerFor(totalBytesInSegments()); + valuePointer8 = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (0U << (shiftForWord())), valuePointer8); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -71630,7 +71144,8 @@ primitiveVMParameter(void) assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (1U << (shiftForWord())), valuePointer9); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (2U << (shiftForWord())), valuePointer10); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -71966,7 +71481,8 @@ primitiveVMParameter(void) /* begin primitiveGetVMParameter: */ switch (index) { case 1: - result = positiveMachineIntegerFor(totalBytesInSegments()); + result = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); goto l93; break; case 2: @@ -71974,7 +71490,8 @@ primitiveVMParameter(void) goto l93; break; case 3: - result = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + result = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); goto l93; break; case 6: @@ -72927,17 +72444,6 @@ unmarkAllFrames(void) static char _m[] = ""; void* vm_exports[][3] = { - {(void*)_m, "activeProcess", (void*)activeProcess}, - {(void*)_m, "callbackEnter", (void*)callbackEnter}, - {(void*)_m, "callbackLeave", (void*)callbackLeave}, - {(void*)_m, "checkAllAccessibleObjectsOkay", (void*)checkAllAccessibleObjectsOkay}, - {(void*)_m, "checkOkayInterpreterObjects", (void*)checkOkayInterpreterObjects}, - {(void*)_m, "dumpPrimTraceLogOn", (void*)dumpPrimTraceLogOn}, - {(void*)_m, "inOrderPrintFreeTreeprintList", (void*)inOrderPrintFreeTreeprintList}, - {(void*)_m, "longPrintInstancesOf", (void*)longPrintInstancesOf}, - {(void*)_m, "longPrintInstancesWithClassIndex", (void*)longPrintInstancesWithClassIndex}, - {(void*)_m, "longPrintOop", (void*)longPrintOop}, - {(void*)_m, "longPrintReferencesTo", (void*)longPrintReferencesTo}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, {(void*)_m, "primitiveAddLargeIntegers\000\000\001", (void*)primitiveAddLargeIntegers}, {(void*)_m, "primitiveAllInstances\000\000\000", (void*)primitiveAllInstances}, @@ -73001,69 +72507,5 @@ void* vm_exports[][3] = { #endif /* TestingPrimitives */ {(void*)_m, "primitiveUtcWithOffset\000\001\000", (void*)primitiveUtcWithOffset}, {(void*)_m, "primitiveVoidReceiver\000\377\000", (void*)primitiveVoidReceiver}, - {(void*)_m, "printActivationsOf", (void*)printActivationsOf}, - {(void*)_m, "printAllStacks", (void*)printAllStacks}, - {(void*)_m, "printAllStacksOn", (void*)printAllStacksOn}, - {(void*)_m, "printBogons", (void*)printBogons}, - {(void*)_m, "printCallStack", (void*)printCallStack}, - {(void*)_m, "printCallStackOf", (void*)printCallStackOf}, - {(void*)_m, "printCallStackOn", (void*)printCallStackOn}, - {(void*)_m, "printContextReferencesTo", (void*)printContextReferencesTo}, - {(void*)_m, "printContext", (void*)printContext}, - {(void*)_m, "printEntity", (void*)printEntity}, - {(void*)_m, "printExternalHeadFrame", (void*)printExternalHeadFrame}, - {(void*)_m, "printForwarders", (void*)printForwarders}, - {(void*)_m, "printFramesInPage", (void*)printFramesInPage}, - {(void*)_m, "printFramesOnStackPageListInUse", (void*)printFramesOnStackPageListInUse}, - {(void*)_m, "printFrame", (void*)printFrame}, - {(void*)_m, "printFrameWithSP", (void*)printFrameWithSP}, - {(void*)_m, "printFreeChunk", (void*)printFreeChunk}, - {(void*)_m, "printFreeListHeads", (void*)printFreeListHeads}, - {(void*)_m, "printFreeList", (void*)printFreeList}, - {(void*)_m, "printFreeTree", (void*)printFreeTree}, - {(void*)_m, "printHeaderOf", (void*)printHeaderOf}, - {(void*)_m, "printInstancesOf", (void*)printInstancesOf}, - {(void*)_m, "printInstancesWithClassIndex", (void*)printInstancesWithClassIndex}, - {(void*)_m, "printLikelyImplementorsOfSelector", (void*)printLikelyImplementorsOfSelector}, -#if LLDB - {(void*)_m, "printMarkedOops", (void*)printMarkedOops}, -#endif /* LLDB */ - {(void*)_m, "printMethodCache", (void*)printMethodCache}, - {(void*)_m, "printMethodCacheFor", (void*)printMethodCacheFor}, - {(void*)_m, "printMethodDictionaryOf", (void*)printMethodDictionaryOf}, - {(void*)_m, "printMethodDictionary", (void*)printMethodDictionary}, - {(void*)_m, "printMethodImplementorsOf", (void*)printMethodImplementorsOf}, - {(void*)_m, "printMethodReferencesTo", (void*)printMethodReferencesTo}, - {(void*)_m, "printObjectsFromto", (void*)printObjectsFromto}, - {(void*)_m, "printObjectsWithHash", (void*)printObjectsWithHash}, - {(void*)_m, "printOopsExcept", (void*)printOopsExcept}, - {(void*)_m, "printOopsFromto", (void*)printOopsFromto}, - {(void*)_m, "printOopsSuchThat", (void*)printOopsSuchThat}, - {(void*)_m, "printOop", (void*)printOop}, - {(void*)_m, "printProcessStack", (void*)printProcessStack}, - {(void*)_m, "printProcsOnList", (void*)printProcsOnList}, - {(void*)_m, "printReferencesTo", (void*)printReferencesTo}, - {(void*)_m, "printStackCallStackOf", (void*)printStackCallStackOf}, - {(void*)_m, "printStackPageList", (void*)printStackPageList}, - {(void*)_m, "printStackPageListInUse", (void*)printStackPageListInUse}, - {(void*)_m, "printStackPages", (void*)printStackPages}, - {(void*)_m, "printStackPagesInUse", (void*)printStackPagesInUse}, - {(void*)_m, "printStackReferencesTo", (void*)printStackReferencesTo}, -#if LLDB - {(void*)_m, "printUnmarkedOops", (void*)printUnmarkedOops}, -#endif /* LLDB */ - {(void*)_m, "reestablishContextPriorToCallback", (void*)reestablishContextPriorToCallback}, - {(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext}, - {(void*)_m, "segmentContainingObj", (void*)segmentContainingObj}, - {(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext}, - {(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector}, - {(void*)_m, "setBreakSelector", (void*)setBreakSelector}, - {(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain}, - {(void*)_m, "shortPrintFramesInPage", (void*)shortPrintFramesInPage}, - {(void*)_m, "shortPrintFramesOnStackPageListInUse", (void*)shortPrintFramesOnStackPageListInUse}, - {(void*)_m, "shortPrintFrameAndNCallers", (void*)shortPrintFrameAndNCallers}, - {(void*)_m, "shortPrintObjectsFromto", (void*)shortPrintObjectsFromto}, - {(void*)_m, "statNumGCs", (void*)statNumGCs}, - {(void*)_m, "whereIs", (void*)whereIs}, {NULL, NULL, NULL} }; diff --git a/src/spur64.cog.lowcode/cogit.h b/src/spur64.cog.lowcode/cogit.h index 3229017f8b..c7b386282a 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.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -26,6 +26,7 @@ extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMetho extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); +extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern CogMethod * cogFullBlockMethodnumCopied(sqInt aMethodObj, sqInt numCopied); extern void cogitPostGCAction(sqInt gcMode); diff --git a/src/spur64.cog.lowcode/cogitARMv8.c b/src/spur64.cog.lowcode/cogitARMv8.c index 0a6e335d90..4fb9a2709f 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.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -9486,7 +9486,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.cog.lowcode/cogitX64SysV.c b/src/spur64.cog.lowcode/cogitX64SysV.c index 02f6ae94df..82cd2d336d 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.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4805,7 +4805,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.cog.lowcode/cogitX64WIN64.c b/src/spur64.cog.lowcode/cogitX64WIN64.c index 968c7ac3f4..0dd4445956 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.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4805,7 +4805,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.cog.newspeak/cogit.h b/src/spur64.cog.newspeak/cogit.h index 394a1b2caa..520c5edbb6 100644 --- a/src/spur64.cog.newspeak/cogit.h +++ b/src/spur64.cog.newspeak/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -23,31 +23,24 @@ extern sqInt abortOffset(void); extern void addCogMethodsToHeapMap(void); extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMethod *cogMethod); -extern void callCogCodePopReceiver(void); -extern void callCogCodePopReceiverAndClassRegs(void); -extern void ceFree(void *pointer); extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern void cogitPostGCAction(sqInt gcMode); -extern sqInt cogMethodDoesntLookKosher(CogMethod *cogMethod); extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs); extern CogMethod * cogselector(sqInt aMethodObj, sqInt aSelectorOop); extern void compactCogCompiledCode(void); extern sqInt defaultCogCodeSize(void); -extern void enterCogCodePopReceiver(void); extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); extern void flagCogMethodForBecome(CogMethod *cogMethod); extern void followForwardedLiteralsIn(CogMethod *cogMethod); -extern void followForwardedMethods(void); extern void followMovableLiteralsAndUpdateYoungReferrers(void); extern void freeBecomeFlaggedMethods(void); extern void freeCogMethod(CogMethod *cogMethod); extern void freeUnmarkedMachineCode(void); extern void initializeCodeZoneFromupTo(sqInt startAddress, sqInt endAddress); -extern sqInt isPCWithinMethodZone(void *address); extern sqInt isSendReturnPC(sqInt retpc); extern void linkNSSendCacheclassTagenclosingObjecttargetcaller(NSSendCache *nsSendCache, sqInt classTag, sqInt enclosingObject, CogMethod *targetMethod, CogMethod *callingMethod); extern void linkSendAtintooffsetreceiver(sqInt callSiteReturnAddress, CogMethod *sendingMethod, CogMethod *targetMethod, sqInt theEntryOffset, sqInt receiver); @@ -58,17 +51,12 @@ extern usqInt maxCogMethodAddress(void); extern usqInt mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogBlockMethod *cogMethod); extern sqInt mnuOffset(void); extern sqInt patchToOpenPICFornumArgsreceiver(sqInt selector, sqInt numArgs, sqInt receiver); -extern void printCogMethodFor(void *address); -extern void printTrampolineTable(void); -extern sqInt recordPrimTraceFunc(void); -extern void setBreakMethod(sqInt anObj); extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop); extern sqInt traceLinkedSendOffset(void); extern void unflagBecomeFlaggedMethods(void); extern void unlinkAllSends(void); extern void unlinkSendsLinkedForInvalidClasses(void); extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector); -extern void unlinkSendsToFree(void); extern void unlinkSendsToMethodsSuchThatAndFreeIf(sqInt (*criterion)(CogMethod *), sqInt freeIfTrue); extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue); extern void voidCogCompiledCode(void); @@ -78,15 +66,7 @@ extern CogMethod * methodFor(void *address); extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj); extern sqInt numMethods(void); extern sqInt numMethodsOfType(sqInt cogMethodType); -extern void printCogMethods(void); -extern void printCogMethodsOfType(sqInt cmType); -extern void printCogMethodsWithMethod(sqInt methodOop); -extern void printCogMethodsWithPrimitive(sqInt primIdx); -extern void printCogMethodsWithSelector(sqInt selectorOop); -extern void printCogYoungReferrers(void); -extern sqInt printOpenPICList(void); -extern sqInt pruneYoungReferrers(void); -EXPORT(char *) whereIsMaybeCodeThing(sqInt anOop); +extern char * whereIsMaybeCodeThing(sqInt anOop); extern sqInt cogMethodHasExternalPrim(CogMethod *aCogMethod); extern sqInt cogMethodHasMachineCodePrim(CogMethod *aCogMethod); extern sqInt genQuickReturnConst(void); @@ -99,7 +79,6 @@ extern void callCogCodePopReceiverArg1Arg0Regs(void); /*** Global Variables ***/ extern sqInt blockNoContextSwitchOffset; -extern sqInt breakPC; extern sqInt cbEntryOffset; extern sqInt cbNoSwitchEntryOffset; extern sqInt ceBaseFrameReturnTrampoline; @@ -121,26 +100,15 @@ extern sqInt ceReturnToInterpreterTrampoline; #if COGMTVM extern usqIntptr_t (*ceTryLockVMOwner)(usqIntptr_t); #endif -#if !defined(cFramePointerInUse) -extern sqInt cFramePointerInUse; -#endif extern sqInt cmEntryOffset; extern sqInt cmNoCheckEntryOffset; extern usqInt methodZoneBase; extern sqInt missOffset; -extern void (*realCECallCogCodePopReceiverAndClassRegs)(void); -extern void (*realCECallCogCodePopReceiverArg0Regs)(void); -extern void (*realCECallCogCodePopReceiverArg1Arg0Regs)(void); -extern void (*realCECallCogCodePopReceiverReg)(void); -extern void (*realCEEnterCogCodePopReceiverReg)(void); extern int traceFlags ; -extern const char * traceFlagsMeanings[] ; -extern sqInt traceStores; /*** Macros ***/ #define blockAlignment() 8 -#define breakOnImplicitReceiver() (traceFlags & 256) #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline) #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline) diff --git a/src/spur64.cog.newspeak/cogitARMv8.c b/src/spur64.cog.newspeak/cogitARMv8.c index a432f54492..0520be667e 100644 --- a/src/spur64.cog.newspeak/cogitARMv8.c +++ b/src/spur64.cog.newspeak/cogitARMv8.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -688,10 +688,10 @@ static AbstractInstruction * NoDbgRegParms CallNewspeakSend(sqInt callTarget); static AbstractInstruction * NoDbgRegParms CallRTregistersToBeSavedMask(sqInt callTarget, sqInt registersToBeSaved); static AbstractInstruction * NoDbgRegParms gCall(sqInt callTarget); static AbstractInstruction * NoDbgRegParms gCmpCqR(sqInt quickConstant, sqInt reg); -extern void callCogCodePopReceiver(void); -extern void callCogCodePopReceiverAndClassRegs(void); +static void callCogCodePopReceiver(void); +static void callCogCodePopReceiverAndClassRegs(void); static sqInt NoDbgRegParms ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver); -extern void ceFree(void *pointer); +static void NoDbgRegParms ceFree(void *pointer); static void* NoDbgRegParms ceMalloc(size_t size); static sqInt NoDbgRegParms ceSICMiss(sqInt receiver); static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod); @@ -707,7 +707,7 @@ extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); static void NoDbgRegParms cogExtendPICCaseNMethodtagisMNUCase(CogMethod *cPIC, sqInt caseNMethod, sqInt caseNTag, sqInt isMNUCase); extern void cogitPostGCAction(sqInt gcMode); -extern sqInt cogMethodDoesntLookKosher(CogMethod *cogMethod); +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod); extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs); static CogMethod * NoDbgRegParms cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs); static CogMethod * NoDbgRegParms cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt numArgs, CogMethod *case0CogMethod, sqInt case1MethodOrNil, sqInt case1Tag, sqInt isMNUCase); @@ -742,7 +742,7 @@ static AbstractInstruction * NoDbgRegParms gDivRRQuoRem(sqInt rDivisor, sqInt rD extern sqInt defaultCogCodeSize(void); static sqInt NoDbgRegParms deltaToSkipPrimAndErrorStoreInheader(sqInt aMethodObj, sqInt aMethodHeader); static sqInt NoDbgRegParms endPCOf(sqInt aMethod); -extern void enterCogCodePopReceiver(void); +static void enterCogCodePopReceiver(void); static sqInt NoDbgRegParms entryPointTagIsSelector(sqInt entryPoint); static sqInt NoDbgRegParms expectedClosedPICPrototype(CogMethod *cPIC); static sqInt extABytecode(void); @@ -760,9 +760,6 @@ static BytecodeFixup * NoDbgRegParms fixupAt(sqInt fixupPC); extern void flagCogMethodForBecome(CogMethod *cogMethod); static void NoDbgRegParms followForwardedLiteralsImplementationIn(CogMethod *cogMethod); extern void followForwardedLiteralsIn(CogMethod *cogMethod); -extern void followForwardedMethods(void); -static sqInt NoDbgRegParms followMaybeObjRefInClosedPICAt(sqInt mcpc); -static sqInt NoDbgRegParms followMethodReferencesInClosedPIC(CogMethod *cPIC); extern void followMovableLiteralsAndUpdateYoungReferrers(void); extern void freeBecomeFlaggedMethods(void); extern void freeCogMethod(CogMethod *cogMethod); @@ -806,7 +803,7 @@ static sqInt initialMethodUsageCount(void); static sqInt initialOpenPICUsageCount(void); static sqInt NoDbgRegParms inverseBranchFor(sqInt opcode); static sqInt NoDbgRegParms isPCMappedAnnotation(sqInt annotation); -extern sqInt isPCWithinMethodZone(void *address); +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address); extern sqInt isSendReturnPC(sqInt retpc); static AbstractInstruction * NoDbgRegParms gJumpFPEqual(void *jumpTarget); static AbstractInstruction * NoDbgRegParms gJumpFPGreaterOrEqual(void *jumpTarget); @@ -885,7 +882,6 @@ static void NoDbgRegParms rewriteCPICCaseAttagobjReftarget(sqInt followingAddres static AbstractInstruction * NoDbgRegParms gSubCwR(sqInt wordConstant, sqInt reg); static AbstractInstruction * NoDbgRegParms gSubRRR(sqInt subReg, sqInt fromReg, sqInt destReg); static sqInt scanForCleanBlocks(void); -extern void setBreakMethod(sqInt anObj); extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop); static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC); static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc); @@ -907,7 +903,7 @@ static sqInt NoDbgRegParms unlinkIfLinkedSendpcignored(sqInt annotation, char *m static sqInt NoDbgRegParms unlinkIfLinkedSendpcto(sqInt annotation, char *mcpc, CogMethod *theCogMethod); extern void unlinkSendsLinkedForInvalidClasses(void); extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector); -extern void unlinkSendsToFree(void); +static void unlinkSendsToFree(void); extern void unlinkSendsToMethodsSuchThatAndFreeIf(sqInt (*criterion)(CogMethod *), sqInt freeIfTrue); extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue); extern void voidCogCompiledCode(void); @@ -942,7 +938,7 @@ extern void printCogMethodsWithPrimitive(sqInt primIdx); extern void printCogMethodsWithSelector(sqInt selectorOop); extern void printCogYoungReferrers(void); extern sqInt printOpenPICList(void); -extern sqInt pruneYoungReferrers(void); +static sqInt pruneYoungReferrers(void); static sqInt relocateAndPruneYoungReferrers(void); static sqInt relocateMethodsPreCompaction(void); static sqInt NoDbgRegParms removeFromOpenPICList(CogMethod *anOpenPIC); @@ -951,7 +947,7 @@ static sqInt NoDbgRegParms roundUpLength(sqInt numBytes); static void voidOpenPICList(void); static void voidUnpairedMethodList(void); static void voidYoungReferrersPostTenureAll(void); -EXPORT(char *) whereIsMaybeCodeThing(sqInt anOop); +extern char * whereIsMaybeCodeThing(sqInt anOop); static sqInt zoneAlignment(void); static sqInt NoDbgRegParms checkValidObjectReference(sqInt anOop); static AbstractInstruction * NoDbgRegParms genCmpClassFloatCompactIndexR(sqInt reg); @@ -5158,7 +5154,7 @@ dispatchConcretize(AbstractInstruction * self_in_dispatchConcretize) rn = ((self_in_dispatchConcretize->operands))[1]; assert(addressIsInCurrentCompilation((((self_in_dispatchConcretize->dependent))->address))); assert((((((self_in_dispatchConcretize->dependent))->address)) % 4) == 0); - assert((SQABS((((((self_in_dispatchConcretize->dependent))->address)) - ((self_in_dispatchConcretize->address))))) < (0x40000)); + assert((SQABS(((((usqInt)((((self_in_dispatchConcretize->dependent))->address)))) - (((usqInt)((self_in_dispatchConcretize->address))))))) < (0x40000)); ((self_in_dispatchConcretize->machineCode))[0] = (((0x18000000) + (((sqInt)((usqInt)((((((self_in_dispatchConcretize->dependent))->address)) - ((self_in_dispatchConcretize->address)))) << 3)))) + RISCTempReg); ((self_in_dispatchConcretize->machineCode))[1] = (((((0x6B200000) + (((sqInt)((usqInt)(RISCTempReg) << 16)))) + (((sqInt)((usqInt)(UXTX) << 13)))) + (rn << 5)) + XZR); return 8; @@ -5922,7 +5918,7 @@ emitMoveCwintoRat(AbstractInstruction * self_in_emitMoveCwintoRat, usqInt consta } assert(addressIsInCurrentCompilation((((self_in_emitMoveCwintoRat->dependent))->address))); assert((((((self_in_emitMoveCwintoRat->dependent))->address)) % 4) == 0); - assert((SQABS((((((self_in_emitMoveCwintoRat->dependent))->address)) - (((self_in_emitMoveCwintoRat->address)) + offsetBytes)))) < (0x100000)); + assert((SQABS(((((usqInt)((((self_in_emitMoveCwintoRat->dependent))->address)))) - (((usqInt)(((self_in_emitMoveCwintoRat->address)) + offsetBytes)))))) < (0x100000)); ((self_in_emitMoveCwintoRat->machineCode))[offsetBytes / 4] = (((0x58000000) + (((sqInt)((usqInt)(((((((self_in_emitMoveCwintoRat->dependent))->address)) - (((self_in_emitMoveCwintoRat->address)) + offsetBytes)) & (0x1FFFFF))) << 3)))) + destReg); return offsetBytes + 4; } @@ -7361,7 +7357,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; @@ -7371,7 +7367,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; } @@ -8535,12 +8531,11 @@ gCmpCqR(sqInt quickConstant, sqInt reg) } -/* This is a static version of ceCallCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverReg for break-pointing + when debugging in C. Marked so the code generator won't delete it. */ /* Cogit>>#callCogCodePopReceiver */ -void +static void callCogCodePopReceiver(void) { realCECallCogCodePopReceiverReg(); @@ -8550,12 +8545,12 @@ callCogCodePopReceiver(void) } -/* This is a static version of ceCallCogCodePopReceiverAndClassRegs - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverAndClassRegs for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#callCogCodePopReceiverAndClassRegs */ -void +static void callCogCodePopReceiverAndClassRegs(void) { realCECallCogCodePopReceiverAndClassRegs(); @@ -8569,6 +8564,7 @@ callCogCodePopReceiverAndClassRegs(void) receiver args sp=> sender return address */ +/* Marked so the code generator won't delete it. */ /* Cogit>>#ceCPICMiss:receiver: */ static sqInt NoDbgRegParms @@ -8684,13 +8680,23 @@ ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver) return null; } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceFree: */ -void +static void NoDbgRegParms ceFree(void *pointer) { free(pointer); } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceMalloc: */ static void* NoDbgRegParms ceMalloc(size_t size) @@ -8710,7 +8716,9 @@ ceMalloc(size_t size) sp=> ceMethodAbort call return address So we can find the method that did the failing entry check at ceMethodAbort call return address - missOffset - and we can find the send site from the outer return address. */ + and we can find the send site from the outer return address. + Invoked from a trampoline. Marked so the code generator won't delete + it. */ /* Cogit>>#ceSICMiss: */ static sqInt NoDbgRegParms @@ -8947,13 +8955,13 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * entryPoint = (nsSendCache->target); if (entryPoint != 0) { nsTargetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - if (!(asserta(isCMMethodEtAl(nsTargetMethod)))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) nsTargetMethod))))) { return 12; } } } if (annotation >= IsSendCall) { - if (!(asserta(isCMMethodEtAl(((CogMethod *) cogMethod))))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) cogMethod))))))) { return 3; } /* begin entryCacheTagAndCouldBeObjectAt:annotation:into: */ @@ -9044,9 +9052,9 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * } } targetMethod1 = ((CogMethod *) (entryPoint - offset1)); - if (!(asserta((isCMMethodEtAl(targetMethod1)) - || ((isCMClosedPIC(targetMethod1)) - || (isCMOpenPIC(targetMethod1)))))) { + if (!(asserta((isCMMethodEtAl(((CogBlockMethod *) targetMethod1))) + || ((isCMClosedPIC(((CogBlockMethod *) targetMethod1))) + || (isCMOpenPIC(((CogBlockMethod *) targetMethod1))))))) { return 10; } } @@ -9408,6 +9416,11 @@ codeEntryNameFor(char *address) return null; } + +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ + /* Cogit>>#cogCodeBase */ sqInt cogCodeBase(void) @@ -9637,7 +9650,7 @@ cogitPostGCAction(sqInt gcMode) the type. Answer 0 if it is ok, otherwise answer a code for the error. */ /* Cogit>>#cogMethodDoesntLookKosher: */ -sqInt +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod) { if (((((cogMethod->blockSize)) & (BytesPerWord - 1)) != 0) @@ -9773,7 +9786,7 @@ cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = 1; (writablePIC->cPICNumCases = 1); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 1); @@ -9903,7 +9916,7 @@ cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs) # else // __APPLE__ && __MACH__ ceFlushICache((((usqInt)pic)) - codeToDataDelta, ((((usqInt)pic)) - codeToDataDelta) + openPICSize); # endif - assert(isCMOpenPIC(pic)); + assert(isCMOpenPIC(((CogBlockMethod *) pic))); assert(((pic->selector)) == selector); assert(((pic->cmNumArgs)) == numArgs); assert((callTargetFromReturnAddress(backEnd, ((((sqInt)pic)) - codeToDataDelta) + missOffset)) == (picAbortTrampolineFor(numArgs))); @@ -9965,7 +9978,7 @@ cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt nu ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = isMNUCase; (writablePIC->cPICNumCases = 2); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 2); @@ -11046,8 +11059,8 @@ cPICCompactAndIsNowEmpty(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { if (i == 1) { return 1; @@ -11140,8 +11153,8 @@ cPICHasFreedTargets(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { return 1; } @@ -11237,7 +11250,7 @@ createCPICData(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); target = (targetMethod->methodObject); } storePointerUncheckedofObjectwithValue((i * 2) - 1, picData, class); @@ -11342,12 +11355,12 @@ endPCOf(sqInt aMethod) } -/* This is a static version of ceEnterCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceEnterCogCodePopReceiverReg for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#enterCogCodePopReceiver */ -void +static void enterCogCodePopReceiver(void) { realCEEnterCogCodePopReceiverReg(); @@ -11650,7 +11663,7 @@ findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if (startbcpc == (startPCOfMethodHeader((cogMethod->methodHeader)))) { return ((CogBlockMethod *) cogMethod); } @@ -11707,7 +11720,7 @@ fixupAt(sqInt fixupPC) void flagCogMethodForBecome(CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ # if !DUAL_MAPPED_CODE_ZONE /* begin makeCodeZoneWritable */ @@ -11736,7 +11749,7 @@ followForwardedLiteralsImplementationIn(CogMethod *cogMethod) sqInt result; CogMethod *writableCogMethod; - assert((!(isCMMethodEtAl(cogMethod))) + assert((!(isCMMethodEtAl(((CogBlockMethod *) cogMethod)))) || (!(isForwarded((cogMethod->methodObject))))); writableCogMethod = ((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)); hasYoungObj = isYoung((cogMethod->methodObject)); @@ -11820,135 +11833,6 @@ followForwardedLiteralsIn(CogMethod *cogMethod) # endif // !DUAL_MAPPED_CODE_ZONE } - /* Cogit>>#followForwardedMethods */ -void -followForwardedMethods(void) -{ - CogMethod *cogMethod; - sqInt freedPIC; - - /* begin ensureWritableCodeZone */ -# if !DUAL_MAPPED_CODE_ZONE - /* begin makeCodeZoneWritable */ -# if __APPLE__ && __MACH__ - pthread_jit_write_protect_np(0); - PJWPNClear = __LINE__; - if (PJWPNState) { - PJWPNChange = __LINE__; - PJWPNState = 0; - } -# endif // __APPLE__ && __MACH__ -# endif // !DUAL_MAPPED_CODE_ZONE - freedPIC = 0; - cogMethod = ((CogMethod *) methodZoneBase); - while (cogMethod < (limitZony())) { - if (((cogMethod->cmType)) >= CMMethod) { - if (isForwarded((cogMethod->methodObject))) { - (cogMethod->methodObject = followForwarded((cogMethod->methodObject))); - if (isYoungObject((cogMethod->methodObject))) { - ensureInYoungReferrers(cogMethod); - } - } - } - if (((cogMethod->cmType)) == CMClosedPIC) { - if (followMethodReferencesInClosedPIC(cogMethod)) { - freedPIC = 1; - freeMethod(cogMethod); - } - } - cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); - } - if (freedPIC) { - unlinkSendsToFree(); - } - /* begin ensureExecutableCodeZone */ -# if !DUAL_MAPPED_CODE_ZONE - /* begin makeCodeZoneExecutable */ -# if __APPLE__ && __MACH__ - pthread_jit_write_protect_np(1); - PJWPNSet = __LINE__; - if (!PJWPNState) { - PJWPNChange = __LINE__; - PJWPNState = 1; - } -# endif // __APPLE__ && __MACH__ -# endif // !DUAL_MAPPED_CODE_ZONE -} - - -/* Follow a potential object reference from a closed PIC. - This may be a method reference or null. - Answer if the followed literal is young. - 'mcpc' refers to the jump/branch instruction at the end of - each cpic case */ - - /* Cogit>>#followMaybeObjRefInClosedPICAt: */ -static sqInt NoDbgRegParms -followMaybeObjRefInClosedPICAt(sqInt mcpc) -{ - sqInt object; - sqInt subject; - - object = literalBeforeFollowingAddress(backEnd, mcpc); - if (!(couldBeObject(object))) { - return 0; - } - if (!(isForwarded(object))) { - return isYoungObject(object); - } - subject = followForwarded(object); - /* begin setCodeModified */ -# if DUAL_MAPPED_CODE_ZONE - codeModified = 1; -# else - if (!codeModified) { - codeModified = 1; - /* begin makeCodeZoneWritable */ -# if __APPLE__ && __MACH__ - pthread_jit_write_protect_np(0); - PJWPNClear = __LINE__; - if (PJWPNState) { - PJWPNChange = __LINE__; - PJWPNState = 0; - } -# endif // __APPLE__ && __MACH__ - } -# endif // DUAL_MAPPED_CODE_ZONE - storeLiteralbeforeFollowingAddress(backEnd, subject, mcpc); - return isYoungObject(subject); -} - - -/* Remap all object references in the closed PIC. Answer if any references - are young. - Set codeModified if any modifications are made. */ - - /* Cogit>>#followMethodReferencesInClosedPIC: */ -static sqInt NoDbgRegParms -followMethodReferencesInClosedPIC(CogMethod *cPIC) -{ - sqInt i; - sqInt pc; - sqInt refersToYoung; - - - /* first we check the potential method oop load at the beginning of the CPIC */ - pc = addressOfEndOfCaseinCPIC(1, cPIC); - - /* We find the end address of the cPICNumCases'th case and can then just step forward by the case size thereafter */ - refersToYoung = followMaybeObjRefInClosedPICAt(pc - (jumpLongByteSize(backEnd))); - - /* Next we check the potential potential method oop load for each case. */ - pc = addressOfEndOfCaseinCPIC((cPIC->cPICNumCases), cPIC); - for (i = 2; i <= ((cPIC->cPICNumCases)); i += 1) { - if (followMaybeObjRefInClosedPICAt((pc - (jumpLongConditionalByteSize(backEnd))) - (cmpC32RTempByteSize(backEnd)))) { - refersToYoung = 1; - } - pc += cPICCaseSize; - } - return refersToYoung; -} - /* To avoid runtime checks on literal variable and literal accesses in == and ~~, @@ -13871,8 +13755,11 @@ isPCMappedAnnotation(sqInt annotation) return annotation >= HasBytecodePC; } + +/* Useful for debugging. Marked so the code generator won't delete it. */ + /* Cogit>>#isPCWithinMethodZone: */ -sqInt +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address) { return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (freeStart()))); @@ -14524,8 +14411,8 @@ mapObjectReferencesInMachineCodeForYoungGC(void) else { assert((cogMethodDoesntLookKosher(cogMethod)) == 0); if ((cogMethod->cmRefersToYoung)) { - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); if (!zoneIsWritable) { /* begin ensureWritableCodeZone */ # if !DUAL_MAPPED_CODE_ZONE @@ -14703,9 +14590,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) if ((((cogMethod->cmType)) >= CMMethod) && (isMarked((cogMethod->methodObject)))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -14747,9 +14634,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector))))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -14884,7 +14771,7 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) } if (firstVisit) { /* begin markLiteralsAndUnlinkUnmarkedSendsIn: */ - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); assert(isMarked((cogMethod->methodObject))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); /* begin maybeMarkIRCsIn: */ @@ -14961,9 +14848,9 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) freeMethod(cogMethod); return 1; } - assert((isCMMethodEtAl(cogMethod)) - || ((isCMClosedPIC(cogMethod)) - || (isCMOpenPIC(cogMethod)))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || ((isCMClosedPIC(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod))))); return 0; } @@ -14985,8 +14872,8 @@ markAndTraceOrFreePICTargetin(sqInt entryPoint, CogMethod *cPIC) return 0; } targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); return markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)cPIC))); } @@ -15896,6 +15783,9 @@ previousInstruction(void) return abstractInstructionAt(opcodeIndex - 1); } + +/* useful for debugging */ + /* Cogit>>#printCogMethodFor: */ void printCogMethodFor(void *address) @@ -15919,6 +15809,9 @@ printCogMethodFor(void *address) } } + +/* useful for debugging */ + /* Cogit>>#printTrampolineTable */ void printTrampolineTable(void) @@ -16030,9 +15923,9 @@ relocateCallsAndSelfReferencesInMethod(CogMethod *cogMethod) refDelta = (cogMethod->objectHeader); callDelta = refDelta; - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); - assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(cogMethod) + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); + assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(((CogBlockMethod *) cogMethod)) ? methodAbortTrampolineFor((cogMethod->cmNumArgs)) : picAbortTrampolineFor((cogMethod->cmNumArgs))))); relocateCallBeforeReturnPCby(backEnd, (((sqInt)cogMethod)) + missOffset, -callDelta); @@ -16098,7 +15991,7 @@ relocateCallsInClosedPIC(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); if (i == 1) { relocateJumpLongBeforeFollowingAddressby(backEnd, pc, -(callDelta - ((targetMethod->objectHeader)))); } @@ -16528,13 +16421,6 @@ scanForCleanBlocks(void) return numCleanBlocks; } - /* Cogit>>#setBreakMethod: */ -void -setBreakMethod(sqInt anObj) -{ - breakMethod = anObj; -} - /* If a method is compiled to machine code via a block entry it won't have a selector. A subsequent send can find the method and hence fill in the @@ -16548,7 +16434,7 @@ setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop) { compilationBreakpointisMNUCase(aSelectorOop, 0); - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ # if !DUAL_MAPPED_CODE_ZONE /* begin makeCodeZoneWritable */ @@ -17557,7 +17443,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) while (cogMethod < (limitZony())) { if (!(((cogMethod->cmType)) == CMFree)) { if ((cogMethod->cpicHasMNUCaseOrCMIsFullBlock)) { - assert(isCMClosedPIC(cogMethod)); + assert(isCMClosedPIC(((CogBlockMethod *) cogMethod))); freeMethod(cogMethod); mustScanAndUnlink = 1; } @@ -17664,7 +17550,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) /* Unlink all sends in cog methods to free methods and/or pics. */ /* Cogit>>#unlinkSendsToFree */ -void +static void unlinkSendsToFree(void) { sqInt annotation; @@ -18070,9 +17956,9 @@ counters(CogMethod * self_in_counters) static void NoDbgRegParms addToOpenPICList(CogMethod *anOpenPIC) { - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); assert((openPICList == null) - || (isCMOpenPIC(openPICList))); + || (isCMOpenPIC(((CogBlockMethod *) openPICList)))); assertValidDualZoneWriteAddress(anOpenPIC); (anOpenPIC->nextOpenPIC = ((usqInt)openPICList)); openPICList = ((CogMethod *) ((((usqInt)anOpenPIC)) - (getCodeToDataDelta()))); @@ -18082,10 +17968,10 @@ addToOpenPICList(CogMethod *anOpenPIC) static void NoDbgRegParms addToUnpairedMethodList(CogMethod *aCogMethod) { - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); assert((noAssertMethodClassAssociationOf((aCogMethod->methodObject))) == (nilObject())); assert((unpairedMethodList == null) - || (isCMMethodEtAl(((CogMethod *) unpairedMethodList)))); + || (isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) unpairedMethodList)))))); assertValidDualZoneWriteAddress(aCogMethod); (aCogMethod->nextMethodOrIRCs = unpairedMethodList); unpairedMethodList = (((usqInt)aCogMethod)) - (getCodeToDataDelta()); @@ -18310,7 +18196,7 @@ findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { cogMethod = ((CogMethod *) unpairedMethodList); while (cogMethod != null) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if ((((cogMethod->selector)) == aSelectorOop) && (((cogMethod->methodObject)) == aMethodObj)) { return cogMethod; @@ -18342,7 +18228,7 @@ freeMethod(CogMethod *cogMethod) usqInt maybeIRCs; CogMethod *writableMethod; - assert(!((isCMFree(cogMethod)))); + assert(!((isCMFree(((CogBlockMethod *) cogMethod))))); assert((cogMethodDoesntLookKosher(cogMethod)) == 0); /* begin ensureWritableCodeZone */ # if !DUAL_MAPPED_CODE_ZONE @@ -18634,6 +18520,9 @@ planCompaction(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethods */ void printCogMethods(void) @@ -18696,6 +18585,9 @@ printCogMethods(void) cr(); } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsOfType: */ void printCogMethodsOfType(sqInt cmType) @@ -18712,6 +18604,9 @@ printCogMethodsOfType(sqInt cmType) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithMethod: */ void printCogMethodsWithMethod(sqInt methodOop) @@ -18729,6 +18624,9 @@ printCogMethodsWithMethod(sqInt methodOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithPrimitive: */ void printCogMethodsWithPrimitive(sqInt primIdx) @@ -18746,6 +18644,9 @@ printCogMethodsWithPrimitive(sqInt primIdx) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithSelector: */ void printCogMethodsWithSelector(sqInt selectorOop) @@ -18763,6 +18664,9 @@ printCogMethodsWithSelector(sqInt selectorOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogYoungReferrers */ void printCogYoungReferrers(void) @@ -18788,6 +18692,9 @@ printCogYoungReferrers(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printOpenPICList */ sqInt printOpenPICList(void) @@ -18807,7 +18714,7 @@ printOpenPICList(void) } /* CogMethodZone>>#pruneYoungReferrers */ -sqInt +static sqInt pruneYoungReferrers(void) { usqInt dest; @@ -18936,13 +18843,13 @@ removeFromOpenPICList(CogMethod *anOpenPIC) { CogMethod *prevPIC; - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); if (!openPICList) { return null; } - assert((isCMOpenPIC(openPICList)) + assert((isCMOpenPIC(((CogBlockMethod *) openPICList))) && ((((openPICList->nextOpenPIC)) == null) - || (isCMOpenPIC(((CogMethod *) ((openPICList->nextOpenPIC))))))); + || (isCMOpenPIC(((CogBlockMethod *) (((CogMethod *) ((openPICList->nextOpenPIC))))))))); if (anOpenPIC == openPICList) { /* N.B. Use self rather than coInterpreter to avoid attempting to cast nil. @@ -18953,7 +18860,7 @@ removeFromOpenPICList(CogMethod *anOpenPIC) prevPIC = openPICList; do { assert((prevPIC != null) - && (isCMOpenPIC(prevPIC))); + && (isCMOpenPIC(((CogBlockMethod *) prevPIC)))); if (((prevPIC->nextOpenPIC)) == (((usqInt)anOpenPIC))) { ((((CogMethod *) ((((usqInt)prevPIC)) + codeToDataDelta)))->nextOpenPIC = (anOpenPIC->nextOpenPIC)); return null; @@ -18969,7 +18876,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) { CogMethod *prevMethod; - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); if ((((usqInt)aCogMethod)) == unpairedMethodList) { unpairedMethodList = (aCogMethod->nextMethodOrIRCs); return null; @@ -18977,7 +18884,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) prevMethod = ((CogMethod *) unpairedMethodList); while (prevMethod != null) { assert((prevMethod != null) - && (isCMMethodEtAl(prevMethod))); + && (isCMMethodEtAl(((CogBlockMethod *) prevMethod)))); if (((prevMethod->nextMethodOrIRCs)) == (((usqInt)aCogMethod))) { (prevMethod->nextMethodOrIRCs = (aCogMethod->nextMethodOrIRCs)); return null; @@ -19035,11 +18942,8 @@ voidYoungReferrersPostTenureAll(void) youngReferrers = limitAddress; } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CogMethodZone>>#whereIsMaybeCodeThing: */ -EXPORT(char *) +char * whereIsMaybeCodeThing(sqInt anOop) { if (oopisGreaterThanOrEqualToandLessThan(anOop, codeBase, limitAddress)) { diff --git a/src/spur64.cog.newspeak/cogitX64SysV.c b/src/spur64.cog.newspeak/cogitX64SysV.c index ddc3c932ac..63acf42144 100644 --- a/src/spur64.cog.newspeak/cogitX64SysV.c +++ b/src/spur64.cog.newspeak/cogitX64SysV.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -563,10 +563,10 @@ static AbstractInstruction * NoDbgRegParms CallNewspeakSend(sqInt callTarget); static AbstractInstruction * NoDbgRegParms CallRTregistersToBeSavedMask(sqInt callTarget, sqInt registersToBeSaved); static AbstractInstruction * NoDbgRegParms gCall(sqInt callTarget); static AbstractInstruction * NoDbgRegParms gCmpCqR(sqInt quickConstant, sqInt reg); -extern void callCogCodePopReceiver(void); -extern void callCogCodePopReceiverAndClassRegs(void); +static void callCogCodePopReceiver(void); +static void callCogCodePopReceiverAndClassRegs(void); static sqInt NoDbgRegParms ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver); -extern void ceFree(void *pointer); +static void NoDbgRegParms ceFree(void *pointer); static void* NoDbgRegParms ceMalloc(size_t size); static sqInt NoDbgRegParms ceSICMiss(sqInt receiver); static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod); @@ -582,7 +582,7 @@ extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); static void NoDbgRegParms cogExtendPICCaseNMethodtagisMNUCase(CogMethod *cPIC, sqInt caseNMethod, sqInt caseNTag, sqInt isMNUCase); extern void cogitPostGCAction(sqInt gcMode); -extern sqInt cogMethodDoesntLookKosher(CogMethod *cogMethod); +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod); extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs); static CogMethod * NoDbgRegParms cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs); static CogMethod * NoDbgRegParms cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt numArgs, CogMethod *case0CogMethod, sqInt case1MethodOrNil, sqInt case1Tag, sqInt isMNUCase); @@ -617,7 +617,7 @@ static AbstractInstruction * NoDbgRegParms gDivRRQuoRem(sqInt rDivisor, sqInt rD extern sqInt defaultCogCodeSize(void); static sqInt NoDbgRegParms deltaToSkipPrimAndErrorStoreInheader(sqInt aMethodObj, sqInt aMethodHeader); static sqInt NoDbgRegParms endPCOf(sqInt aMethod); -extern void enterCogCodePopReceiver(void); +static void enterCogCodePopReceiver(void); static sqInt NoDbgRegParms entryPointTagIsSelector(sqInt entryPoint); static sqInt NoDbgRegParms expectedClosedPICPrototype(CogMethod *cPIC); static sqInt extABytecode(void); @@ -635,9 +635,6 @@ static BytecodeFixup * NoDbgRegParms fixupAt(sqInt fixupPC); extern void flagCogMethodForBecome(CogMethod *cogMethod); static void NoDbgRegParms followForwardedLiteralsImplementationIn(CogMethod *cogMethod); extern void followForwardedLiteralsIn(CogMethod *cogMethod); -extern void followForwardedMethods(void); -static sqInt NoDbgRegParms followMaybeObjRefInClosedPICAt(sqInt mcpc); -static sqInt NoDbgRegParms followMethodReferencesInClosedPIC(CogMethod *cPIC); extern void followMovableLiteralsAndUpdateYoungReferrers(void); extern void freeBecomeFlaggedMethods(void); extern void freeCogMethod(CogMethod *cogMethod); @@ -680,7 +677,7 @@ static sqInt initialMethodUsageCount(void); static sqInt initialOpenPICUsageCount(void); static sqInt NoDbgRegParms inverseBranchFor(sqInt opcode); static sqInt NoDbgRegParms isPCMappedAnnotation(sqInt annotation); -extern sqInt isPCWithinMethodZone(void *address); +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address); extern sqInt isSendReturnPC(sqInt retpc); static AbstractInstruction * NoDbgRegParms gJumpFPEqual(void *jumpTarget); static AbstractInstruction * NoDbgRegParms gJumpFPGreaterOrEqual(void *jumpTarget); @@ -756,7 +753,6 @@ static sqInt NoDbgRegParms remapMaybeObjRefInClosedPICAt(sqInt mcpc); static void NoDbgRegParms rewriteCPICCaseAttagobjReftarget(sqInt followingAddress, sqInt newTag, sqInt newObjRef, sqInt newTarget); static AbstractInstruction * NoDbgRegParms gSubRRR(sqInt subReg, sqInt fromReg, sqInt destReg); static sqInt scanForCleanBlocks(void); -extern void setBreakMethod(sqInt anObj); extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop); static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC); static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc); @@ -778,7 +774,7 @@ static sqInt NoDbgRegParms unlinkIfLinkedSendpcignored(sqInt annotation, char *m static sqInt NoDbgRegParms unlinkIfLinkedSendpcto(sqInt annotation, char *mcpc, CogMethod *theCogMethod); extern void unlinkSendsLinkedForInvalidClasses(void); extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector); -extern void unlinkSendsToFree(void); +static void unlinkSendsToFree(void); extern void unlinkSendsToMethodsSuchThatAndFreeIf(sqInt (*criterion)(CogMethod *), sqInt freeIfTrue); extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue); extern void voidCogCompiledCode(void); @@ -812,7 +808,7 @@ extern void printCogMethodsWithPrimitive(sqInt primIdx); extern void printCogMethodsWithSelector(sqInt selectorOop); extern void printCogYoungReferrers(void); extern sqInt printOpenPICList(void); -extern sqInt pruneYoungReferrers(void); +static sqInt pruneYoungReferrers(void); static sqInt relocateAndPruneYoungReferrers(void); static sqInt relocateMethodsPreCompaction(void); static sqInt NoDbgRegParms removeFromOpenPICList(CogMethod *anOpenPIC); @@ -821,7 +817,7 @@ static sqInt NoDbgRegParms roundUpLength(sqInt numBytes); static void voidOpenPICList(void); static void voidUnpairedMethodList(void); static void voidYoungReferrersPostTenureAll(void); -EXPORT(char *) whereIsMaybeCodeThing(sqInt anOop); +extern char * whereIsMaybeCodeThing(sqInt anOop); static sqInt zoneAlignment(void); static sqInt NoDbgRegParms checkValidObjectReference(sqInt anOop); static AbstractInstruction * NoDbgRegParms genCmpClassFloatCompactIndexR(sqInt reg); @@ -3971,12 +3967,11 @@ gCmpCqR(sqInt quickConstant, sqInt reg) } -/* This is a static version of ceCallCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverReg for break-pointing + when debugging in C. Marked so the code generator won't delete it. */ /* Cogit>>#callCogCodePopReceiver */ -void +static void callCogCodePopReceiver(void) { realCECallCogCodePopReceiverReg(); @@ -3986,12 +3981,12 @@ callCogCodePopReceiver(void) } -/* This is a static version of ceCallCogCodePopReceiverAndClassRegs - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverAndClassRegs for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#callCogCodePopReceiverAndClassRegs */ -void +static void callCogCodePopReceiverAndClassRegs(void) { realCECallCogCodePopReceiverAndClassRegs(); @@ -4005,6 +4000,7 @@ callCogCodePopReceiverAndClassRegs(void) receiver args sp=> sender return address */ +/* Marked so the code generator won't delete it. */ /* Cogit>>#ceCPICMiss:receiver: */ static sqInt NoDbgRegParms @@ -4087,13 +4083,23 @@ ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver) return null; } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceFree: */ -void +static void NoDbgRegParms ceFree(void *pointer) { free(pointer); } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceMalloc: */ static void* NoDbgRegParms ceMalloc(size_t size) @@ -4113,7 +4119,9 @@ ceMalloc(size_t size) sp=> ceMethodAbort call return address So we can find the method that did the failing entry check at ceMethodAbort call return address - missOffset - and we can find the send site from the outer return address. */ + and we can find the send site from the outer return address. + Invoked from a trampoline. Marked so the code generator won't delete + it. */ /* Cogit>>#ceSICMiss: */ static sqInt NoDbgRegParms @@ -4286,13 +4294,13 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * entryPoint = (nsSendCache->target); if (entryPoint != 0) { nsTargetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - if (!(asserta(isCMMethodEtAl(nsTargetMethod)))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) nsTargetMethod))))) { return 12; } } } if (annotation >= IsSendCall) { - if (!(asserta(isCMMethodEtAl(((CogMethod *) cogMethod))))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) cogMethod))))))) { return 3; } /* begin entryCacheTagAndCouldBeObjectAt:annotation:into: */ @@ -4382,9 +4390,9 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * } } targetMethod1 = ((CogMethod *) (entryPoint - offset1)); - if (!(asserta((isCMMethodEtAl(targetMethod1)) - || ((isCMClosedPIC(targetMethod1)) - || (isCMOpenPIC(targetMethod1)))))) { + if (!(asserta((isCMMethodEtAl(((CogBlockMethod *) targetMethod1))) + || ((isCMClosedPIC(((CogBlockMethod *) targetMethod1))) + || (isCMOpenPIC(((CogBlockMethod *) targetMethod1))))))) { return 10; } } @@ -4744,6 +4752,11 @@ codeEntryNameFor(char *address) return null; } + +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ + /* Cogit>>#cogCodeBase */ sqInt cogCodeBase(void) @@ -4936,7 +4949,7 @@ cogitPostGCAction(sqInt gcMode) the type. Answer 0 if it is ok, otherwise answer a code for the error. */ /* Cogit>>#cogMethodDoesntLookKosher: */ -sqInt +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod) { if (((((cogMethod->blockSize)) & (BytesPerWord - 1)) != 0) @@ -5059,7 +5072,7 @@ cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = 1; (writablePIC->cPICNumCases = 1); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 1); @@ -5137,7 +5150,7 @@ cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs) (pic->cPICNumCases = 0); (pic->blockEntryOffset = 0); flushICacheFromto(backEnd, (((usqInt)pic)) - codeToDataDelta, ((((usqInt)pic)) - codeToDataDelta) + openPICSize); - assert(isCMOpenPIC(pic)); + assert(isCMOpenPIC(((CogBlockMethod *) pic))); assert(((pic->selector)) == selector); assert(((pic->cmNumArgs)) == numArgs); assert((callTargetFromReturnAddress(backEnd, ((((sqInt)pic)) - codeToDataDelta) + missOffset)) == (picAbortTrampolineFor(numArgs))); @@ -5196,7 +5209,7 @@ cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt nu ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = isMNUCase; (writablePIC->cPICNumCases = 2); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 2); @@ -6292,8 +6305,8 @@ cPICCompactAndIsNowEmpty(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { if (i == 1) { return 1; @@ -6384,8 +6397,8 @@ cPICHasFreedTargets(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { return 1; } @@ -6481,7 +6494,7 @@ createCPICData(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); target = (targetMethod->methodObject); } storePointerUncheckedofObjectwithValue((i * 2) - 1, picData, class); @@ -6586,12 +6599,12 @@ endPCOf(sqInt aMethod) } -/* This is a static version of ceEnterCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceEnterCogCodePopReceiverReg for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#enterCogCodePopReceiver */ -void +static void enterCogCodePopReceiver(void) { realCEEnterCogCodePopReceiverReg(); @@ -6889,7 +6902,7 @@ findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if (startbcpc == (startPCOfMethodHeader((cogMethod->methodHeader)))) { return ((CogBlockMethod *) cogMethod); } @@ -6946,7 +6959,7 @@ fixupAt(sqInt fixupPC) void flagCogMethodForBecome(CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ ((((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)))->cmType = CMMethodFlaggedForBecome); } @@ -6964,7 +6977,7 @@ followForwardedLiteralsImplementationIn(CogMethod *cogMethod) sqInt result; CogMethod *writableCogMethod; - assert((!(isCMMethodEtAl(cogMethod))) + assert((!(isCMMethodEtAl(((CogBlockMethod *) cogMethod)))) || (!(isForwarded((cogMethod->methodObject))))); writableCogMethod = ((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)); hasYoungObj = isYoung((cogMethod->methodObject)); @@ -7026,102 +7039,6 @@ followForwardedLiteralsIn(CogMethod *cogMethod) /* begin ensureExecutableCodeZone */ } - /* Cogit>>#followForwardedMethods */ -void -followForwardedMethods(void) -{ - CogMethod *cogMethod; - sqInt freedPIC; - - /* begin ensureWritableCodeZone */ - freedPIC = 0; - cogMethod = ((CogMethod *) methodZoneBase); - while (cogMethod < (limitZony())) { - if (((cogMethod->cmType)) >= CMMethod) { - if (isForwarded((cogMethod->methodObject))) { - (cogMethod->methodObject = followForwarded((cogMethod->methodObject))); - if (isYoungObject((cogMethod->methodObject))) { - ensureInYoungReferrers(cogMethod); - } - } - } - if (((cogMethod->cmType)) == CMClosedPIC) { - if (followMethodReferencesInClosedPIC(cogMethod)) { - freedPIC = 1; - freeMethod(cogMethod); - } - } - cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); - } - if (freedPIC) { - unlinkSendsToFree(); - } - /* begin ensureExecutableCodeZone */ -} - - -/* Follow a potential object reference from a closed PIC. - This may be a method reference or null. - Answer if the followed literal is young. - 'mcpc' refers to the jump/branch instruction at the end of - each cpic case */ - - /* Cogit>>#followMaybeObjRefInClosedPICAt: */ -static sqInt NoDbgRegParms -followMaybeObjRefInClosedPICAt(sqInt mcpc) -{ - sqInt object; - sqInt subject; - - object = literalBeforeFollowingAddress(backEnd, mcpc); - if (!(couldBeObject(object))) { - return 0; - } - if (!(isForwarded(object))) { - return isYoungObject(object); - } - subject = followForwarded(object); - /* begin setCodeModified */ -# if DUAL_MAPPED_CODE_ZONE - codeModified = 1; -# else - codeModified = 1; -# endif - storeLiteralbeforeFollowingAddress(backEnd, subject, mcpc); - return isYoungObject(subject); -} - - -/* Remap all object references in the closed PIC. Answer if any references - are young. - Set codeModified if any modifications are made. */ - - /* Cogit>>#followMethodReferencesInClosedPIC: */ -static sqInt NoDbgRegParms -followMethodReferencesInClosedPIC(CogMethod *cPIC) -{ - sqInt i; - sqInt pc; - sqInt refersToYoung; - - - /* first we check the potential method oop load at the beginning of the CPIC */ - pc = addressOfEndOfCaseinCPIC(1, cPIC); - - /* We find the end address of the cPICNumCases'th case and can then just step forward by the case size thereafter */ - refersToYoung = followMaybeObjRefInClosedPICAt(pc - (jumpLongByteSize(backEnd))); - - /* Next we check the potential potential method oop load for each case. */ - pc = addressOfEndOfCaseinCPIC((cPIC->cPICNumCases), cPIC); - for (i = 2; i <= ((cPIC->cPICNumCases)); i += 1) { - if (followMaybeObjRefInClosedPICAt((pc - (jumpLongConditionalByteSize(backEnd))) - (cmpC32RTempByteSize(backEnd)))) { - refersToYoung = 1; - } - pc += cPICCaseSize; - } - return refersToYoung; -} - /* To avoid runtime checks on literal variable and literal accesses in == and ~~, @@ -8611,8 +8528,11 @@ isPCMappedAnnotation(sqInt annotation) return annotation >= HasBytecodePC; } + +/* Useful for debugging. Marked so the code generator won't delete it. */ + /* Cogit>>#isPCWithinMethodZone: */ -sqInt +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address) { return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (freeStart()))); @@ -9184,8 +9104,8 @@ mapObjectReferencesInMachineCodeForYoungGC(void) else { assert((cogMethodDoesntLookKosher(cogMethod)) == 0); if ((cogMethod->cmRefersToYoung)) { - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); if (!zoneIsWritable) { /* begin ensureWritableCodeZone */ zoneIsWritable = 1; @@ -9310,9 +9230,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) if ((((cogMethod->cmType)) >= CMMethod) && (isMarked((cogMethod->methodObject)))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -9354,9 +9274,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector))))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -9461,7 +9381,7 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) } if (firstVisit) { /* begin markLiteralsAndUnlinkUnmarkedSendsIn: */ - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); assert(isMarked((cogMethod->methodObject))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); /* begin maybeMarkIRCsIn: */ @@ -9516,9 +9436,9 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) freeMethod(cogMethod); return 1; } - assert((isCMMethodEtAl(cogMethod)) - || ((isCMClosedPIC(cogMethod)) - || (isCMOpenPIC(cogMethod)))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || ((isCMClosedPIC(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod))))); return 0; } @@ -9540,8 +9460,8 @@ markAndTraceOrFreePICTargetin(sqInt entryPoint, CogMethod *cPIC) return 0; } targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); return markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)cPIC))); } @@ -10360,6 +10280,9 @@ picInterpretAbortOffset(void) return (interpretOffset()) - (callInstructionByteSize(backEnd)); } + +/* useful for debugging */ + /* Cogit>>#printCogMethodFor: */ void printCogMethodFor(void *address) @@ -10383,6 +10306,9 @@ printCogMethodFor(void *address) } } + +/* useful for debugging */ + /* Cogit>>#printTrampolineTable */ void printTrampolineTable(void) @@ -10492,9 +10418,9 @@ relocateCallsAndSelfReferencesInMethod(CogMethod *cogMethod) refDelta = (cogMethod->objectHeader); callDelta = refDelta; - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); - assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(cogMethod) + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); + assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(((CogBlockMethod *) cogMethod)) ? methodAbortTrampolineFor((cogMethod->cmNumArgs)) : picAbortTrampolineFor((cogMethod->cmNumArgs))))); relocateCallBeforeReturnPCby(backEnd, (((sqInt)cogMethod)) + missOffset, -callDelta); @@ -10560,7 +10486,7 @@ relocateCallsInClosedPIC(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); if (i == 1) { relocateJumpLongBeforeFollowingAddressby(backEnd, pc, -(callDelta - ((targetMethod->objectHeader)))); } @@ -10951,13 +10877,6 @@ scanForCleanBlocks(void) return numCleanBlocks; } - /* Cogit>>#setBreakMethod: */ -void -setBreakMethod(sqInt anObj) -{ - breakMethod = anObj; -} - /* If a method is compiled to machine code via a block entry it won't have a selector. A subsequent send can find the method and hence fill in the @@ -10970,7 +10889,7 @@ void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop) { compilationBreakpointisMNUCase(aSelectorOop, 0); - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ ((((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)))->selector = aSelectorOop); if (isYoung(aSelectorOop)) { @@ -11836,7 +11755,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) while (cogMethod < (limitZony())) { if (!(((cogMethod->cmType)) == CMFree)) { if ((cogMethod->cpicHasMNUCaseOrCMIsFullBlock)) { - assert(isCMClosedPIC(cogMethod)); + assert(isCMClosedPIC(((CogBlockMethod *) cogMethod))); freeMethod(cogMethod); mustScanAndUnlink = 1; } @@ -11913,7 +11832,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) /* Unlink all sends in cog methods to free methods and/or pics. */ /* Cogit>>#unlinkSendsToFree */ -void +static void unlinkSendsToFree(void) { sqInt annotation; @@ -12202,9 +12121,9 @@ counters(CogMethod * self_in_counters) static void NoDbgRegParms addToOpenPICList(CogMethod *anOpenPIC) { - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); assert((openPICList == null) - || (isCMOpenPIC(openPICList))); + || (isCMOpenPIC(((CogBlockMethod *) openPICList)))); assertValidDualZoneWriteAddress(anOpenPIC); (anOpenPIC->nextOpenPIC = ((usqInt)openPICList)); openPICList = ((CogMethod *) ((((usqInt)anOpenPIC)) - (getCodeToDataDelta()))); @@ -12214,10 +12133,10 @@ addToOpenPICList(CogMethod *anOpenPIC) static void NoDbgRegParms addToUnpairedMethodList(CogMethod *aCogMethod) { - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); assert((noAssertMethodClassAssociationOf((aCogMethod->methodObject))) == (nilObject())); assert((unpairedMethodList == null) - || (isCMMethodEtAl(((CogMethod *) unpairedMethodList)))); + || (isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) unpairedMethodList)))))); assertValidDualZoneWriteAddress(aCogMethod); (aCogMethod->nextMethodOrIRCs = unpairedMethodList); unpairedMethodList = (((usqInt)aCogMethod)) - (getCodeToDataDelta()); @@ -12431,7 +12350,7 @@ findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { cogMethod = ((CogMethod *) unpairedMethodList); while (cogMethod != null) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if ((((cogMethod->selector)) == aSelectorOop) && (((cogMethod->methodObject)) == aMethodObj)) { return cogMethod; @@ -12463,7 +12382,7 @@ freeMethod(CogMethod *cogMethod) usqInt maybeIRCs; CogMethod *writableMethod; - assert(!((isCMFree(cogMethod)))); + assert(!((isCMFree(((CogBlockMethod *) cogMethod))))); assert((cogMethodDoesntLookKosher(cogMethod)) == 0); /* begin ensureWritableCodeZone */ if (((cogMethod->cmType)) >= CMMethod) { @@ -12744,6 +12663,9 @@ planCompaction(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethods */ void printCogMethods(void) @@ -12806,6 +12728,9 @@ printCogMethods(void) cr(); } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsOfType: */ void printCogMethodsOfType(sqInt cmType) @@ -12822,6 +12747,9 @@ printCogMethodsOfType(sqInt cmType) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithMethod: */ void printCogMethodsWithMethod(sqInt methodOop) @@ -12839,6 +12767,9 @@ printCogMethodsWithMethod(sqInt methodOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithPrimitive: */ void printCogMethodsWithPrimitive(sqInt primIdx) @@ -12856,6 +12787,9 @@ printCogMethodsWithPrimitive(sqInt primIdx) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithSelector: */ void printCogMethodsWithSelector(sqInt selectorOop) @@ -12873,6 +12807,9 @@ printCogMethodsWithSelector(sqInt selectorOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogYoungReferrers */ void printCogYoungReferrers(void) @@ -12898,6 +12835,9 @@ printCogYoungReferrers(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printOpenPICList */ sqInt printOpenPICList(void) @@ -12917,7 +12857,7 @@ printOpenPICList(void) } /* CogMethodZone>>#pruneYoungReferrers */ -sqInt +static sqInt pruneYoungReferrers(void) { usqInt dest; @@ -13035,13 +12975,13 @@ removeFromOpenPICList(CogMethod *anOpenPIC) { CogMethod *prevPIC; - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); if (!openPICList) { return null; } - assert((isCMOpenPIC(openPICList)) + assert((isCMOpenPIC(((CogBlockMethod *) openPICList))) && ((((openPICList->nextOpenPIC)) == null) - || (isCMOpenPIC(((CogMethod *) ((openPICList->nextOpenPIC))))))); + || (isCMOpenPIC(((CogBlockMethod *) (((CogMethod *) ((openPICList->nextOpenPIC))))))))); if (anOpenPIC == openPICList) { /* N.B. Use self rather than coInterpreter to avoid attempting to cast nil. @@ -13052,7 +12992,7 @@ removeFromOpenPICList(CogMethod *anOpenPIC) prevPIC = openPICList; do { assert((prevPIC != null) - && (isCMOpenPIC(prevPIC))); + && (isCMOpenPIC(((CogBlockMethod *) prevPIC)))); if (((prevPIC->nextOpenPIC)) == (((usqInt)anOpenPIC))) { ((((CogMethod *) ((((usqInt)prevPIC)) + codeToDataDelta)))->nextOpenPIC = (anOpenPIC->nextOpenPIC)); return null; @@ -13068,7 +13008,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) { CogMethod *prevMethod; - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); if ((((usqInt)aCogMethod)) == unpairedMethodList) { unpairedMethodList = (aCogMethod->nextMethodOrIRCs); return null; @@ -13076,7 +13016,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) prevMethod = ((CogMethod *) unpairedMethodList); while (prevMethod != null) { assert((prevMethod != null) - && (isCMMethodEtAl(prevMethod))); + && (isCMMethodEtAl(((CogBlockMethod *) prevMethod)))); if (((prevMethod->nextMethodOrIRCs)) == (((usqInt)aCogMethod))) { (prevMethod->nextMethodOrIRCs = (aCogMethod->nextMethodOrIRCs)); return null; @@ -13134,11 +13074,8 @@ voidYoungReferrersPostTenureAll(void) youngReferrers = limitAddress; } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CogMethodZone>>#whereIsMaybeCodeThing: */ -EXPORT(char *) +char * whereIsMaybeCodeThing(sqInt anOop) { if (oopisGreaterThanOrEqualToandLessThan(anOop, codeBase, limitAddress)) { diff --git a/src/spur64.cog.newspeak/cogitX64WIN64.c b/src/spur64.cog.newspeak/cogitX64WIN64.c index 3548685425..ba46652ee0 100644 --- a/src/spur64.cog.newspeak/cogitX64WIN64.c +++ b/src/spur64.cog.newspeak/cogitX64WIN64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -563,10 +563,10 @@ static AbstractInstruction * NoDbgRegParms CallNewspeakSend(sqInt callTarget); static AbstractInstruction * NoDbgRegParms CallRTregistersToBeSavedMask(sqInt callTarget, sqInt registersToBeSaved); static AbstractInstruction * NoDbgRegParms gCall(sqInt callTarget); static AbstractInstruction * NoDbgRegParms gCmpCqR(sqInt quickConstant, sqInt reg); -extern void callCogCodePopReceiver(void); -extern void callCogCodePopReceiverAndClassRegs(void); +static void callCogCodePopReceiver(void); +static void callCogCodePopReceiverAndClassRegs(void); static sqInt NoDbgRegParms ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver); -extern void ceFree(void *pointer); +static void NoDbgRegParms ceFree(void *pointer); static void* NoDbgRegParms ceMalloc(size_t size); static sqInt NoDbgRegParms ceSICMiss(sqInt receiver); static sqInt NoDbgRegParms checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod *cogMethod); @@ -582,7 +582,7 @@ extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); static void NoDbgRegParms cogExtendPICCaseNMethodtagisMNUCase(CogMethod *cPIC, sqInt caseNMethod, sqInt caseNTag, sqInt isMNUCase); extern void cogitPostGCAction(sqInt gcMode); -extern sqInt cogMethodDoesntLookKosher(CogMethod *cogMethod); +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod); extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs); static CogMethod * NoDbgRegParms cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs); static CogMethod * NoDbgRegParms cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt numArgs, CogMethod *case0CogMethod, sqInt case1MethodOrNil, sqInt case1Tag, sqInt isMNUCase); @@ -617,7 +617,7 @@ static AbstractInstruction * NoDbgRegParms gDivRRQuoRem(sqInt rDivisor, sqInt rD extern sqInt defaultCogCodeSize(void); static sqInt NoDbgRegParms deltaToSkipPrimAndErrorStoreInheader(sqInt aMethodObj, sqInt aMethodHeader); static sqInt NoDbgRegParms endPCOf(sqInt aMethod); -extern void enterCogCodePopReceiver(void); +static void enterCogCodePopReceiver(void); static sqInt NoDbgRegParms entryPointTagIsSelector(sqInt entryPoint); static sqInt NoDbgRegParms expectedClosedPICPrototype(CogMethod *cPIC); static sqInt extABytecode(void); @@ -635,9 +635,6 @@ static BytecodeFixup * NoDbgRegParms fixupAt(sqInt fixupPC); extern void flagCogMethodForBecome(CogMethod *cogMethod); static void NoDbgRegParms followForwardedLiteralsImplementationIn(CogMethod *cogMethod); extern void followForwardedLiteralsIn(CogMethod *cogMethod); -extern void followForwardedMethods(void); -static sqInt NoDbgRegParms followMaybeObjRefInClosedPICAt(sqInt mcpc); -static sqInt NoDbgRegParms followMethodReferencesInClosedPIC(CogMethod *cPIC); extern void followMovableLiteralsAndUpdateYoungReferrers(void); extern void freeBecomeFlaggedMethods(void); extern void freeCogMethod(CogMethod *cogMethod); @@ -680,7 +677,7 @@ static sqInt initialMethodUsageCount(void); static sqInt initialOpenPICUsageCount(void); static sqInt NoDbgRegParms inverseBranchFor(sqInt opcode); static sqInt NoDbgRegParms isPCMappedAnnotation(sqInt annotation); -extern sqInt isPCWithinMethodZone(void *address); +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address); extern sqInt isSendReturnPC(sqInt retpc); static AbstractInstruction * NoDbgRegParms gJumpFPEqual(void *jumpTarget); static AbstractInstruction * NoDbgRegParms gJumpFPGreaterOrEqual(void *jumpTarget); @@ -756,7 +753,6 @@ static sqInt NoDbgRegParms remapMaybeObjRefInClosedPICAt(sqInt mcpc); static void NoDbgRegParms rewriteCPICCaseAttagobjReftarget(sqInt followingAddress, sqInt newTag, sqInt newObjRef, sqInt newTarget); static AbstractInstruction * NoDbgRegParms gSubRRR(sqInt subReg, sqInt fromReg, sqInt destReg); static sqInt scanForCleanBlocks(void); -extern void setBreakMethod(sqInt anObj); extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop); static sqInt NoDbgRegParms spanForCleanBlockStartingAt(sqInt startPC); static usqInt NoDbgRegParms stackCheckOffsetOfBlockAtisMcpc(sqInt blockEntryMcpc, sqInt mcpc); @@ -778,7 +774,7 @@ static sqInt NoDbgRegParms unlinkIfLinkedSendpcignored(sqInt annotation, char *m static sqInt NoDbgRegParms unlinkIfLinkedSendpcto(sqInt annotation, char *mcpc, CogMethod *theCogMethod); extern void unlinkSendsLinkedForInvalidClasses(void); extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector); -extern void unlinkSendsToFree(void); +static void unlinkSendsToFree(void); extern void unlinkSendsToMethodsSuchThatAndFreeIf(sqInt (*criterion)(CogMethod *), sqInt freeIfTrue); extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue); extern void voidCogCompiledCode(void); @@ -812,7 +808,7 @@ extern void printCogMethodsWithPrimitive(sqInt primIdx); extern void printCogMethodsWithSelector(sqInt selectorOop); extern void printCogYoungReferrers(void); extern sqInt printOpenPICList(void); -extern sqInt pruneYoungReferrers(void); +static sqInt pruneYoungReferrers(void); static sqInt relocateAndPruneYoungReferrers(void); static sqInt relocateMethodsPreCompaction(void); static sqInt NoDbgRegParms removeFromOpenPICList(CogMethod *anOpenPIC); @@ -821,7 +817,7 @@ static sqInt NoDbgRegParms roundUpLength(sqInt numBytes); static void voidOpenPICList(void); static void voidUnpairedMethodList(void); static void voidYoungReferrersPostTenureAll(void); -EXPORT(char *) whereIsMaybeCodeThing(sqInt anOop); +extern char * whereIsMaybeCodeThing(sqInt anOop); static sqInt zoneAlignment(void); static sqInt NoDbgRegParms checkValidObjectReference(sqInt anOop); static AbstractInstruction * NoDbgRegParms genCmpClassFloatCompactIndexR(sqInt reg); @@ -3971,12 +3967,11 @@ gCmpCqR(sqInt quickConstant, sqInt reg) } -/* This is a static version of ceCallCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverReg for break-pointing + when debugging in C. Marked so the code generator won't delete it. */ /* Cogit>>#callCogCodePopReceiver */ -void +static void callCogCodePopReceiver(void) { realCECallCogCodePopReceiverReg(); @@ -3986,12 +3981,12 @@ callCogCodePopReceiver(void) } -/* This is a static version of ceCallCogCodePopReceiverAndClassRegs - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceCallCogCodePopReceiverAndClassRegs for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#callCogCodePopReceiverAndClassRegs */ -void +static void callCogCodePopReceiverAndClassRegs(void) { realCECallCogCodePopReceiverAndClassRegs(); @@ -4005,6 +4000,7 @@ callCogCodePopReceiverAndClassRegs(void) receiver args sp=> sender return address */ +/* Marked so the code generator won't delete it. */ /* Cogit>>#ceCPICMiss:receiver: */ static sqInt NoDbgRegParms @@ -4087,13 +4083,23 @@ ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver) return null; } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceFree: */ -void +static void NoDbgRegParms ceFree(void *pointer) { free(pointer); } + +/* Invoked from a trampoline. Marked so the code generator won't delete + it. + */ + /* Cogit>>#ceMalloc: */ static void* NoDbgRegParms ceMalloc(size_t size) @@ -4113,7 +4119,9 @@ ceMalloc(size_t size) sp=> ceMethodAbort call return address So we can find the method that did the failing entry check at ceMethodAbort call return address - missOffset - and we can find the send site from the outer return address. */ + and we can find the send site from the outer return address. + Invoked from a trampoline. Marked so the code generator won't delete + it. */ /* Cogit>>#ceSICMiss: */ static sqInt NoDbgRegParms @@ -4286,13 +4294,13 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * entryPoint = (nsSendCache->target); if (entryPoint != 0) { nsTargetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - if (!(asserta(isCMMethodEtAl(nsTargetMethod)))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) nsTargetMethod))))) { return 12; } } } if (annotation >= IsSendCall) { - if (!(asserta(isCMMethodEtAl(((CogMethod *) cogMethod))))) { + if (!(asserta(isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) cogMethod))))))) { return 3; } /* begin entryCacheTagAndCouldBeObjectAt:annotation:into: */ @@ -4382,9 +4390,9 @@ checkIfValidOopRefAndTargetpccogMethod(sqInt annotation, char *mcpc, CogMethod * } } targetMethod1 = ((CogMethod *) (entryPoint - offset1)); - if (!(asserta((isCMMethodEtAl(targetMethod1)) - || ((isCMClosedPIC(targetMethod1)) - || (isCMOpenPIC(targetMethod1)))))) { + if (!(asserta((isCMMethodEtAl(((CogBlockMethod *) targetMethod1))) + || ((isCMClosedPIC(((CogBlockMethod *) targetMethod1))) + || (isCMOpenPIC(((CogBlockMethod *) targetMethod1))))))) { return 10; } } @@ -4744,6 +4752,11 @@ codeEntryNameFor(char *address) return null; } + +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ + /* Cogit>>#cogCodeBase */ sqInt cogCodeBase(void) @@ -4936,7 +4949,7 @@ cogitPostGCAction(sqInt gcMode) the type. Answer 0 if it is ok, otherwise answer a code for the error. */ /* Cogit>>#cogMethodDoesntLookKosher: */ -sqInt +static sqInt NoDbgRegParms cogMethodDoesntLookKosher(CogMethod *cogMethod) { if (((((cogMethod->blockSize)) & (BytesPerWord - 1)) != 0) @@ -5059,7 +5072,7 @@ cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = 1; (writablePIC->cPICNumCases = 1); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 1); @@ -5137,7 +5150,7 @@ cogOpenPICSelectornumArgs(sqInt selector, sqInt numArgs) (pic->cPICNumCases = 0); (pic->blockEntryOffset = 0); flushICacheFromto(backEnd, (((usqInt)pic)) - codeToDataDelta, ((((usqInt)pic)) - codeToDataDelta) + openPICSize); - assert(isCMOpenPIC(pic)); + assert(isCMOpenPIC(((CogBlockMethod *) pic))); assert(((pic->selector)) == selector); assert(((pic->cmNumArgs)) == numArgs); assert((callTargetFromReturnAddress(backEnd, ((((sqInt)pic)) - codeToDataDelta) + missOffset)) == (picAbortTrampolineFor(numArgs))); @@ -5196,7 +5209,7 @@ cogPICSelectornumArgsCase0MethodCase1MethodtagisMNUCase(sqInt selector, sqInt nu ((((CogBlockMethod *) writablePIC))->cpicHasMNUCaseOrCMIsFullBlock) = isMNUCase; (writablePIC->cPICNumCases = 2); (writablePIC->blockEntryOffset = 0); - assert(isCMClosedPIC(writablePIC)); + assert(isCMClosedPIC(((CogBlockMethod *) writablePIC))); assert(((writablePIC->selector)) == selector); assert(((writablePIC->cmNumArgs)) == numArgs); assert(((writablePIC->cPICNumCases)) == 2); @@ -6300,8 +6313,8 @@ cPICCompactAndIsNowEmpty(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { if (i == 1) { return 1; @@ -6392,8 +6405,8 @@ cPICHasFreedTargets(CogMethod *cPIC) if (!(((((usqInt)cPIC)) <= (((usqInt)entryPoint))) && (((((usqInt)cPIC)) + ((cPIC->blockSize))) >= (((usqInt)entryPoint))))) { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); if (((targetMethod->cmType)) == CMFree) { return 1; } @@ -6489,7 +6502,7 @@ createCPICData(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); target = (targetMethod->methodObject); } storePointerUncheckedofObjectwithValue((i * 2) - 1, picData, class); @@ -6594,12 +6607,12 @@ endPCOf(sqInt aMethod) } -/* This is a static version of ceEnterCogCodePopReceiverReg - for break-pointing when debugging in C. */ -/* This exists only for break-pointing. */ +/* This is a static version of ceEnterCogCodePopReceiverReg for + break-pointing when debugging in C. Marked so the code generator + won't delete it. */ /* Cogit>>#enterCogCodePopReceiver */ -void +static void enterCogCodePopReceiver(void) { realCEEnterCogCodePopReceiverReg(); @@ -6897,7 +6910,7 @@ findMapLocationForMcpcinMethod(usqInt targetMcpc, CogMethod *cogMethod) CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if (startbcpc == (startPCOfMethodHeader((cogMethod->methodHeader)))) { return ((CogBlockMethod *) cogMethod); } @@ -6954,7 +6967,7 @@ fixupAt(sqInt fixupPC) void flagCogMethodForBecome(CogMethod *cogMethod) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ ((((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)))->cmType = CMMethodFlaggedForBecome); } @@ -6972,7 +6985,7 @@ followForwardedLiteralsImplementationIn(CogMethod *cogMethod) sqInt result; CogMethod *writableCogMethod; - assert((!(isCMMethodEtAl(cogMethod))) + assert((!(isCMMethodEtAl(((CogBlockMethod *) cogMethod)))) || (!(isForwarded((cogMethod->methodObject))))); writableCogMethod = ((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)); hasYoungObj = isYoung((cogMethod->methodObject)); @@ -7034,102 +7047,6 @@ followForwardedLiteralsIn(CogMethod *cogMethod) /* begin ensureExecutableCodeZone */ } - /* Cogit>>#followForwardedMethods */ -void -followForwardedMethods(void) -{ - CogMethod *cogMethod; - sqInt freedPIC; - - /* begin ensureWritableCodeZone */ - freedPIC = 0; - cogMethod = ((CogMethod *) methodZoneBase); - while (cogMethod < (limitZony())) { - if (((cogMethod->cmType)) >= CMMethod) { - if (isForwarded((cogMethod->methodObject))) { - (cogMethod->methodObject = followForwarded((cogMethod->methodObject))); - if (isYoungObject((cogMethod->methodObject))) { - ensureInYoungReferrers(cogMethod); - } - } - } - if (((cogMethod->cmType)) == CMClosedPIC) { - if (followMethodReferencesInClosedPIC(cogMethod)) { - freedPIC = 1; - freeMethod(cogMethod); - } - } - cogMethod = ((CogMethod *) (roundUpToMethodAlignment(backEnd(), (((sqInt)cogMethod)) + ((cogMethod->blockSize))))); - } - if (freedPIC) { - unlinkSendsToFree(); - } - /* begin ensureExecutableCodeZone */ -} - - -/* Follow a potential object reference from a closed PIC. - This may be a method reference or null. - Answer if the followed literal is young. - 'mcpc' refers to the jump/branch instruction at the end of - each cpic case */ - - /* Cogit>>#followMaybeObjRefInClosedPICAt: */ -static sqInt NoDbgRegParms -followMaybeObjRefInClosedPICAt(sqInt mcpc) -{ - sqInt object; - sqInt subject; - - object = literalBeforeFollowingAddress(backEnd, mcpc); - if (!(couldBeObject(object))) { - return 0; - } - if (!(isForwarded(object))) { - return isYoungObject(object); - } - subject = followForwarded(object); - /* begin setCodeModified */ -# if DUAL_MAPPED_CODE_ZONE - codeModified = 1; -# else - codeModified = 1; -# endif - storeLiteralbeforeFollowingAddress(backEnd, subject, mcpc); - return isYoungObject(subject); -} - - -/* Remap all object references in the closed PIC. Answer if any references - are young. - Set codeModified if any modifications are made. */ - - /* Cogit>>#followMethodReferencesInClosedPIC: */ -static sqInt NoDbgRegParms -followMethodReferencesInClosedPIC(CogMethod *cPIC) -{ - sqInt i; - sqInt pc; - sqInt refersToYoung; - - - /* first we check the potential method oop load at the beginning of the CPIC */ - pc = addressOfEndOfCaseinCPIC(1, cPIC); - - /* We find the end address of the cPICNumCases'th case and can then just step forward by the case size thereafter */ - refersToYoung = followMaybeObjRefInClosedPICAt(pc - (jumpLongByteSize(backEnd))); - - /* Next we check the potential potential method oop load for each case. */ - pc = addressOfEndOfCaseinCPIC((cPIC->cPICNumCases), cPIC); - for (i = 2; i <= ((cPIC->cPICNumCases)); i += 1) { - if (followMaybeObjRefInClosedPICAt((pc - (jumpLongConditionalByteSize(backEnd))) - (cmpC32RTempByteSize(backEnd)))) { - refersToYoung = 1; - } - pc += cPICCaseSize; - } - return refersToYoung; -} - /* To avoid runtime checks on literal variable and literal accesses in == and ~~, @@ -8629,8 +8546,11 @@ isPCMappedAnnotation(sqInt annotation) return annotation >= HasBytecodePC; } + +/* Useful for debugging. Marked so the code generator won't delete it. */ + /* Cogit>>#isPCWithinMethodZone: */ -sqInt +static sqInt NoDbgRegParms isPCWithinMethodZone(void *address) { return (((((usqInt)address)) >= methodZoneBase) && ((((usqInt)address)) <= (freeStart()))); @@ -9202,8 +9122,8 @@ mapObjectReferencesInMachineCodeForYoungGC(void) else { assert((cogMethodDoesntLookKosher(cogMethod)) == 0); if ((cogMethod->cmRefersToYoung)) { - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); if (!zoneIsWritable) { /* begin ensureWritableCodeZone */ zoneIsWritable = 1; @@ -9328,9 +9248,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) if ((((cogMethod->cmType)) >= CMMethod) && (isMarked((cogMethod->methodObject)))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -9372,9 +9292,9 @@ markAndTraceMachineCodeOfMarkedMethods(void) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector))))) { /* begin markAndTraceLiteralsIn: */ - assert(((isCMMethodEtAl(cogMethod)) + assert(((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) && (isMarked((cogMethod->methodObject)))) - || ((isCMOpenPIC(cogMethod)) + || ((isCMOpenPIC(((CogBlockMethod *) cogMethod))) && ((isImmediate((cogMethod->selector))) || (isMarked((cogMethod->selector)))))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); @@ -9479,7 +9399,7 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) } if (firstVisit) { /* begin markLiteralsAndUnlinkUnmarkedSendsIn: */ - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); assert(isMarked((cogMethod->methodObject))); markAndTraceLiteralinat((cogMethod->selector), cogMethod, (&((cogMethod->selector)))); /* begin maybeMarkIRCsIn: */ @@ -9534,9 +9454,9 @@ markAndTraceOrFreeCogMethodfirstVisit(CogMethod *cogMethod, sqInt firstVisit) freeMethod(cogMethod); return 1; } - assert((isCMMethodEtAl(cogMethod)) - || ((isCMClosedPIC(cogMethod)) - || (isCMOpenPIC(cogMethod)))); + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || ((isCMClosedPIC(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod))))); return 0; } @@ -9558,8 +9478,8 @@ markAndTraceOrFreePICTargetin(sqInt entryPoint, CogMethod *cPIC) return 0; } targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert((isCMMethodEtAl(targetMethod)) - || (isCMFree(targetMethod))); + assert((isCMMethodEtAl(((CogBlockMethod *) targetMethod))) + || (isCMFree(((CogBlockMethod *) targetMethod)))); return markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)cPIC))); } @@ -10378,6 +10298,9 @@ picInterpretAbortOffset(void) return (interpretOffset()) - (callInstructionByteSize(backEnd)); } + +/* useful for debugging */ + /* Cogit>>#printCogMethodFor: */ void printCogMethodFor(void *address) @@ -10401,6 +10324,9 @@ printCogMethodFor(void *address) } } + +/* useful for debugging */ + /* Cogit>>#printTrampolineTable */ void printTrampolineTable(void) @@ -10510,9 +10436,9 @@ relocateCallsAndSelfReferencesInMethod(CogMethod *cogMethod) refDelta = (cogMethod->objectHeader); callDelta = refDelta; - assert((isCMMethodEtAl(cogMethod)) - || (isCMOpenPIC(cogMethod))); - assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(cogMethod) + assert((isCMMethodEtAl(((CogBlockMethod *) cogMethod))) + || (isCMOpenPIC(((CogBlockMethod *) cogMethod)))); + assert((callTargetFromReturnAddress(backEnd, (((sqInt)cogMethod)) + missOffset)) == ((isCMMethodEtAl(((CogBlockMethod *) cogMethod)) ? methodAbortTrampolineFor((cogMethod->cmNumArgs)) : picAbortTrampolineFor((cogMethod->cmNumArgs))))); relocateCallBeforeReturnPCby(backEnd, (((sqInt)cogMethod)) + missOffset, -callDelta); @@ -10578,7 +10504,7 @@ relocateCallsInClosedPIC(CogMethod *cPIC) } else { targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset)); - assert(isCMMethodEtAl(targetMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) targetMethod))); if (i == 1) { relocateJumpLongBeforeFollowingAddressby(backEnd, pc, -(callDelta - ((targetMethod->objectHeader)))); } @@ -10969,13 +10895,6 @@ scanForCleanBlocks(void) return numCleanBlocks; } - /* Cogit>>#setBreakMethod: */ -void -setBreakMethod(sqInt anObj) -{ - breakMethod = anObj; -} - /* If a method is compiled to machine code via a block entry it won't have a selector. A subsequent send can find the method and hence fill in the @@ -10988,7 +10907,7 @@ void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop) { compilationBreakpointisMNUCase(aSelectorOop, 0); - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); /* begin ensureWritableCodeZone */ ((((CogMethod *) ((((usqInt)cogMethod)) + codeToDataDelta)))->selector = aSelectorOop); if (isYoung(aSelectorOop)) { @@ -11854,7 +11773,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) while (cogMethod < (limitZony())) { if (!(((cogMethod->cmType)) == CMFree)) { if ((cogMethod->cpicHasMNUCaseOrCMIsFullBlock)) { - assert(isCMClosedPIC(cogMethod)); + assert(isCMClosedPIC(((CogBlockMethod *) cogMethod))); freeMethod(cogMethod); mustScanAndUnlink = 1; } @@ -11931,7 +11850,7 @@ unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector) /* Unlink all sends in cog methods to free methods and/or pics. */ /* Cogit>>#unlinkSendsToFree */ -void +static void unlinkSendsToFree(void) { sqInt annotation; @@ -12220,9 +12139,9 @@ counters(CogMethod * self_in_counters) static void NoDbgRegParms addToOpenPICList(CogMethod *anOpenPIC) { - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); assert((openPICList == null) - || (isCMOpenPIC(openPICList))); + || (isCMOpenPIC(((CogBlockMethod *) openPICList)))); assertValidDualZoneWriteAddress(anOpenPIC); (anOpenPIC->nextOpenPIC = ((usqInt)openPICList)); openPICList = ((CogMethod *) ((((usqInt)anOpenPIC)) - (getCodeToDataDelta()))); @@ -12232,10 +12151,10 @@ addToOpenPICList(CogMethod *anOpenPIC) static void NoDbgRegParms addToUnpairedMethodList(CogMethod *aCogMethod) { - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); assert((noAssertMethodClassAssociationOf((aCogMethod->methodObject))) == (nilObject())); assert((unpairedMethodList == null) - || (isCMMethodEtAl(((CogMethod *) unpairedMethodList)))); + || (isCMMethodEtAl(((CogBlockMethod *) (((CogMethod *) unpairedMethodList)))))); assertValidDualZoneWriteAddress(aCogMethod); (aCogMethod->nextMethodOrIRCs = unpairedMethodList); unpairedMethodList = (((usqInt)aCogMethod)) - (getCodeToDataDelta()); @@ -12449,7 +12368,7 @@ findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { cogMethod = ((CogMethod *) unpairedMethodList); while (cogMethod != null) { - assert(isCMMethodEtAl(cogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) cogMethod))); if ((((cogMethod->selector)) == aSelectorOop) && (((cogMethod->methodObject)) == aMethodObj)) { return cogMethod; @@ -12481,7 +12400,7 @@ freeMethod(CogMethod *cogMethod) usqInt maybeIRCs; CogMethod *writableMethod; - assert(!((isCMFree(cogMethod)))); + assert(!((isCMFree(((CogBlockMethod *) cogMethod))))); assert((cogMethodDoesntLookKosher(cogMethod)) == 0); /* begin ensureWritableCodeZone */ if (((cogMethod->cmType)) >= CMMethod) { @@ -12762,6 +12681,9 @@ planCompaction(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethods */ void printCogMethods(void) @@ -12824,6 +12746,9 @@ printCogMethods(void) cr(); } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsOfType: */ void printCogMethodsOfType(sqInt cmType) @@ -12840,6 +12765,9 @@ printCogMethodsOfType(sqInt cmType) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithMethod: */ void printCogMethodsWithMethod(sqInt methodOop) @@ -12857,6 +12785,9 @@ printCogMethodsWithMethod(sqInt methodOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithPrimitive: */ void printCogMethodsWithPrimitive(sqInt primIdx) @@ -12874,6 +12805,9 @@ printCogMethodsWithPrimitive(sqInt primIdx) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogMethodsWithSelector: */ void printCogMethodsWithSelector(sqInt selectorOop) @@ -12891,6 +12825,9 @@ printCogMethodsWithSelector(sqInt selectorOop) } } + +/* useful for debugging */ + /* CogMethodZone>>#printCogYoungReferrers */ void printCogYoungReferrers(void) @@ -12916,6 +12853,9 @@ printCogYoungReferrers(void) } } + +/* useful for debugging */ + /* CogMethodZone>>#printOpenPICList */ sqInt printOpenPICList(void) @@ -12935,7 +12875,7 @@ printOpenPICList(void) } /* CogMethodZone>>#pruneYoungReferrers */ -sqInt +static sqInt pruneYoungReferrers(void) { usqInt dest; @@ -13053,13 +12993,13 @@ removeFromOpenPICList(CogMethod *anOpenPIC) { CogMethod *prevPIC; - assert(isCMOpenPIC(anOpenPIC)); + assert(isCMOpenPIC(((CogBlockMethod *) anOpenPIC))); if (!openPICList) { return null; } - assert((isCMOpenPIC(openPICList)) + assert((isCMOpenPIC(((CogBlockMethod *) openPICList))) && ((((openPICList->nextOpenPIC)) == null) - || (isCMOpenPIC(((CogMethod *) ((openPICList->nextOpenPIC))))))); + || (isCMOpenPIC(((CogBlockMethod *) (((CogMethod *) ((openPICList->nextOpenPIC))))))))); if (anOpenPIC == openPICList) { /* N.B. Use self rather than coInterpreter to avoid attempting to cast nil. @@ -13070,7 +13010,7 @@ removeFromOpenPICList(CogMethod *anOpenPIC) prevPIC = openPICList; do { assert((prevPIC != null) - && (isCMOpenPIC(prevPIC))); + && (isCMOpenPIC(((CogBlockMethod *) prevPIC)))); if (((prevPIC->nextOpenPIC)) == (((usqInt)anOpenPIC))) { ((((CogMethod *) ((((usqInt)prevPIC)) + codeToDataDelta)))->nextOpenPIC = (anOpenPIC->nextOpenPIC)); return null; @@ -13086,7 +13026,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) { CogMethod *prevMethod; - assert(isCMMethodEtAl(aCogMethod)); + assert(isCMMethodEtAl(((CogBlockMethod *) aCogMethod))); if ((((usqInt)aCogMethod)) == unpairedMethodList) { unpairedMethodList = (aCogMethod->nextMethodOrIRCs); return null; @@ -13094,7 +13034,7 @@ removeFromUnpairedMethodList(CogMethod *aCogMethod) prevMethod = ((CogMethod *) unpairedMethodList); while (prevMethod != null) { assert((prevMethod != null) - && (isCMMethodEtAl(prevMethod))); + && (isCMMethodEtAl(((CogBlockMethod *) prevMethod)))); if (((prevMethod->nextMethodOrIRCs)) == (((usqInt)aCogMethod))) { (prevMethod->nextMethodOrIRCs = (aCogMethod->nextMethodOrIRCs)); return null; @@ -13152,11 +13092,8 @@ voidYoungReferrersPostTenureAll(void) youngReferrers = limitAddress; } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CogMethodZone>>#whereIsMaybeCodeThing: */ -EXPORT(char *) +char * whereIsMaybeCodeThing(sqInt anOop) { if (oopisGreaterThanOrEqualToandLessThan(anOop, codeBase, limitAddress)) { diff --git a/src/spur64.cog.newspeak/cointerp.c b/src/spur64.cog.newspeak/cointerp.c index de6aa5ed5f..9e6a25f8d2 100644 --- a/src/spur64.cog.newspeak/cointerp.c +++ b/src/spur64.cog.newspeak/cointerp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - CoInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CoInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -170,7 +170,6 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define GCCheckShorten 64 #define GCModeBecome 8 #define GCModeFull 1 -#define GCModeIncremental 4 #define GCModeNewSpace 2 #define HasBeenReturnedFromMCPC -1 #define HasBeenReturnedFromMCPCOop 0xFFFFFFFFFFFFFFF9ULL @@ -430,7 +429,6 @@ static void NoDbgRegParms addNewMethodToCache(sqInt classObj); extern usqInt argumentCountAddress(void); static CogMethod * NoDbgRegParms asCogHomeMethod(CogBlockMethod *aCogMethod); static void NoDbgRegParms assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln); -extern void assertValidMachineCodeFrame(sqInt instrPtr); static sqInt NoDbgRegParms assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln); static void NoDbgRegParms assertValidStackedInstructionPointers(sqInt ln); static void NoDbgRegParms attemptToSwitchToMachineCode(sqInt bcpc); @@ -457,7 +455,7 @@ extern sqInt ceNonLocalReturn(sqInt returnValue); extern void ceOuterSendreceiver(sqInt cacheAddress, sqInt methodReceiver); extern void ceReapAndResetErrorCodeFor(CogMethod *cogMethod); extern void ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver); -extern sqInt ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); +static sqInt NoDbgRegParms ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); extern sqInt ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC); extern sqInt ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize); extern sqInt ceSendMustBeBoolean(sqInt anObject); @@ -495,7 +493,7 @@ static sqInt NoDbgRegParms divorceAFrameIfin(sqInt (*criterion)(char *fp), Stack static sqInt NoDbgRegParms divorceAllFramesSuchThat(sqInt (*criterion)(char *fp)); static sqInt NoDbgRegParms divorceAMachineCodeFrameWithCogMethodin(CogMethod *cogMethod, StackPage *aStackPage); extern void dumpPrimTraceLog(void); -EXPORT(void) dumpPrimTraceLogOn(FILE *aStdioStream); +extern void dumpPrimTraceLogOn(FILE *aStdioStream); static void NoDbgRegParms ensureAllContextsHaveBytecodePCsIf(sqInt (*criterion)(sqInt methodOop)); static void NoDbgRegParms ensureContextHasBytecodePC(sqInt aContext); static void NoDbgRegParms ensureContextIsExecutionSafeAfterAssignToStackPointer(sqInt aContext); @@ -525,7 +523,6 @@ extern usqInt framePointerAddress(void); static sqInt NoDbgRegParms frameReceiver(char *theFP); extern void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto(sqInt methodObj, sqInt primitiveIndex, sqInt *flagsPtr))(void); extern sqInt getCurrentBytecode(void); -extern char * getFramePointer(void); static sqInt getImageHeaderFlags(void); static sqInt NoDbgRegParms handleForwardedSendFaultForReceiverstackDelta(sqInt forwardedReceiver, sqInt stackDelta); static sqInt NoDbgRegParms handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage); @@ -535,7 +532,6 @@ static usqInt NoDbgRegParms iframeSavedIP(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); extern usqInt instructionPointerAddress(void); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); -extern usqInt interpretAddress(void); static sqInt NeverInline interpreterAllocationReserveBytes(void); static sqInt interpretMethodFromMachineCode(void); extern sqInt isCogMethodReference(sqInt methodHeader); @@ -577,12 +573,10 @@ extern sqInt methodShouldBeCogged(sqInt aMethodObj); static sqInt NoDbgRegParms methodWithHeaderShouldBeCogged(sqInt methodHeader); static CogBlockMethod * NoDbgRegParms mframeCogMethod(char *theFP); extern CogMethod * mframeHomeMethodExport(void); -extern CogMethod * mframeHomeMethod(char *theFP); +static CogMethod * NoDbgRegParms mframeHomeMethod(char *theFP); static sqInt NoDbgRegParms mframeIsBlockActivation(char *theFP); static sqInt NoDbgRegParms mframeReceiver(char *theFP); static sqInt NeverInline minimumUnusedHeadroom(void); -extern sqInt mMethodClass(void); -extern void mnuCompilationBreakpointFor(sqInt selectorOop); static sqInt NoDbgRegParms mnuMethodOrNilFor(sqInt rcvr); static char * NoDbgRegParms moveFramesInthroughtoPage(StackPage *oldPage, char *theFP, StackPage *newPage); static sqInt NoDbgRegParms mustMapMachineCodePCcontext(sqInt theIP, sqInt aOnceMarriedContext); @@ -600,16 +594,15 @@ extern usqInt primFailCodeAddress(void); static void NoDbgRegParms primitiveBecomeReturn(sqInt ec); static void primitiveExecuteMethod(void); static void primitiveExecuteMethodArgsArray(void); -extern usqInt primitiveFailAddress(void); extern sqInt primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs); extern void * primTraceLogAddress(void); extern usqInt primTraceLogIndexAddress(void); -EXPORT(void) printCogMethod(CogMethod *cogMethod); +extern void printCogMethod(CogMethod *cogMethod); static void NoDbgRegParms printFrameFlagsForFP(char *theFP); static void NoDbgRegParms printFrameMethodFor(char *theFP); static void NoDbgRegParms printFrameThingatextra(char *name, char *address, sqInt extraValue); -EXPORT(sqInt) printFrameWithSP(char *theFP, char *theSP); -EXPORT(void) printMethodCacheFor(sqInt thing); +extern sqInt printFrameWithSP(char *theFP, char *theSP); +extern void printMethodCacheFor(sqInt thing); static sqInt NoDbgRegParms printPrimLogEntryAthasParameter(sqInt i, sqInt hasParameter); extern sqInt quickPrimitiveConstantFor(sqInt aQuickPrimitiveIndex); extern sqInt (*quickPrimitiveGeneratorFor(sqInt aQuickPrimitiveIndex))(void); @@ -620,13 +613,13 @@ extern size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredH extern sqInt recordFastCCallPrimTraceForMethod(sqInt aMethodObj); extern sqInt recordPrimTraceForMethod(sqInt aMethodObj); static void NeverInline reloadPrimitiveCalloutPointer(void); -EXPORT(void) reportMinimumUnusedHeadroom(void); -EXPORT(void) reportMinimumUnusedHeadroomOn(FILE *aStdioStream); +extern void reportMinimumUnusedHeadroom(void); +extern void reportMinimumUnusedHeadroomOn(FILE *aStdioStream); static sqInt NoDbgRegParms resumepreemptedYieldingIffrom(sqInt aProcess, sqInt yieldImplicitly, sqInt sourceCode); static sqInt NoDbgRegParms returnToExecutivepostContextSwitch(sqInt inInterpreter, sqInt switchedContext); static sqInt NoDbgRegParms returntoExecutive(sqInt returnValue, sqInt inInterpreter); static sqInt NoDbgRegParms roomToPushNArgs(sqInt n); -EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); +extern sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); static sqInt NoDbgRegParms shortPrintFrame(char *theFP); extern sqInt signed32BitIntegerFor(sqInt integerValue); extern int signed32BitValueOf(sqInt oop); @@ -648,7 +641,7 @@ static void NoDbgRegParms updateStateOfSpouseContextForFrameWithSP(char *theFP, extern sqInt validInstructionPointerinMethodframePointer(usqInt instrPointer, usqInt aMethod, char *fp); static sqInt NoDbgRegParms validStackPageBaseFrame(StackPage *aPage); static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); -EXPORT(char *) whereIs(sqInt anOop); +extern char * whereIs(sqInt anOop); static void NoDbgRegParms NeverInline widowOrForceToBytecodePC(sqInt ctxt); static sqInt NoDbgRegParms frameIsMarked(sqInt theFPInt); #if VMBenchmarks @@ -660,6 +653,9 @@ EXPORT(void) primitiveBenchmarkFollowForwardersOfReceiverAndTemporariesInStackZo #if VMBenchmarks EXPORT(sqInt) primitiveBenchmarkJITReceiver(void); #endif /* VMBenchmarks */ +#if VMBenchmarks +EXPORT(void) primitiveBenchmarkScavenge(void); +#endif /* VMBenchmarks */ static void primitiveClosureCopyWithCopiedValues(void); static void primitiveCollectCogCodeConstituents(void); static void primitiveContextXray(void); @@ -944,7 +940,7 @@ extern void ceScheduleScavenge(void); extern sqInt classSmallFloat(void); static void clearLeakMapAndMapAccessibleObjects(void); extern void ensureNoForwardedLiteralsIn(sqInt aMethodObj); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern usqInt freeStartAddress(void); extern usqInt getScavengeThreshold(void); static sqLong NoDbgRegParms headerWhileForwardingOf(sqInt aCompiledMethodObjOop); @@ -972,9 +968,7 @@ static void NoDbgRegParms hackSlimBridgeToat(sqInt objOop, sqInt startAddress); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); static sqInt NoDbgRegParms initFreeChunkWithBytesat(usqLong numBytes, sqInt address); static void NoDbgRegParms initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt integerObjectOf(sqInt value); extern sqInt integerValueOf(sqInt oop); static sqInt NoDbgRegParms isFloatInstance(sqInt oop); @@ -1056,8 +1050,6 @@ extern void characterTable(void); extern usqInt characterValueOf(sqInt oop); static sqInt NoDbgRegParms cheapAddressCouldBeInHeap(sqInt address); extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); static sqInt checkHeapFreeSpaceIntegrity(void); static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt classIndicesShouldBeValid); extern sqInt checkOkayOop(usqInt oop); @@ -1101,13 +1093,13 @@ extern sqInt classWordArray(void); static void clearLeakMapAndMapAccessibleFreeSpace(void); static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning); extern sqInt cloneObject(sqInt objOop); -extern sqInt compactClassIndexOf(sqInt objOop); +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop); static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i); extern void countMarkedAndUnmarkdObjects(sqInt printFlags); static usqLong currentAllocatedBytes(void); extern sqInt displayObject(void); static void NoDbgRegParms doScavenge(sqInt tenuringCriterion); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); static void NoDbgRegParms emptyObjStack(sqInt objStack); static void NoDbgRegParms enableObjectEnumerationFrom(sqInt initialObject); @@ -1163,12 +1155,11 @@ static sqInt imageSegmentVersion(void); extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ extern void incrementalGC(void); -extern sqInt indexOfin(sqInt anElement, sqInt anObject); static void NoDbgRegParms inFreeTreeReplacewith(sqInt treeNode, sqInt newNode); static sqInt NoDbgRegParms initialInstanceOf(sqInt classObj); static void NeverInline initializeNewSpaceVariables(void); static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift); -EXPORT(void) inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); +extern void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); static void NoDbgRegParms NeverInline inPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag); extern sqInt instanceSizeOf(sqInt classObj); static sqInt NoDbgRegParms instantiateClass(sqInt classObj); @@ -1176,7 +1167,6 @@ extern sqInt instSpecOfClassFormat(sqInt classFormat); static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer); static void NoDbgRegParms invalidCompactClassError(const char *className); static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isArray(sqInt oop); static sqInt NoDbgRegParms isBridgeOrEnumerableObjectNoAssert(sqInt objOop); extern sqInt isBytes(sqInt oop); @@ -1214,7 +1204,7 @@ static sqInt NoDbgRegParms isMaybeFiredEphemeron(sqInt objOop); extern sqInt isNonImmediate(sqInt oop); static sqInt NoDbgRegParms isObjEphemeron(sqInt objOop); static sqInt NoDbgRegParms isObjImmutable(sqInt anOop); -extern sqInt isOldObject(sqInt objOop); +static sqInt NoDbgRegParms isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); extern sqInt isOopImmutable(sqInt oop); @@ -1222,12 +1212,11 @@ extern sqInt isOopMutable(sqInt oop); extern sqInt isPinned(sqInt objOop); extern sqInt isPointers(sqInt oop); static sqInt NoDbgRegParms isPureBitsFormat(sqInt format); -extern sqInt isReallyYoung(sqInt oop); static sqInt NoDbgRegParms isRemembered(sqInt objOop); static sqInt NoDbgRegParms isSegmentBridge(sqInt objOop); static sqInt NoDbgRegParms isSemaphoreOop(sqInt anOop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop); extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); static sqInt NoDbgRegParms isValidObjStackAt(sqInt objStackRootIndex); @@ -1248,20 +1237,18 @@ static sqInt NoDbgRegParms isonObjStack(sqInt oop, sqInt objStack); static sqInt NoDbgRegParms keyOfEphemeron(sqInt objOop); static sqInt NoDbgRegParms knownClassAtIndex(sqInt classIndex); static sqInt lastPointerFormat(void); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop); +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); static sqInt NoDbgRegParms lengthOfMaybeImmediate(sqInt oop); static sqInt NoDbgRegParms lengthOf(sqInt objOop); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); static sqInt NoDbgRegParms NeverInline loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray); -EXPORT(void) longPrintInstancesOf(sqInt aClassOop); -EXPORT(void) longPrintInstancesWithClassIndex(sqInt classIndex); -EXPORT(void) longPrintReferencesTo(sqInt anOop); +extern void longPrintInstancesOf(sqInt aClassOop); +extern void longPrintInstancesWithClassIndex(sqInt classIndex); +extern void longPrintReferencesTo(sqInt anOop); static void mapExtraRoots(void); static void NeverInline mapMournQueue(void); static sqInt NoDbgRegParms mapOopsFromtooutPointersoutHashes(sqInt segStart, sqInt segAddr, sqInt outPointerArray, sqInt savedOutHashes); @@ -1273,7 +1260,6 @@ static void NoDbgRegParms NeverInline markObjects(sqInt objectsShouldBeUnmarkedA static void markWeaklingsAndMarkAndFireEphemerons(void); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); extern sqInt minSlotsForShortening(void); static usqInt NoDbgRegParms newHashBitsOf(sqInt objOop); static usqInt newObjectHash(void); @@ -1291,12 +1277,11 @@ static sqInt noUnscannedEphemerons(void); static sqInt NoDbgRegParms numBytesOfBitsformat(sqInt objOop, sqInt format); static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numSlotsForBytes(sqInt numBytes); static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); extern sqInt objectBefore(sqInt objOop); static sqInt NoDbgRegParms objectInPastSpaceBefore(sqInt objOop); @@ -1311,45 +1296,46 @@ static sqInt NoDbgRegParms popObjStack(sqInt objStack); extern sqInt popRemappableOop(void); static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags); extern sqInt primitiveErrorTable(void); -EXPORT(void) printActivationsOf(sqInt aMethodObj); -EXPORT(void) printBogons(void); +extern void printActivationsOf(sqInt aMethodObj); +extern void printBogons(void); +static void NoDbgRegParms printBridgeon(sqInt oop, FILE *aStream); static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printContextReferencesTo(sqInt anOop); -EXPORT(void) printEntity(sqInt oop); -EXPORT(void) printForwarders(void); +extern void printContextReferencesTo(sqInt anOop); +extern void printEntity(sqInt oop); +extern void printForwarders(void); static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream); extern void printFreeChunks(void); -EXPORT(void) printFreeChunk(sqInt freeChunk); +extern void printFreeChunk(sqInt freeChunk); static void NoDbgRegParms printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode); -EXPORT(void) printFreeListHeads(void); -EXPORT(sqInt) printFreeList(sqInt chunkOrIndex); +extern void printFreeListHeads(void); +extern sqInt printFreeList(sqInt chunkOrIndex); static void NoDbgRegParms printFreeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printFreeTree(void); +extern void printFreeTree(void); static void NoDbgRegParms printFreeTreeChunk(sqInt chunkOrZero); -EXPORT(void) printHeaderOf(sqInt objOop); +extern void printHeaderOf(sqInt objOop); static void NoDbgRegParms printImmediateObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printInstancesOf(sqInt aClassOop); -EXPORT(void) printInstancesWithClassIndex(sqInt classIndex); +extern void printInstancesOf(sqInt aClassOop); +extern void printInstancesWithClassIndex(sqInt classIndex); extern void printInvalidClassTableEntries(void); #if LLDB -EXPORT(void) printMarkedOops(void); +extern void printMarkedOops(void); #endif /* LLDB */ -EXPORT(void) printMethodImplementorsOf(sqInt anOop); -EXPORT(void) printMethodReferencesTo(sqInt anOop); +extern void printMethodImplementorsOf(sqInt anOop); +extern void printMethodReferencesTo(sqInt anOop); static void NoDbgRegParms printNonPointerDataOfon(sqInt oop, FILE *aStream); -EXPORT(void) printObjectsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) printObjectsWithHash(sqInt hash); +extern void printObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void printObjectsWithHash(sqInt hash); +extern void printObjStackAndContents(sqInt objStack); static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents); static void NoDbgRegParms printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType); extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); -EXPORT(void) NeverInline printOopsExcept(sqInt (*function)(sqInt)); -EXPORT(void) printOopsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); -EXPORT(void) printReferencesTo(sqInt anOop); +extern void NeverInline printOopsExcept(sqInt (*function)(sqInt)); +extern void printOopsFromto(sqInt startAddress, sqInt endAddress); +extern void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); +extern void printReferencesTo(sqInt anOop); static void NoDbgRegParms printStringDataOfon(sqInt oop, FILE *aStream); #if LLDB -EXPORT(void) printUnmarkedOops(void); +extern void printUnmarkedOops(void); #endif /* LLDB */ static sqInt NoDbgRegParms pushOnUnscannedEphemeronsStack(sqInt anEphemeron); extern void pushRemappableOop(sqInt oop); @@ -1367,14 +1353,14 @@ static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedObjsclassIndicesShould static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion); static sqInt NoDbgRegParms NeverInline setHeapBasememoryLimitendOfMemory(sqInt baseOfHeap, sqInt memLimit, sqInt memEnd); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); -EXPORT(void) shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); extern sqInt shouldRemapOop(sqInt oop); static sqInt NoDbgRegParms sizeOfObjStack(sqInt objStack); static sqInt slidingCompactionInProgress(void); extern sqInt slotSizeOf(sqInt oop); extern sqInt splObj(sqInt index); static usqInt NoDbgRegParms startOfObject(sqInt objOop); -EXPORT(sqInt) statNumGCs(void); +extern sqInt statNumGCs(void); extern usqInt storeCheckBoundary(void); static sqInt NoDbgRegParms storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointerArrayArg, sqInt arrayOfRootsArg); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); @@ -1438,7 +1424,7 @@ static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i); static void postSnapshot(void); static void NeverInline prepareForSnapshot(void); static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes); -EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop); +extern SpurSegmentInfo * segmentContainingObj(sqInt objOop); static sqInt segmentOverlap(void); static sqInt NoDbgRegParms shrinkObjectMemory(usqInt delta); static sqInt someSegmentContainsPinned(void); @@ -1448,7 +1434,7 @@ static sqInt NoDbgRegParms writeImageSegmentsToFile(sqImageFile aBinaryStream); static sqInt NoDbgRegParms writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSegment, sqImageFile aBinaryStream); static sqInt NoDbgRegParms accessModifierOfMethod(sqInt methodObj); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -EXPORT(sqInt) activeProcess(void); +extern sqInt activeProcess(void); extern void addIdleUsecs(sqInt idleUsecs); static void NoDbgRegParms addLastLinktoList(sqInt proc, sqInt aList); static void NoDbgRegParms addNewMethodToNSCache(sqInt rule); @@ -1462,11 +1448,11 @@ static sqInt NoDbgRegParms asciiOfCharacter(sqInt characterObj); extern void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); static void NoDbgRegParms assertValidStackLimits(sqInt ln); extern sqInt booleanValueOf(sqInt obj); -EXPORT(sqInt) callbackEnter(sqInt *callbackID); -EXPORT(sqInt) callbackLeave(sqInt cbID); +extern sqInt callbackEnter(sqInt *callbackID); +extern sqInt callbackLeave(sqInt cbID); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); extern sqInt characterForAscii(sqInt ascii); -EXPORT(sqInt) checkAllAccessibleObjectsOkay(void); +extern sqInt checkAllAccessibleObjectsOkay(void); #if LRPCheck static sqInt NeverInline checkDeliveryOfLongRunningPrimitiveSignal(void); #endif /* LRPCheck */ @@ -1475,7 +1461,7 @@ static sqInt NoDbgRegParms checkForEventsMayContextSwitch(sqInt mayContextSwitch static sqInt NoDbgRegParms checkImageVersionFromstartingAt(sqImageFile f, squeakFileOffsetType imageOffset); static sqInt checkInterpreterIntegrity(void); static sqInt NoDbgRegParms checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP); -EXPORT(sqInt) checkOkayInterpreterObjects(sqInt writeBack); +extern sqInt checkOkayInterpreterObjects(sqInt writeBack); static sqInt NoDbgRegParms checkOkayStackPage(StackPage *thePage); static sqInt NoDbgRegParms checkOkayStackZone(sqInt writeBack); static void NoDbgRegParms checkProfileTick(sqInt aPrimitiveMethod); @@ -1484,8 +1470,7 @@ static sqInt NoDbgRegParms checkStackPointerIndexForFrame(char *theFP); static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className); static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext); static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern sqInt copyBits(void); extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y); static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop); @@ -1536,7 +1521,7 @@ static sqInt NoDbgRegParms frameStackedReceiverOffset(char *theFP); static sqInt NoDbgRegParms frameStackedReceivernumArgs(char *theFP, sqInt numArgs); static void freeUntracedStackPages(void); extern sqInt fullDisplayUpdate(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); +static void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); static sqInt getCogVMFeatureFlags(void); static sqInt getErrorObjectFromPrimFailCode(void); extern sqInt getFullScreenFlag(void); @@ -1594,7 +1579,7 @@ static sqInt NoDbgRegParms lengthOfNameOfClass(sqInt classOop); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt loadBitBltFrom(sqInt bb); extern void loadInitialContext(void); -EXPORT(void) longPrintOop(sqInt oop); +extern void longPrintOop(sqInt oop); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); static sqInt NoDbgRegParms lookupInMethodCacheSelclassTag(sqInt selector, sqInt classTag); static sqInt NoDbgRegParms lookupLexicalfromrule(sqInt selector, sqInt mixin, sqInt rule); @@ -1641,7 +1626,6 @@ static sqInt NoDbgRegParms objectequalsString(sqInt anOop, char *aCString); extern sqInt ownVM(sqInt threadIndexAndFlags); static sqInt NoDbgRegParms pcPreviousToinSqueakV3PlusClosuresMethod(sqInt theIP, sqInt aMethod); extern sqInt pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt pop(sqInt nItems); extern void popthenPush(sqInt nItems, sqInt oop); @@ -1657,44 +1641,43 @@ extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); static void NoDbgRegParms printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void NoDbgRegParms printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); -EXPORT(void) printAllStacks(void); -EXPORT(void) printAllStacksOn(FILE *aStdioStream); -EXPORT(void) printCallStack(void); +extern void printAllStacks(void); +extern void printAllStacksOn(FILE *aStdioStream); +extern void printCallStack(void); static sqInt NoDbgRegParms printCallStackFP(char *theFP); -EXPORT(sqInt) printCallStackOf(sqInt aContextOrProcessOrFrame); +extern sqInt printCallStackOf(sqInt aContextOrProcessOrFrame); static sqInt NoDbgRegParms printCallStackOfcurrentFP(sqInt aContext, char *currFP); -EXPORT(void) printCallStackOn(FILE *aStdioStream); +extern void printCallStackOn(FILE *aStdioStream); static sqInt NoDbgRegParms printContextCallStackOf(sqInt aContext); -EXPORT(void) printContext(sqInt aContext); +extern void printContext(sqInt aContext); static void NoDbgRegParms printDecodeMethodHeaderOop(sqInt methodHeaderOop); -EXPORT(void) printExternalHeadFrame(void); +extern void printExternalHeadFrame(void); static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort); static void NoDbgRegParms printFrameOopat(char *name, char *address); static void NoDbgRegParms printFrameOopindexat(char *name, sqInt idx, char *address); -EXPORT(void) printFramesInPage(StackPage *thePage); -EXPORT(void) printFramesOnStackPageListInUse(void); +extern void printFramesInPage(StackPage *thePage); +extern void printFramesOnStackPageListInUse(void); static void NoDbgRegParms printFrameThingandFrameat(char *name, char *theFP, char *address); static void NoDbgRegParms printFrameThingatextraString(char *name, char *address, char *extraStringOrNil); -EXPORT(sqInt) printFrame(char *theFP); -extern sqInt printHexnp(usqInt n); +extern sqInt printFrame(char *theFP); static sqInt NoDbgRegParms printHexPtrnp(void *p); extern void printHex(usqInt n); -EXPORT(void) printLikelyImplementorsOfSelector(sqInt selector); -EXPORT(void) printMethodCache(void); -EXPORT(void) printMethodDictionaryOf(sqInt behavior); -EXPORT(void) printMethodDictionary(sqInt dictionary); +extern void printLikelyImplementorsOfSelector(sqInt selector); +extern void printMethodCache(void); +extern void printMethodDictionaryOf(sqInt behavior); +extern void printMethodDictionary(sqInt dictionary); static void NoDbgRegParms printNameOfClasscount(sqInt classOop, sqInt cnt); static void NoDbgRegParms printOopShortInner(sqInt oop); -EXPORT(void) printOop(sqInt oop); -EXPORT(void) printProcessStack(sqInt aProcess); -EXPORT(sqInt) printProcsOnList(sqInt procList); -EXPORT(sqInt) printStackCallStackOf(sqInt aContextOrProcessOrFrame); -EXPORT(void) printStackPageList(void); -EXPORT(void) printStackPageListInUse(void); -EXPORT(void) printStackPages(void); -EXPORT(void) printStackPagesInUse(void); +extern void printOop(sqInt oop); +extern void printProcessStack(sqInt aProcess); +extern sqInt printProcsOnList(sqInt procList); +extern sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame); +extern void printStackPageList(void); +extern void printStackPageListInUse(void); +extern void printStackPages(void); +extern void printStackPagesInUse(void); static void NoDbgRegParms printStackPageuseCount(StackPage *page, sqInt n); -EXPORT(void) printStackReferencesTo(sqInt oop); +extern void printStackReferencesTo(sqInt oop); static void NoDbgRegParms printStringOf(sqInt oop); extern void print(char *s); extern void pushBool(sqInt trueOrFalse); @@ -1708,20 +1691,20 @@ static void NoDbgRegParms putToSleepyieldingIf(sqInt aProcess, sqInt yieldImplic static void NoDbgRegParms putWord32toFile(int aWord32, sqImageFile aFile); extern sqInt readableFormat(sqInt imageVersion); static void NoDbgRegParms NeverInline reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader); -EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext); +extern sqInt reestablishContextPriorToCallback(sqInt callbackContext); static sqInt NoDbgRegParms removeFirstLinkOfList(sqInt aList); static sqInt NoDbgRegParms removeProcessfromList(sqInt aProcess, sqInt aList); static sqInt retryPrimitiveOnFailure(void); -EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); +extern sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); static void NoDbgRegParms reverseDisplayFromto(sqInt startIndex, sqInt endIndex); static void NoDbgRegParms rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)()); static sqInt NoDbgRegParms safeMethodClassOf(sqInt methodPointer); static sqInt NoDbgRegParms saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex); static sqInt schedulerPointer(void); -EXPORT(void) setBreakMNUSelector(char *aString); -EXPORT(void) setBreakSelector(char *aString); +extern void setBreakMNUSelector(char *aString); +extern void setBreakSelector(char *aString); extern void setFullScreenFlag(sqInt value); -EXPORT(void *) setInterruptCheckChain(void (*aFunction)()); +extern void * setInterruptCheckChain(void (*aFunction)()); extern void setInterruptKeycode(sqInt value); extern void setInterruptPending(sqInt value); extern void setNextWakeupUsecs(usqLong value); @@ -1730,9 +1713,9 @@ static void setSignalLowSpaceFlagAndSaveProcess(void); static void NoDbgRegParms setTraceFlagOnContextsFramesPageIfNeeded(sqInt aContext); static sqInt NoDbgRegParms shortPrintContext(sqInt aContext); static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP); -EXPORT(void) shortPrintFramesInPage(StackPage *thePage); -EXPORT(void) shortPrintFramesOnStackPageListInUse(void); -EXPORT(void) shortPrintFrameAndNCallers(char *theFP, sqInt n); +extern void shortPrintFramesInPage(StackPage *thePage); +extern void shortPrintFramesOnStackPageListInUse(void); +extern void shortPrintFrameAndNCallers(char *theFP, sqInt n); static void NoDbgRegParms shortPrintOop(sqInt oop); static sqInt NoDbgRegParms shortReversePrintFrameAndCallers(char *aFramePointer); extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); @@ -1836,8 +1819,8 @@ _iss usqInt instructionPointer; _iss sqInt argumentCount; _iss sqLong nextProfileTick; _iss sqInt primTraceLog[256]; -_iss FILE * transcript; _iss StackPage * stackPage; +_iss FILE * transcript; _iss sqInt nilObj; _iss usqInt oldSpaceStart; _iss usqInt method; @@ -1851,9 +1834,9 @@ _iss sqInt trueObj; _iss sqInt falseObj; _iss usqInt totalFreeOldSpace; _iss sqInt lkupClassTag; -_iss SpurSegmentInfo * segments; _iss usqInt newSpaceStart; _iss sqInt hiddenRootsObj; +_iss SpurSegmentInfo * segments; _iss sqInt bytesPerPage; _iss sqInt numSegments; _iss sqInt classTableFirstPage; @@ -1870,6 +1853,7 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; _iss sqInt numStackPages; _iss sqInt tempOop; @@ -1889,13 +1873,11 @@ _iss sqInt becomeEffectsFlags; _iss sqInt growHeadroom; _iss sqInt tenureThreshold; _iss char * objStackInvalidBecause; -_iss sqInt sweepIndex; _iss sqInt ephemeronList; #if LRPCheck _iss sqInt longRunningPrimitiveCheckMethod; #endif _iss sqInt tenureCriterion; -_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classNameIndex; _iss usqInt freeOldSpaceStart; _iss sqInt extraRootCount; @@ -2026,7 +2008,6 @@ _iss sqInt traceLog[TraceBufferSize /* 768 */]; _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 65 */]; _iss usqLong byteCount; -_iss sqInt preferredPinningSegment; _iss sqInt statCoalesces; _iss usqLong statFGCDeltaUsecs; _iss usqLong statIncrGCUsecs; @@ -2075,7 +2056,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, @@ -2719,8 +2700,8 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 584 */])(void) = { 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */; -sqInt checkForLeaks; sqInt breakLookupClassTag; +sqInt checkForLeaks; sqInt breakSelectorLength = MinSmallInteger; sqInt debugCallbackPath; void * displayBits; @@ -2729,9 +2710,9 @@ sqInt primitiveDoMixedArithmetic = -1; sqInt desiredEdenBytes; sqInt desiredNumStackPages; sqInt extraVMMemory; -char * breakSelector; sqInt desiredCogCodeSize; sqInt eventTraceMask; +char * breakSelector; usqInt maxOldSpaceSize; sqInt ffiExceptionResponse; usqInt heapBase; @@ -2740,12 +2721,12 @@ sqInt upscaleDisplayIfHighDPI = -1; sqInt deferDisplayUpdates; struct VirtualMachine* interpreterProxy; sqInt sendWheelEvents; -sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.3310"; +const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.3329"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2779,13 +2760,6 @@ volatile int sendTrace; } while (0) #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize) #define heapBase() heapBase -#define mnuCompilationBreakpoint(sel, len) do { \ - if ((len) == -breakSelectorLength \ - && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, -breakSelectorLength)) { \ - suppressHeartbeatFlag = 1; \ - compilationBreakpointFor(sel); \ - } \ -} while (0) #define primTraceLogIndex(aValue) (GIV(primTraceLogIndex) = (aValue)) #define pageIndexForstackBasePlus1bytesPerPage(pointer,stkBasePlus1,pageByteSize) (((char *)(pointer) - (stkBasePlus1)) / (pageByteSize)) #define startOfMemory() heapBase @@ -14798,29 +14772,6 @@ assertl((methodUsesAlternateBytecodeSet(GIV(method))) == (GIV(bytecodeSetSelecto } } - /* CoInterpreter>>#assertValidMachineCodeFrame: */ -void -assertValidMachineCodeFrame(sqInt instrPtr) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - CogBlockMethod *cogMethod; - CogMethod *homeMethod; - - assert(isMachineCodeFrame(GIV(framePointer))); - /* begin mframeCogMethod: */ - cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask)); - /* begin asCogHomeMethod: */ - if (((cogMethod->cmType)) >= CMMethod) { - homeMethod = ((CogMethod *) cogMethod); - } - else { - /* begin cmHomeMethod */ - homeMethod = ((CogMethod *) ((((usqInt)cogMethod)) - ((cogMethod->homeOffset)))); - } - assert((methodFor(cogMethod)) == homeMethod); - assert((instrPtr > (((sqInt)cogMethod))) - && (instrPtr < ((((sqInt)homeMethod)) + ((homeMethod->blockSize))))); -} - /* Check that the stacked instruction pointers in the given page are correct. Checks the interpreter sender/machine code callee contract. */ @@ -16118,8 +16069,8 @@ ceInterpretMethodFromPICreceiver(sqInt aMethodObj, sqInt rcvr) /* pop off inner return and locate open or closed PIC */ pic = ((CogMethod *) ((popStack()) - (interpretOffset()))); - assert((isCMOpenPIC(pic)) - || (isCMClosedPIC(pic))); + assert((isCMOpenPIC(((CogBlockMethod *) pic))) + || (isCMClosedPIC(((CogBlockMethod *) pic)))); if (((pic->cmType)) == CMOpenPIC) { assert(!(methodHasCogMethod(aMethodObj))); if (methodShouldBeCogged(aMethodObj)) { @@ -16189,8 +16140,8 @@ ceMNUFromPICMNUMethodreceiver(sqInt aMethodObj, sqInt rcvr) ? tagBits2 : (longAt(rcvr)) & (classIndexMask()))); cPIC = ((CogMethod *) ((popStack()) - (mnuOffset()))); - assert((isCMClosedPIC(cPIC)) - || (isCMOpenPIC(cPIC))); + assert((isCMClosedPIC(((CogBlockMethod *) cPIC))) + || (isCMOpenPIC(((CogBlockMethod *) cPIC)))); GIV(argumentCount) = (cPIC->cmNumArgs); GIV(messageSelector) = (cPIC->selector); if (aMethodObj != 0) { @@ -16857,7 +16808,7 @@ ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver) cogged or not. */ /* CoInterpreter>>#ceSendAbort:to:numArgs: */ -sqInt +static sqInt NoDbgRegParms ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt aMethodObj; @@ -18691,7 +18642,7 @@ dumpPrimTraceLog(void) */ /* CoInterpreter>>#dumpPrimTraceLogOn: */ -EXPORT(void) +void dumpPrimTraceLogOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -20084,20 +20035,14 @@ void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto( sqInt getCurrentBytecode(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - return (((((((usqInt)GIV(framePointer))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)GIV(framePointer))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)GIV(framePointer))) <= (((usqInt)GIV(pages))))))) + return (((GIV(stackBasePlus1) != null) + && ((((((usqInt)GIV(framePointer))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)GIV(framePointer))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)GIV(framePointer))) <= (((usqInt)GIV(pages)))))))) && (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))) ? byteAt(GIV(instructionPointer)) : -1); } - /* CoInterpreter>>#getFramePointer */ -char * -getFramePointer(void) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return GIV(framePointer); -} - /* Answer the flags that are contained in the 7th long of the image header. */ @@ -20282,12 +20227,14 @@ ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, if (savedSPP != 0) { savedSPP[0] = GIV(stackPointer); } - if ((((((usqInt)theCFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theCFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCFP)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)theCFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theCFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCFP)) <= (((usqInt)GIV(pages)))))))) { GIV(framePointer) = theCFP; } - if ((((((usqInt)theCSP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theCSP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCSP)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)theCSP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theCSP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCSP)) <= (((usqInt)GIV(pages)))))))) { GIV(stackPointer) = theCSP; } } @@ -20356,21 +20303,6 @@ instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sq } -/* This is used for asserts that check that inline cache editing results in - valid addresses. - In the C VM interpret is presumed to come before any primitives and so it - constitutes the lowest address in C code that machine code should be - linked. In the simulator - we just answer something not low. */ - - /* CoInterpreter>>#interpretAddress */ -usqInt -interpretAddress(void) -{ - return ((usqInt)((&interpret))); -} - - /* At a rough approximation we may need to allocate up to a couple of page's worth of contexts when switching stack pages, assigning to senders, etc. But the snapshot primitive voids all stack pages. @@ -21953,7 +21885,7 @@ mframeHomeMethodExport(void) method field. */ /* CoInterpreter>>#mframeHomeMethod: */ -CogMethod * +static CogMethod * NoDbgRegParms mframeHomeMethod(char *theFP) { sqInt methodField; @@ -22020,49 +21952,6 @@ minimumUnusedHeadroom(void) return minUnused; } - /* CoInterpreter>>#mMethodClass */ -sqInt -mMethodClass(void) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt literal; - sqInt methodPointer; - sqInt objOop; - sqInt objOop1; - sqInt offset; - - /* begin methodClassOf: */ - methodPointer = ((mframeHomeMethod(GIV(framePointer)))->methodObject); - /* begin followLiteral:ofMethod: */ - offset = (literalCountOf(methodPointer)) - 1; - /* begin followField:ofObject: */ - objOop1 = longAt((methodPointer + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); - if (((!(objOop1 & (tagMask())))) - && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { - objOop1 = fixFollowedFieldofObjectwithInitialValue(offset + LiteralStart, methodPointer, objOop1); - } - literal = objOop1; - return ((literal != GIV(nilObj)) - && (((!(literal & (tagMask())))) - && (((((usqInt)((longAt(literal)))) >> (formatShift())) & (formatMask())) <= 5 /* lastPointerFormat */)) - ? (assert((numSlotsOf(literal)) > ValueIndex), - /* begin followField:ofObject: */ - (objOop = longAt((literal + BaseHeaderSize) + (((sqInt)((usqInt)(ValueIndex) << (shiftForWord())))))), - (((!(objOop & (tagMask())))) - && ((!((longAt(objOop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))) - ? (objOop = fixFollowedFieldofObjectwithInitialValue(ValueIndex, literal, objOop)) - : 0), - objOop) - : /* begin nilObject */ GIV(nilObj)); -} - - /* CoInterpreter>>#mnuCompilationBreakpointFor: */ -void -mnuCompilationBreakpointFor(sqInt selectorOop) -{ - suppressHeartbeatFlag = 1; - warning("compilation MNU break (heartbeat suppressed)"); -} - /* Lookup the doesNotUnderstand: selector in the class of the argument rcvr. Answer either the matching method (cogged if appropriate), or nil, if not @@ -22909,22 +22798,6 @@ primitiveExecuteMethodArgsArray(void) } -/* This is used for asserts that check that inline cache editing results in - valid addresses. - In the C VM interpret is presumed to come before any primitives and so it - constitutes the lowest address in C code that machine code should be - linked, but optimizing - compilers change things around. In the simulator we just answer something - not low. */ - - /* CoInterpreter>>#primitiveFailAddress */ -usqInt -primitiveFailAddress(void) -{ - return ((usqInt)((&primitiveFail))); -} - - /* Answer any special requirements of the given primitive */ /* CoInterpreter>>#primitivePropertyFlags:numArgs: */ @@ -22968,11 +22841,8 @@ primTraceLogIndexAddress(void) return ((usqInt)((&GIV(primTraceLogIndex)))); } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CoInterpreter>>#printCogMethod: */ -EXPORT(void) +void printCogMethod(CogMethod *cogMethod) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -23152,12 +23022,10 @@ printFrameThingatextra(char *name, char *address, sqInt extraValue) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#printFrame:WithSP: */ -EXPORT(sqInt) +sqInt printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -23169,7 +23037,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -23177,8 +23045,9 @@ printFrameWithSP(char *theFP, char *theSP) sqInt theMethodEnd; sqInt topThing; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { fprintf(GIV(transcript), "%p is not in the stack zone?!\n", theFP); @@ -23312,12 +23181,10 @@ printFrameWithSP(char *theFP, char *theSP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#printMethodCacheFor: */ -EXPORT(void) +void printMethodCacheFor(sqInt thing) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -24111,7 +23978,7 @@ reloadPrimitiveCalloutPointer(void) /* Report the stack page size and minimum unused headroom to stdout. */ /* CoInterpreter>>#reportMinimumUnusedHeadroom */ -EXPORT(void) +void reportMinimumUnusedHeadroom(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT fprintf(GIV(transcript), @@ -24125,7 +23992,7 @@ reportMinimumUnusedHeadroom(void) /* Report the stack page size and minimum unused headroom to a stream. */ /* CoInterpreter>>#reportMinimumUnusedHeadroomOn: */ -EXPORT(void) +void reportMinimumUnusedHeadroomOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -24360,7 +24227,7 @@ roomToPushNArgs(sqInt n) logged normally. */ /* CoInterpreter>>#sendInvokeCallbackContext: */ -EXPORT(sqInt) +sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt aMethodObj; @@ -24590,8 +24457,9 @@ shortPrintFrame(char *theFP) sqInt mthd; sqInt rcvr; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { /* begin print: */ fprintf(GIV(transcript), "invalid frame pointer"); cr(); @@ -25689,12 +25557,10 @@ voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#whereIs: */ -EXPORT(char *) +char * whereIs(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *somewhere; @@ -25863,6 +25729,29 @@ primitiveBenchmarkJITReceiver(void) } #endif /* VMBenchmarks */ + /* CoInterpreterPrimitives>>#primitiveBenchmarkScavenge */ +#if VMBenchmarks +EXPORT(void) +primitiveBenchmarkScavenge(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *sp; + usqLong then; + + /* begin primitiveReturnTimeTakenFor: */ + then = ioHighResClock(); + /* begin scavengingGC */ + scavengingGCTenuringIf(TenureByAge); + (((usqInt)(((((GIV(totalFreeOldSpace) + (GIV(scavengeThreshold) - GIV(freeStart))) - (interpreterAllocationReserveBytes())) < 0) ? 0 : ((GIV(totalFreeOldSpace) + (GIV(scavengeThreshold) - GIV(freeStart))) - (interpreterAllocationReserveBytes())))) << 3) | 1); + /* begin methodReturnValue: */ + oop = positive64BitIntegerFor((ioHighResClock()) - then); + assert(!((failed()))); + /* begin pop:thenPush: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; +} +#endif /* VMBenchmarks */ + /* This is optional old obsolete stuff tedious to implement in Cog because of the need to map from machine code pc to bytecode pc. So for now just fail. */ @@ -30667,6 +30556,7 @@ primitiveClosureValue(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -30928,6 +30818,7 @@ primitiveClosureValueNoContextSwitch(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -31221,6 +31112,7 @@ primitiveClosureValueWithArgs(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -34964,7 +34856,7 @@ primitiveInvokeObjectAsMethod(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; sqInt lookupClassTag; - sqInt runArgs; + usqInt runArgs; sqInt runReceiver; char *sp; char *sp1; @@ -36528,8 +36420,9 @@ primitivePathToUsing(void) stackp = 0; while (1) { while (((index -= 1)) >= -1) { - if ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages)))))))) { if (index >= 0) { next = fieldofFrame(index, ((char *) current)); } @@ -36550,8 +36443,9 @@ primitivePathToUsing(void) next = fetchClassOfNonImm(current); } } - if ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages)))))))) { assert(isFrameonPage(((char *) next), stackPageFor(((char *) next)))); } else { @@ -36584,8 +36478,9 @@ primitivePathToUsing(void) goto l8; } if (((!(next & (smallIntegerTag())))) - && (((((((usqInt)next)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages)))))) + && (((GIV(stackBasePlus1) != null) + && ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) ? !(frameIsMarked(next)) : (next >= heapBase) && ((!(((((usqInt)((longAt(next)))) >> (markedBitFullShift())) & 1) != 0)) @@ -36610,8 +36505,9 @@ primitivePathToUsing(void) assert(!(isOopForwarded(stack))); longAtput((stack + BaseHeaderSize) + (((sqInt)((usqInt)((stackp + 1)) << (shiftForWord())))), (((usqInt)index << 3) | 1)); stackp += 2; - if ((((((usqInt)(((char *) next)))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)(((char *) next)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) next)))) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)(((char *) next)))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)(((char *) next)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) next)))) <= (((usqInt)GIV(pages)))))))) { /* begin markFrame: */ methodField = longAt(next + FoxMethod); if ((((usqInt)methodField)) < (startOfMemory())) { @@ -40308,10 +40204,8 @@ primitiveStoreImageSegment(void) && (((((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) >= (firstLongFormat())) && (((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) <= ((firstShortFormat()) - 1)))))))) { /* Must be indexable words */ - /* begin primitiveFail */ - if (!GIV(primFailCode)) { - GIV(primFailCode) = 1; - } + /* begin primitiveFailFor: */ + GIV(primFailCode) = PrimErrBadArgument; return; } ecode = storeImageSegmentIntooutPointersroots(segmentWordArray, outPointerArray, arrayOfRoots); @@ -40980,7 +40874,8 @@ primitiveStringReplace(void) replFmt = replFmt & -4; l10: /* end classFormatFromInstFormat: */; if (!((arrayFmt == replFmt) - && (arrayFmt < (firstCompiledMethodFormat())))) { + && ((arrayFmt >= (sixtyFourBitIndexableFormat())) + && (arrayFmt < (firstCompiledMethodFormat()))))) { /* begin primitiveFailFor: */ GIV(primFailCode) = PrimErrInappropriate; goto l17; @@ -42139,7 +42034,7 @@ ensureNoForwardedLiteralsIn(sqInt aMethodObj) need since depth is always finite. */ /* Spur64BitCoMemoryManager>>#followForwardedObjectFields:toDepth: */ -sqInt +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -43205,111 +43100,6 @@ initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur64BitMemoryManager>>#inOldSpaceInstantiatePinnedClass:indexableSize: */ -sqInt -inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt fillValue; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt numSlots; - usqInt p; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - fillValue = 0; - switch (instSpec) { - case 2 /* arrayFormat */: - numSlots = nElements; - fillValue = GIV(nilObj); - break; - case indexablePointersFormat(): - case weakArrayFormat(): - numSlots = (classFormat & ((1U << (fixedFieldsFieldWidth())) - 1)) + nElements; - fillValue = GIV(nilObj); - break; - case sixtyFourBitIndexableFormat(): - numSlots = nElements; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstShortFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - case firstByteFormat(): - numSlots = (nElements + 7) / 8; - instSpec += (8 - nElements) & 7; - break; - default: - - /* non-indexable */ - /* Some Squeak images include funky fixed subclasses of abstract variable - superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection. - The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via - this method. - Hence allow fixed classes to be instantiated here iff nElements = 0. */ - if ((nElements != 0) - || (instSpec > 5 /* lastPointerFormat */)) { - return null; - } - numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); - fillValue = GIV(nilObj); - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > (0x10000000000LL)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsForPinningInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : (numSlots << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - if (!(newObj == null)) { - /* begin fillObj:numSlots:with: */ - assert(oopisLessThan(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1, addressAfter(newObj))); - for (p = (((usqInt)(newObj + BaseHeaderSize))); p <= (((usqInt)(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { - longAtput(p, fillValue); - } - } - return newObj; -} - - /* Allocate an instance of a variable class, excepting CompiledMethod. */ /* Spur64BitMemoryManager>>#instantiateClass:indexableSize: */ @@ -43460,130 +43250,6 @@ instantiateClassindexableSize(sqInt classObj, usqInt nElements) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur64BitMemoryManager>>#instantiateUninitializedClass:indexableSize: */ -sqInt -instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt newObj1; - usqInt numBytes; - usqInt numSlots; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - assert(isPureBitsFormat(instSpec)); - switch (instSpec) { - case sixtyFourBitIndexableFormat(): - numSlots = nElements; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstShortFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - case firstByteFormat(): - numSlots = (nElements + 7) / 8; - instSpec += (8 - nElements) & 7; - break; - default: - - /* not bits indexable */ - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > ((1U << (fixedFieldsFieldWidth())) - 1)) { - if (numSlots > (0x10000000000LL)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : (numSlots << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - } - else { - /* begin allocateSlots:format:classIndex: */ - if (numSlots >= (numSlotsMask())) { - if (((numSlots) >> 56) > 0) { - newObj = null; - goto l7; - } - newObj1 = GIV(freeStart) + BaseHeaderSize; - numBytes = (BaseHeaderSize + BaseHeaderSize) + (numSlots * BytesPerOop); - } - else { - newObj1 = GIV(freeStart); - numBytes = BaseHeaderSize + ((numSlots < 1 - ? /* begin allocationUnit */ 8 - : numSlots * BytesPerOop)); - } - if ((GIV(freeStart) + numBytes) > GIV(scavengeThreshold)) { - if (!GIV(needGCFlag)) { - /* begin scheduleScavenge */ - GIV(needGCFlag) = 1; - forceInterruptCheck(); - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, instSpec, classIndex); - goto l7; - } - if (numSlots >= (numSlotsMask())) { - - /* for header parsing we put a saturated slot count in the prepended overflow size word */ - flag("endianness"); - longAtput(GIV(freeStart), (((sqInt)((usqInt)((numSlotsMask())) << (numSlotsFullShift())))) + numSlots); - longAtput(newObj1, headerForSlotsformatclassIndex(numSlotsMask(), instSpec, classIndex)); - } - else { - longAtput(newObj1, (((((usqLong) numSlots)) << (numSlotsFullShift())) + (((sqInt)((usqInt)(instSpec) << (formatShift()))))) + classIndex); - } - assert((numBytes % (allocationUnit())) == 0); - assert((newObj1 % (allocationUnit())) == 0); - GIV(freeStart) += numBytes; - newObj = newObj1; - l7: /* end allocateSlots:format:classIndex: */; - } - return newObj; -} - - /* Convert the integer value, assumed to be in SmallInteger range, into a tagged SmallInteger object. In C, use a shift and an add to set the tag bit. @@ -44068,8 +43734,8 @@ allWeakSurvivorsOnWeakList(void) writes code that stresses the remembered table. One might conclude that if the remembered table is full, then the right thing - to do is simply to tenure everything, emptying the remembered table. Bt in - some circumstances this + to do is simply to tenure everything, emptying the remembered table. But + in some circumstances this can be counter-productive, and result in the same situation arising soon after tenuring everything. Instead, we can try and selectively prune the remembered table, tenuring @@ -44463,6 +44129,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj3 == null)) { + assert(isPinned(obj3)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1, addressAfter(obj3))); for (p2 = (((usqInt)(obj3 + BaseHeaderSize))); p2 <= (((usqInt)(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1))); p2 += 8 /* allocationUnit */) { @@ -44479,6 +44146,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj2 == null)) { + assert(isPinned(obj2)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1, addressAfter(obj2))); for (p1 = (((usqInt)(obj2 + BaseHeaderSize))); p1 <= (((usqInt)(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1))); p1 += 8 /* allocationUnit */) { @@ -44498,6 +44166,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -44699,6 +44368,7 @@ openScavengeLog(void) /* Print the objects in the remembered set. */ +/* useful for debugging */ /* SpurGenerationScavenger>>#printRememberedSet */ void @@ -46994,6 +46664,7 @@ allocatePinnedSlots(sqInt nSlots) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj == null)) { + assert(isPinned(obj)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj))); for (p = (((usqInt)(obj + BaseHeaderSize))); p <= (((usqInt)(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -48014,30 +47685,6 @@ checkedLongAt(sqInt byteAddress) return longAt(byteAddress); } - /* SpurMemoryManager>>#checkFreeSpace: */ -void -checkFreeSpace(sqInt gcModes) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, null); - } -} - - /* SpurMemoryManager>>#checkFreeSpace:ignoring: */ -void -checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, anOopToIgnore); - } -} - /* Perform an integrity/leak check using the heapMap. Assume clearLeakMapAndMapAccessibleFreeSpace has set a bit at each free chunk's @@ -49006,6 +48653,7 @@ checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt cla /* Verify that the given oop is legitimate. Check address, header, and size but not class. Answer true if OK. Otherwise print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOkayOop: */ sqInt @@ -49100,6 +48748,7 @@ checkOkayOop(usqInt oop) or more fields. Finally, the instance specification field of the behavior must match that of the instance. If OK answer true. If not, print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOopHasOkayClass: */ sqInt @@ -49956,7 +49605,7 @@ cloneObject(sqInt objOop) } /* SpurMemoryManager>>#compactClassIndexOf: */ -sqInt +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop) { /* begin classIndexOf: */ @@ -50125,6 +49774,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS /* print the count of marked and unmarked objects. In addition if 1 is set in printFlags, short-print marked objects, and/or if 2 is set, short-print unmarked obejcts. */ +/* useful for debugging */ /* SpurMemoryManager>>#countMarkedAndUnmarkdObjects: */ void @@ -50222,7 +49872,8 @@ currentAllocatedBytes(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt use; - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); return (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); } @@ -50249,7 +49900,8 @@ doScavenge(sqInt tenuringCriterion) usqInt use; /* begin doAllocationAccountingForScavenge */ - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); GIV(statAllocatedBytes) = (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); GIV(gcPhaseInProgress) = ScavengeInProgress; /* begin scavenge: */ @@ -50300,7 +49952,8 @@ doScavenge(sqInt tenuringCriterion) GIV(freeStart) = ((eden()).start); GIV(gcPhaseInProgress) = 0; /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); } @@ -50314,7 +49967,7 @@ doScavenge(sqInt tenuringCriterion) was possible. */ /* SpurMemoryManager>>#doShorten:toIndexableSize: */ -sqInt +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt bytesBefore; @@ -51171,6 +50824,7 @@ findLargestFreeChunk(void) /* Print the oops of all string-like things that start with the same characters as aCString */ +/* useful for debugging */ /* SpurMemoryManager>>#findStringBeginningWith: */ void @@ -51835,7 +51489,6 @@ fullGC(void) runLeakCheckerForexcludeUnmarkedObjsclassIndicesShouldBeValid(GCModeFull, 1, 1); compactionStartUsecs = ioUTCMicrosecondsNow(); /* begin prepareForGlobalSweep */ - GIV(sweepIndex) = 0; for (i = 0; i < GIV(numSegments); i += 1) { ((GIV(segments)[i]).containsPinned = 0); } @@ -51855,9 +51508,11 @@ fullGC(void) GIV(statShrinkMemory) += 1; } /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); assert(validObjStacks()); assert(isEmptyObjStack(GIV(markStack))); assert(isEmptyObjStack(GIV(weaklingStack))); @@ -51914,12 +51569,10 @@ growOldSpaceByAtLeast(sqInt minAmmount) sqInt ammount; sqInt bytes; sqInt headroom; - sqInt i; sqInt interval; SpurSegmentInfo *segInfo; sqInt start; usqInt total; - usqInt total1; /* statGrowMemory counts attempts, not successes. */ @@ -51936,13 +51589,8 @@ growOldSpaceByAtLeast(sqInt minAmmount) /* Now apply the maxOldSpaceSize limit, if one is in effect. */ ammount = ((ammount < GIV(growHeadroom)) ? GIV(growHeadroom) : ammount); if (maxOldSpaceSize > 0) { - /* begin totalBytesInSegments */ - total1 = 0; - for (i = 0; i < GIV(numSegments); i += 1) { - total1 += ((GIV(segments)[i]).segSize); - } - assert(GIV(totalHeapSizeIncludingBridges) == total1); - total = total1; + assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)); + total = GIV(totalHeapSizeIncludingBridges); if (total >= maxOldSpaceSize) { GIV(needGCFlag) = 1; return null; @@ -52111,73 +51759,6 @@ incrementalGC(void) error("shouldNotImplement"); } - /* SpurMemoryManager>>#indexOf:in: */ -sqInt -indexOfin(sqInt anElement, sqInt anObject) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt fmt; - sqInt fmt1; - sqInt i; - usqInt numSlots; - usqInt numSlots1; - - /* begin formatOf: */ - fmt = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - if (fmt <= 5 /* lastPointerFormat */) { - /* begin numSlotsOf: */ - assert((classIndexOf(anObject)) > (isForwardedObjectClassIndexPun())); - numSlots1 = byteAt(anObject + 7); - numSlots = (numSlots1 == (numSlotsMask()) - ? ((((usqInt)(((sqInt)((usqInt)((longAt(anObject - BaseHeaderSize))) << 8)))))) >> 8 - : numSlots1); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (longAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) { - return i; - } - } - } - if (fmt >= (firstByteFormat())) { - if (fmt >= (firstCompiledMethodFormat())) { - /* begin primitiveFailFor: */ - return (GIV(primFailCode) = PrimErrUnsupported); - } - /* begin numBytesOfBytes: */ - fmt1 = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - assert(fmt1 >= (firstByteFormat())); - numSlots = ((numSlotsOf(anObject)) << (shiftForWord())) - (fmt1 & 7); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (byteAt((anObject + BaseHeaderSize) + i))) { - return i; - } - } - } - if (fmt >= (firstShortFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 1; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (((unsigned short) (shortAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 1)))))))) { - return i; - } - } - } - if (fmt == (sixtyFourBitIndexableFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 3; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long64At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 3)))))) { - return i; - } - } - } - if (fmt >= (firstLongFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 2; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long32At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 2)))))) { - return i; - } - } - } - return -1; -} - /* Part of reorderReversedTreeList:. Switch treeNode with newNode in the tree, but do nothing to the list linked through freeChunkNextIndex. */ @@ -52643,6 +52224,7 @@ initializeObjectMemory(sqInt bytesToShift) /* begin allocatePinnedSlots: */ obj1 = allocateSlotsForPinningInOldSpacebytesformatclassIndex(0x400, (1024U << (shiftForWord())) + (BaseHeaderSize + BaseHeaderSize), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -52658,7 +52240,7 @@ initializeObjectMemory(sqInt bytesToShift) else { /* The Spur32to64BitBootstrap failed to set the type of rememberedSetObj to 64-bit indexability. - This is unimportant except for simulation; rememberedSet is declared as sqInt *, but in to have + This is unimportant except for simulation; rememberedSet is declared as sqInt *, but to have firstIndexableField: below answer a suitable type the format must be wordIndexableFormat. */ /* begin setFormatOf:to: */ format = sixtyFourBitIndexableFormat(); @@ -52688,9 +52270,11 @@ initializeObjectMemory(sqInt bytesToShift) /* free space before shrinking */ GIV(shrinkThreshold) = 0x2000000; /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* By default GC after scavenge if heap has grown by a third since the last GC */ GIV(heapGrowthToSizeGCRatio) = 0.333333; @@ -52698,12 +52282,10 @@ initializeObjectMemory(sqInt bytesToShift) /* print free chunks in freeTree in order. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#inOrderPrintFreeTree:printList: */ -EXPORT(void) +void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList) { sqInt next; @@ -52958,18 +52540,6 @@ isAnyPointerFormat(sqInt format) } -/* Answer if this is an indexable object with pointer elements, e.g., an - array - */ - - /* SpurMemoryManager>>#isArrayNonImm: */ -sqInt -isArrayNonImm(sqInt oop) -{ - return ((((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask())) == 2 /* arrayFormat */; -} - - /* Answer true if this is an indexable object with pointer elements, e.g., an array */ @@ -53395,7 +52965,7 @@ isObjImmutable(sqInt anOop) /* Answer if obj is old. Require that obj is non-immediate. */ /* SpurMemoryManager>>#isOldObject: */ -sqInt +static sqInt NoDbgRegParms isOldObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(isNonImmediate(objOop)); @@ -53468,19 +53038,6 @@ isPureBitsFormat(sqInt format) && (format < (firstCompiledMethodFormat())); } - -/* Answer if oop is young. */ - - /* SpurMemoryManager>>#isReallyYoung: */ -sqInt -isReallyYoung(sqInt oop) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return ((!(oop & (tagMask())))) - && ((assert(isNonImmediate(oop)), - (oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart))))); -} - /* SpurMemoryManager>>#isRemembered: */ static sqInt NoDbgRegParms isRemembered(sqInt objOop) @@ -53521,10 +53078,10 @@ isShorts(sqInt oop) /* This version is private to SpurMemoryManager (for asserts, etc). It does - not take advantage of the power-of0two optimization in isForwarded:. */ + not take advantage of the power-of-two optimization in isForwarded:. */ /* SpurMemoryManager>>#isUnambiguouslyForwarder: */ -sqInt +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop) { return ((longAt(objOop)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()); @@ -53915,7 +53472,7 @@ lastPointerFormat(void) pointer, and the image contains no forwarders (see class comment). */ /* SpurMemoryManager>>#lastPointerOfWhileSwizzling: */ -sqInt +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fmt; @@ -53952,7 +53509,7 @@ lastPointerOfWhileSwizzling(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#lastPointerOf: */ -sqInt +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -54001,13 +53558,6 @@ lastPointerOf(sqInt objOop) ((header >> 3)) & AlternateHeaderNumLiteralsMask)) + LiteralStart) - 1) * BytesPerOop) + BaseHeaderSize; } - /* SpurMemoryManager>>#leakCheckBecome */ -sqInt -leakCheckBecome(void) -{ - return ((checkForLeaks & GCModeBecome) != 0); -} - /* SpurMemoryManager>>#leakCheckFullGC */ sqInt leakCheckFullGC(void) @@ -54015,13 +53565,6 @@ leakCheckFullGC(void) return ((checkForLeaks & GCModeFull) != 0); } - /* SpurMemoryManager>>#leakCheckIncremental */ -sqInt -leakCheckIncremental(void) -{ - return ((checkForLeaks & GCModeIncremental) != 0); -} - /* SpurMemoryManager>>#leakCheckNewSpaceGC */ sqInt leakCheckNewSpaceGC(void) @@ -54620,12 +54163,10 @@ loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesOf: */ -EXPORT(void) +void longPrintInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -54640,12 +54181,10 @@ longPrintInstancesOf(sqInt aClassOop) /* Scan the heap printing any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesWithClassIndex: */ -EXPORT(void) +void longPrintInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -54753,12 +54292,10 @@ longPrintInstancesWithClassIndex(sqInt classIndex) /* Scan the heap long printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintReferencesTo: */ -EXPORT(void) +void longPrintReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -56203,21 +55740,6 @@ maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format) } -/* Answer one of the objects in the SpecialObjectsArray, if in range, - otherwise answer nil. - */ - - /* SpurMemoryManager>>#maybeSplObj: */ -sqInt -maybeSplObj(sqInt index) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return (index < (numSlotsOf(GIV(specialObjectsOop))) - ? (/* begin fetchPointer:ofObject: */ - longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) - : 0); -} - - /* Answer the minimum number of additional slots to allocate in an object to always be able to shorten it. This is enough slots to allocate a minimum-sized object. */ @@ -56642,7 +56164,7 @@ numBytesOf(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#numPointerSlotsOf: */ -usqInt +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -56822,24 +56344,6 @@ numStrongSlotsOfInephemeral(sqInt objOop) } -/* Answer the number of strong pointer fields in the given weakling. */ - - /* SpurMemoryManager>>#numStrongSlotsOfWeakling: */ -sqInt -numStrongSlotsOfWeakling(sqInt objOop) -{ - sqInt classFormat; - sqInt objOop1; - - assert((formatOf(objOop)) == (weakArrayFormat())); - /* begin fixedFieldsOfClass: */ - objOop1 = fetchClassOfNonImm(objOop); - /* begin fixedFieldsOfClassFormat: */ - classFormat = ((longAt((objOop1 + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - return classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); -} - - /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -56911,6 +56415,9 @@ objectAfter(sqInt objOop) : followingWordAddress3); } + +/* useful for debugging */ + /* SpurMemoryManager>>#objectBefore: */ sqInt objectBefore(sqInt objOop) @@ -57499,6 +57006,7 @@ okayOop(sqInt signedOop) } +/* useful for debugging */ /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -57679,7 +57187,6 @@ pinObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt format; - sqInt i; sqInt oldClone; sqInt referent; SpurSegmentInfo *seg; @@ -57695,15 +57202,7 @@ pinObject(sqInt objOop) longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); return objOop; } - /* begin segmentContainingObj: */ - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - seg = (&(GIV(segments)[i])); - goto l1; - } - } - seg = null; - l1: /* end segmentContainingObj: */; + seg = segmentContainingObj(objOop); if ((seg->containsPinned)) { /* begin setIsPinnedOf:to: */ longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); @@ -57952,12 +57451,10 @@ primitiveErrorTable(void) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printActivationsOf: */ -EXPORT(void) +void printActivationsOf(sqInt aMethodObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -58025,12 +57522,10 @@ printActivationsOf(sqInt aMethodObj) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printBogons */ -EXPORT(void) +void printBogons(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT /* begin printTheBogons: */ @@ -58047,16 +57542,34 @@ printBogons(void) cr(); } + /* SpurMemoryManager>>#printBridge:on: */ +static void NoDbgRegParms +printBridgeon(sqInt oop, FILE *aStream) +{ + fprintf(aStream, + "%p is a bridge hdr%d slot size %ul\n", + ((void *)oop), + ((byteAt(oop + 7)) == (numSlotsMask()) + ? 16 + : 8), + numSlotsOfAny(oop)); +} + /* SpurMemoryManager>>#printCantBeObject:on: */ static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (((oop & (7)) == 0) - && (((oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) - && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))))) { - printForwarderon(oop, aStream); - return; + if ((oop & (7)) == 0) { + if (((oopisLessThan(oop, GIV(oldSpaceStart))) + && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) + && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { + printForwarderon(oop, aStream); + return; + } + if (oop == (bridgeAt((numSegments()) - 1))) { + printBridgeon(oop, aStream); + return; + } } fprintf(aStream, "%p%s\n", @@ -58070,12 +57583,10 @@ printCantBeObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printContextReferencesTo: */ -EXPORT(void) +void printContextReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -58155,12 +57666,10 @@ printContextReferencesTo(sqInt anOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printEntity: */ -EXPORT(void) +void printEntity(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -58294,12 +57803,10 @@ printEntity(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printForwarders */ -EXPORT(void) +void printForwarders(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58408,7 +57915,7 @@ static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream) { fprintf(aStream, - "%p is a forwarded hdr%d slot size %ud object to %p\n", + "%p is a forwarded hdr%d slot size %ul object to %p\n", ((void *)oop), ((byteAt(oop + 7)) == (numSlotsMask()) ? 16 @@ -58421,6 +57928,7 @@ printForwarderon(sqInt oop, FILE *aStream) /* This version goes through memory, printing all free chunks. Other versions go through the free lists. This one will show all free chunks even if the free lists are corrupt. */ +/* useful for debugging */ /* SpurMemoryManager>>#printFreeChunks */ void @@ -58536,12 +58044,10 @@ printFreeChunks(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeChunk: */ -EXPORT(void) +void printFreeChunk(sqInt freeChunk) { printFreeChunkprintAsTreeNode(freeChunk, 1); @@ -58631,12 +58137,10 @@ printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeListHeads */ -EXPORT(void) +void printFreeListHeads(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt expectedMask; @@ -58672,12 +58176,10 @@ printFreeListHeads(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeList: */ -EXPORT(sqInt) +sqInt printFreeList(sqInt chunkOrIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fieldIndex; @@ -58710,12 +58212,10 @@ printFreeObjecton(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeTree */ -EXPORT(void) +void printFreeTree(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFreeTreeChunk(GIV(freeLists)[0]); @@ -58739,13 +58239,11 @@ printFreeTreeChunk(sqInt chunkOrZero) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* N.B. No safety bounds checks!! We need to look e.g. at corpses. */ /* SpurMemoryManager>>#printHeaderOf: */ -EXPORT(void) +void printHeaderOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -58862,12 +58360,10 @@ printImmediateObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesOf: */ -EXPORT(void) +void printInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -58882,12 +58378,10 @@ printInstancesOf(sqInt aClassOop) /* Scan the heap printing the oops of any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesWithClassIndex: */ -EXPORT(void) +void printInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58993,6 +58487,7 @@ printInstancesWithClassIndex(sqInt classIndex) /* Print the objects in the classTable that have bad hashes. */ +/* useful for debugging */ /* SpurMemoryManager>>#printInvalidClassTableEntries */ void @@ -59042,13 +58537,11 @@ printInvalidClassTableEntries(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMarkedOops */ #if LLDB -EXPORT(void) +void printMarkedOops(void) { printOopsSuchThat(isMarked); @@ -59059,12 +58552,10 @@ printMarkedOops(void) /* Scan the heap printing the oops of any and all methods that implement anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodImplementorsOf: */ -EXPORT(void) +void printMethodImplementorsOf(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -59130,12 +58621,10 @@ printMethodImplementorsOf(sqInt anOop) /* Scan the heap printing the oops of any and all methods that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodReferencesTo: */ -EXPORT(void) +void printMethodReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -59321,12 +58810,10 @@ printNonPointerDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsFrom:to: */ -EXPORT(void) +void printObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -59350,12 +58837,10 @@ printObjectsFromto(sqInt startAddress, sqInt endAddress) /* Scan the heap printing the oops of any and all objects whose hash equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsWithHash: */ -EXPORT(void) +void printObjectsWithHash(sqInt hash) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59457,6 +58942,21 @@ printObjectsWithHash(sqInt hash) l4: /* end allNewSpaceEntitiesDo: */; } + /* SpurMemoryManager>>#printObjStackAndContents: */ +void +printObjStackAndContents(sqInt objStack) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + /* begin printObjStack:printContents: */ + if (objStack == GIV(nilObj)) { + /* begin print: */ + fprintf(GIV(transcript), "nil"); + cr(); + } + else { + printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((sqInt)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, 1); + } +} + /* SpurMemoryManager>>#printObjStackPage:myIndex:pageType:printContents: */ static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents) @@ -59619,6 +59119,9 @@ printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType) cr(); } + +/* useful for debugging */ + /* SpurMemoryManager>>#printObjStack: */ void printObjStack(sqInt objStack) @@ -59634,27 +59137,11 @@ printObjStack(sqInt objStack) } } - /* SpurMemoryManager>>#printObjStack:printContents: */ -void -printObjStackprintContents(sqInt objStack, sqInt printContents) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - if (objStack == GIV(nilObj)) { - /* begin print: */ - fprintf(GIV(transcript), "nil"); - cr(); - } - else { - printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((sqInt)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, printContents); - } -} - -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsExcept: */ -EXPORT(void) NeverInline +void NeverInline printOopsExcept(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59772,12 +59259,10 @@ printOopsExcept(sqInt (*function)(sqInt)) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsFrom:to: */ -EXPORT(void) +void printOopsFromto(sqInt startAddress, sqInt endAddress) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstNonEntity; @@ -59830,12 +59315,10 @@ printOopsFromto(sqInt startAddress, sqInt endAddress) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsSuchThat: */ -EXPORT(void) NeverInline +void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59954,12 +59437,10 @@ printOopsSuchThat(sqInt (*function)(sqInt)) /* Scan the heap printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printReferencesTo: */ -EXPORT(void) +void printReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -60203,13 +59684,11 @@ printStringDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printUnmarkedOops */ #if LLDB -EXPORT(void) +void printUnmarkedOops(void) { printOopsExcept(isMarked); @@ -60876,12 +60355,10 @@ shortentoIndexableSize(sqInt objOop, sqInt indexableSize) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#shortPrintObjectsFrom:to: */ -EXPORT(void) +void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -61019,7 +60496,7 @@ startOfObject(sqInt objOop) /* Part of InterpreterProxy's 1.14 API */ /* SpurMemoryManager>>#statNumGCs */ -EXPORT(sqInt) +sqInt statNumGCs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT return (GIV(statScavenges) + GIV(statIncrGCs)) + GIV(statFullGCs); @@ -61061,13 +60538,21 @@ storeCheckBoundary(void) The primitive can fail for the following reasons with the specified failure codes: - PrimErrGenericError: the segmentWordArray is too small for the version - stamp PrimErrWritePastObject: the segmentWordArray is too small to contain - the reachable objects - PrimErrBadIndex: the outPointerArray is too small - PrimErrNoMemory: additional allocations failed + PrimErrGenericFailure: the segmentWordArray is too small for the version + stamp PrimErrWritePastObject: the segmentWordArray is too small to + contain the reachable objects + PrimErrBadIndex: the outPointerArray is too small + PrimErrNoMemory: there is insufficient free space to store the array + answered by objectsReachableFromRoots:, + or the savedFirstFields and savedOutHashes arrays. + PrimErrNeedCompaction: a GC is needed to make room for the array answered + by objectsReachableFromRoots: PrimErrLimitExceeded: there is no room in the hash field to store out - pointer indices or class references. */ + pointer indices or class references, + or the outPointerArray is larger than the max value of the hash field. + PrimErrNoModification: the segmentWordArrayArg or outPointerArrayArg are + immutable PrimErrObjectIsPinned: the segmentWordArrayArg or + outPointerArrayArg are pinned */ /* SpurMemoryManager>>#storeImageSegmentInto:outPointers:roots: */ static sqInt NoDbgRegParms @@ -61320,6 +60805,7 @@ storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt val /* Note must check here for stores of young objects into old ones. */ +/* See SistaCogit */ /* SpurMemoryManager>>#storePointer:ofObject:withValue: */ sqInt @@ -61417,7 +60903,8 @@ sufficientSpaceAfterGC(sqInt numBytes) assert(numBytes == 0); scavengingGCTenuringIf(TenureByAge); - heapSizePostGC = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + heapSizePostGC = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); if (((((double) (heapSizePostGC - GIV(heapSizeAtPreviousGC)) )) / GIV(heapSizeAtPreviousGC)) >= GIV(heapGrowthToSizeGCRatio)) { fullGC(); } @@ -62036,6 +61523,9 @@ validClassTableRootPages(void) return 1; } + +/* useful for debugging */ + /* SpurMemoryManager>>#validFreeTree */ sqInt validFreeTree(void) @@ -62446,6 +61936,7 @@ copyAndUnmarkMobileObjects(void) usqInt previousPin; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt start; usqInt startOfPreviousPin; usqInt toFinger; @@ -62523,23 +62014,18 @@ copyAndUnmarkMobileObjects(void) assert((isMarked(previousPin)) && (isPinned(previousPin))); /* begin unmarkPinned: */ - if (!(((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(previousPin)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(previousPin))); longAtput(previousPin, (longAt(previousPin)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(previousPin)); - if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(previousPin))); - longAtput(previousPin, (longAt(previousPin)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), previousPin)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(previousPin)))); + seg = segmentContainingObj(previousPin); + (seg->containsPinned = 1); } toFinger = addressAfter(previousPin); /* begin objectStartingAt: */ @@ -62785,6 +62271,7 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) usqInt numSlots; sqInt obj; usqInt objStart; + SpurSegmentInfo *seg; usqInt toFinger; toFinger = initialToFinger; @@ -62807,23 +62294,18 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) if ((((((usqInt)((longAt(obj)))) >> (markedBitFullShift())) & 1) != 0) && (((((usqInt)((longAt(obj)))) >> (pinnedBitShift())) & 1) != 0)) { /* begin unmarkPinned: */ - if (!(((longAt(obj)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(obj)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(obj))); longAtput(obj, (longAt(obj)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(obj)); - if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(obj))); - longAtput(obj, (longAt(obj)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), obj)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(obj)))); + seg = segmentContainingObj(obj); + (seg->containsPinned = 1); } if (toFinger < objStart) { /* begin addFreeChunkWithBytes:at: */ @@ -63238,6 +62720,7 @@ unmarkObjectsFromFirstFreeObject(void) sqInt objOop; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt startOfFree; startOfFree = 0; @@ -63260,23 +62743,18 @@ unmarkObjectsFromFirstFreeObject(void) } if (((((usqInt)((longAt(objOop)))) >> (pinnedBitShift())) & 1) != 0) { /* begin unmarkPinned: */ - if (!(((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(objOop)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(objOop))); longAtput(objOop, (longAt(objOop)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(objOop)); - if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(objOop))); - longAtput(objOop, (longAt(objOop)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), objOop)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(objOop)))); + seg = segmentContainingObj(objOop); + (seg->containsPinned = 1); } } else { @@ -63949,7 +63427,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: */ @@ -63979,7 +63457,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)) { @@ -64341,9 +63819,11 @@ collapseSegmentsPostSwizzle(void) GIV(canSwizzle) = 0; GIV(numSegments) = 1; + /* begin computeTotalHeapSizeIncludingBridges */ + GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()); cascade0 = (&(GIV(segments)[0])); (cascade0->segStart = oldSpaceStart()); - (cascade0->segSize = (GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()))); + (cascade0->segSize = GIV(totalHeapSizeIncludingBridges)); assert(isSegmentBridge(bridgeAt(0))); assert((numSlotsOfAny(bridgeAt(0))) == 0); } @@ -64525,12 +64005,11 @@ prepareForSnapshot(void) usqInt followingWordAddress; usqInt freeChunk; sqInt i; - sqInt i1; sqInt largeChild; sqInt limit; sqInt newEndOfMemory; sqInt next; - sqInt node; + usqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -64573,24 +64052,16 @@ prepareForSnapshot(void) followingWordAddress = addressAfter(node); if (oopisGreaterThanOrEqualTo(followingWordAddress, limit)) { next = limit; - goto l9; + goto l7; } flag("endianness"); followingWord = longAt(followingWordAddress); next = ((((usqInt)(followingWord)) >> (numSlotsFullShift())) == (numSlotsMask()) ? followingWordAddress + BaseHeaderSize : followingWordAddress); - l9: /* end objectAfter:limit: */; + l7: /* end objectAfter:limit: */; if (((longAt(next)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin segmentContainingObj: */ - for (i1 = (GIV(numSegments) - 1); i1 >= 0; i1 += -1) { - if (node >= (((GIV(segments)[i1]).segStart))) { - seg = (&(GIV(segments)[i1])); - goto l8; - } - } - seg = null; - l8: /* end segmentContainingObj: */; + seg = segmentContainingObj(node); (seg->lastFreeObject = node); node = 0; } @@ -64705,17 +64176,51 @@ readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes) return totalBytesRead; } + +/* Answer the segment containing an object. This is mostly for assert + checking, but + variations on the incremental GC may use it in anger. Binary search is (of + course) marginally slower than linear search for a single segment (e.g. in + a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every + old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or + 20% faster + in the same heap extended with enough large arrays to require 11 segments; + and this + is pessimal; there are fewer objects at high addresses since the large + arrays are there). */ + /* SpurSegmentManager>>#segmentContainingObj: */ -EXPORT(SpurSegmentInfo *) +SpurSegmentInfo * segmentContainingObj(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; + sqInt high; + sqInt low; + sqInt mid; + SpurSegmentInfo *seg; - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - return (&(GIV(segments)[i])); + low = 0; + mid = GIV(numSegments) / 2; + high = GIV(numSegments) - 1; + do { + seg = (&(GIV(segments)[mid])); + if (oopisGreaterThanOrEqualTo(objOop, (seg->segStart))) { + if (mid == high) { + return (oopisLessThan(objOop, ((seg->segSize)) + ((seg->segStart))) + ? seg + : 0); + } + else { + low = mid; + mid = ((mid + high) + 1) / 2; + } } - } + else { + high = mid - 1; + mid = (low + mid) / 2; + } + } while(low <= high); return null; } @@ -64892,6 +64397,9 @@ swizzleObj(sqInt objOop) return objOop + (((GIV(segments)[0]).swizzle)); } + +/* This ``slow'' count is for asserts only. */ + /* SpurSegmentManager>>#totalBytesInSegments */ static usqInt totalBytesInSegments(void) @@ -64903,7 +64411,6 @@ totalBytesInSegments(void) for (i = 0; i < GIV(numSegments); i += 1) { total += ((GIV(segments)[i]).segSize); } - assert(GIV(totalHeapSizeIncludingBridges) == total); return total; } @@ -65028,12 +64535,10 @@ accessorDepthForPrimitiveMethod(sqInt aMethodObj) /* Answer the current activeProcess. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#activeProcess */ -EXPORT(sqInt) +sqInt activeProcess(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt objOop; @@ -65366,7 +64871,7 @@ booleanValueOf(sqInt obj) /* Re-enter the interpreter to execute a (non-Alien) callback. */ /* StackInterpreter>>#callbackEnter: */ -EXPORT(sqInt) +sqInt callbackEnter(sqInt *callbackID) { warning("callbackEnter: is obsolete"); @@ -65377,7 +64882,7 @@ callbackEnter(sqInt *callbackID) /* Leave from a previous callback */ /* StackInterpreter>>#callbackLeave: */ -EXPORT(sqInt) +sqInt callbackLeave(sqInt cbID) { warning("callbackLeave: is obsolete"); @@ -65431,12 +64936,10 @@ characterForAscii(sqInt ascii) /* Ensure that all accessible objects in the heap are okay. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkAllAccessibleObjectsOkay */ -EXPORT(sqInt) +sqInt checkAllAccessibleObjectsOkay(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -65856,12 +65359,10 @@ checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkOkayInterpreterObjects: */ -EXPORT(sqInt) +sqInt checkOkayInterpreterObjects(sqInt writeBack) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -66209,19 +65710,10 @@ contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP) /* StackInterpreter>>#copiedValueCountOfClosure: */ sqInt -copiedValueCountOfClosure(sqInt closurePointer) -{ - return (numSlotsOf(closurePointer)) - ClosureFirstCopiedValueIndex; -} - - -/* for Cogit */ - - /* StackInterpreter>>#copiedValueCountOfFullClosure: */ -sqInt -copiedValueCountOfFullClosure(sqInt closurePointer) +copiedValueCountOfClosure(sqInt closureObj) { - return (numSlotsOf(closurePointer)) - FullClosureFirstCopiedValueIndex; + return (assert(isVanillaBlockClosure(closureObj)), + (numSlotsOf(closureObj)) - ClosureFirstCopiedValueIndex); } @@ -68488,7 +67980,7 @@ fullDisplayUpdate(void) example). Default for now is simply the entry in the base primitiveTable. */ /* StackInterpreter>>#functionPointerFor:inClass: */ -void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) +static void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) { return (primIdx > MaxPrimitiveIndex ? 0 @@ -69931,12 +69423,10 @@ loadInitialContext(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#longPrintOop: */ -EXPORT(void) +void longPrintOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -72691,19 +72181,6 @@ pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod return pcPreviousToinSqueakV3PlusClosuresMethod(theIP, aMethod); } - /* StackInterpreter>>#penultimateLiteralOf: */ -sqInt -penultimateLiteralOf(sqInt aMethodOop) -{ - sqInt offset; - - assert(isOopCompiledMethod(aMethodOop)); - /* begin literal:ofMethod: */ - offset = (literalCountOf(aMethodOop)) - 2; - /* begin fetchPointer:ofObject: */ - return longAt((aMethodOop + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); -} - /* In the StackInterpreter stacks grow down. */ @@ -73618,12 +73095,10 @@ printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObjec /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacks */ -EXPORT(void) +void printAllStacks(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -73822,12 +73297,10 @@ printAllStacks(void) /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacksOn: */ -EXPORT(void) +void printAllStacksOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -73842,12 +73315,10 @@ printAllStacksOn(FILE *aStdioStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStack */ -EXPORT(void) +void printCallStack(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (GIV(framePointer) == null) { @@ -73881,18 +73352,17 @@ printCallStackFP(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOf: */ -EXPORT(sqInt) +sqInt printCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; - if ((((((usqInt)aContextOrProcessOrFrame)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)aContextOrProcessOrFrame)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)aContextOrProcessOrFrame)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)aContextOrProcessOrFrame)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)aContextOrProcessOrFrame)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)aContextOrProcessOrFrame)) <= (((usqInt)GIV(pages)))))))) { return printCallStackFP(((char *) aContextOrProcessOrFrame)); } if (aContextOrProcessOrFrame == (activeProcess())) { @@ -73989,12 +73459,10 @@ printCallStackOfcurrentFP(sqInt aContext, char *currFP) /* Print the call stack on a specific output stream. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOn: */ -EXPORT(void) +void printCallStackOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -74028,12 +73496,10 @@ printContextCallStackOf(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printContext: */ -EXPORT(void) +void printContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -74129,7 +73595,7 @@ printContext(sqInt aContext) meth = longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - meth); + ((void *)meth)); printOopShortInner(meth); if (methodHasCogMethod(meth)) { fprintf(GIV(transcript), @@ -74232,12 +73698,10 @@ printDecodeMethodHeaderOop(sqInt methodHeaderOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printExternalHeadFrame */ -EXPORT(void) +void printExternalHeadFrame(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFrameWithSP(GIV(framePointer), GIV(stackPointer)); @@ -74247,8 +73711,9 @@ printExternalHeadFrame(void) static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { return null; } if (!((longAt(theFP + FoxSavedFP)) == 0)) { @@ -74297,7 +73762,7 @@ printFrameOopindexat(char *name, sqInt idx, char *address) "%16p:", ((void *)address)); fprintf(GIV(transcript), - "%s%10s%d: %16p\t", + "%s%10s%" PRIdSQINT ": %16p\t", (idx > 9 ? "" : " "), @@ -74309,19 +73774,20 @@ printFrameOopindexat(char *name, sqInt idx, char *address) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFramesInPage: */ -EXPORT(void) +void printFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 0); } + +/* useful for VM debugging */ + /* StackInterpreter>>#printFramesOnStackPageListInUse */ -EXPORT(void) +void printFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -74394,12 +73860,10 @@ printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame: */ -EXPORT(sqInt) +sqInt printFrame(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *aFrame; @@ -74409,8 +73873,9 @@ printFrame(char *theFP) StackPage *thePage; char *theSP; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { if ((addressCouldBeObj(((sqInt)theFP))) && ((isInMemory(((sqInt)theFP))) && ((((longAt(((sqInt)theFP))) & (classIndexMask())) == ClassMethodContextCompactIndex) @@ -74488,18 +73953,6 @@ printFrame(char *theFP) } -/* Print n in hex, in the form '0x1234', unpadded */ - - /* StackInterpreter>>#printHexnp: */ -sqInt -printHexnp(usqInt n) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return fprintf(GIV(transcript), - "%p", - ((void *)n)); -} - - /* Print p in hex, unpadded, in the form 0x1234 (C)/16r1234 (here) */ /* StackInterpreter>>#printHexPtrnp: */ @@ -74531,12 +73984,10 @@ printHex(usqInt n) /* Print all methods whose penultimate literal is either selector, or an object whose first inst var is the method and whose second is selector (e.g. an AdditionalMethodState). */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printLikelyImplementorsOfSelector: */ -EXPORT(void) +void printLikelyImplementorsOfSelector(sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -74614,12 +74065,10 @@ printLikelyImplementorsOfSelector(sqInt selector) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCache */ -EXPORT(void) +void printMethodCache(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -74704,12 +74153,10 @@ printMethodCache(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionaryOf: */ -EXPORT(void) +void printMethodDictionaryOf(sqInt behavior) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt dictionary; @@ -74752,12 +74199,10 @@ printMethodDictionaryOf(sqInt behavior) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionary: */ -EXPORT(void) +void printMethodDictionary(sqInt dictionary) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt index; @@ -75037,10 +74482,10 @@ printOopShortInner(sqInt oop) } -/* use export: not api, so it won't be written to cointerp.h */ +/* useful for VM debugging */ /* StackInterpreter>>#printOop: */ -EXPORT(void) +void printOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -75222,12 +74667,10 @@ printOop(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcessStack: */ -EXPORT(void) +void printProcessStack(sqInt aProcess) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ctx; @@ -75266,12 +74709,10 @@ printProcessStack(sqInt aProcess) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcsOnList: */ -EXPORT(sqInt) +sqInt printProcsOnList(sqInt procList) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstProc; @@ -75297,12 +74738,10 @@ printProcsOnList(sqInt procList) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackCallStackOf: */ -EXPORT(sqInt) +sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -75335,12 +74774,10 @@ printStackCallStackOf(sqInt aContextOrProcessOrFrame) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageList */ -EXPORT(void) +void printStackPageList(void) { StackPage *page; @@ -75354,12 +74791,10 @@ printStackPageList(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageListInUse */ -EXPORT(void) +void printStackPageListInUse(void) { sqInt n; @@ -75376,12 +74811,10 @@ printStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPages */ -EXPORT(void) +void printStackPages(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -75396,12 +74829,10 @@ printStackPages(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPagesInUse */ -EXPORT(void) +void printStackPagesInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -75530,12 +74961,10 @@ printStackPageuseCount(StackPage *page, sqInt n) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackReferencesTo: */ -EXPORT(void) +void printStackReferencesTo(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *callerFP; @@ -75917,7 +75346,7 @@ putWord32toFile(int aWord32, sqImageFile aFile) } -/* Anwer true if images of the given format are readable by this interpreter. +/* Anwer if images of the given format are readable by this interpreter. Allows a virtual machine to accept selected older image formats. */ /* StackInterpreter>>#readableFormat: */ @@ -75958,7 +75387,7 @@ reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader) and mark calloutContext as dead. */ /* StackInterpreter>>#reestablishContextPriorToCallback: */ -EXPORT(sqInt) +sqInt reestablishContextPriorToCallback(sqInt callbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; @@ -76495,7 +75924,7 @@ retryPrimitiveOnFailure(void) and mark callbackMethodContext as dead. */ /* StackInterpreter>>#returnAs:ThroughCallback:Context: */ -EXPORT(sqInt) +sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt aMethodObj; @@ -76823,12 +76252,10 @@ schedulerPointer(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakMNUSelector: */ -EXPORT(void) +void setBreakMNUSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -76842,12 +76269,10 @@ setBreakMNUSelector(char *aString) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakSelector: */ -EXPORT(void) +void setBreakSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -76868,7 +76293,7 @@ setFullScreenFlag(sqInt value) } /* StackInterpreter>>#setInterruptCheckChain: */ -EXPORT(void *) +void * setInterruptCheckChain(void (*aFunction)()) { void (*prevFunction)(); @@ -76991,6 +76416,7 @@ static sqInt NoDbgRegParms shortPrintContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt home; + sqInt rcvr; sqInt senderOop; char *theFP; @@ -77034,15 +76460,16 @@ shortPrintContext(sqInt aContext) if (home == null) { /* begin print: */ fprintf(GIV(transcript), " BOGUS CONTEXT (can't determine home)"); + cr(); } else { - printActivationNameForreceiverisBlockfirstTemporary(fetchPointerofObject(MethodIndex, (!(home) - ? aContext - : home)), (home == null - ? /* begin nilObject */ GIV(nilObj) - : (longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)(ReceiverIndex) << (shiftForWord()))))))), home != aContext, longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin fetchPointer:ofObject: */ + rcvr = longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)(ReceiverIndex) << (shiftForWord()))))); + printActivationNameForreceiverisBlockfirstTemporary(longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))), rcvr, home != aContext, longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin space */ + printChar(' '); + shortPrintOop(rcvr); } - cr(); return 0; } @@ -77050,8 +76477,9 @@ shortPrintContext(sqInt aContext) static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { return null; } shortPrintFrame(theFP); @@ -77062,19 +76490,20 @@ shortPrintFrameAndCallers(char *theFP) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFramesInPage: */ -EXPORT(void) +void shortPrintFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 1); } + +/* useful for VM debugging */ + /* StackInterpreter>>#shortPrintFramesOnStackPageListInUse */ -EXPORT(void) +void shortPrintFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -77093,17 +76522,16 @@ shortPrintFramesOnStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFrame:AndNCallers: */ -EXPORT(void) +void shortPrintFrameAndNCallers(char *theFP, sqInt n) { DECL_MAYBE_SQ_GLOBAL_STRUCT if ((n != 0) + && ((GIV(stackBasePlus1) != null) && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { shortPrintFrame(theFP); shortPrintFrameAndNCallers(pointerForOop(longAt(theFP + FoxSavedFP)), n - 1); } @@ -82594,7 +82022,8 @@ primitiveStoreStackp(void) 48 various header flags. See getImageHeaderFlags. 49 max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing) - 50 max literal count for JIT compile (stored in image file header; Cog + + 50 max literal count for JIT compile (stored in image file header; Cog only; otherwise nil) 51 nil; reserved for VM parameters that persist in the image (such as eden above) 52 root/remembered table capacity @@ -82742,7 +82171,8 @@ primitiveVMParameter(void) /* begin primitiveAllVMParameters: */ result1 = instantiateClassindexableSize(splObj(ClassArray), paramsArraySize); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer8 = positiveMachineIntegerFor(totalBytesInSegments()); + valuePointer8 = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (0U << (shiftForWord())), valuePointer8); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -82750,7 +82180,8 @@ primitiveVMParameter(void) assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (1U << (shiftForWord())), valuePointer9); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (2U << (shiftForWord())), valuePointer10); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -83086,7 +82517,8 @@ primitiveVMParameter(void) /* begin primitiveGetVMParameter: */ switch (index) { case 1: - result = positiveMachineIntegerFor(totalBytesInSegments()); + result = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); goto l88; break; case 2: @@ -83094,7 +82526,8 @@ primitiveVMParameter(void) goto l88; break; case 3: - result = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + result = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); goto l88; break; case 6: @@ -83853,8 +83286,9 @@ pruneStackstackp(sqInt stack, sqInt stackp) for (i = 2; i < stackp; i += 2) { /* begin fetchPointer:ofObject: */ objOrFP = longAt((stack + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))); - if ((((((usqInt)(((char *) objOrFP)))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)(((char *) objOrFP)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) objOrFP)))) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)(((char *) objOrFP)))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)(((char *) objOrFP)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) objOrFP)))) <= (((usqInt)GIV(pages)))))))) { /* begin withSmallIntegerTags: */ assert(((oopForPointer(((char *) objOrFP))) & (BytesPerWord - 1)) == 0); objOrFP = (oopForPointer(((char *) objOrFP))) + (smallIntegerTag()); @@ -84070,17 +83504,6 @@ unmarkAfterPathTo(void) static char _m[] = ""; void* vm_exports[][3] = { - {(void*)_m, "activeProcess", (void*)activeProcess}, - {(void*)_m, "callbackEnter", (void*)callbackEnter}, - {(void*)_m, "callbackLeave", (void*)callbackLeave}, - {(void*)_m, "checkAllAccessibleObjectsOkay", (void*)checkAllAccessibleObjectsOkay}, - {(void*)_m, "checkOkayInterpreterObjects", (void*)checkOkayInterpreterObjects}, - {(void*)_m, "dumpPrimTraceLogOn", (void*)dumpPrimTraceLogOn}, - {(void*)_m, "inOrderPrintFreeTreeprintList", (void*)inOrderPrintFreeTreeprintList}, - {(void*)_m, "longPrintInstancesOf", (void*)longPrintInstancesOf}, - {(void*)_m, "longPrintInstancesWithClassIndex", (void*)longPrintInstancesWithClassIndex}, - {(void*)_m, "longPrintOop", (void*)longPrintOop}, - {(void*)_m, "longPrintReferencesTo", (void*)longPrintReferencesTo}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, {(void*)_m, "primitiveAddLargeIntegers\000\000\001", (void*)primitiveAddLargeIntegers}, {(void*)_m, "primitiveAllInstances\000\000\000", (void*)primitiveAllInstances}, @@ -84093,6 +83516,9 @@ void* vm_exports[][3] = { #endif /* VMBenchmarks */ #if VMBenchmarks {(void*)_m, "primitiveBenchmarkJITReceiver\000\000\000", (void*)primitiveBenchmarkJITReceiver}, +#endif /* VMBenchmarks */ +#if VMBenchmarks + {(void*)_m, "primitiveBenchmarkScavenge\000\377\000", (void*)primitiveBenchmarkScavenge}, #endif /* VMBenchmarks */ {(void*)_m, "primitiveBitAndLargeIntegers\000\000\001", (void*)primitiveBitAndLargeIntegers}, {(void*)_m, "primitiveBitOrLargeIntegers\000\000\001", (void*)primitiveBitOrLargeIntegers}, @@ -84158,72 +83584,5 @@ void* vm_exports[][3] = { #endif /* TestingPrimitives */ {(void*)_m, "primitiveUtcWithOffset\000\001\000", (void*)primitiveUtcWithOffset}, {(void*)_m, "primitiveVoidReceiver\000\377\000", (void*)primitiveVoidReceiver}, - {(void*)_m, "printActivationsOf", (void*)printActivationsOf}, - {(void*)_m, "printAllStacks", (void*)printAllStacks}, - {(void*)_m, "printAllStacksOn", (void*)printAllStacksOn}, - {(void*)_m, "printBogons", (void*)printBogons}, - {(void*)_m, "printCallStack", (void*)printCallStack}, - {(void*)_m, "printCallStackOf", (void*)printCallStackOf}, - {(void*)_m, "printCallStackOn", (void*)printCallStackOn}, - {(void*)_m, "printCogMethod", (void*)printCogMethod}, - {(void*)_m, "printContextReferencesTo", (void*)printContextReferencesTo}, - {(void*)_m, "printContext", (void*)printContext}, - {(void*)_m, "printEntity", (void*)printEntity}, - {(void*)_m, "printExternalHeadFrame", (void*)printExternalHeadFrame}, - {(void*)_m, "printForwarders", (void*)printForwarders}, - {(void*)_m, "printFramesInPage", (void*)printFramesInPage}, - {(void*)_m, "printFramesOnStackPageListInUse", (void*)printFramesOnStackPageListInUse}, - {(void*)_m, "printFrame", (void*)printFrame}, - {(void*)_m, "printFrameWithSP", (void*)printFrameWithSP}, - {(void*)_m, "printFreeChunk", (void*)printFreeChunk}, - {(void*)_m, "printFreeListHeads", (void*)printFreeListHeads}, - {(void*)_m, "printFreeList", (void*)printFreeList}, - {(void*)_m, "printFreeTree", (void*)printFreeTree}, - {(void*)_m, "printHeaderOf", (void*)printHeaderOf}, - {(void*)_m, "printInstancesOf", (void*)printInstancesOf}, - {(void*)_m, "printInstancesWithClassIndex", (void*)printInstancesWithClassIndex}, - {(void*)_m, "printLikelyImplementorsOfSelector", (void*)printLikelyImplementorsOfSelector}, -#if LLDB - {(void*)_m, "printMarkedOops", (void*)printMarkedOops}, -#endif /* LLDB */ - {(void*)_m, "printMethodCache", (void*)printMethodCache}, - {(void*)_m, "printMethodCacheFor", (void*)printMethodCacheFor}, - {(void*)_m, "printMethodDictionaryOf", (void*)printMethodDictionaryOf}, - {(void*)_m, "printMethodDictionary", (void*)printMethodDictionary}, - {(void*)_m, "printMethodImplementorsOf", (void*)printMethodImplementorsOf}, - {(void*)_m, "printMethodReferencesTo", (void*)printMethodReferencesTo}, - {(void*)_m, "printObjectsFromto", (void*)printObjectsFromto}, - {(void*)_m, "printObjectsWithHash", (void*)printObjectsWithHash}, - {(void*)_m, "printOopsExcept", (void*)printOopsExcept}, - {(void*)_m, "printOopsFromto", (void*)printOopsFromto}, - {(void*)_m, "printOopsSuchThat", (void*)printOopsSuchThat}, - {(void*)_m, "printOop", (void*)printOop}, - {(void*)_m, "printProcessStack", (void*)printProcessStack}, - {(void*)_m, "printProcsOnList", (void*)printProcsOnList}, - {(void*)_m, "printReferencesTo", (void*)printReferencesTo}, - {(void*)_m, "printStackCallStackOf", (void*)printStackCallStackOf}, - {(void*)_m, "printStackPageList", (void*)printStackPageList}, - {(void*)_m, "printStackPageListInUse", (void*)printStackPageListInUse}, - {(void*)_m, "printStackPages", (void*)printStackPages}, - {(void*)_m, "printStackPagesInUse", (void*)printStackPagesInUse}, - {(void*)_m, "printStackReferencesTo", (void*)printStackReferencesTo}, -#if LLDB - {(void*)_m, "printUnmarkedOops", (void*)printUnmarkedOops}, -#endif /* LLDB */ - {(void*)_m, "reestablishContextPriorToCallback", (void*)reestablishContextPriorToCallback}, - {(void*)_m, "reportMinimumUnusedHeadroom", (void*)reportMinimumUnusedHeadroom}, - {(void*)_m, "reportMinimumUnusedHeadroomOn", (void*)reportMinimumUnusedHeadroomOn}, - {(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext}, - {(void*)_m, "segmentContainingObj", (void*)segmentContainingObj}, - {(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext}, - {(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector}, - {(void*)_m, "setBreakSelector", (void*)setBreakSelector}, - {(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain}, - {(void*)_m, "shortPrintFramesInPage", (void*)shortPrintFramesInPage}, - {(void*)_m, "shortPrintFramesOnStackPageListInUse", (void*)shortPrintFramesOnStackPageListInUse}, - {(void*)_m, "shortPrintFrameAndNCallers", (void*)shortPrintFrameAndNCallers}, - {(void*)_m, "shortPrintObjectsFromto", (void*)shortPrintObjectsFromto}, - {(void*)_m, "statNumGCs", (void*)statNumGCs}, - {(void*)_m, "whereIs", (void*)whereIs}, {NULL, NULL, NULL} }; diff --git a/src/spur64.cog.newspeak/cointerp.h b/src/spur64.cog.newspeak/cointerp.h index 23cc37f4c2..4b8b0afa8a 100644 --- a/src/spur64.cog.newspeak/cointerp.h +++ b/src/spur64.cog.newspeak/cointerp.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -22,7 +22,6 @@ extern sqInt accessorDepthForPrimitiveIndex(sqInt primIndex); extern usqInt argumentCountAddress(void); -extern void assertValidMachineCodeFrame(sqInt instrPtr); extern void callForCogCompiledCodeCompaction(void); extern void ceActivateFailingPrimitiveMethod(sqInt aPrimitiveMethod); extern sqInt ceBaseFrameReturn(sqInt returnValue); @@ -44,7 +43,6 @@ extern sqInt ceNonLocalReturn(sqInt returnValue); extern void ceOuterSendreceiver(sqInt cacheAddress, sqInt methodReceiver); extern void ceReapAndResetErrorCodeFor(CogMethod *cogMethod); extern void ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver); -extern sqInt ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); extern sqInt ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC); extern sqInt ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize); extern sqInt ceSendMustBeBoolean(sqInt anObject); @@ -57,29 +55,22 @@ extern void ceTraceBlockActivation(void); extern void ceTraceLinkedSend(sqInt theReceiver); extern void ceTraceStoreOfinto(sqInt aValue, sqInt anObject); extern usqInt cFramePointerAddress(void); -extern void checkAssertsEnabledInCoInterpreter(void); extern sqInt checkForAndFollowForwardedPrimitiveState(void); extern sqInt checkIfCFramePointerInUse(void); #if LRPCheck extern sqInt checkingLongRunningPrimitives(void); #endif /* LRPCheck */ -extern void clearTraceLog(void); -extern sqInt cogMethodHasTooManyLiterals(CogMethod *aCogMethod); extern CogMethod * cogMethodOf(sqInt aMethodOop); extern void compilationBreakpointFor(sqInt selectorOop); extern usqInt cReturnAddressAddress(void); extern usqInt cStackPointerAddress(void); extern sqInt defaultNativeStackFrameSize(void); -extern void dumpPrimTraceLog(void); extern void executeCogMethodfromLinkedSendWithReceiver(CogMethod *cogMethod, sqInt rcvr); extern void executeCogPICfromLinkedSendWithReceiverandCacheTag(CogMethod *cogPIC, sqInt rcvr, sqInt cacheTag); extern usqInt framePointerAddress(void); extern void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto(sqInt methodObj, sqInt primitiveIndex, sqInt *flagsPtr))(void); -extern char * getFramePointer(void); -extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); extern usqInt instructionPointerAddress(void); extern sqInt interpret(void); -extern usqInt interpretAddress(void); extern sqInt isCogMethodReference(sqInt methodHeader); extern sqInt isFullBlockMethod(sqInt aMethodObj); #if LRPCheck @@ -95,9 +86,6 @@ extern sqInt methodHasCogMethod(sqInt aMethodOop); extern sqInt methodNeedsLargeContext(sqInt methodObj); extern sqInt methodShouldBeCogged(sqInt aMethodObj); extern CogMethod * mframeHomeMethodExport(void); -extern CogMethod * mframeHomeMethod(char *theFP); -extern sqInt mMethodClass(void); -extern void mnuCompilationBreakpointFor(sqInt selectorOop); extern usqInt newMethodAddress(void); extern usqInt nextProfileTickAddress(void); extern sqInt noAssertHeaderOf(sqInt methodPointer); @@ -106,11 +94,10 @@ extern unsigned int positive32BitValueOf(sqInt oop); extern sqInt positive64BitIntegerFor(usqLong integerValue); extern usqLong positive64BitValueOf(sqInt oop); extern usqInt primFailCodeAddress(void); -extern usqInt primitiveFailAddress(void); extern sqInt primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs); extern void * primTraceLogAddress(void); extern usqInt primTraceLogIndexAddress(void); -EXPORT(void) printCogMethod(CogMethod *cogMethod); +extern void printCogMethod(CogMethod *cogMethod); extern sqInt quickPrimitiveConstantFor(sqInt aQuickPrimitiveIndex); extern sqInt (*quickPrimitiveGeneratorFor(sqInt aQuickPrimitiveIndex))(void); extern sqInt quickPrimitiveInstVarIndexFor(sqInt primIndex); @@ -129,24 +116,12 @@ extern sqInt startPCOfMethodHeader(sqInt aCompiledMethodHeader); extern sqInt startPCOrNilOfLiteralin(sqInt lit, sqInt aMethodObj); extern void updateStackZoneReferencesToCompiledCodePreCompaction(void); extern usqInt primitiveFunctionPointerAddress(void); -extern char * cStringOrNullFor(sqInt oop); -extern sqInt failed(void); -extern sqInt identityHashOf(sqInt anOop); extern void primitiveClosureValueNoContextSwitch(void); extern sqInt primitiveFail(void); -extern sqInt primitiveFailForFFIExceptionat(usqLong exceptionCode, usqInt pc); -extern sqInt primitiveFailForOSError(sqLong osErrorCode); -extern sqInt primitiveFailFor(sqInt reasonCode); -extern sqInt primitiveFailForwithSecondary(sqInt reasonCode, sqLong extraErrorCode); -extern sqInt primitiveFailureCode(void); EXPORT(sqInt) primitiveHighResClock(void); -extern sqInt signalNoResume(sqInt aSemaphore); -extern usqInt sizeOfAlienData(sqInt oop); -extern void * startOfAlienData(sqInt oop); extern void ceScheduleScavenge(void); extern sqInt classSmallFloat(void); extern void ensureNoForwardedLiteralsIn(sqInt aMethodObj); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern usqInt freeStartAddress(void); extern usqInt getScavengeThreshold(void); extern sqInt isForwardedClassIndex(sqInt maybeClassIndex); @@ -158,36 +133,23 @@ extern sqLong nullHeaderForMachineCodeMethod(void); extern usqInt scavengeThresholdAddress(void); extern usqInt specialObjectsOopAddress(void); extern sqInt withoutForwardingOnandwithsendToCogit(sqInt obj1, sqInt obj2, sqInt aBool, sqInt (*selector)(sqInt,sqInt,sqInt)); -extern sqInt byteSwapped(sqInt w); extern sqInt fetchClassTagOf(sqInt oop); extern sqInt floatObjectOf(double aFloat); extern double floatValueOf(sqInt oop); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt isIntegerValue(sqInt intValue); extern sqInt isMarked(sqInt objOop); extern usqInt smallObjectBytesForSlots(sqInt numSlots); -extern void openScavengeLog(void); -extern void printRememberedSet(void); extern sqInt remember(sqInt objOop); -extern sqInt addGCRoot(sqInt *varLoc); extern sqInt addressCouldBeObj(sqInt address); extern sqInt addressCouldBeOop(sqInt address); extern sqInt allocatePinnedSlots(sqInt nSlots); extern sqInt arrayFormat(void); -extern sqInt becomewith(sqInt array1, sqInt array2); extern void beRootIfOld(sqInt oop); extern sqInt byteSizeOf(sqInt oop); extern usqInt bytesPerElement(sqInt oop); extern sqInt characterObjectOf(sqInt characterCode); -extern usqInt characterValueOf(sqInt oop); -extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); -extern sqInt checkOkayOop(usqInt oop); -extern sqInt checkOopHasOkayClass(usqInt obj); extern sqInt classArray(void); extern sqInt classAtIndex(sqInt classIndex); extern sqInt classIndexOf(sqInt objOop); @@ -197,15 +159,10 @@ extern sqInt classTableMinorIndexMask(void); extern sqInt classTablePageSize(void); extern sqInt classTableRootObj(void); extern sqInt classTagForClass(sqInt classObj); -extern sqInt compactClassIndexOf(sqInt objOop); -extern void countMarkedAndUnmarkdObjects(sqInt printFlags); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); extern sqInt falseObject(void); extern sqInt fetchByteofObject(sqInt byteIndex, sqInt objOop); extern sqInt fetchPointerofObject(sqInt fieldIndex, sqInt objOop); -extern void findStringBeginningWith(char *aCString); -extern void findString(char *aCString); extern sqInt fixedFieldsOfClassFormatMask(void); extern sqInt fixedFieldsOfClassFormat(sqInt classFormat); extern sqInt followForwarded(sqInt objOop); @@ -215,12 +172,8 @@ extern usqLong headerForSlotsformatclassIndex(sqInt numSlots, sqInt formatField, #if IMMUTABILITY extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ -extern sqInt indexOfin(sqInt anElement, sqInt anObject); -extern sqInt instanceSizeOf(sqInt classObj); extern sqInt instSpecOfClassFormat(sqInt classFormat); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isCharacterObject(sqInt oop); -extern sqInt isCharacterValue(sqInt anInteger); extern sqInt isCompiledMethod(sqInt objOop); extern sqInt isFixedSizePointerFormat(sqInt format); extern sqInt isForwarded(sqInt objOop); @@ -228,116 +181,75 @@ extern sqInt isImmediate(sqInt oop); extern sqInt isInOldSpace(sqInt address); extern sqInt isLong64s(sqInt oop); extern sqInt isNonImmediate(sqInt oop); -extern sqInt isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); -extern sqInt isOopImmutable(sqInt oop); extern sqInt isOopMutable(sqInt oop); -extern sqInt isPinned(sqInt objOop); -extern sqInt isReallyYoung(sqInt oop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); -extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); -extern sqInt isWordsOrShorts(sqInt oop); extern sqInt isYoungObject(sqInt objOop); extern sqInt isYoung(sqInt oop); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); extern void NeverInline markAndTrace(sqInt objOop); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); extern sqInt minSlotsForShortening(void); extern sqInt nilObject(void); extern sqInt nonIndexablePointerFormat(void); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); -extern sqInt objectBefore(sqInt objOop); -extern sqInt oldSpaceObjectAfter(sqInt objOop); extern sqInt popRemappableOop(void); extern sqInt primitiveErrorTable(void); -extern void printFreeChunks(void); -extern void printInvalidClassTableEntries(void); -extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); +extern void printObjStackAndContents(sqInt objStack); extern void pushRemappableOop(sqInt oop); extern sqInt rawHashBitsOf(sqInt objOop); extern sqInt receiverTagBitsForMethod(sqInt aMethodObj); -extern sqInt removeGCRoot(sqInt *varLoc); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern sqInt shouldRemapOop(sqInt oop); extern sqInt splObj(sqInt index); extern usqInt storeCheckBoundary(void); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); extern sqInt storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer); +extern sqInt storePointerofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer); extern sqInt stringForCString(const char *aCString); extern void tenuringIncrementalGC(void); extern sqInt topRemappableOop(void); extern sqInt trueObject(void); -extern sqInt validFreeTree(void); -extern sqInt vmEndianness(void); extern sqInt remapObj(sqInt objOop); extern sqInt shouldRemapObj(sqInt objOop); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -extern void addIdleUsecs(sqInt idleUsecs); extern sqInt argumentCountOfClosure(sqInt closurePointer); extern sqInt argumentCountOfMethodHeader(sqInt header); extern sqInt argumentCountOf(sqInt methodPointer); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); -extern sqInt disownVM(sqInt flags); -extern sqInt doSignalSemaphoreWithIndex(sqInt index); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern void NeverInline eekcr(void); extern void flush(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); -extern usqLong getNextWakeupUsecs(void); -extern sqInt * getStackPointer(void); +extern sqInt getThisSessionID(void); extern FILE * getTranscript(void); extern sqInt highBit(usqInt anUnsignedValue); -extern sqInt isFloatObject(sqInt oop); -extern sqInt isKindOfInteger(sqInt oop); -extern sqInt isLargeIntegerObject(sqInt oop); -extern sqInt isLargeNegativeIntegerObject(sqInt oop); -extern sqInt isLargePositiveIntegerObject(sqInt oop); extern sqInt isQuickPrimitiveIndex(sqInt anInteger); extern sqInt isReadMediatedContextInstVarIndex(sqInt index); extern sqInt isWriteMediatedContextInstVarIndex(sqInt index); -extern sqInt isKindOfClass(sqInt oop, sqInt aClass); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); extern sqInt lookupSelectorinClass(sqInt selector, sqInt class); extern sqInt maybeSelectorOfMethod(sqInt methodObj); extern sqInt methodClassAssociationOf(sqInt methodPointer); extern sqInt methodClassOf(sqInt methodPointer); -extern sqInt methodPrimitiveIndex(void); extern sqInt methodUsesAlternateBytecodeSet(sqInt aMethodObj); extern sqInt objCouldBeClassObj(sqInt objOop); -extern sqInt ownVM(sqInt threadIndexAndFlags); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); -extern sqInt printHexnp(usqInt n); extern void printHex(usqInt n); extern void print(char *s); -extern sqInt readableFormat(sqInt imageVersion); -extern void setNextWakeupUsecs(usqLong value); extern sqInt sizeOfCallPrimitiveBytecode(sqInt methodHeader); extern sqInt sizeOfLongStoreTempBytecode(sqInt methodHeader); extern sqInt specialSelector(sqInt index); -extern usqIntptr_t stackPositiveMachineIntegerValue(sqInt offset); -extern sqIntptr_t stackSignedMachineIntegerValue(sqInt offset); extern sqInt stackTop(void); extern sqInt stackValue(sqInt offset); extern sqInt startPCOfMethod(sqInt aCompiledMethod); @@ -347,39 +259,11 @@ extern sqInt ultimateLiteralOf(sqInt aMethodOop); /*** Global Variables ***/ -extern sqInt breakLookupClassTag; extern char * breakSelector; extern sqInt breakSelectorLength ; -extern sqInt cannotDeferDisplayUpdates; -extern sqInt checkedPluginName; -extern sqInt checkForLeaks; -extern sqInt debugCallbackInvokes; -extern sqInt debugCallbackPath; -extern sqInt debugCallbackReturns; -extern sqInt deferDisplayUpdates; -extern sqInt desiredCogCodeSize; -extern sqInt desiredEdenBytes; -extern sqInt desiredNumStackPages; -extern void * displayBits; -extern int displayDepth; -extern int displayHeight; -extern int displayWidth; -extern sqInt eventTraceMask; -extern sqInt extraVMMemory; -extern sqInt ffiExceptionResponse; extern usqInt heapBase; -extern sqInt inIOProcessEvents; -extern struct VirtualMachine* interpreterProxy; -extern sqInt maxLiteralCountForCompile ; -extern usqInt maxOldSpaceSize; -extern sqInt minBackwardJumpCountForCompile ; extern sqInt primitiveDoMixedArithmetic ; -extern char * primTracePluginName; -extern volatile int sendTrace; -extern sqInt sendWheelEvents; -extern int (*showSurfaceFn)(sqIntptr_t, int, int, int, int); extern sqInt suppressHeartbeatFlag; -extern sqInt upscaleDisplayIfHighDPI ; /*** Macros ***/ @@ -397,13 +281,6 @@ extern sqInt upscaleDisplayIfHighDPI ; compilationBreakpointFor(sel); \ } \ } while (0) -#define mnuCompilationBreakpoint(sel, len) do { \ - if ((len) == -breakSelectorLength \ - && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, -breakSelectorLength)) { \ - suppressHeartbeatFlag = 1; \ - compilationBreakpointFor(sel); \ - } \ -} while (0) #define startOfMemory() heapBase #define numTagBits() 3 #define shiftForWord() 3 diff --git a/src/spur64.cog.newspeak/gcc3x-cointerp.c b/src/spur64.cog.newspeak/gcc3x-cointerp.c index 3d61a2b2ea..b1c4086041 100644 --- a/src/spur64.cog.newspeak/gcc3x-cointerp.c +++ b/src/spur64.cog.newspeak/gcc3x-cointerp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - CoInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CoInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -173,7 +173,6 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define GCCheckShorten 64 #define GCModeBecome 8 #define GCModeFull 1 -#define GCModeIncremental 4 #define GCModeNewSpace 2 #define HasBeenReturnedFromMCPC -1 #define HasBeenReturnedFromMCPCOop 0xFFFFFFFFFFFFFFF9ULL @@ -433,7 +432,6 @@ static void NoDbgRegParms addNewMethodToCache(sqInt classObj); extern usqInt argumentCountAddress(void); static CogMethod * NoDbgRegParms asCogHomeMethod(CogBlockMethod *aCogMethod); static void NoDbgRegParms assertValidExecutionPointersimbarline(usqInt lip, char *lifp, char *lisp, sqInt inInterpreter, sqInt ln); -extern void assertValidMachineCodeFrame(sqInt instrPtr); static sqInt NoDbgRegParms assertValidStackedInstructionPointersInline(StackPage *aStackPage, sqInt ln); static void NoDbgRegParms assertValidStackedInstructionPointers(sqInt ln); static void NoDbgRegParms attemptToSwitchToMachineCode(sqInt bcpc); @@ -460,7 +458,7 @@ extern sqInt ceNonLocalReturn(sqInt returnValue); extern void ceOuterSendreceiver(sqInt cacheAddress, sqInt methodReceiver); extern void ceReapAndResetErrorCodeFor(CogMethod *cogMethod); extern void ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver); -extern sqInt ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); +static sqInt NoDbgRegParms ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs); extern sqInt ceSendFromInLineCacheMiss(CogMethod *cogMethodOrPIC); extern sqInt ceSendMustBeBooleanTointerpretingAtDelta(sqInt aNonBooleanObject, sqInt jumpSize); extern sqInt ceSendMustBeBoolean(sqInt anObject); @@ -498,7 +496,7 @@ static sqInt NoDbgRegParms divorceAFrameIfin(sqInt (*criterion)(char *fp), Stack static sqInt NoDbgRegParms divorceAllFramesSuchThat(sqInt (*criterion)(char *fp)); static sqInt NoDbgRegParms divorceAMachineCodeFrameWithCogMethodin(CogMethod *cogMethod, StackPage *aStackPage); extern void dumpPrimTraceLog(void); -EXPORT(void) dumpPrimTraceLogOn(FILE *aStdioStream); +extern void dumpPrimTraceLogOn(FILE *aStdioStream); static void NoDbgRegParms ensureAllContextsHaveBytecodePCsIf(sqInt (*criterion)(sqInt methodOop)); static void NoDbgRegParms ensureContextHasBytecodePC(sqInt aContext); static void NoDbgRegParms ensureContextIsExecutionSafeAfterAssignToStackPointer(sqInt aContext); @@ -528,7 +526,6 @@ extern usqInt framePointerAddress(void); static sqInt NoDbgRegParms frameReceiver(char *theFP); extern void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto(sqInt methodObj, sqInt primitiveIndex, sqInt *flagsPtr))(void); extern sqInt getCurrentBytecode(void); -extern char * getFramePointer(void); static sqInt getImageHeaderFlags(void); static sqInt NoDbgRegParms handleForwardedSendFaultForReceiverstackDelta(sqInt forwardedReceiver, sqInt stackDelta); static sqInt NoDbgRegParms handleMNUInMachineCodeToclassForMessage(sqInt selectorIndex, sqInt rcvr, sqInt classForMessage); @@ -538,7 +535,6 @@ static usqInt NoDbgRegParms iframeSavedIP(char *theFP); extern void ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, char **savedSPP); extern usqInt instructionPointerAddress(void); static sqInt NoDbgRegParms instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sqInt instrPtr); -extern usqInt interpretAddress(void); static sqInt NeverInline interpreterAllocationReserveBytes(void); static sqInt interpretMethodFromMachineCode(void); extern sqInt isCogMethodReference(sqInt methodHeader); @@ -580,12 +576,10 @@ extern sqInt methodShouldBeCogged(sqInt aMethodObj); static sqInt NoDbgRegParms methodWithHeaderShouldBeCogged(sqInt methodHeader); static CogBlockMethod * NoDbgRegParms mframeCogMethod(char *theFP); extern CogMethod * mframeHomeMethodExport(void); -extern CogMethod * mframeHomeMethod(char *theFP); +static CogMethod * NoDbgRegParms mframeHomeMethod(char *theFP); static sqInt NoDbgRegParms mframeIsBlockActivation(char *theFP); static sqInt NoDbgRegParms mframeReceiver(char *theFP); static sqInt NeverInline minimumUnusedHeadroom(void); -extern sqInt mMethodClass(void); -extern void mnuCompilationBreakpointFor(sqInt selectorOop); static sqInt NoDbgRegParms mnuMethodOrNilFor(sqInt rcvr); static char * NoDbgRegParms moveFramesInthroughtoPage(StackPage *oldPage, char *theFP, StackPage *newPage); static sqInt NoDbgRegParms mustMapMachineCodePCcontext(sqInt theIP, sqInt aOnceMarriedContext); @@ -603,16 +597,15 @@ extern usqInt primFailCodeAddress(void); static void NoDbgRegParms primitiveBecomeReturn(sqInt ec); static void primitiveExecuteMethod(void); static void primitiveExecuteMethodArgsArray(void); -extern usqInt primitiveFailAddress(void); extern sqInt primitivePropertyFlagsnumArgs(sqInt primIndex, sqInt numArgs); extern void * primTraceLogAddress(void); extern usqInt primTraceLogIndexAddress(void); -EXPORT(void) printCogMethod(CogMethod *cogMethod); +extern void printCogMethod(CogMethod *cogMethod); static void NoDbgRegParms printFrameFlagsForFP(char *theFP); static void NoDbgRegParms printFrameMethodFor(char *theFP); static void NoDbgRegParms printFrameThingatextra(char *name, char *address, sqInt extraValue); -EXPORT(sqInt) printFrameWithSP(char *theFP, char *theSP); -EXPORT(void) printMethodCacheFor(sqInt thing); +extern sqInt printFrameWithSP(char *theFP, char *theSP); +extern void printMethodCacheFor(sqInt thing); static sqInt NoDbgRegParms printPrimLogEntryAthasParameter(sqInt i, sqInt hasParameter); extern sqInt quickPrimitiveConstantFor(sqInt aQuickPrimitiveIndex); extern sqInt (*quickPrimitiveGeneratorFor(sqInt aQuickPrimitiveIndex))(void); @@ -623,13 +616,13 @@ extern size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredH extern sqInt recordFastCCallPrimTraceForMethod(sqInt aMethodObj); extern sqInt recordPrimTraceForMethod(sqInt aMethodObj); static void NeverInline reloadPrimitiveCalloutPointer(void); -EXPORT(void) reportMinimumUnusedHeadroom(void); -EXPORT(void) reportMinimumUnusedHeadroomOn(FILE *aStdioStream); +extern void reportMinimumUnusedHeadroom(void); +extern void reportMinimumUnusedHeadroomOn(FILE *aStdioStream); static sqInt NoDbgRegParms resumepreemptedYieldingIffrom(sqInt aProcess, sqInt yieldImplicitly, sqInt sourceCode); static sqInt NoDbgRegParms returnToExecutivepostContextSwitch(sqInt inInterpreter, sqInt switchedContext); static sqInt NoDbgRegParms returntoExecutive(sqInt returnValue, sqInt inInterpreter); static sqInt NoDbgRegParms roomToPushNArgs(sqInt n); -EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); +extern sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); static sqInt NoDbgRegParms shortPrintFrame(char *theFP); extern sqInt signed32BitIntegerFor(sqInt integerValue); extern int signed32BitValueOf(sqInt oop); @@ -651,7 +644,7 @@ static void NoDbgRegParms updateStateOfSpouseContextForFrameWithSP(char *theFP, extern sqInt validInstructionPointerinMethodframePointer(usqInt instrPointer, usqInt aMethod, char *fp); static sqInt NoDbgRegParms validStackPageBaseFrame(StackPage *aPage); static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); -EXPORT(char *) whereIs(sqInt anOop); +extern char * whereIs(sqInt anOop); static void NoDbgRegParms NeverInline widowOrForceToBytecodePC(sqInt ctxt); static sqInt NoDbgRegParms frameIsMarked(sqInt theFPInt); #if VMBenchmarks @@ -663,6 +656,9 @@ EXPORT(void) primitiveBenchmarkFollowForwardersOfReceiverAndTemporariesInStackZo #if VMBenchmarks EXPORT(sqInt) primitiveBenchmarkJITReceiver(void); #endif /* VMBenchmarks */ +#if VMBenchmarks +EXPORT(void) primitiveBenchmarkScavenge(void); +#endif /* VMBenchmarks */ static void primitiveClosureCopyWithCopiedValues(void); static void primitiveCollectCogCodeConstituents(void); static void primitiveContextXray(void); @@ -947,7 +943,7 @@ extern void ceScheduleScavenge(void); extern sqInt classSmallFloat(void); static void clearLeakMapAndMapAccessibleObjects(void); extern void ensureNoForwardedLiteralsIn(sqInt aMethodObj); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern usqInt freeStartAddress(void); extern usqInt getScavengeThreshold(void); static sqLong NoDbgRegParms headerWhileForwardingOf(sqInt aCompiledMethodObjOop); @@ -975,9 +971,7 @@ static void NoDbgRegParms hackSlimBridgeToat(sqInt objOop, sqInt startAddress); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); static sqInt NoDbgRegParms initFreeChunkWithBytesat(usqLong numBytes, sqInt address); static void NoDbgRegParms initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt integerObjectOf(sqInt value); extern sqInt integerValueOf(sqInt oop); static sqInt NoDbgRegParms isFloatInstance(sqInt oop); @@ -1059,8 +1053,6 @@ extern void characterTable(void); extern usqInt characterValueOf(sqInt oop); static sqInt NoDbgRegParms cheapAddressCouldBeInHeap(sqInt address); extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); static sqInt checkHeapFreeSpaceIntegrity(void); static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt classIndicesShouldBeValid); extern sqInt checkOkayOop(usqInt oop); @@ -1104,13 +1096,13 @@ extern sqInt classWordArray(void); static void clearLeakMapAndMapAccessibleFreeSpace(void); static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning); extern sqInt cloneObject(sqInt objOop); -extern sqInt compactClassIndexOf(sqInt objOop); +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop); static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i); extern void countMarkedAndUnmarkdObjects(sqInt printFlags); static usqLong currentAllocatedBytes(void); extern sqInt displayObject(void); static void NoDbgRegParms doScavenge(sqInt tenuringCriterion); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); static void NoDbgRegParms emptyObjStack(sqInt objStack); static void NoDbgRegParms enableObjectEnumerationFrom(sqInt initialObject); @@ -1166,12 +1158,11 @@ static sqInt imageSegmentVersion(void); extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ extern void incrementalGC(void); -extern sqInt indexOfin(sqInt anElement, sqInt anObject); static void NoDbgRegParms inFreeTreeReplacewith(sqInt treeNode, sqInt newNode); static sqInt NoDbgRegParms initialInstanceOf(sqInt classObj); static void NeverInline initializeNewSpaceVariables(void); static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift); -EXPORT(void) inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); +extern void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); static void NoDbgRegParms NeverInline inPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag); extern sqInt instanceSizeOf(sqInt classObj); static sqInt NoDbgRegParms instantiateClass(sqInt classObj); @@ -1179,7 +1170,6 @@ extern sqInt instSpecOfClassFormat(sqInt classFormat); static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer); static void NoDbgRegParms invalidCompactClassError(const char *className); static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isArray(sqInt oop); static sqInt NoDbgRegParms isBridgeOrEnumerableObjectNoAssert(sqInt objOop); extern sqInt isBytes(sqInt oop); @@ -1217,7 +1207,7 @@ static sqInt NoDbgRegParms isMaybeFiredEphemeron(sqInt objOop); extern sqInt isNonImmediate(sqInt oop); static sqInt NoDbgRegParms isObjEphemeron(sqInt objOop); static sqInt NoDbgRegParms isObjImmutable(sqInt anOop); -extern sqInt isOldObject(sqInt objOop); +static sqInt NoDbgRegParms isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); extern sqInt isOopImmutable(sqInt oop); @@ -1225,12 +1215,11 @@ extern sqInt isOopMutable(sqInt oop); extern sqInt isPinned(sqInt objOop); extern sqInt isPointers(sqInt oop); static sqInt NoDbgRegParms isPureBitsFormat(sqInt format); -extern sqInt isReallyYoung(sqInt oop); static sqInt NoDbgRegParms isRemembered(sqInt objOop); static sqInt NoDbgRegParms isSegmentBridge(sqInt objOop); static sqInt NoDbgRegParms isSemaphoreOop(sqInt anOop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop); extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); static sqInt NoDbgRegParms isValidObjStackAt(sqInt objStackRootIndex); @@ -1251,20 +1240,18 @@ static sqInt NoDbgRegParms isonObjStack(sqInt oop, sqInt objStack); static sqInt NoDbgRegParms keyOfEphemeron(sqInt objOop); static sqInt NoDbgRegParms knownClassAtIndex(sqInt classIndex); static sqInt lastPointerFormat(void); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop); +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); static sqInt NoDbgRegParms lengthOfMaybeImmediate(sqInt oop); static sqInt NoDbgRegParms lengthOf(sqInt objOop); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); static sqInt NoDbgRegParms NeverInline loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray); -EXPORT(void) longPrintInstancesOf(sqInt aClassOop); -EXPORT(void) longPrintInstancesWithClassIndex(sqInt classIndex); -EXPORT(void) longPrintReferencesTo(sqInt anOop); +extern void longPrintInstancesOf(sqInt aClassOop); +extern void longPrintInstancesWithClassIndex(sqInt classIndex); +extern void longPrintReferencesTo(sqInt anOop); static void mapExtraRoots(void); static void NeverInline mapMournQueue(void); static sqInt NoDbgRegParms mapOopsFromtooutPointersoutHashes(sqInt segStart, sqInt segAddr, sqInt outPointerArray, sqInt savedOutHashes); @@ -1276,7 +1263,6 @@ static void NoDbgRegParms NeverInline markObjects(sqInt objectsShouldBeUnmarkedA static void markWeaklingsAndMarkAndFireEphemerons(void); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); extern sqInt minSlotsForShortening(void); static usqInt NoDbgRegParms newHashBitsOf(sqInt objOop); static usqInt newObjectHash(void); @@ -1294,12 +1280,11 @@ static sqInt noUnscannedEphemerons(void); static sqInt NoDbgRegParms numBytesOfBitsformat(sqInt objOop, sqInt format); static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numSlotsForBytes(sqInt numBytes); static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); extern sqInt objectBefore(sqInt objOop); static sqInt NoDbgRegParms objectInPastSpaceBefore(sqInt objOop); @@ -1314,45 +1299,46 @@ static sqInt NoDbgRegParms popObjStack(sqInt objStack); extern sqInt popRemappableOop(void); static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags); extern sqInt primitiveErrorTable(void); -EXPORT(void) printActivationsOf(sqInt aMethodObj); -EXPORT(void) printBogons(void); +extern void printActivationsOf(sqInt aMethodObj); +extern void printBogons(void); +static void NoDbgRegParms printBridgeon(sqInt oop, FILE *aStream); static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printContextReferencesTo(sqInt anOop); -EXPORT(void) printEntity(sqInt oop); -EXPORT(void) printForwarders(void); +extern void printContextReferencesTo(sqInt anOop); +extern void printEntity(sqInt oop); +extern void printForwarders(void); static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream); extern void printFreeChunks(void); -EXPORT(void) printFreeChunk(sqInt freeChunk); +extern void printFreeChunk(sqInt freeChunk); static void NoDbgRegParms printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode); -EXPORT(void) printFreeListHeads(void); -EXPORT(sqInt) printFreeList(sqInt chunkOrIndex); +extern void printFreeListHeads(void); +extern sqInt printFreeList(sqInt chunkOrIndex); static void NoDbgRegParms printFreeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printFreeTree(void); +extern void printFreeTree(void); static void NoDbgRegParms printFreeTreeChunk(sqInt chunkOrZero); -EXPORT(void) printHeaderOf(sqInt objOop); +extern void printHeaderOf(sqInt objOop); static void NoDbgRegParms printImmediateObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printInstancesOf(sqInt aClassOop); -EXPORT(void) printInstancesWithClassIndex(sqInt classIndex); +extern void printInstancesOf(sqInt aClassOop); +extern void printInstancesWithClassIndex(sqInt classIndex); extern void printInvalidClassTableEntries(void); #if LLDB -EXPORT(void) printMarkedOops(void); +extern void printMarkedOops(void); #endif /* LLDB */ -EXPORT(void) printMethodImplementorsOf(sqInt anOop); -EXPORT(void) printMethodReferencesTo(sqInt anOop); +extern void printMethodImplementorsOf(sqInt anOop); +extern void printMethodReferencesTo(sqInt anOop); static void NoDbgRegParms printNonPointerDataOfon(sqInt oop, FILE *aStream); -EXPORT(void) printObjectsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) printObjectsWithHash(sqInt hash); +extern void printObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void printObjectsWithHash(sqInt hash); +extern void printObjStackAndContents(sqInt objStack); static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents); static void NoDbgRegParms printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType); extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); -EXPORT(void) NeverInline printOopsExcept(sqInt (*function)(sqInt)); -EXPORT(void) printOopsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); -EXPORT(void) printReferencesTo(sqInt anOop); +extern void NeverInline printOopsExcept(sqInt (*function)(sqInt)); +extern void printOopsFromto(sqInt startAddress, sqInt endAddress); +extern void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); +extern void printReferencesTo(sqInt anOop); static void NoDbgRegParms printStringDataOfon(sqInt oop, FILE *aStream); #if LLDB -EXPORT(void) printUnmarkedOops(void); +extern void printUnmarkedOops(void); #endif /* LLDB */ static sqInt NoDbgRegParms pushOnUnscannedEphemeronsStack(sqInt anEphemeron); extern void pushRemappableOop(sqInt oop); @@ -1370,14 +1356,14 @@ static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedObjsclassIndicesShould static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion); static sqInt NoDbgRegParms NeverInline setHeapBasememoryLimitendOfMemory(sqInt baseOfHeap, sqInt memLimit, sqInt memEnd); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); -EXPORT(void) shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); extern sqInt shouldRemapOop(sqInt oop); static sqInt NoDbgRegParms sizeOfObjStack(sqInt objStack); static sqInt slidingCompactionInProgress(void); extern sqInt slotSizeOf(sqInt oop); extern sqInt splObj(sqInt index); static usqInt NoDbgRegParms startOfObject(sqInt objOop); -EXPORT(sqInt) statNumGCs(void); +extern sqInt statNumGCs(void); extern usqInt storeCheckBoundary(void); static sqInt NoDbgRegParms storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointerArrayArg, sqInt arrayOfRootsArg); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); @@ -1441,7 +1427,7 @@ static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i); static void postSnapshot(void); static void NeverInline prepareForSnapshot(void); static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes); -EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop); +extern SpurSegmentInfo * segmentContainingObj(sqInt objOop); static sqInt segmentOverlap(void); static sqInt NoDbgRegParms shrinkObjectMemory(usqInt delta); static sqInt someSegmentContainsPinned(void); @@ -1451,7 +1437,7 @@ static sqInt NoDbgRegParms writeImageSegmentsToFile(sqImageFile aBinaryStream); static sqInt NoDbgRegParms writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSegment, sqImageFile aBinaryStream); static sqInt NoDbgRegParms accessModifierOfMethod(sqInt methodObj); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -EXPORT(sqInt) activeProcess(void); +extern sqInt activeProcess(void); extern void addIdleUsecs(sqInt idleUsecs); static void NoDbgRegParms addLastLinktoList(sqInt proc, sqInt aList); static void NoDbgRegParms addNewMethodToNSCache(sqInt rule); @@ -1465,11 +1451,11 @@ static sqInt NoDbgRegParms asciiOfCharacter(sqInt characterObj); extern void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); static void NoDbgRegParms assertValidStackLimits(sqInt ln); extern sqInt booleanValueOf(sqInt obj); -EXPORT(sqInt) callbackEnter(sqInt *callbackID); -EXPORT(sqInt) callbackLeave(sqInt cbID); +extern sqInt callbackEnter(sqInt *callbackID); +extern sqInt callbackLeave(sqInt cbID); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); extern sqInt characterForAscii(sqInt ascii); -EXPORT(sqInt) checkAllAccessibleObjectsOkay(void); +extern sqInt checkAllAccessibleObjectsOkay(void); #if LRPCheck static sqInt NeverInline checkDeliveryOfLongRunningPrimitiveSignal(void); #endif /* LRPCheck */ @@ -1478,7 +1464,7 @@ static sqInt NoDbgRegParms checkForEventsMayContextSwitch(sqInt mayContextSwitch static sqInt NoDbgRegParms checkImageVersionFromstartingAt(sqImageFile f, squeakFileOffsetType imageOffset); static sqInt checkInterpreterIntegrity(void); static sqInt NoDbgRegParms checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP); -EXPORT(sqInt) checkOkayInterpreterObjects(sqInt writeBack); +extern sqInt checkOkayInterpreterObjects(sqInt writeBack); static sqInt NoDbgRegParms checkOkayStackPage(StackPage *thePage); static sqInt NoDbgRegParms checkOkayStackZone(sqInt writeBack); static void NoDbgRegParms checkProfileTick(sqInt aPrimitiveMethod); @@ -1487,8 +1473,7 @@ static sqInt NoDbgRegParms checkStackPointerIndexForFrame(char *theFP); static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className); static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext); static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern sqInt copyBits(void); extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y); static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop); @@ -1539,7 +1524,7 @@ static sqInt NoDbgRegParms frameStackedReceiverOffset(char *theFP); static sqInt NoDbgRegParms frameStackedReceivernumArgs(char *theFP, sqInt numArgs); static void freeUntracedStackPages(void); extern sqInt fullDisplayUpdate(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); +static void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); static sqInt getCogVMFeatureFlags(void); static sqInt getErrorObjectFromPrimFailCode(void); extern sqInt getFullScreenFlag(void); @@ -1597,7 +1582,7 @@ static sqInt NoDbgRegParms lengthOfNameOfClass(sqInt classOop); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt loadBitBltFrom(sqInt bb); extern void loadInitialContext(void); -EXPORT(void) longPrintOop(sqInt oop); +extern void longPrintOop(sqInt oop); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); static sqInt NoDbgRegParms lookupInMethodCacheSelclassTag(sqInt selector, sqInt classTag); static sqInt NoDbgRegParms lookupLexicalfromrule(sqInt selector, sqInt mixin, sqInt rule); @@ -1644,7 +1629,6 @@ static sqInt NoDbgRegParms objectequalsString(sqInt anOop, char *aCString); extern sqInt ownVM(sqInt threadIndexAndFlags); static sqInt NoDbgRegParms pcPreviousToinSqueakV3PlusClosuresMethod(sqInt theIP, sqInt aMethod); extern sqInt pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt pop(sqInt nItems); extern void popthenPush(sqInt nItems, sqInt oop); @@ -1660,44 +1644,43 @@ extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); static void NoDbgRegParms printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void NoDbgRegParms printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); -EXPORT(void) printAllStacks(void); -EXPORT(void) printAllStacksOn(FILE *aStdioStream); -EXPORT(void) printCallStack(void); +extern void printAllStacks(void); +extern void printAllStacksOn(FILE *aStdioStream); +extern void printCallStack(void); static sqInt NoDbgRegParms printCallStackFP(char *theFP); -EXPORT(sqInt) printCallStackOf(sqInt aContextOrProcessOrFrame); +extern sqInt printCallStackOf(sqInt aContextOrProcessOrFrame); static sqInt NoDbgRegParms printCallStackOfcurrentFP(sqInt aContext, char *currFP); -EXPORT(void) printCallStackOn(FILE *aStdioStream); +extern void printCallStackOn(FILE *aStdioStream); static sqInt NoDbgRegParms printContextCallStackOf(sqInt aContext); -EXPORT(void) printContext(sqInt aContext); +extern void printContext(sqInt aContext); static void NoDbgRegParms printDecodeMethodHeaderOop(sqInt methodHeaderOop); -EXPORT(void) printExternalHeadFrame(void); +extern void printExternalHeadFrame(void); static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort); static void NoDbgRegParms printFrameOopat(char *name, char *address); static void NoDbgRegParms printFrameOopindexat(char *name, sqInt idx, char *address); -EXPORT(void) printFramesInPage(StackPage *thePage); -EXPORT(void) printFramesOnStackPageListInUse(void); +extern void printFramesInPage(StackPage *thePage); +extern void printFramesOnStackPageListInUse(void); static void NoDbgRegParms printFrameThingandFrameat(char *name, char *theFP, char *address); static void NoDbgRegParms printFrameThingatextraString(char *name, char *address, char *extraStringOrNil); -EXPORT(sqInt) printFrame(char *theFP); -extern sqInt printHexnp(usqInt n); +extern sqInt printFrame(char *theFP); static sqInt NoDbgRegParms printHexPtrnp(void *p); extern void printHex(usqInt n); -EXPORT(void) printLikelyImplementorsOfSelector(sqInt selector); -EXPORT(void) printMethodCache(void); -EXPORT(void) printMethodDictionaryOf(sqInt behavior); -EXPORT(void) printMethodDictionary(sqInt dictionary); +extern void printLikelyImplementorsOfSelector(sqInt selector); +extern void printMethodCache(void); +extern void printMethodDictionaryOf(sqInt behavior); +extern void printMethodDictionary(sqInt dictionary); static void NoDbgRegParms printNameOfClasscount(sqInt classOop, sqInt cnt); static void NoDbgRegParms printOopShortInner(sqInt oop); -EXPORT(void) printOop(sqInt oop); -EXPORT(void) printProcessStack(sqInt aProcess); -EXPORT(sqInt) printProcsOnList(sqInt procList); -EXPORT(sqInt) printStackCallStackOf(sqInt aContextOrProcessOrFrame); -EXPORT(void) printStackPageList(void); -EXPORT(void) printStackPageListInUse(void); -EXPORT(void) printStackPages(void); -EXPORT(void) printStackPagesInUse(void); +extern void printOop(sqInt oop); +extern void printProcessStack(sqInt aProcess); +extern sqInt printProcsOnList(sqInt procList); +extern sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame); +extern void printStackPageList(void); +extern void printStackPageListInUse(void); +extern void printStackPages(void); +extern void printStackPagesInUse(void); static void NoDbgRegParms printStackPageuseCount(StackPage *page, sqInt n); -EXPORT(void) printStackReferencesTo(sqInt oop); +extern void printStackReferencesTo(sqInt oop); static void NoDbgRegParms printStringOf(sqInt oop); extern void print(char *s); extern void pushBool(sqInt trueOrFalse); @@ -1711,20 +1694,20 @@ static void NoDbgRegParms putToSleepyieldingIf(sqInt aProcess, sqInt yieldImplic static void NoDbgRegParms putWord32toFile(int aWord32, sqImageFile aFile); extern sqInt readableFormat(sqInt imageVersion); static void NoDbgRegParms NeverInline reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader); -EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext); +extern sqInt reestablishContextPriorToCallback(sqInt callbackContext); static sqInt NoDbgRegParms removeFirstLinkOfList(sqInt aList); static sqInt NoDbgRegParms removeProcessfromList(sqInt aProcess, sqInt aList); static sqInt retryPrimitiveOnFailure(void); -EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); +extern sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); static void NoDbgRegParms reverseDisplayFromto(sqInt startIndex, sqInt endIndex); static void NoDbgRegParms rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)()); static sqInt NoDbgRegParms safeMethodClassOf(sqInt methodPointer); static sqInt NoDbgRegParms saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex); static sqInt schedulerPointer(void); -EXPORT(void) setBreakMNUSelector(char *aString); -EXPORT(void) setBreakSelector(char *aString); +extern void setBreakMNUSelector(char *aString); +extern void setBreakSelector(char *aString); extern void setFullScreenFlag(sqInt value); -EXPORT(void *) setInterruptCheckChain(void (*aFunction)()); +extern void * setInterruptCheckChain(void (*aFunction)()); extern void setInterruptKeycode(sqInt value); extern void setInterruptPending(sqInt value); extern void setNextWakeupUsecs(usqLong value); @@ -1733,9 +1716,9 @@ static void setSignalLowSpaceFlagAndSaveProcess(void); static void NoDbgRegParms setTraceFlagOnContextsFramesPageIfNeeded(sqInt aContext); static sqInt NoDbgRegParms shortPrintContext(sqInt aContext); static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP); -EXPORT(void) shortPrintFramesInPage(StackPage *thePage); -EXPORT(void) shortPrintFramesOnStackPageListInUse(void); -EXPORT(void) shortPrintFrameAndNCallers(char *theFP, sqInt n); +extern void shortPrintFramesInPage(StackPage *thePage); +extern void shortPrintFramesOnStackPageListInUse(void); +extern void shortPrintFrameAndNCallers(char *theFP, sqInt n); static void NoDbgRegParms shortPrintOop(sqInt oop); static sqInt NoDbgRegParms shortReversePrintFrameAndCallers(char *aFramePointer); extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); @@ -1839,8 +1822,8 @@ _iss usqInt instructionPointer; _iss sqInt argumentCount; _iss sqLong nextProfileTick; _iss sqInt primTraceLog[256]; -_iss FILE * transcript; _iss StackPage * stackPage; +_iss FILE * transcript; _iss sqInt nilObj; _iss usqInt oldSpaceStart; _iss usqInt method; @@ -1854,9 +1837,9 @@ _iss sqInt trueObj; _iss sqInt falseObj; _iss usqInt totalFreeOldSpace; _iss sqInt lkupClassTag; -_iss SpurSegmentInfo * segments; _iss usqInt newSpaceStart; _iss sqInt hiddenRootsObj; +_iss SpurSegmentInfo * segments; _iss sqInt bytesPerPage; _iss sqInt numSegments; _iss sqInt classTableFirstPage; @@ -1873,6 +1856,7 @@ _iss usqInt firstFreeObject; _iss usqInt freeListsMask; _iss StackPage * mostRecentlyUsedPage; _iss sqInt remapBufferCount; +_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; _iss sqInt numStackPages; _iss sqInt tempOop; @@ -1892,13 +1876,11 @@ _iss sqInt becomeEffectsFlags; _iss sqInt growHeadroom; _iss sqInt tenureThreshold; _iss char * objStackInvalidBecause; -_iss sqInt sweepIndex; _iss sqInt ephemeronList; #if LRPCheck _iss sqInt longRunningPrimitiveCheckMethod; #endif _iss sqInt tenureCriterion; -_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classNameIndex; _iss usqInt freeOldSpaceStart; _iss sqInt extraRootCount; @@ -2029,7 +2011,6 @@ _iss sqInt traceLog[TraceBufferSize /* 768 */]; _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 65 */]; _iss usqLong byteCount; -_iss sqInt preferredPinningSegment; _iss sqInt statCoalesces; _iss usqLong statFGCDeltaUsecs; _iss usqLong statIncrGCUsecs; @@ -2078,7 +2059,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, @@ -2722,8 +2703,8 @@ static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 584 */])(void) = { 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); sqInt maxLiteralCountForCompile = MaxLiteralCountForCompile /* 60 */; -sqInt checkForLeaks; sqInt breakLookupClassTag; +sqInt checkForLeaks; sqInt breakSelectorLength = MinSmallInteger; sqInt debugCallbackPath; void * displayBits; @@ -2732,9 +2713,9 @@ sqInt primitiveDoMixedArithmetic = -1; sqInt desiredEdenBytes; sqInt desiredNumStackPages; sqInt extraVMMemory; -char * breakSelector; sqInt desiredCogCodeSize; sqInt eventTraceMask; +char * breakSelector; usqInt maxOldSpaceSize; sqInt ffiExceptionResponse; usqInt heapBase; @@ -2743,12 +2724,12 @@ sqInt upscaleDisplayIfHighDPI = -1; sqInt deferDisplayUpdates; struct VirtualMachine* interpreterProxy; sqInt sendWheelEvents; -sqInt suppressHeartbeatFlag; sqInt debugCallbackInvokes; sqInt debugCallbackReturns; +sqInt suppressHeartbeatFlag; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.3310"; +const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-eem.3329"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */; int displayWidth; int displayDepth; @@ -2782,13 +2763,6 @@ volatile int sendTrace; } while (0) #define getDesiredCogCodeSize() integerObjectOf(desiredCogCodeSize) #define heapBase() heapBase -#define mnuCompilationBreakpoint(sel, len) do { \ - if ((len) == -breakSelectorLength \ - && !strncmp((char *)((sel) + BaseHeaderSize), breakSelector, -breakSelectorLength)) { \ - suppressHeartbeatFlag = 1; \ - compilationBreakpointFor(sel); \ - } \ -} while (0) #define primTraceLogIndex(aValue) (GIV(primTraceLogIndex) = (aValue)) #define pageIndexForstackBasePlus1bytesPerPage(pointer,stkBasePlus1,pageByteSize) (((char *)(pointer) - (stkBasePlus1)) / (pageByteSize)) #define startOfMemory() heapBase @@ -14807,29 +14781,6 @@ assertl((methodUsesAlternateBytecodeSet(GIV(method))) == (GIV(bytecodeSetSelecto } } - /* CoInterpreter>>#assertValidMachineCodeFrame: */ -void -assertValidMachineCodeFrame(sqInt instrPtr) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - CogBlockMethod *cogMethod; - CogMethod *homeMethod; - - assert(isMachineCodeFrame(GIV(framePointer))); - /* begin mframeCogMethod: */ - cogMethod = ((CogBlockMethod *) ((longAt(GIV(framePointer) + FoxMethod)) & MFMethodMask)); - /* begin asCogHomeMethod: */ - if (((cogMethod->cmType)) >= CMMethod) { - homeMethod = ((CogMethod *) cogMethod); - } - else { - /* begin cmHomeMethod */ - homeMethod = ((CogMethod *) ((((usqInt)cogMethod)) - ((cogMethod->homeOffset)))); - } - assert((methodFor(cogMethod)) == homeMethod); - assert((instrPtr > (((sqInt)cogMethod))) - && (instrPtr < ((((sqInt)homeMethod)) + ((homeMethod->blockSize))))); -} - /* Check that the stacked instruction pointers in the given page are correct. Checks the interpreter sender/machine code callee contract. */ @@ -16127,8 +16078,8 @@ ceInterpretMethodFromPICreceiver(sqInt aMethodObj, sqInt rcvr) /* pop off inner return and locate open or closed PIC */ pic = ((CogMethod *) ((popStack()) - (interpretOffset()))); - assert((isCMOpenPIC(pic)) - || (isCMClosedPIC(pic))); + assert((isCMOpenPIC(((CogBlockMethod *) pic))) + || (isCMClosedPIC(((CogBlockMethod *) pic)))); if (((pic->cmType)) == CMOpenPIC) { assert(!(methodHasCogMethod(aMethodObj))); if (methodShouldBeCogged(aMethodObj)) { @@ -16198,8 +16149,8 @@ ceMNUFromPICMNUMethodreceiver(sqInt aMethodObj, sqInt rcvr) ? tagBits2 : (longAt(rcvr)) & (classIndexMask()))); cPIC = ((CogMethod *) ((popStack()) - (mnuOffset()))); - assert((isCMClosedPIC(cPIC)) - || (isCMOpenPIC(cPIC))); + assert((isCMClosedPIC(((CogBlockMethod *) cPIC))) + || (isCMOpenPIC(((CogBlockMethod *) cPIC)))); GIV(argumentCount) = (cPIC->cmNumArgs); GIV(messageSelector) = (cPIC->selector); if (aMethodObj != 0) { @@ -16866,7 +16817,7 @@ ceSelfSendreceiver(sqInt cacheAddress, sqInt methodReceiver) cogged or not. */ /* CoInterpreter>>#ceSendAbort:to:numArgs: */ -sqInt +static sqInt NoDbgRegParms ceSendAborttonumArgs(sqInt selector, sqInt rcvr, sqInt numArgs) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt aMethodObj; @@ -18700,7 +18651,7 @@ dumpPrimTraceLog(void) */ /* CoInterpreter>>#dumpPrimTraceLogOn: */ -EXPORT(void) +void dumpPrimTraceLogOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -20093,20 +20044,14 @@ void (*functionPointerForCompiledMethodprimitiveIndexprimitivePropertyFlagsInto( sqInt getCurrentBytecode(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - return (((((((usqInt)GIV(framePointer))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)GIV(framePointer))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)GIV(framePointer))) <= (((usqInt)GIV(pages))))))) + return (((GIV(stackBasePlus1) != null) + && ((((((usqInt)GIV(framePointer))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)GIV(framePointer))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)GIV(framePointer))) <= (((usqInt)GIV(pages)))))))) && (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))) ? byteAt(GIV(instructionPointer)) : -1); } - /* CoInterpreter>>#getFramePointer */ -char * -getFramePointer(void) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return GIV(framePointer); -} - /* Answer the flags that are contained in the 7th long of the image header. */ @@ -20291,12 +20236,14 @@ ifValidWriteBackStackPointersSaveTo(void *theCFP, void *theCSP, char **savedFPP, if (savedSPP != 0) { savedSPP[0] = GIV(stackPointer); } - if ((((((usqInt)theCFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theCFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCFP)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)theCFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theCFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCFP)) <= (((usqInt)GIV(pages)))))))) { GIV(framePointer) = theCFP; } - if ((((((usqInt)theCSP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theCSP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCSP)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)theCSP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theCSP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theCSP)) <= (((usqInt)GIV(pages)))))))) { GIV(stackPointer) = theCSP; } } @@ -20365,21 +20312,6 @@ instructionPointerForFramecurrentFPcurrentIP(char *spouseFP, char *currentFP, sq } -/* This is used for asserts that check that inline cache editing results in - valid addresses. - In the C VM interpret is presumed to come before any primitives and so it - constitutes the lowest address in C code that machine code should be - linked. In the simulator - we just answer something not low. */ - - /* CoInterpreter>>#interpretAddress */ -usqInt -interpretAddress(void) -{ - return ((usqInt)((&interpret))); -} - - /* At a rough approximation we may need to allocate up to a couple of page's worth of contexts when switching stack pages, assigning to senders, etc. But the snapshot primitive voids all stack pages. @@ -21962,7 +21894,7 @@ mframeHomeMethodExport(void) method field. */ /* CoInterpreter>>#mframeHomeMethod: */ -CogMethod * +static CogMethod * NoDbgRegParms mframeHomeMethod(char *theFP) { sqInt methodField; @@ -22029,49 +21961,6 @@ minimumUnusedHeadroom(void) return minUnused; } - /* CoInterpreter>>#mMethodClass */ -sqInt -mMethodClass(void) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt literal; - sqInt methodPointer; - sqInt objOop; - sqInt objOop1; - sqInt offset; - - /* begin methodClassOf: */ - methodPointer = ((mframeHomeMethod(GIV(framePointer)))->methodObject); - /* begin followLiteral:ofMethod: */ - offset = (literalCountOf(methodPointer)) - 1; - /* begin followField:ofObject: */ - objOop1 = longAt((methodPointer + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); - if (((!(objOop1 & (tagMask())))) - && ((!((longAt(objOop1)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { - objOop1 = fixFollowedFieldofObjectwithInitialValue(offset + LiteralStart, methodPointer, objOop1); - } - literal = objOop1; - return ((literal != GIV(nilObj)) - && (((!(literal & (tagMask())))) - && (((((usqInt)((longAt(literal)))) >> (formatShift())) & (formatMask())) <= 5 /* lastPointerFormat */)) - ? (assert((numSlotsOf(literal)) > ValueIndex), - /* begin followField:ofObject: */ - (objOop = longAt((literal + BaseHeaderSize) + (((sqInt)((usqInt)(ValueIndex) << (shiftForWord())))))), - (((!(objOop & (tagMask())))) - && ((!((longAt(objOop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))) - ? (objOop = fixFollowedFieldofObjectwithInitialValue(ValueIndex, literal, objOop)) - : 0), - objOop) - : /* begin nilObject */ GIV(nilObj)); -} - - /* CoInterpreter>>#mnuCompilationBreakpointFor: */ -void -mnuCompilationBreakpointFor(sqInt selectorOop) -{ - suppressHeartbeatFlag = 1; - warning("compilation MNU break (heartbeat suppressed)"); -} - /* Lookup the doesNotUnderstand: selector in the class of the argument rcvr. Answer either the matching method (cogged if appropriate), or nil, if not @@ -22918,22 +22807,6 @@ primitiveExecuteMethodArgsArray(void) } -/* This is used for asserts that check that inline cache editing results in - valid addresses. - In the C VM interpret is presumed to come before any primitives and so it - constitutes the lowest address in C code that machine code should be - linked, but optimizing - compilers change things around. In the simulator we just answer something - not low. */ - - /* CoInterpreter>>#primitiveFailAddress */ -usqInt -primitiveFailAddress(void) -{ - return ((usqInt)((&primitiveFail))); -} - - /* Answer any special requirements of the given primitive */ /* CoInterpreter>>#primitivePropertyFlags:numArgs: */ @@ -22977,11 +22850,8 @@ primTraceLogIndexAddress(void) return ((usqInt)((&GIV(primTraceLogIndex)))); } - -/* useful for VM debugging; use export: so it will be accessible on win32 */ - /* CoInterpreter>>#printCogMethod: */ -EXPORT(void) +void printCogMethod(CogMethod *cogMethod) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -23161,12 +23031,10 @@ printFrameThingatextra(char *name, char *address, sqInt extraValue) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#printFrame:WithSP: */ -EXPORT(sqInt) +sqInt printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -23178,7 +23046,7 @@ printFrameWithSP(char *theFP, char *theSP) usqInt index; sqInt methodField; usqInt numArgs; - sqInt numTemps; + usqInt numTemps; char *rcvrAddress; sqInt rcvrOrClosure; CogBlockMethod * self_in_cmHomeMethod; @@ -23186,8 +23054,9 @@ printFrameWithSP(char *theFP, char *theSP) sqInt theMethodEnd; sqInt topThing; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { fprintf(GIV(transcript), "%p is not in the stack zone?!\n", theFP); @@ -23321,12 +23190,10 @@ printFrameWithSP(char *theFP, char *theSP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#printMethodCacheFor: */ -EXPORT(void) +void printMethodCacheFor(sqInt thing) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -24120,7 +23987,7 @@ reloadPrimitiveCalloutPointer(void) /* Report the stack page size and minimum unused headroom to stdout. */ /* CoInterpreter>>#reportMinimumUnusedHeadroom */ -EXPORT(void) +void reportMinimumUnusedHeadroom(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT fprintf(GIV(transcript), @@ -24134,7 +24001,7 @@ reportMinimumUnusedHeadroom(void) /* Report the stack page size and minimum unused headroom to a stream. */ /* CoInterpreter>>#reportMinimumUnusedHeadroomOn: */ -EXPORT(void) +void reportMinimumUnusedHeadroomOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -24369,7 +24236,7 @@ roomToPushNArgs(sqInt n) logged normally. */ /* CoInterpreter>>#sendInvokeCallbackContext: */ -EXPORT(sqInt) +sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt aMethodObj; @@ -24599,8 +24466,9 @@ shortPrintFrame(char *theFP) sqInt mthd; sqInt rcvr; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { /* begin print: */ fprintf(GIV(transcript), "invalid frame pointer"); cr(); @@ -25698,12 +25566,10 @@ voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* CoInterpreter>>#whereIs: */ -EXPORT(char *) +char * whereIs(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *somewhere; @@ -25872,6 +25738,29 @@ primitiveBenchmarkJITReceiver(void) } #endif /* VMBenchmarks */ + /* CoInterpreterPrimitives>>#primitiveBenchmarkScavenge */ +#if VMBenchmarks +EXPORT(void) +primitiveBenchmarkScavenge(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt oop; + char *sp; + usqLong then; + + /* begin primitiveReturnTimeTakenFor: */ + then = ioHighResClock(); + /* begin scavengingGC */ + scavengingGCTenuringIf(TenureByAge); + (((usqInt)(((((GIV(totalFreeOldSpace) + (GIV(scavengeThreshold) - GIV(freeStart))) - (interpreterAllocationReserveBytes())) < 0) ? 0 : ((GIV(totalFreeOldSpace) + (GIV(scavengeThreshold) - GIV(freeStart))) - (interpreterAllocationReserveBytes())))) << 3) | 1); + /* begin methodReturnValue: */ + oop = positive64BitIntegerFor((ioHighResClock()) - then); + assert(!((failed()))); + /* begin pop:thenPush: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop); + GIV(stackPointer) = sp; +} +#endif /* VMBenchmarks */ + /* This is optional old obsolete stuff tedious to implement in Cog because of the need to map from machine code pc to bytecode pc. So for now just fail. */ @@ -30676,6 +30565,7 @@ primitiveClosureValue(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -30937,6 +30827,7 @@ primitiveClosureValueNoContextSwitch(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -31230,6 +31121,7 @@ primitiveClosureValueWithArgs(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -34973,7 +34865,7 @@ primitiveInvokeObjectAsMethod(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; sqInt lookupClassTag; - sqInt runArgs; + usqInt runArgs; sqInt runReceiver; char *sp; char *sp1; @@ -36537,8 +36429,9 @@ primitivePathToUsing(void) stackp = 0; while (1) { while (((index -= 1)) >= -1) { - if ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)current)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)current)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)current)) <= (((usqInt)GIV(pages)))))))) { if (index >= 0) { next = fieldofFrame(index, ((char *) current)); } @@ -36559,8 +36452,9 @@ primitivePathToUsing(void) next = fetchClassOfNonImm(current); } } - if ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages)))))))) { assert(isFrameonPage(((char *) next), stackPageFor(((char *) next)))); } else { @@ -36593,8 +36487,9 @@ primitivePathToUsing(void) goto l8; } if (((!(next & (smallIntegerTag())))) - && (((((((usqInt)next)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages)))))) + && (((GIV(stackBasePlus1) != null) + && ((((((usqInt)next)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)next)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)next)) <= (((usqInt)GIV(pages))))))) ? !(frameIsMarked(next)) : (next >= heapBase) && ((!(((((usqInt)((longAt(next)))) >> (markedBitFullShift())) & 1) != 0)) @@ -36619,8 +36514,9 @@ primitivePathToUsing(void) assert(!(isOopForwarded(stack))); longAtput((stack + BaseHeaderSize) + (((sqInt)((usqInt)((stackp + 1)) << (shiftForWord())))), (((usqInt)index << 3) | 1)); stackp += 2; - if ((((((usqInt)(((char *) next)))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)(((char *) next)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) next)))) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)(((char *) next)))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)(((char *) next)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) next)))) <= (((usqInt)GIV(pages)))))))) { /* begin markFrame: */ methodField = longAt(next + FoxMethod); if ((((usqInt)methodField)) < (startOfMemory())) { @@ -40317,10 +40213,8 @@ primitiveStoreImageSegment(void) && (((((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) >= (firstLongFormat())) && (((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) <= ((firstShortFormat()) - 1)))))))) { /* Must be indexable words */ - /* begin primitiveFail */ - if (!GIV(primFailCode)) { - GIV(primFailCode) = 1; - } + /* begin primitiveFailFor: */ + GIV(primFailCode) = PrimErrBadArgument; return; } ecode = storeImageSegmentIntooutPointersroots(segmentWordArray, outPointerArray, arrayOfRoots); @@ -40989,7 +40883,8 @@ primitiveStringReplace(void) replFmt = replFmt & -4; l10: /* end classFormatFromInstFormat: */; if (!((arrayFmt == replFmt) - && (arrayFmt < (firstCompiledMethodFormat())))) { + && ((arrayFmt >= (sixtyFourBitIndexableFormat())) + && (arrayFmt < (firstCompiledMethodFormat()))))) { /* begin primitiveFailFor: */ GIV(primFailCode) = PrimErrInappropriate; goto l17; @@ -42148,7 +42043,7 @@ ensureNoForwardedLiteralsIn(sqInt aMethodObj) need since depth is always finite. */ /* Spur64BitCoMemoryManager>>#followForwardedObjectFields:toDepth: */ -sqInt +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -43214,111 +43109,6 @@ initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur64BitMemoryManager>>#inOldSpaceInstantiatePinnedClass:indexableSize: */ -sqInt -inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt fillValue; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt numSlots; - usqInt p; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - fillValue = 0; - switch (instSpec) { - case 2 /* arrayFormat */: - numSlots = nElements; - fillValue = GIV(nilObj); - break; - case indexablePointersFormat(): - case weakArrayFormat(): - numSlots = (classFormat & ((1U << (fixedFieldsFieldWidth())) - 1)) + nElements; - fillValue = GIV(nilObj); - break; - case sixtyFourBitIndexableFormat(): - numSlots = nElements; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstShortFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - case firstByteFormat(): - numSlots = (nElements + 7) / 8; - instSpec += (8 - nElements) & 7; - break; - default: - - /* non-indexable */ - /* Some Squeak images include funky fixed subclasses of abstract variable - superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection. - The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via - this method. - Hence allow fixed classes to be instantiated here iff nElements = 0. */ - if ((nElements != 0) - || (instSpec > 5 /* lastPointerFormat */)) { - return null; - } - numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); - fillValue = GIV(nilObj); - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > (0x10000000000LL)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsForPinningInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : (numSlots << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - if (!(newObj == null)) { - /* begin fillObj:numSlots:with: */ - assert(oopisLessThan(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1, addressAfter(newObj))); - for (p = (((usqInt)(newObj + BaseHeaderSize))); p <= (((usqInt)(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { - longAtput(p, fillValue); - } - } - return newObj; -} - - /* Allocate an instance of a variable class, excepting CompiledMethod. */ /* Spur64BitMemoryManager>>#instantiateClass:indexableSize: */ @@ -43469,130 +43259,6 @@ instantiateClassindexableSize(sqInt classObj, usqInt nElements) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur64BitMemoryManager>>#instantiateUninitializedClass:indexableSize: */ -sqInt -instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt newObj1; - usqInt numBytes; - usqInt numSlots; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - assert(isPureBitsFormat(instSpec)); - switch (instSpec) { - case sixtyFourBitIndexableFormat(): - numSlots = nElements; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstShortFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - case firstByteFormat(): - numSlots = (nElements + 7) / 8; - instSpec += (8 - nElements) & 7; - break; - default: - - /* not bits indexable */ - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > ((1U << (fixedFieldsFieldWidth())) - 1)) { - if (numSlots > (0x10000000000LL)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : (numSlots << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - } - else { - /* begin allocateSlots:format:classIndex: */ - if (numSlots >= (numSlotsMask())) { - if (((numSlots) >> 56) > 0) { - newObj = null; - goto l7; - } - newObj1 = GIV(freeStart) + BaseHeaderSize; - numBytes = (BaseHeaderSize + BaseHeaderSize) + (numSlots * BytesPerOop); - } - else { - newObj1 = GIV(freeStart); - numBytes = BaseHeaderSize + ((numSlots < 1 - ? /* begin allocationUnit */ 8 - : numSlots * BytesPerOop)); - } - if ((GIV(freeStart) + numBytes) > GIV(scavengeThreshold)) { - if (!GIV(needGCFlag)) { - /* begin scheduleScavenge */ - GIV(needGCFlag) = 1; - forceInterruptCheck(); - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, instSpec, classIndex); - goto l7; - } - if (numSlots >= (numSlotsMask())) { - - /* for header parsing we put a saturated slot count in the prepended overflow size word */ - flag("endianness"); - longAtput(GIV(freeStart), (((sqInt)((usqInt)((numSlotsMask())) << (numSlotsFullShift())))) + numSlots); - longAtput(newObj1, headerForSlotsformatclassIndex(numSlotsMask(), instSpec, classIndex)); - } - else { - longAtput(newObj1, (((((usqLong) numSlots)) << (numSlotsFullShift())) + (((sqInt)((usqInt)(instSpec) << (formatShift()))))) + classIndex); - } - assert((numBytes % (allocationUnit())) == 0); - assert((newObj1 % (allocationUnit())) == 0); - GIV(freeStart) += numBytes; - newObj = newObj1; - l7: /* end allocateSlots:format:classIndex: */; - } - return newObj; -} - - /* Convert the integer value, assumed to be in SmallInteger range, into a tagged SmallInteger object. In C, use a shift and an add to set the tag bit. @@ -44077,8 +43743,8 @@ allWeakSurvivorsOnWeakList(void) writes code that stresses the remembered table. One might conclude that if the remembered table is full, then the right thing - to do is simply to tenure everything, emptying the remembered table. Bt in - some circumstances this + to do is simply to tenure everything, emptying the remembered table. But + in some circumstances this can be counter-productive, and result in the same situation arising soon after tenuring everything. Instead, we can try and selectively prune the remembered table, tenuring @@ -44472,6 +44138,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj3 == null)) { + assert(isPinned(obj3)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1, addressAfter(obj3))); for (p2 = (((usqInt)(obj3 + BaseHeaderSize))); p2 <= (((usqInt)(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1))); p2 += 8 /* allocationUnit */) { @@ -44488,6 +44155,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj2 == null)) { + assert(isPinned(obj2)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1, addressAfter(obj2))); for (p1 = (((usqInt)(obj2 + BaseHeaderSize))); p1 <= (((usqInt)(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1))); p1 += 8 /* allocationUnit */) { @@ -44507,6 +44175,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -44708,6 +44377,7 @@ openScavengeLog(void) /* Print the objects in the remembered set. */ +/* useful for debugging */ /* SpurGenerationScavenger>>#printRememberedSet */ void @@ -47003,6 +46673,7 @@ allocatePinnedSlots(sqInt nSlots) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj == null)) { + assert(isPinned(obj)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj))); for (p = (((usqInt)(obj + BaseHeaderSize))); p <= (((usqInt)(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -48023,30 +47694,6 @@ checkedLongAt(sqInt byteAddress) return longAt(byteAddress); } - /* SpurMemoryManager>>#checkFreeSpace: */ -void -checkFreeSpace(sqInt gcModes) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, null); - } -} - - /* SpurMemoryManager>>#checkFreeSpace:ignoring: */ -void -checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, anOopToIgnore); - } -} - /* Perform an integrity/leak check using the heapMap. Assume clearLeakMapAndMapAccessibleFreeSpace has set a bit at each free chunk's @@ -49015,6 +48662,7 @@ checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt cla /* Verify that the given oop is legitimate. Check address, header, and size but not class. Answer true if OK. Otherwise print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOkayOop: */ sqInt @@ -49109,6 +48757,7 @@ checkOkayOop(usqInt oop) or more fields. Finally, the instance specification field of the behavior must match that of the instance. If OK answer true. If not, print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOopHasOkayClass: */ sqInt @@ -49965,7 +49614,7 @@ cloneObject(sqInt objOop) } /* SpurMemoryManager>>#compactClassIndexOf: */ -sqInt +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop) { /* begin classIndexOf: */ @@ -50134,6 +49783,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS /* print the count of marked and unmarked objects. In addition if 1 is set in printFlags, short-print marked objects, and/or if 2 is set, short-print unmarked obejcts. */ +/* useful for debugging */ /* SpurMemoryManager>>#countMarkedAndUnmarkdObjects: */ void @@ -50231,7 +49881,8 @@ currentAllocatedBytes(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt use; - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); return (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); } @@ -50258,7 +49909,8 @@ doScavenge(sqInt tenuringCriterion) usqInt use; /* begin doAllocationAccountingForScavenge */ - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); GIV(statAllocatedBytes) = (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); GIV(gcPhaseInProgress) = ScavengeInProgress; /* begin scavenge: */ @@ -50309,7 +49961,8 @@ doScavenge(sqInt tenuringCriterion) GIV(freeStart) = ((eden()).start); GIV(gcPhaseInProgress) = 0; /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); } @@ -50323,7 +49976,7 @@ doScavenge(sqInt tenuringCriterion) was possible. */ /* SpurMemoryManager>>#doShorten:toIndexableSize: */ -sqInt +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt bytesBefore; @@ -51180,6 +50833,7 @@ findLargestFreeChunk(void) /* Print the oops of all string-like things that start with the same characters as aCString */ +/* useful for debugging */ /* SpurMemoryManager>>#findStringBeginningWith: */ void @@ -51844,7 +51498,6 @@ fullGC(void) runLeakCheckerForexcludeUnmarkedObjsclassIndicesShouldBeValid(GCModeFull, 1, 1); compactionStartUsecs = ioUTCMicrosecondsNow(); /* begin prepareForGlobalSweep */ - GIV(sweepIndex) = 0; for (i = 0; i < GIV(numSegments); i += 1) { ((GIV(segments)[i]).containsPinned = 0); } @@ -51864,9 +51517,11 @@ fullGC(void) GIV(statShrinkMemory) += 1; } /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); assert(validObjStacks()); assert(isEmptyObjStack(GIV(markStack))); assert(isEmptyObjStack(GIV(weaklingStack))); @@ -51923,12 +51578,10 @@ growOldSpaceByAtLeast(sqInt minAmmount) sqInt ammount; sqInt bytes; sqInt headroom; - sqInt i; sqInt interval; SpurSegmentInfo *segInfo; sqInt start; usqInt total; - usqInt total1; /* statGrowMemory counts attempts, not successes. */ @@ -51945,13 +51598,8 @@ growOldSpaceByAtLeast(sqInt minAmmount) /* Now apply the maxOldSpaceSize limit, if one is in effect. */ ammount = ((ammount < GIV(growHeadroom)) ? GIV(growHeadroom) : ammount); if (maxOldSpaceSize > 0) { - /* begin totalBytesInSegments */ - total1 = 0; - for (i = 0; i < GIV(numSegments); i += 1) { - total1 += ((GIV(segments)[i]).segSize); - } - assert(GIV(totalHeapSizeIncludingBridges) == total1); - total = total1; + assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)); + total = GIV(totalHeapSizeIncludingBridges); if (total >= maxOldSpaceSize) { GIV(needGCFlag) = 1; return null; @@ -52120,73 +51768,6 @@ incrementalGC(void) error("shouldNotImplement"); } - /* SpurMemoryManager>>#indexOf:in: */ -sqInt -indexOfin(sqInt anElement, sqInt anObject) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt fmt; - sqInt fmt1; - sqInt i; - usqInt numSlots; - usqInt numSlots1; - - /* begin formatOf: */ - fmt = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - if (fmt <= 5 /* lastPointerFormat */) { - /* begin numSlotsOf: */ - assert((classIndexOf(anObject)) > (isForwardedObjectClassIndexPun())); - numSlots1 = byteAt(anObject + 7); - numSlots = (numSlots1 == (numSlotsMask()) - ? ((((usqInt)(((sqInt)((usqInt)((longAt(anObject - BaseHeaderSize))) << 8)))))) >> 8 - : numSlots1); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (longAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) { - return i; - } - } - } - if (fmt >= (firstByteFormat())) { - if (fmt >= (firstCompiledMethodFormat())) { - /* begin primitiveFailFor: */ - return (GIV(primFailCode) = PrimErrUnsupported); - } - /* begin numBytesOfBytes: */ - fmt1 = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - assert(fmt1 >= (firstByteFormat())); - numSlots = ((numSlotsOf(anObject)) << (shiftForWord())) - (fmt1 & 7); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (byteAt((anObject + BaseHeaderSize) + i))) { - return i; - } - } - } - if (fmt >= (firstShortFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 1; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (((unsigned short) (shortAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 1)))))))) { - return i; - } - } - } - if (fmt == (sixtyFourBitIndexableFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 3; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long64At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 3)))))) { - return i; - } - } - } - if (fmt >= (firstLongFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 2; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long32At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 2)))))) { - return i; - } - } - } - return -1; -} - /* Part of reorderReversedTreeList:. Switch treeNode with newNode in the tree, but do nothing to the list linked through freeChunkNextIndex. */ @@ -52652,6 +52233,7 @@ initializeObjectMemory(sqInt bytesToShift) /* begin allocatePinnedSlots: */ obj1 = allocateSlotsForPinningInOldSpacebytesformatclassIndex(0x400, (1024U << (shiftForWord())) + (BaseHeaderSize + BaseHeaderSize), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -52667,7 +52249,7 @@ initializeObjectMemory(sqInt bytesToShift) else { /* The Spur32to64BitBootstrap failed to set the type of rememberedSetObj to 64-bit indexability. - This is unimportant except for simulation; rememberedSet is declared as sqInt *, but in to have + This is unimportant except for simulation; rememberedSet is declared as sqInt *, but to have firstIndexableField: below answer a suitable type the format must be wordIndexableFormat. */ /* begin setFormatOf:to: */ format = sixtyFourBitIndexableFormat(); @@ -52697,9 +52279,11 @@ initializeObjectMemory(sqInt bytesToShift) /* free space before shrinking */ GIV(shrinkThreshold) = 0x2000000; /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* By default GC after scavenge if heap has grown by a third since the last GC */ GIV(heapGrowthToSizeGCRatio) = 0.333333; @@ -52707,12 +52291,10 @@ initializeObjectMemory(sqInt bytesToShift) /* print free chunks in freeTree in order. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#inOrderPrintFreeTree:printList: */ -EXPORT(void) +void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList) { sqInt next; @@ -52967,18 +52549,6 @@ isAnyPointerFormat(sqInt format) } -/* Answer if this is an indexable object with pointer elements, e.g., an - array - */ - - /* SpurMemoryManager>>#isArrayNonImm: */ -sqInt -isArrayNonImm(sqInt oop) -{ - return ((((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask())) == 2 /* arrayFormat */; -} - - /* Answer true if this is an indexable object with pointer elements, e.g., an array */ @@ -53404,7 +52974,7 @@ isObjImmutable(sqInt anOop) /* Answer if obj is old. Require that obj is non-immediate. */ /* SpurMemoryManager>>#isOldObject: */ -sqInt +static sqInt NoDbgRegParms isOldObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(isNonImmediate(objOop)); @@ -53477,19 +53047,6 @@ isPureBitsFormat(sqInt format) && (format < (firstCompiledMethodFormat())); } - -/* Answer if oop is young. */ - - /* SpurMemoryManager>>#isReallyYoung: */ -sqInt -isReallyYoung(sqInt oop) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return ((!(oop & (tagMask())))) - && ((assert(isNonImmediate(oop)), - (oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart))))); -} - /* SpurMemoryManager>>#isRemembered: */ static sqInt NoDbgRegParms isRemembered(sqInt objOop) @@ -53530,10 +53087,10 @@ isShorts(sqInt oop) /* This version is private to SpurMemoryManager (for asserts, etc). It does - not take advantage of the power-of0two optimization in isForwarded:. */ + not take advantage of the power-of-two optimization in isForwarded:. */ /* SpurMemoryManager>>#isUnambiguouslyForwarder: */ -sqInt +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop) { return ((longAt(objOop)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()); @@ -53924,7 +53481,7 @@ lastPointerFormat(void) pointer, and the image contains no forwarders (see class comment). */ /* SpurMemoryManager>>#lastPointerOfWhileSwizzling: */ -sqInt +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fmt; @@ -53961,7 +53518,7 @@ lastPointerOfWhileSwizzling(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#lastPointerOf: */ -sqInt +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -54010,13 +53567,6 @@ lastPointerOf(sqInt objOop) ((header >> 3)) & AlternateHeaderNumLiteralsMask)) + LiteralStart) - 1) * BytesPerOop) + BaseHeaderSize; } - /* SpurMemoryManager>>#leakCheckBecome */ -sqInt -leakCheckBecome(void) -{ - return ((checkForLeaks & GCModeBecome) != 0); -} - /* SpurMemoryManager>>#leakCheckFullGC */ sqInt leakCheckFullGC(void) @@ -54024,13 +53574,6 @@ leakCheckFullGC(void) return ((checkForLeaks & GCModeFull) != 0); } - /* SpurMemoryManager>>#leakCheckIncremental */ -sqInt -leakCheckIncremental(void) -{ - return ((checkForLeaks & GCModeIncremental) != 0); -} - /* SpurMemoryManager>>#leakCheckNewSpaceGC */ sqInt leakCheckNewSpaceGC(void) @@ -54629,12 +54172,10 @@ loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesOf: */ -EXPORT(void) +void longPrintInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -54649,12 +54190,10 @@ longPrintInstancesOf(sqInt aClassOop) /* Scan the heap printing any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesWithClassIndex: */ -EXPORT(void) +void longPrintInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -54762,12 +54301,10 @@ longPrintInstancesWithClassIndex(sqInt classIndex) /* Scan the heap long printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintReferencesTo: */ -EXPORT(void) +void longPrintReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -56212,21 +55749,6 @@ maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format) } -/* Answer one of the objects in the SpecialObjectsArray, if in range, - otherwise answer nil. - */ - - /* SpurMemoryManager>>#maybeSplObj: */ -sqInt -maybeSplObj(sqInt index) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return (index < (numSlotsOf(GIV(specialObjectsOop))) - ? (/* begin fetchPointer:ofObject: */ - longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) - : 0); -} - - /* Answer the minimum number of additional slots to allocate in an object to always be able to shorten it. This is enough slots to allocate a minimum-sized object. */ @@ -56651,7 +56173,7 @@ numBytesOf(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#numPointerSlotsOf: */ -usqInt +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -56831,24 +56353,6 @@ numStrongSlotsOfInephemeral(sqInt objOop) } -/* Answer the number of strong pointer fields in the given weakling. */ - - /* SpurMemoryManager>>#numStrongSlotsOfWeakling: */ -sqInt -numStrongSlotsOfWeakling(sqInt objOop) -{ - sqInt classFormat; - sqInt objOop1; - - assert((formatOf(objOop)) == (weakArrayFormat())); - /* begin fixedFieldsOfClass: */ - objOop1 = fetchClassOfNonImm(objOop); - /* begin fixedFieldsOfClassFormat: */ - classFormat = ((longAt((objOop1 + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - return classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); -} - - /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -56920,6 +56424,9 @@ objectAfter(sqInt objOop) : followingWordAddress3); } + +/* useful for debugging */ + /* SpurMemoryManager>>#objectBefore: */ sqInt objectBefore(sqInt objOop) @@ -57508,6 +57015,7 @@ okayOop(sqInt signedOop) } +/* useful for debugging */ /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -57688,7 +57196,6 @@ pinObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt format; - sqInt i; sqInt oldClone; sqInt referent; SpurSegmentInfo *seg; @@ -57704,15 +57211,7 @@ pinObject(sqInt objOop) longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); return objOop; } - /* begin segmentContainingObj: */ - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - seg = (&(GIV(segments)[i])); - goto l1; - } - } - seg = null; - l1: /* end segmentContainingObj: */; + seg = segmentContainingObj(objOop); if ((seg->containsPinned)) { /* begin setIsPinnedOf:to: */ longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); @@ -57961,12 +57460,10 @@ primitiveErrorTable(void) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printActivationsOf: */ -EXPORT(void) +void printActivationsOf(sqInt aMethodObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -58034,12 +57531,10 @@ printActivationsOf(sqInt aMethodObj) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printBogons */ -EXPORT(void) +void printBogons(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT /* begin printTheBogons: */ @@ -58056,16 +57551,34 @@ printBogons(void) cr(); } + /* SpurMemoryManager>>#printBridge:on: */ +static void NoDbgRegParms +printBridgeon(sqInt oop, FILE *aStream) +{ + fprintf(aStream, + "%p is a bridge hdr%d slot size %ul\n", + ((void *)oop), + ((byteAt(oop + 7)) == (numSlotsMask()) + ? 16 + : 8), + numSlotsOfAny(oop)); +} + /* SpurMemoryManager>>#printCantBeObject:on: */ static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (((oop & (7)) == 0) - && (((oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) - && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))))) { - printForwarderon(oop, aStream); - return; + if ((oop & (7)) == 0) { + if (((oopisLessThan(oop, GIV(oldSpaceStart))) + && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) + && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { + printForwarderon(oop, aStream); + return; + } + if (oop == (bridgeAt((numSegments()) - 1))) { + printBridgeon(oop, aStream); + return; + } } fprintf(aStream, "%p%s\n", @@ -58079,12 +57592,10 @@ printCantBeObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printContextReferencesTo: */ -EXPORT(void) +void printContextReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -58164,12 +57675,10 @@ printContextReferencesTo(sqInt anOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printEntity: */ -EXPORT(void) +void printEntity(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -58303,12 +57812,10 @@ printEntity(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printForwarders */ -EXPORT(void) +void printForwarders(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -58417,7 +57924,7 @@ static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream) { fprintf(aStream, - "%p is a forwarded hdr%d slot size %ud object to %p\n", + "%p is a forwarded hdr%d slot size %ul object to %p\n", ((void *)oop), ((byteAt(oop + 7)) == (numSlotsMask()) ? 16 @@ -58430,6 +57937,7 @@ printForwarderon(sqInt oop, FILE *aStream) /* This version goes through memory, printing all free chunks. Other versions go through the free lists. This one will show all free chunks even if the free lists are corrupt. */ +/* useful for debugging */ /* SpurMemoryManager>>#printFreeChunks */ void @@ -58545,12 +58053,10 @@ printFreeChunks(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeChunk: */ -EXPORT(void) +void printFreeChunk(sqInt freeChunk) { printFreeChunkprintAsTreeNode(freeChunk, 1); @@ -58640,12 +58146,10 @@ printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeListHeads */ -EXPORT(void) +void printFreeListHeads(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt expectedMask; @@ -58681,12 +58185,10 @@ printFreeListHeads(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeList: */ -EXPORT(sqInt) +sqInt printFreeList(sqInt chunkOrIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fieldIndex; @@ -58719,12 +58221,10 @@ printFreeObjecton(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeTree */ -EXPORT(void) +void printFreeTree(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFreeTreeChunk(GIV(freeLists)[0]); @@ -58748,13 +58248,11 @@ printFreeTreeChunk(sqInt chunkOrZero) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* N.B. No safety bounds checks!! We need to look e.g. at corpses. */ /* SpurMemoryManager>>#printHeaderOf: */ -EXPORT(void) +void printHeaderOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -58871,12 +58369,10 @@ printImmediateObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesOf: */ -EXPORT(void) +void printInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -58891,12 +58387,10 @@ printInstancesOf(sqInt aClassOop) /* Scan the heap printing the oops of any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesWithClassIndex: */ -EXPORT(void) +void printInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59002,6 +58496,7 @@ printInstancesWithClassIndex(sqInt classIndex) /* Print the objects in the classTable that have bad hashes. */ +/* useful for debugging */ /* SpurMemoryManager>>#printInvalidClassTableEntries */ void @@ -59051,13 +58546,11 @@ printInvalidClassTableEntries(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMarkedOops */ #if LLDB -EXPORT(void) +void printMarkedOops(void) { printOopsSuchThat(isMarked); @@ -59068,12 +58561,10 @@ printMarkedOops(void) /* Scan the heap printing the oops of any and all methods that implement anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodImplementorsOf: */ -EXPORT(void) +void printMethodImplementorsOf(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -59139,12 +58630,10 @@ printMethodImplementorsOf(sqInt anOop) /* Scan the heap printing the oops of any and all methods that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodReferencesTo: */ -EXPORT(void) +void printMethodReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -59330,12 +58819,10 @@ printNonPointerDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsFrom:to: */ -EXPORT(void) +void printObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -59359,12 +58846,10 @@ printObjectsFromto(sqInt startAddress, sqInt endAddress) /* Scan the heap printing the oops of any and all objects whose hash equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsWithHash: */ -EXPORT(void) +void printObjectsWithHash(sqInt hash) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59466,6 +58951,21 @@ printObjectsWithHash(sqInt hash) l4: /* end allNewSpaceEntitiesDo: */; } + /* SpurMemoryManager>>#printObjStackAndContents: */ +void +printObjStackAndContents(sqInt objStack) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + /* begin printObjStack:printContents: */ + if (objStack == GIV(nilObj)) { + /* begin print: */ + fprintf(GIV(transcript), "nil"); + cr(); + } + else { + printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((sqInt)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, 1); + } +} + /* SpurMemoryManager>>#printObjStackPage:myIndex:pageType:printContents: */ static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents) @@ -59628,6 +59128,9 @@ printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType) cr(); } + +/* useful for debugging */ + /* SpurMemoryManager>>#printObjStack: */ void printObjStack(sqInt objStack) @@ -59643,27 +59146,11 @@ printObjStack(sqInt objStack) } } - /* SpurMemoryManager>>#printObjStack:printContents: */ -void -printObjStackprintContents(sqInt objStack, sqInt printContents) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - if (objStack == GIV(nilObj)) { - /* begin print: */ - fprintf(GIV(transcript), "nil"); - cr(); - } - else { - printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((sqInt)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, printContents); - } -} - -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsExcept: */ -EXPORT(void) NeverInline +void NeverInline printOopsExcept(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59781,12 +59268,10 @@ printOopsExcept(sqInt (*function)(sqInt)) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsFrom:to: */ -EXPORT(void) +void printOopsFromto(sqInt startAddress, sqInt endAddress) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstNonEntity; @@ -59839,12 +59324,10 @@ printOopsFromto(sqInt startAddress, sqInt endAddress) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsSuchThat: */ -EXPORT(void) NeverInline +void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -59963,12 +59446,10 @@ printOopsSuchThat(sqInt (*function)(sqInt)) /* Scan the heap printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printReferencesTo: */ -EXPORT(void) +void printReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -60212,13 +59693,11 @@ printStringDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printUnmarkedOops */ #if LLDB -EXPORT(void) +void printUnmarkedOops(void) { printOopsExcept(isMarked); @@ -60885,12 +60364,10 @@ shortentoIndexableSize(sqInt objOop, sqInt indexableSize) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#shortPrintObjectsFrom:to: */ -EXPORT(void) +void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -61028,7 +60505,7 @@ startOfObject(sqInt objOop) /* Part of InterpreterProxy's 1.14 API */ /* SpurMemoryManager>>#statNumGCs */ -EXPORT(sqInt) +sqInt statNumGCs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT return (GIV(statScavenges) + GIV(statIncrGCs)) + GIV(statFullGCs); @@ -61070,13 +60547,21 @@ storeCheckBoundary(void) The primitive can fail for the following reasons with the specified failure codes: - PrimErrGenericError: the segmentWordArray is too small for the version - stamp PrimErrWritePastObject: the segmentWordArray is too small to contain - the reachable objects - PrimErrBadIndex: the outPointerArray is too small - PrimErrNoMemory: additional allocations failed + PrimErrGenericFailure: the segmentWordArray is too small for the version + stamp PrimErrWritePastObject: the segmentWordArray is too small to + contain the reachable objects + PrimErrBadIndex: the outPointerArray is too small + PrimErrNoMemory: there is insufficient free space to store the array + answered by objectsReachableFromRoots:, + or the savedFirstFields and savedOutHashes arrays. + PrimErrNeedCompaction: a GC is needed to make room for the array answered + by objectsReachableFromRoots: PrimErrLimitExceeded: there is no room in the hash field to store out - pointer indices or class references. */ + pointer indices or class references, + or the outPointerArray is larger than the max value of the hash field. + PrimErrNoModification: the segmentWordArrayArg or outPointerArrayArg are + immutable PrimErrObjectIsPinned: the segmentWordArrayArg or + outPointerArrayArg are pinned */ /* SpurMemoryManager>>#storeImageSegmentInto:outPointers:roots: */ static sqInt NoDbgRegParms @@ -61329,6 +60814,7 @@ storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt val /* Note must check here for stores of young objects into old ones. */ +/* See SistaCogit */ /* SpurMemoryManager>>#storePointer:ofObject:withValue: */ sqInt @@ -61426,7 +60912,8 @@ sufficientSpaceAfterGC(sqInt numBytes) assert(numBytes == 0); scavengingGCTenuringIf(TenureByAge); - heapSizePostGC = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + heapSizePostGC = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); if (((((double) (heapSizePostGC - GIV(heapSizeAtPreviousGC)) )) / GIV(heapSizeAtPreviousGC)) >= GIV(heapGrowthToSizeGCRatio)) { fullGC(); } @@ -62045,6 +61532,9 @@ validClassTableRootPages(void) return 1; } + +/* useful for debugging */ + /* SpurMemoryManager>>#validFreeTree */ sqInt validFreeTree(void) @@ -62455,6 +61945,7 @@ copyAndUnmarkMobileObjects(void) usqInt previousPin; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt start; usqInt startOfPreviousPin; usqInt toFinger; @@ -62532,23 +62023,18 @@ copyAndUnmarkMobileObjects(void) assert((isMarked(previousPin)) && (isPinned(previousPin))); /* begin unmarkPinned: */ - if (!(((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(previousPin)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(previousPin))); longAtput(previousPin, (longAt(previousPin)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(previousPin)); - if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(previousPin))); - longAtput(previousPin, (longAt(previousPin)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), previousPin)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(previousPin)))); + seg = segmentContainingObj(previousPin); + (seg->containsPinned = 1); } toFinger = addressAfter(previousPin); /* begin objectStartingAt: */ @@ -62794,6 +62280,7 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) usqInt numSlots; sqInt obj; usqInt objStart; + SpurSegmentInfo *seg; usqInt toFinger; toFinger = initialToFinger; @@ -62816,23 +62303,18 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) if ((((((usqInt)((longAt(obj)))) >> (markedBitFullShift())) & 1) != 0) && (((((usqInt)((longAt(obj)))) >> (pinnedBitShift())) & 1) != 0)) { /* begin unmarkPinned: */ - if (!(((longAt(obj)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(obj)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(obj))); longAtput(obj, (longAt(obj)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(obj)); - if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(obj))); - longAtput(obj, (longAt(obj)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), obj)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(obj)))); + seg = segmentContainingObj(obj); + (seg->containsPinned = 1); } if (toFinger < objStart) { /* begin addFreeChunkWithBytes:at: */ @@ -63247,6 +62729,7 @@ unmarkObjectsFromFirstFreeObject(void) sqInt objOop; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt startOfFree; startOfFree = 0; @@ -63269,23 +62752,18 @@ unmarkObjectsFromFirstFreeObject(void) } if (((((usqInt)((longAt(objOop)))) >> (pinnedBitShift())) & 1) != 0) { /* begin unmarkPinned: */ - if (!(((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(objOop)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(objOop))); longAtput(objOop, (longAt(objOop)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(objOop)); - if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(objOop))); - longAtput(objOop, (longAt(objOop)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), objOop)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(objOop)))); + seg = segmentContainingObj(objOop); + (seg->containsPinned = 1); } } else { @@ -63958,7 +63436,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: */ @@ -63988,7 +63466,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)) { @@ -64350,9 +63828,11 @@ collapseSegmentsPostSwizzle(void) GIV(canSwizzle) = 0; GIV(numSegments) = 1; + /* begin computeTotalHeapSizeIncludingBridges */ + GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()); cascade0 = (&(GIV(segments)[0])); (cascade0->segStart = oldSpaceStart()); - (cascade0->segSize = (GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()))); + (cascade0->segSize = GIV(totalHeapSizeIncludingBridges)); assert(isSegmentBridge(bridgeAt(0))); assert((numSlotsOfAny(bridgeAt(0))) == 0); } @@ -64534,12 +64014,11 @@ prepareForSnapshot(void) usqInt followingWordAddress; usqInt freeChunk; sqInt i; - sqInt i1; sqInt largeChild; sqInt limit; sqInt newEndOfMemory; sqInt next; - sqInt node; + usqInt node; SpurSegmentInfo *seg; sqInt smallChild; sqInt treeNode; @@ -64582,24 +64061,16 @@ prepareForSnapshot(void) followingWordAddress = addressAfter(node); if (oopisGreaterThanOrEqualTo(followingWordAddress, limit)) { next = limit; - goto l9; + goto l7; } flag("endianness"); followingWord = longAt(followingWordAddress); next = ((((usqInt)(followingWord)) >> (numSlotsFullShift())) == (numSlotsMask()) ? followingWordAddress + BaseHeaderSize : followingWordAddress); - l9: /* end objectAfter:limit: */; + l7: /* end objectAfter:limit: */; if (((longAt(next)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin segmentContainingObj: */ - for (i1 = (GIV(numSegments) - 1); i1 >= 0; i1 += -1) { - if (node >= (((GIV(segments)[i1]).segStart))) { - seg = (&(GIV(segments)[i1])); - goto l8; - } - } - seg = null; - l8: /* end segmentContainingObj: */; + seg = segmentContainingObj(node); (seg->lastFreeObject = node); node = 0; } @@ -64714,17 +64185,51 @@ readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes) return totalBytesRead; } + +/* Answer the segment containing an object. This is mostly for assert + checking, but + variations on the incremental GC may use it in anger. Binary search is (of + course) marginally slower than linear search for a single segment (e.g. in + a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every + old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or + 20% faster + in the same heap extended with enough large arrays to require 11 segments; + and this + is pessimal; there are fewer objects at high addresses since the large + arrays are there). */ + /* SpurSegmentManager>>#segmentContainingObj: */ -EXPORT(SpurSegmentInfo *) +SpurSegmentInfo * segmentContainingObj(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; + sqInt high; + sqInt low; + sqInt mid; + SpurSegmentInfo *seg; - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - return (&(GIV(segments)[i])); + low = 0; + mid = GIV(numSegments) / 2; + high = GIV(numSegments) - 1; + do { + seg = (&(GIV(segments)[mid])); + if (oopisGreaterThanOrEqualTo(objOop, (seg->segStart))) { + if (mid == high) { + return (oopisLessThan(objOop, ((seg->segSize)) + ((seg->segStart))) + ? seg + : 0); + } + else { + low = mid; + mid = ((mid + high) + 1) / 2; + } } - } + else { + high = mid - 1; + mid = (low + mid) / 2; + } + } while(low <= high); return null; } @@ -64901,6 +64406,9 @@ swizzleObj(sqInt objOop) return objOop + (((GIV(segments)[0]).swizzle)); } + +/* This ``slow'' count is for asserts only. */ + /* SpurSegmentManager>>#totalBytesInSegments */ static usqInt totalBytesInSegments(void) @@ -64912,7 +64420,6 @@ totalBytesInSegments(void) for (i = 0; i < GIV(numSegments); i += 1) { total += ((GIV(segments)[i]).segSize); } - assert(GIV(totalHeapSizeIncludingBridges) == total); return total; } @@ -65037,12 +64544,10 @@ accessorDepthForPrimitiveMethod(sqInt aMethodObj) /* Answer the current activeProcess. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#activeProcess */ -EXPORT(sqInt) +sqInt activeProcess(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt objOop; @@ -65375,7 +64880,7 @@ booleanValueOf(sqInt obj) /* Re-enter the interpreter to execute a (non-Alien) callback. */ /* StackInterpreter>>#callbackEnter: */ -EXPORT(sqInt) +sqInt callbackEnter(sqInt *callbackID) { warning("callbackEnter: is obsolete"); @@ -65386,7 +64891,7 @@ callbackEnter(sqInt *callbackID) /* Leave from a previous callback */ /* StackInterpreter>>#callbackLeave: */ -EXPORT(sqInt) +sqInt callbackLeave(sqInt cbID) { warning("callbackLeave: is obsolete"); @@ -65440,12 +64945,10 @@ characterForAscii(sqInt ascii) /* Ensure that all accessible objects in the heap are okay. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkAllAccessibleObjectsOkay */ -EXPORT(sqInt) +sqInt checkAllAccessibleObjectsOkay(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -65865,12 +65368,10 @@ checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkOkayInterpreterObjects: */ -EXPORT(sqInt) +sqInt checkOkayInterpreterObjects(sqInt writeBack) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -66218,19 +65719,10 @@ contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP) /* StackInterpreter>>#copiedValueCountOfClosure: */ sqInt -copiedValueCountOfClosure(sqInt closurePointer) -{ - return (numSlotsOf(closurePointer)) - ClosureFirstCopiedValueIndex; -} - - -/* for Cogit */ - - /* StackInterpreter>>#copiedValueCountOfFullClosure: */ -sqInt -copiedValueCountOfFullClosure(sqInt closurePointer) +copiedValueCountOfClosure(sqInt closureObj) { - return (numSlotsOf(closurePointer)) - FullClosureFirstCopiedValueIndex; + return (assert(isVanillaBlockClosure(closureObj)), + (numSlotsOf(closureObj)) - ClosureFirstCopiedValueIndex); } @@ -68497,7 +67989,7 @@ fullDisplayUpdate(void) example). Default for now is simply the entry in the base primitiveTable. */ /* StackInterpreter>>#functionPointerFor:inClass: */ -void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) +static void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) { return (primIdx > MaxPrimitiveIndex ? 0 @@ -69940,12 +69432,10 @@ loadInitialContext(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#longPrintOop: */ -EXPORT(void) +void longPrintOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -72700,19 +72190,6 @@ pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod return pcPreviousToinSqueakV3PlusClosuresMethod(theIP, aMethod); } - /* StackInterpreter>>#penultimateLiteralOf: */ -sqInt -penultimateLiteralOf(sqInt aMethodOop) -{ - sqInt offset; - - assert(isOopCompiledMethod(aMethodOop)); - /* begin literal:ofMethod: */ - offset = (literalCountOf(aMethodOop)) - 2; - /* begin fetchPointer:ofObject: */ - return longAt((aMethodOop + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); -} - /* In the StackInterpreter stacks grow down. */ @@ -73627,12 +73104,10 @@ printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObjec /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacks */ -EXPORT(void) +void printAllStacks(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -73831,12 +73306,10 @@ printAllStacks(void) /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacksOn: */ -EXPORT(void) +void printAllStacksOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -73851,12 +73324,10 @@ printAllStacksOn(FILE *aStdioStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStack */ -EXPORT(void) +void printCallStack(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (GIV(framePointer) == null) { @@ -73890,18 +73361,17 @@ printCallStackFP(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOf: */ -EXPORT(sqInt) +sqInt printCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; - if ((((((usqInt)aContextOrProcessOrFrame)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)aContextOrProcessOrFrame)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)aContextOrProcessOrFrame)) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)aContextOrProcessOrFrame)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)aContextOrProcessOrFrame)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)aContextOrProcessOrFrame)) <= (((usqInt)GIV(pages)))))))) { return printCallStackFP(((char *) aContextOrProcessOrFrame)); } if (aContextOrProcessOrFrame == (activeProcess())) { @@ -73998,12 +73468,10 @@ printCallStackOfcurrentFP(sqInt aContext, char *currFP) /* Print the call stack on a specific output stream. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOn: */ -EXPORT(void) +void printCallStackOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -74037,12 +73505,10 @@ printContextCallStackOf(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printContext: */ -EXPORT(void) +void printContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -74138,7 +73604,7 @@ printContext(sqInt aContext) meth = longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))); fprintf(GIV(transcript), "%p: ", - meth); + ((void *)meth)); printOopShortInner(meth); if (methodHasCogMethod(meth)) { fprintf(GIV(transcript), @@ -74241,12 +73707,10 @@ printDecodeMethodHeaderOop(sqInt methodHeaderOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printExternalHeadFrame */ -EXPORT(void) +void printExternalHeadFrame(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFrameWithSP(GIV(framePointer), GIV(stackPointer)); @@ -74256,8 +73720,9 @@ printExternalHeadFrame(void) static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { return null; } if (!((longAt(theFP + FoxSavedFP)) == 0)) { @@ -74306,7 +73771,7 @@ printFrameOopindexat(char *name, sqInt idx, char *address) "%16p:", ((void *)address)); fprintf(GIV(transcript), - "%s%10s%d: %16p\t", + "%s%10s%" PRIdSQINT ": %16p\t", (idx > 9 ? "" : " "), @@ -74318,19 +73783,20 @@ printFrameOopindexat(char *name, sqInt idx, char *address) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFramesInPage: */ -EXPORT(void) +void printFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 0); } + +/* useful for VM debugging */ + /* StackInterpreter>>#printFramesOnStackPageListInUse */ -EXPORT(void) +void printFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -74403,12 +73869,10 @@ printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame: */ -EXPORT(sqInt) +sqInt printFrame(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *aFrame; @@ -74418,8 +73882,9 @@ printFrame(char *theFP) StackPage *thePage; char *theSP; - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { if ((addressCouldBeObj(((sqInt)theFP))) && ((isInMemory(((sqInt)theFP))) && ((((longAt(((sqInt)theFP))) & (classIndexMask())) == ClassMethodContextCompactIndex) @@ -74497,18 +73962,6 @@ printFrame(char *theFP) } -/* Print n in hex, in the form '0x1234', unpadded */ - - /* StackInterpreter>>#printHexnp: */ -sqInt -printHexnp(usqInt n) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return fprintf(GIV(transcript), - "%p", - ((void *)n)); -} - - /* Print p in hex, unpadded, in the form 0x1234 (C)/16r1234 (here) */ /* StackInterpreter>>#printHexPtrnp: */ @@ -74540,12 +73993,10 @@ printHex(usqInt n) /* Print all methods whose penultimate literal is either selector, or an object whose first inst var is the method and whose second is selector (e.g. an AdditionalMethodState). */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printLikelyImplementorsOfSelector: */ -EXPORT(void) +void printLikelyImplementorsOfSelector(sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -74623,12 +74074,10 @@ printLikelyImplementorsOfSelector(sqInt selector) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCache */ -EXPORT(void) +void printMethodCache(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -74713,12 +74162,10 @@ printMethodCache(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionaryOf: */ -EXPORT(void) +void printMethodDictionaryOf(sqInt behavior) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt dictionary; @@ -74761,12 +74208,10 @@ printMethodDictionaryOf(sqInt behavior) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionary: */ -EXPORT(void) +void printMethodDictionary(sqInt dictionary) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt index; @@ -75046,10 +74491,10 @@ printOopShortInner(sqInt oop) } -/* use export: not api, so it won't be written to cointerp.h */ +/* useful for VM debugging */ /* StackInterpreter>>#printOop: */ -EXPORT(void) +void printOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -75231,12 +74676,10 @@ printOop(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcessStack: */ -EXPORT(void) +void printProcessStack(sqInt aProcess) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ctx; @@ -75275,12 +74718,10 @@ printProcessStack(sqInt aProcess) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcsOnList: */ -EXPORT(sqInt) +sqInt printProcsOnList(sqInt procList) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstProc; @@ -75306,12 +74747,10 @@ printProcsOnList(sqInt procList) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackCallStackOf: */ -EXPORT(sqInt) +sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -75344,12 +74783,10 @@ printStackCallStackOf(sqInt aContextOrProcessOrFrame) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageList */ -EXPORT(void) +void printStackPageList(void) { StackPage *page; @@ -75363,12 +74800,10 @@ printStackPageList(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageListInUse */ -EXPORT(void) +void printStackPageListInUse(void) { sqInt n; @@ -75385,12 +74820,10 @@ printStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPages */ -EXPORT(void) +void printStackPages(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -75405,12 +74838,10 @@ printStackPages(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPagesInUse */ -EXPORT(void) +void printStackPagesInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -75539,12 +74970,10 @@ printStackPageuseCount(StackPage *page, sqInt n) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackReferencesTo: */ -EXPORT(void) +void printStackReferencesTo(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *callerFP; @@ -75926,7 +75355,7 @@ putWord32toFile(int aWord32, sqImageFile aFile) } -/* Anwer true if images of the given format are readable by this interpreter. +/* Anwer if images of the given format are readable by this interpreter. Allows a virtual machine to accept selected older image formats. */ /* StackInterpreter>>#readableFormat: */ @@ -75967,7 +75396,7 @@ reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader) and mark calloutContext as dead. */ /* StackInterpreter>>#reestablishContextPriorToCallback: */ -EXPORT(sqInt) +sqInt reestablishContextPriorToCallback(sqInt callbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; @@ -76504,7 +75933,7 @@ retryPrimitiveOnFailure(void) and mark callbackMethodContext as dead. */ /* StackInterpreter>>#returnAs:ThroughCallback:Context: */ -EXPORT(sqInt) +sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt aMethodObj; @@ -76832,12 +76261,10 @@ schedulerPointer(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakMNUSelector: */ -EXPORT(void) +void setBreakMNUSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -76851,12 +76278,10 @@ setBreakMNUSelector(char *aString) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakSelector: */ -EXPORT(void) +void setBreakSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -76877,7 +76302,7 @@ setFullScreenFlag(sqInt value) } /* StackInterpreter>>#setInterruptCheckChain: */ -EXPORT(void *) +void * setInterruptCheckChain(void (*aFunction)()) { void (*prevFunction)(); @@ -77000,6 +76425,7 @@ static sqInt NoDbgRegParms shortPrintContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt home; + sqInt rcvr; sqInt senderOop; char *theFP; @@ -77043,15 +76469,16 @@ shortPrintContext(sqInt aContext) if (home == null) { /* begin print: */ fprintf(GIV(transcript), " BOGUS CONTEXT (can't determine home)"); + cr(); } else { - printActivationNameForreceiverisBlockfirstTemporary(fetchPointerofObject(MethodIndex, (!(home) - ? aContext - : home)), (home == null - ? /* begin nilObject */ GIV(nilObj) - : (longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)(ReceiverIndex) << (shiftForWord()))))))), home != aContext, longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin fetchPointer:ofObject: */ + rcvr = longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)(ReceiverIndex) << (shiftForWord()))))); + printActivationNameForreceiverisBlockfirstTemporary(longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))), rcvr, home != aContext, longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin space */ + printChar(' '); + shortPrintOop(rcvr); } - cr(); return 0; } @@ -77059,8 +76486,9 @@ shortPrintContext(sqInt aContext) static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (!((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + if (!((GIV(stackBasePlus1) != null) + && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { return null; } shortPrintFrame(theFP); @@ -77071,19 +76499,20 @@ shortPrintFrameAndCallers(char *theFP) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFramesInPage: */ -EXPORT(void) +void shortPrintFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 1); } + +/* useful for VM debugging */ + /* StackInterpreter>>#shortPrintFramesOnStackPageListInUse */ -EXPORT(void) +void shortPrintFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -77102,17 +76531,16 @@ shortPrintFramesOnStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFrame:AndNCallers: */ -EXPORT(void) +void shortPrintFrameAndNCallers(char *theFP, sqInt n) { DECL_MAYBE_SQ_GLOBAL_STRUCT if ((n != 0) + && ((GIV(stackBasePlus1) != null) && ((((((usqInt)theFP)) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages)))))))) { + && ((((((usqInt)theFP)) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)theFP)) <= (((usqInt)GIV(pages))))))))) { shortPrintFrame(theFP); shortPrintFrameAndNCallers(pointerForOop(longAt(theFP + FoxSavedFP)), n - 1); } @@ -82603,7 +82031,8 @@ primitiveStoreStackp(void) 48 various header flags. See getImageHeaderFlags. 49 max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing) - 50 max literal count for JIT compile (stored in image file header; Cog + + 50 max literal count for JIT compile (stored in image file header; Cog only; otherwise nil) 51 nil; reserved for VM parameters that persist in the image (such as eden above) 52 root/remembered table capacity @@ -82751,7 +82180,8 @@ primitiveVMParameter(void) /* begin primitiveAllVMParameters: */ result1 = instantiateClassindexableSize(splObj(ClassArray), paramsArraySize); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer8 = positiveMachineIntegerFor(totalBytesInSegments()); + valuePointer8 = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (0U << (shiftForWord())), valuePointer8); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -82759,7 +82189,8 @@ primitiveVMParameter(void) assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (1U << (shiftForWord())), valuePointer9); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (2U << (shiftForWord())), valuePointer10); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -83095,7 +82526,8 @@ primitiveVMParameter(void) /* begin primitiveGetVMParameter: */ switch (index) { case 1: - result = positiveMachineIntegerFor(totalBytesInSegments()); + result = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); goto l88; break; case 2: @@ -83103,7 +82535,8 @@ primitiveVMParameter(void) goto l88; break; case 3: - result = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + result = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); goto l88; break; case 6: @@ -83862,8 +83295,9 @@ pruneStackstackp(sqInt stack, sqInt stackp) for (i = 2; i < stackp; i += 2) { /* begin fetchPointer:ofObject: */ objOrFP = longAt((stack + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))); - if ((((((usqInt)(((char *) objOrFP)))) & (BytesPerWord - 1)) == 0) - && ((((((usqInt)(((char *) objOrFP)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) objOrFP)))) <= (((usqInt)GIV(pages))))))) { + if ((GIV(stackBasePlus1) != null) + && ((((((usqInt)(((char *) objOrFP)))) & (BytesPerWord - 1)) == 0) + && ((((((usqInt)(((char *) objOrFP)))) >= (((usqInt)(GIV(stackBasePlus1) - 1)))) && ((((usqInt)(((char *) objOrFP)))) <= (((usqInt)GIV(pages)))))))) { /* begin withSmallIntegerTags: */ assert(((oopForPointer(((char *) objOrFP))) & (BytesPerWord - 1)) == 0); objOrFP = (oopForPointer(((char *) objOrFP))) + (smallIntegerTag()); @@ -84079,17 +83513,6 @@ unmarkAfterPathTo(void) static char _m[] = ""; void* vm_exports[][3] = { - {(void*)_m, "activeProcess", (void*)activeProcess}, - {(void*)_m, "callbackEnter", (void*)callbackEnter}, - {(void*)_m, "callbackLeave", (void*)callbackLeave}, - {(void*)_m, "checkAllAccessibleObjectsOkay", (void*)checkAllAccessibleObjectsOkay}, - {(void*)_m, "checkOkayInterpreterObjects", (void*)checkOkayInterpreterObjects}, - {(void*)_m, "dumpPrimTraceLogOn", (void*)dumpPrimTraceLogOn}, - {(void*)_m, "inOrderPrintFreeTreeprintList", (void*)inOrderPrintFreeTreeprintList}, - {(void*)_m, "longPrintInstancesOf", (void*)longPrintInstancesOf}, - {(void*)_m, "longPrintInstancesWithClassIndex", (void*)longPrintInstancesWithClassIndex}, - {(void*)_m, "longPrintOop", (void*)longPrintOop}, - {(void*)_m, "longPrintReferencesTo", (void*)longPrintReferencesTo}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, {(void*)_m, "primitiveAddLargeIntegers\000\000\001", (void*)primitiveAddLargeIntegers}, {(void*)_m, "primitiveAllInstances\000\000\000", (void*)primitiveAllInstances}, @@ -84102,6 +83525,9 @@ void* vm_exports[][3] = { #endif /* VMBenchmarks */ #if VMBenchmarks {(void*)_m, "primitiveBenchmarkJITReceiver\000\000\000", (void*)primitiveBenchmarkJITReceiver}, +#endif /* VMBenchmarks */ +#if VMBenchmarks + {(void*)_m, "primitiveBenchmarkScavenge\000\377\000", (void*)primitiveBenchmarkScavenge}, #endif /* VMBenchmarks */ {(void*)_m, "primitiveBitAndLargeIntegers\000\000\001", (void*)primitiveBitAndLargeIntegers}, {(void*)_m, "primitiveBitOrLargeIntegers\000\000\001", (void*)primitiveBitOrLargeIntegers}, @@ -84167,72 +83593,5 @@ void* vm_exports[][3] = { #endif /* TestingPrimitives */ {(void*)_m, "primitiveUtcWithOffset\000\001\000", (void*)primitiveUtcWithOffset}, {(void*)_m, "primitiveVoidReceiver\000\377\000", (void*)primitiveVoidReceiver}, - {(void*)_m, "printActivationsOf", (void*)printActivationsOf}, - {(void*)_m, "printAllStacks", (void*)printAllStacks}, - {(void*)_m, "printAllStacksOn", (void*)printAllStacksOn}, - {(void*)_m, "printBogons", (void*)printBogons}, - {(void*)_m, "printCallStack", (void*)printCallStack}, - {(void*)_m, "printCallStackOf", (void*)printCallStackOf}, - {(void*)_m, "printCallStackOn", (void*)printCallStackOn}, - {(void*)_m, "printCogMethod", (void*)printCogMethod}, - {(void*)_m, "printContextReferencesTo", (void*)printContextReferencesTo}, - {(void*)_m, "printContext", (void*)printContext}, - {(void*)_m, "printEntity", (void*)printEntity}, - {(void*)_m, "printExternalHeadFrame", (void*)printExternalHeadFrame}, - {(void*)_m, "printForwarders", (void*)printForwarders}, - {(void*)_m, "printFramesInPage", (void*)printFramesInPage}, - {(void*)_m, "printFramesOnStackPageListInUse", (void*)printFramesOnStackPageListInUse}, - {(void*)_m, "printFrame", (void*)printFrame}, - {(void*)_m, "printFrameWithSP", (void*)printFrameWithSP}, - {(void*)_m, "printFreeChunk", (void*)printFreeChunk}, - {(void*)_m, "printFreeListHeads", (void*)printFreeListHeads}, - {(void*)_m, "printFreeList", (void*)printFreeList}, - {(void*)_m, "printFreeTree", (void*)printFreeTree}, - {(void*)_m, "printHeaderOf", (void*)printHeaderOf}, - {(void*)_m, "printInstancesOf", (void*)printInstancesOf}, - {(void*)_m, "printInstancesWithClassIndex", (void*)printInstancesWithClassIndex}, - {(void*)_m, "printLikelyImplementorsOfSelector", (void*)printLikelyImplementorsOfSelector}, -#if LLDB - {(void*)_m, "printMarkedOops", (void*)printMarkedOops}, -#endif /* LLDB */ - {(void*)_m, "printMethodCache", (void*)printMethodCache}, - {(void*)_m, "printMethodCacheFor", (void*)printMethodCacheFor}, - {(void*)_m, "printMethodDictionaryOf", (void*)printMethodDictionaryOf}, - {(void*)_m, "printMethodDictionary", (void*)printMethodDictionary}, - {(void*)_m, "printMethodImplementorsOf", (void*)printMethodImplementorsOf}, - {(void*)_m, "printMethodReferencesTo", (void*)printMethodReferencesTo}, - {(void*)_m, "printObjectsFromto", (void*)printObjectsFromto}, - {(void*)_m, "printObjectsWithHash", (void*)printObjectsWithHash}, - {(void*)_m, "printOopsExcept", (void*)printOopsExcept}, - {(void*)_m, "printOopsFromto", (void*)printOopsFromto}, - {(void*)_m, "printOopsSuchThat", (void*)printOopsSuchThat}, - {(void*)_m, "printOop", (void*)printOop}, - {(void*)_m, "printProcessStack", (void*)printProcessStack}, - {(void*)_m, "printProcsOnList", (void*)printProcsOnList}, - {(void*)_m, "printReferencesTo", (void*)printReferencesTo}, - {(void*)_m, "printStackCallStackOf", (void*)printStackCallStackOf}, - {(void*)_m, "printStackPageList", (void*)printStackPageList}, - {(void*)_m, "printStackPageListInUse", (void*)printStackPageListInUse}, - {(void*)_m, "printStackPages", (void*)printStackPages}, - {(void*)_m, "printStackPagesInUse", (void*)printStackPagesInUse}, - {(void*)_m, "printStackReferencesTo", (void*)printStackReferencesTo}, -#if LLDB - {(void*)_m, "printUnmarkedOops", (void*)printUnmarkedOops}, -#endif /* LLDB */ - {(void*)_m, "reestablishContextPriorToCallback", (void*)reestablishContextPriorToCallback}, - {(void*)_m, "reportMinimumUnusedHeadroom", (void*)reportMinimumUnusedHeadroom}, - {(void*)_m, "reportMinimumUnusedHeadroomOn", (void*)reportMinimumUnusedHeadroomOn}, - {(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext}, - {(void*)_m, "segmentContainingObj", (void*)segmentContainingObj}, - {(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext}, - {(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector}, - {(void*)_m, "setBreakSelector", (void*)setBreakSelector}, - {(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain}, - {(void*)_m, "shortPrintFramesInPage", (void*)shortPrintFramesInPage}, - {(void*)_m, "shortPrintFramesOnStackPageListInUse", (void*)shortPrintFramesOnStackPageListInUse}, - {(void*)_m, "shortPrintFrameAndNCallers", (void*)shortPrintFrameAndNCallers}, - {(void*)_m, "shortPrintObjectsFromto", (void*)shortPrintObjectsFromto}, - {(void*)_m, "statNumGCs", (void*)statNumGCs}, - {(void*)_m, "whereIs", (void*)whereIs}, {NULL, NULL, NULL} }; diff --git a/src/spur64.cog/cogit.h b/src/spur64.cog/cogit.h index c55e7a6792..92f95613cf 100644 --- a/src/spur64.cog/cogit.h +++ b/src/spur64.cog/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -26,6 +26,7 @@ extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMetho extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); +extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern CogMethod * cogFullBlockMethodnumCopied(sqInt aMethodObj, sqInt numCopied); extern void cogitPostGCAction(sqInt gcMode); diff --git a/src/spur64.cog/cogitARMv8.c b/src/spur64.cog/cogitARMv8.c index aea40b84f0..de870160bd 100644 --- a/src/spur64.cog/cogitARMv8.c +++ b/src/spur64.cog/cogitARMv8.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -9300,7 +9300,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.cog/cogitX64SysV.c b/src/spur64.cog/cogitX64SysV.c index bb3f5b83cf..c359db8c29 100644 --- a/src/spur64.cog/cogitX64SysV.c +++ b/src/spur64.cog/cogitX64SysV.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4635,7 +4635,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.cog/cogitX64WIN64.c b/src/spur64.cog/cogitX64WIN64.c index 1fb937d70e..1b8c7316be 100644 --- a/src/spur64.cog/cogitX64WIN64.c +++ b/src/spur64.cog/cogitX64WIN64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4635,7 +4635,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.sista/cogit.h b/src/spur64.sista/cogit.h index a55c7d3e91..8524a2d6bc 100644 --- a/src/spur64.sista/cogit.h +++ b/src/spur64.sista/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -26,6 +26,7 @@ extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMetho extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); +extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern CogMethod * cogFullBlockMethodnumCopied(sqInt aMethodObj, sqInt numCopied); extern void cogitPostGCAction(sqInt gcMode); diff --git a/src/spur64.sista/cogitARMv8.c b/src/spur64.sista/cogitARMv8.c index 146717ab34..c85bbb6ce8 100644 --- a/src/spur64.sista/cogitARMv8.c +++ b/src/spur64.sista/cogitARMv8.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -7456,7 +7456,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; @@ -7466,7 +7466,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; } @@ -9445,7 +9445,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.sista/cogitX64SysV.c b/src/spur64.sista/cogitX64SysV.c index cba574c8b1..e8add30034 100644 --- a/src/spur64.sista/cogitX64SysV.c +++ b/src/spur64.sista/cogitX64SysV.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4771,7 +4771,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.sista/cogitX64WIN64.c b/src/spur64.sista/cogitX64WIN64.c index aec443bae7..bf11d418b3 100644 --- a/src/spur64.sista/cogitX64WIN64.c +++ b/src/spur64.sista/cogitX64WIN64.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -4771,7 +4771,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/spur64.stack.newspeak/gcc3x-interp.c b/src/spur64.stack.newspeak/gcc3x-interp.c index f413e4a9c2..4728027c36 100644 --- a/src/spur64.stack.newspeak/gcc3x-interp.c +++ b/src/spur64.stack.newspeak/gcc3x-interp.c @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -160,7 +160,6 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define GCCheckShorten 64 #define GCModeBecome 8 #define GCModeFull 1 -#define GCModeIncremental 4 #define GCModeNewSpace 2 #define HashMultiplyConstant 1664525 #define HeaderIndex 0 @@ -253,6 +252,7 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define SelectorStart 2 #define SelectorUnknownBytecode 57 #define SenderIndex 0 +#define SistaV1BytecodeSet 0 #define SlidingCompactionInProgress 2 #define SmallContextSlots 22 #define SpecialSelectors 23 @@ -646,9 +646,7 @@ static void NoDbgRegParms hackSlimBridgeToat(sqInt objOop, sqInt startAddress); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); static sqInt NoDbgRegParms initFreeChunkWithBytesat(usqLong numBytes, sqInt address); static void NoDbgRegParms initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt integerObjectOf(sqInt value); extern sqInt integerValueOf(sqInt oop); static sqInt NoDbgRegParms isFloatInstance(sqInt oop); @@ -730,8 +728,6 @@ extern sqInt characterObjectOf(sqInt characterCode); extern void characterTable(void); extern usqInt characterValueOf(sqInt oop); extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); static sqInt checkHeapFreeSpaceIntegrity(void); static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt classIndicesShouldBeValid); extern sqInt checkOkayOop(usqInt oop); @@ -775,13 +771,13 @@ static void clearLeakMapAndMapAccessibleFreeSpace(void); static void clearLeakMapAndMapAccessibleObjects(void); static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning); extern sqInt cloneObject(sqInt objOop); -extern sqInt compactClassIndexOf(sqInt objOop); +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop); static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i); extern void countMarkedAndUnmarkdObjects(sqInt printFlags); static usqLong currentAllocatedBytes(void); extern sqInt displayObject(void); static void NoDbgRegParms doScavenge(sqInt tenuringCriterion); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); static void NoDbgRegParms emptyObjStack(sqInt objStack); static void NoDbgRegParms enableObjectEnumerationFrom(sqInt initialObject); @@ -813,7 +809,7 @@ static sqInt NoDbgRegParms fixedFieldsOfClass(sqInt objOop); static sqInt NoDbgRegParms fixedFieldsOfformatlength(sqInt objOop, sqInt fmt, sqInt wordLength); static sqInt NoDbgRegParms NeverInline fixFollowedFieldofObjectwithInitialValue(sqInt fieldIndex, sqInt anObject, sqInt initialValue); static sqInt NoDbgRegParms followFieldofObject(sqInt fieldIndex, sqInt anObject); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern sqInt followForwarded(sqInt objOop); static sqInt NoDbgRegParms followMaybeForwarded(sqInt objOop); static sqInt NoDbgRegParms followObjFieldofObject(sqInt fieldIndex, sqInt anObject); @@ -839,12 +835,11 @@ static sqInt imageSegmentVersion(void); extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ extern void incrementalGC(void); -extern sqInt indexOfin(sqInt anElement, sqInt anObject); static void NoDbgRegParms inFreeTreeReplacewith(sqInt treeNode, sqInt newNode); static sqInt NoDbgRegParms initialInstanceOf(sqInt classObj); static void NeverInline initializeNewSpaceVariables(void); static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift); -EXPORT(void) inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); +extern void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); static void NoDbgRegParms NeverInline inPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag); extern sqInt instanceSizeOf(sqInt classObj); static sqInt NoDbgRegParms instantiateClass(sqInt classObj); @@ -852,7 +847,6 @@ extern sqInt instSpecOfClassFormat(sqInt classFormat); static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer); static void NoDbgRegParms invalidCompactClassError(const char *className); static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isArray(sqInt oop); static sqInt NoDbgRegParms isBridgeOrEnumerableObjectNoAssert(sqInt objOop); extern sqInt isBytes(sqInt oop); @@ -890,7 +884,7 @@ static sqInt NoDbgRegParms isMaybeFiredEphemeron(sqInt objOop); extern sqInt isNonImmediate(sqInt oop); static sqInt NoDbgRegParms isObjEphemeron(sqInt objOop); static sqInt NoDbgRegParms isObjImmutable(sqInt anOop); -extern sqInt isOldObject(sqInt objOop); +static sqInt NoDbgRegParms isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); extern sqInt isOopImmutable(sqInt oop); @@ -899,11 +893,10 @@ extern sqInt isPinned(sqInt objOop); extern sqInt isPointers(sqInt oop); static sqInt NoDbgRegParms isPureBitsFormat(sqInt format); extern sqInt isReallyYoungObject(sqInt obj); -extern sqInt isReallyYoung(sqInt oop); static sqInt NoDbgRegParms isRemembered(sqInt objOop); static sqInt NoDbgRegParms isSegmentBridge(sqInt objOop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop); extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); static sqInt NoDbgRegParms isValidObjStackAt(sqInt objStackRootIndex); @@ -924,20 +917,18 @@ static sqInt NoDbgRegParms isonObjStack(sqInt oop, sqInt objStack); static sqInt NoDbgRegParms keyOfEphemeron(sqInt objOop); static sqInt NoDbgRegParms knownClassAtIndex(sqInt classIndex); static sqInt lastPointerFormat(void); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop); +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); static sqInt NoDbgRegParms lengthOfMaybeImmediate(sqInt oop); static sqInt NoDbgRegParms lengthOf(sqInt objOop); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); static sqInt NoDbgRegParms NeverInline loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray); -EXPORT(void) longPrintInstancesOf(sqInt aClassOop); -EXPORT(void) longPrintInstancesWithClassIndex(sqInt classIndex); -EXPORT(void) longPrintReferencesTo(sqInt anOop); +extern void longPrintInstancesOf(sqInt aClassOop); +extern void longPrintInstancesWithClassIndex(sqInt classIndex); +extern void longPrintReferencesTo(sqInt anOop); static void mapExtraRoots(void); static void NeverInline mapMournQueue(void); static sqInt NoDbgRegParms mapOopsFromtooutPointersoutHashes(sqInt segStart, sqInt segAddr, sqInt outPointerArray, sqInt savedOutHashes); @@ -949,7 +940,6 @@ static void NoDbgRegParms NeverInline markObjects(sqInt objectsShouldBeUnmarkedA static void markWeaklingsAndMarkAndFireEphemerons(void); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); static sqInt NoDbgRegParms methodHeaderOf(sqInt methodObj); extern sqInt minSlotsForShortening(void); static usqInt newObjectHash(void); @@ -967,12 +957,11 @@ static sqInt noUnscannedEphemerons(void); static sqInt NoDbgRegParms numBytesOfBitsformat(sqInt objOop, sqInt format); static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numSlotsForBytes(sqInt numBytes); static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); extern sqInt objectBefore(sqInt objOop); static sqInt NoDbgRegParms objectInPastSpaceBefore(sqInt objOop); @@ -987,45 +976,46 @@ static sqInt NoDbgRegParms popObjStack(sqInt objStack); extern sqInt popRemappableOop(void); static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags); extern sqInt primitiveErrorTable(void); -EXPORT(void) printActivationsOf(sqInt aMethodObj); -EXPORT(void) printBogons(void); +extern void printActivationsOf(sqInt aMethodObj); +extern void printBogons(void); +static void NoDbgRegParms printBridgeon(sqInt oop, FILE *aStream); static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printContextReferencesTo(sqInt anOop); -EXPORT(void) printEntity(sqInt oop); -EXPORT(void) printForwarders(void); +extern void printContextReferencesTo(sqInt anOop); +extern void printEntity(sqInt oop); +extern void printForwarders(void); static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream); extern void printFreeChunks(void); -EXPORT(void) printFreeChunk(sqInt freeChunk); +extern void printFreeChunk(sqInt freeChunk); static void NoDbgRegParms printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode); -EXPORT(void) printFreeListHeads(void); -EXPORT(sqInt) printFreeList(sqInt chunkOrIndex); +extern void printFreeListHeads(void); +extern sqInt printFreeList(sqInt chunkOrIndex); static void NoDbgRegParms printFreeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printFreeTree(void); +extern void printFreeTree(void); static void NoDbgRegParms printFreeTreeChunk(sqInt chunkOrZero); -EXPORT(void) printHeaderOf(sqInt objOop); +extern void printHeaderOf(sqInt objOop); static void NoDbgRegParms printImmediateObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printInstancesOf(sqInt aClassOop); -EXPORT(void) printInstancesWithClassIndex(sqInt classIndex); +extern void printInstancesOf(sqInt aClassOop); +extern void printInstancesWithClassIndex(sqInt classIndex); extern void printInvalidClassTableEntries(void); #if LLDB -EXPORT(void) printMarkedOops(void); +extern void printMarkedOops(void); #endif /* LLDB */ -EXPORT(void) printMethodImplementorsOf(sqInt anOop); -EXPORT(void) printMethodReferencesTo(sqInt anOop); +extern void printMethodImplementorsOf(sqInt anOop); +extern void printMethodReferencesTo(sqInt anOop); static void NoDbgRegParms printNonPointerDataOfon(sqInt oop, FILE *aStream); -EXPORT(void) printObjectsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) printObjectsWithHash(sqInt hash); +extern void printObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void printObjectsWithHash(sqInt hash); +extern void printObjStackAndContents(sqInt objStack); static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents); static void NoDbgRegParms printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType); extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); -EXPORT(void) NeverInline printOopsExcept(sqInt (*function)(sqInt)); -EXPORT(void) printOopsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); -EXPORT(void) printReferencesTo(sqInt anOop); +extern void NeverInline printOopsExcept(sqInt (*function)(sqInt)); +extern void printOopsFromto(sqInt startAddress, sqInt endAddress); +extern void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); +extern void printReferencesTo(sqInt anOop); static void NoDbgRegParms printStringDataOfon(sqInt oop, FILE *aStream); #if LLDB -EXPORT(void) printUnmarkedOops(void); +extern void printUnmarkedOops(void); #endif /* LLDB */ static sqInt NoDbgRegParms pushOnUnscannedEphemeronsStack(sqInt anEphemeron); extern void pushRemappableOop(sqInt oop); @@ -1042,14 +1032,14 @@ static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedObjsclassIndicesShould static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion); static sqInt NoDbgRegParms NeverInline setHeapBasememoryLimitendOfMemory(sqInt baseOfHeap, sqInt memLimit, sqInt memEnd); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); -EXPORT(void) shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); extern sqInt shouldRemapOop(sqInt oop); static sqInt NoDbgRegParms sizeOfObjStack(sqInt objStack); static sqInt slidingCompactionInProgress(void); extern sqInt slotSizeOf(sqInt oop); extern sqInt splObj(sqInt index); static usqInt NoDbgRegParms startOfObject(sqInt objOop); -EXPORT(sqInt) statNumGCs(void); +extern sqInt statNumGCs(void); extern usqInt storeCheckBoundary(void); static sqInt NoDbgRegParms storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointerArrayArg, sqInt arrayOfRootsArg); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); @@ -1113,7 +1103,7 @@ static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i); static void postSnapshot(void); static void NeverInline prepareForSnapshot(void); static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes); -EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop); +extern SpurSegmentInfo * segmentContainingObj(sqInt objOop); static sqInt segmentOverlap(void); static sqInt NoDbgRegParms shrinkObjectMemory(usqInt delta); static sqInt someSegmentContainsPinned(void); @@ -1123,7 +1113,7 @@ static sqInt NoDbgRegParms writeImageSegmentsToFile(sqImageFile aBinaryStream); static sqInt NoDbgRegParms writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSegment, sqImageFile aBinaryStream); static sqInt NoDbgRegParms accessModifierOfMethod(sqInt methodObj); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -EXPORT(sqInt) activeProcess(void); +extern sqInt activeProcess(void); extern void addIdleUsecs(sqInt idleUsecs); static void NoDbgRegParms addLastLinktoList(sqInt proc, sqInt aList); static void NoDbgRegParms addNewMethodToCache(sqInt classObj); @@ -1139,11 +1129,11 @@ extern void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); static void NoDbgRegParms assertValidExecutionPointersimbarline(usqInt lip, char *lfp, char *lsp, sqInt inInterpreter, sqInt ln); static void NoDbgRegParms backupContexttoBlockingSendTo(sqInt suspendedContext, sqInt conditionVariable); extern sqInt booleanValueOf(sqInt obj); -EXPORT(sqInt) callbackEnter(sqInt *callbackID); -EXPORT(sqInt) callbackLeave(sqInt cbID); +extern sqInt callbackEnter(sqInt *callbackID); +extern sqInt callbackLeave(sqInt cbID); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); extern sqInt characterForAscii(sqInt ascii); -EXPORT(sqInt) checkAllAccessibleObjectsOkay(void); +extern sqInt checkAllAccessibleObjectsOkay(void); static sqInt NoDbgRegParms checkCodeIntegrity(sqInt fullGCFlag); #if LRPCheck static sqInt NeverInline checkDeliveryOfLongRunningPrimitiveSignal(void); @@ -1154,7 +1144,7 @@ static sqInt NoDbgRegParms checkImageVersionFromstartingAt(sqImageFile f, squeak static sqInt checkInterpreterIntegrity(void); static sqInt NoDbgRegParms checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP); static sqInt NoDbgRegParms checkOkayFields(sqInt oop); -EXPORT(sqInt) checkOkayInterpreterObjects(sqInt writeBack); +extern sqInt checkOkayInterpreterObjects(sqInt writeBack); static sqInt NoDbgRegParms checkOkayStackPage(StackPage *thePage); static sqInt NoDbgRegParms checkOkayStackZone(sqInt writeBack); static void NoDbgRegParms checkProfileTick(sqInt aPrimitiveMethod); @@ -1164,8 +1154,7 @@ static sqInt NoDbgRegParms checkStackPointerIndexForFrame(char *theFP); static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className); static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext); static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern sqInt copyBits(void); extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y); static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop); @@ -1179,7 +1168,7 @@ static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); static void dummyReferToProxy(void); extern void dumpPrimTraceLog(void); -EXPORT(void) dumpPrimTraceLogOn(FILE *aStdioStream); +extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); @@ -1226,7 +1215,6 @@ static sqInt NoDbgRegParms frameReceiver(char *theFP); static sqInt NoDbgRegParms frameStackedReceiverOffset(char *theFP); static void freeUntracedStackPages(void); extern sqInt fullDisplayUpdate(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); static sqInt getCogVMFeatureFlags(void); extern sqInt getCurrentBytecode(void); static sqInt getDesiredCogCodeSize(void); @@ -1276,6 +1264,7 @@ static sqInt isPrimitiveFunctionPointerAnIndex(void); extern sqInt isQuickPrimitiveIndex(sqInt anInteger); extern sqInt isReadMediatedContextInstVarIndex(sqInt index); static sqInt NoDbgRegParms isSingleContext(sqInt aContext); +static sqInt NoDbgRegParms isVanillaBlockClosure(sqInt aClosure); static sqInt NoDbgRegParms isWidowedContextDuringGC(sqInt aOnceMarriedContext); static sqInt NoDbgRegParms isWidowedContextNoConvert(sqInt aOnceMarriedContext); static sqInt NoDbgRegParms isWidowedContext(sqInt aOnceMarriedContext); @@ -1287,7 +1276,7 @@ static sqInt NoDbgRegParms lengthOfNameOfClass(sqInt classOop); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt loadBitBltFrom(sqInt bb); extern void loadInitialContext(void); -EXPORT(void) longPrintOop(sqInt oop); +extern void longPrintOop(sqInt oop); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); static sqInt NoDbgRegParms lookupInMethodCacheSelclassTag(sqInt selector, sqInt classTag); static sqInt NoDbgRegParms lookupLexicalfromrule(sqInt selector, sqInt mixin, sqInt rule); @@ -1337,7 +1326,6 @@ static sqInt NoDbgRegParms objectequalsString(sqInt anOop, char *aCString); extern sqInt ownVM(sqInt threadIndexAndFlags); static sqInt NoDbgRegParms pcPreviousToinSqueakV3PlusClosuresMethod(sqInt theIP, sqInt aMethod); extern sqInt pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt pop(sqInt nItems); extern void popthenPush(sqInt nItems, sqInt oop); @@ -1355,45 +1343,44 @@ extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); static void NoDbgRegParms printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void NoDbgRegParms printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); -EXPORT(void) printAllStacks(void); -EXPORT(void) printAllStacksOn(FILE *aStdioStream); -EXPORT(void) printCallStack(void); +extern void printAllStacks(void); +extern void printAllStacksOn(FILE *aStdioStream); +extern void printCallStack(void); static sqInt NoDbgRegParms printCallStackFP(char *theFP); -EXPORT(sqInt) printCallStackOf(sqInt aContextOrProcessOrFrame); +extern sqInt printCallStackOf(sqInt aContextOrProcessOrFrame); static sqInt NoDbgRegParms printCallStackOfcurrentFP(sqInt aContext, char *currFP); -EXPORT(void) printCallStackOn(FILE *aStdioStream); +extern void printCallStackOn(FILE *aStdioStream); static sqInt NoDbgRegParms printContextCallStackOf(sqInt aContext); -EXPORT(void) printContext(sqInt aContext); -EXPORT(void) printExternalHeadFrame(void); +extern void printContext(sqInt aContext); +extern void printExternalHeadFrame(void); static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort); static void NoDbgRegParms printFrameFlagsForFP(char *theFP); static void NoDbgRegParms printFrameOopat(char *name, char *address); -EXPORT(void) printFramesInPage(StackPage *thePage); -EXPORT(void) printFramesOnStackPageListInUse(void); +extern void printFramesInPage(StackPage *thePage); +extern void printFramesOnStackPageListInUse(void); static void NoDbgRegParms printFrameThingandFrameat(char *name, char *theFP, char *address); static void NoDbgRegParms printFrameThingatextraString(char *name, char *address, char *extraStringOrNil); -EXPORT(sqInt) printFrame(char *theFP); -EXPORT(sqInt) printFrameWithSP(char *theFP, char *theSP); -extern sqInt printHexnp(usqInt n); +extern sqInt printFrame(char *theFP); +extern sqInt printFrameWithSP(char *theFP, char *theSP); static sqInt NoDbgRegParms printHexPtrnp(void *p); extern void printHex(usqInt n); -EXPORT(void) printLikelyImplementorsOfSelector(sqInt selector); -EXPORT(void) printMethodCache(void); -EXPORT(void) printMethodCacheFor(sqInt thing); -EXPORT(void) printMethodDictionaryOf(sqInt behavior); -EXPORT(void) printMethodDictionary(sqInt dictionary); +extern void printLikelyImplementorsOfSelector(sqInt selector); +extern void printMethodCache(void); +extern void printMethodCacheFor(sqInt thing); +extern void printMethodDictionaryOf(sqInt behavior); +extern void printMethodDictionary(sqInt dictionary); static void NoDbgRegParms printNameOfClasscount(sqInt classOop, sqInt cnt); static void NoDbgRegParms printOopShortInner(sqInt oop); -EXPORT(void) printOop(sqInt oop); -EXPORT(void) printProcessStack(sqInt aProcess); -EXPORT(sqInt) printProcsOnList(sqInt procList); -EXPORT(sqInt) printStackCallStackOf(sqInt aContextOrProcessOrFrame); -EXPORT(void) printStackPageList(void); -EXPORT(void) printStackPageListInUse(void); -EXPORT(void) printStackPages(void); -EXPORT(void) printStackPagesInUse(void); +extern void printOop(sqInt oop); +extern void printProcessStack(sqInt aProcess); +extern sqInt printProcsOnList(sqInt procList); +extern sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame); +extern void printStackPageList(void); +extern void printStackPageListInUse(void); +extern void printStackPages(void); +extern void printStackPagesInUse(void); static void NoDbgRegParms printStackPageuseCount(StackPage *page, sqInt n); -EXPORT(void) printStackReferencesTo(sqInt oop); +extern void printStackReferencesTo(sqInt oop); static void NoDbgRegParms printStringOf(sqInt oop); extern void print(char *s); extern void pushBool(sqInt trueOrFalse); @@ -1408,22 +1395,22 @@ static void NoDbgRegParms putWord32toFile(int aWord32, sqImageFile aFile); extern sqInt readableFormat(sqInt imageVersion); extern size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset); static void NoDbgRegParms NeverInline reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader); -EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext); +extern sqInt reestablishContextPriorToCallback(sqInt callbackContext); static sqInt NoDbgRegParms removeFirstLinkOfList(sqInt aList); static sqInt NoDbgRegParms removeProcessfromList(sqInt aProcess, sqInt aList); static sqInt NoDbgRegParms resumepreemptedYieldingIf(sqInt aProcess, sqInt yieldImplicitly); static sqInt retryPrimitiveOnFailure(void); -EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); +extern sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); static void NoDbgRegParms reverseDisplayFromto(sqInt startIndex, sqInt endIndex); static void NoDbgRegParms rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)()); static sqInt NoDbgRegParms roomToPushNArgs(sqInt n); static sqInt NoDbgRegParms safeMethodClassOf(sqInt methodPointer); static sqInt NoDbgRegParms saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex); -EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); -EXPORT(void) setBreakMNUSelector(char *aString); -EXPORT(void) setBreakSelector(char *aString); +extern sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); +extern void setBreakMNUSelector(char *aString); +extern void setBreakSelector(char *aString); extern void setFullScreenFlag(sqInt value); -EXPORT(void *) setInterruptCheckChain(void (*aFunction)()); +extern void * setInterruptCheckChain(void (*aFunction)()); extern void setInterruptKeycode(sqInt value); extern void setInterruptPending(sqInt value); extern void setNextWakeupUsecs(usqLong value); @@ -1432,10 +1419,10 @@ static void setSignalLowSpaceFlagAndSaveProcess(void); static void NoDbgRegParms setTraceFlagOnContextsFramesPageIfNeeded(sqInt aContext); static sqInt NoDbgRegParms shortPrintContext(sqInt aContext); static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP); -EXPORT(void) shortPrintFramesInPage(StackPage *thePage); -EXPORT(void) shortPrintFramesOnStackPageListInUse(void); +extern void shortPrintFramesInPage(StackPage *thePage); +extern void shortPrintFramesOnStackPageListInUse(void); static sqInt NoDbgRegParms shortPrintFrame(char *theFP); -EXPORT(void) shortPrintFrameAndNCallers(char *theFP, sqInt n); +extern void shortPrintFrameAndNCallers(char *theFP, sqInt n); static void NoDbgRegParms shortPrintOop(sqInt oop); static sqInt NoDbgRegParms shortReversePrintFrameAndCallers(char *aFramePointer); extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); @@ -1485,7 +1472,7 @@ static void NoDbgRegParms NeverInline voidLongRunningPrimitive(char *reason); #endif /* LRPCheck */ static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); static sqInt wakeHighestPriority(void); -EXPORT(char *) whereIs(sqInt anOop); +extern char * whereIs(sqInt anOop); static sqInt NeverInline writeImageFileIO(void); static usqInt NoDbgRegParms cloneContext(sqInt aContext); static sqInt NoDbgRegParms fieldOrSenderFPofContext(sqInt index, sqInt contextObj); @@ -1566,14 +1553,14 @@ _iss usqInt endOfMemory; _iss usqInt pastSpaceStart; _iss usqInt instructionPointer; _iss sqInt trueObj; -_iss usqInt totalFreeOldSpace; _iss sqInt falseObj; -_iss SpurSegmentInfo * segments; +_iss usqInt totalFreeOldSpace; _iss sqInt lkupClassTag; +_iss SpurSegmentInfo * segments; _iss sqInt hiddenRootsObj; _iss sqInt needGCFlag; -_iss sqInt numSegments; _iss StackPage * pages; +_iss sqInt numSegments; _iss sqInt * freeLists; _iss char * stackMemory; _iss sqInt markStack; @@ -1591,6 +1578,7 @@ _iss StackPage * mostRecentlyUsedPage; _iss sqInt lkupClass; _iss sqInt remapBufferCount; _iss usqInt newSpaceStart; +_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; _iss sqInt tempOop; _iss usqInt lastMobileObject; @@ -1608,7 +1596,6 @@ _iss sqInt becomeEffectsFlags; _iss sqInt growHeadroom; _iss sqInt tenureThreshold; _iss char * objStackInvalidBecause; -_iss sqInt sweepIndex; _iss sqInt ephemeronList; _iss sqInt imageHeaderFlags; #if LRPCheck @@ -1619,7 +1606,6 @@ _iss sqInt longRunningPrimitiveCheckSemaphore; #endif _iss sqInt profileSemaphore; _iss sqInt tenureCriterion; -_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classNameIndex; _iss usqInt freeOldSpaceStart; _iss sqInt extraRootCount; @@ -1739,7 +1725,6 @@ _iss sqInt atCache[AtCacheTotalSize + 1 /* 65 */]; _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 65 */]; _iss usqLong byteCount; -_iss sqInt preferredPinningSegment; _iss sqInt statCoalesces; _iss usqLong statFGCDeltaUsecs; _iss usqLong statIncrGCUsecs; @@ -1785,7 +1770,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, 2, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, +/*100*/ 1, 2, 1, 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, @@ -2423,7 +2408,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] StackInterpreterPrimitives_VMMaker.oscog-eem.3310"; +const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] StackInterpreterPrimitives_VMMaker.oscog-eem.3329"; sqInt suppressHeartbeatFlag; int displayWidth; int displayDepth; @@ -17412,6 +17397,7 @@ primitiveClosureValue(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -17530,6 +17516,7 @@ primitiveClosureValueNoContextSwitch(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -17680,6 +17667,7 @@ primitiveClosureValueWithArgs(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -27269,10 +27257,8 @@ primitiveStoreImageSegment(void) && (((((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) >= (firstLongFormat())) && (((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) <= ((firstShortFormat()) - 1)))))))) { /* Must be indexable words */ - /* begin primitiveFail */ - if (!GIV(primFailCode)) { - GIV(primFailCode) = 1; - } + /* begin primitiveFailFor: */ + GIV(primFailCode) = PrimErrBadArgument; return; } ecode = storeImageSegmentIntooutPointersroots(segmentWordArray, outPointerArray, arrayOfRoots); @@ -27941,7 +27927,8 @@ primitiveStringReplace(void) replFmt = replFmt & -4; l10: /* end classFormatFromInstFormat: */; if (!((arrayFmt == replFmt) - && (arrayFmt < (firstCompiledMethodFormat())))) { + && ((arrayFmt >= (sixtyFourBitIndexableFormat())) + && (arrayFmt < (firstCompiledMethodFormat()))))) { /* begin primitiveFailFor: */ GIV(primFailCode) = PrimErrInappropriate; goto l17; @@ -30044,111 +30031,6 @@ initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur64BitMemoryManager>>#inOldSpaceInstantiatePinnedClass:indexableSize: */ -sqInt -inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt fillValue; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt numSlots; - usqInt p; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - fillValue = 0; - switch (instSpec) { - case 2 /* arrayFormat */: - numSlots = nElements; - fillValue = GIV(nilObj); - break; - case indexablePointersFormat(): - case weakArrayFormat(): - numSlots = (classFormat & ((1U << (fixedFieldsFieldWidth())) - 1)) + nElements; - fillValue = GIV(nilObj); - break; - case sixtyFourBitIndexableFormat(): - numSlots = nElements; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstShortFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - case firstByteFormat(): - numSlots = (nElements + 7) / 8; - instSpec += (8 - nElements) & 7; - break; - default: - - /* non-indexable */ - /* Some Squeak images include funky fixed subclasses of abstract variable - superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection. - The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via - this method. - Hence allow fixed classes to be instantiated here iff nElements = 0. */ - if ((nElements != 0) - || (instSpec > 5 /* lastPointerFormat */)) { - return null; - } - numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); - fillValue = GIV(nilObj); - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > (0x10000000000LL)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsForPinningInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : (numSlots << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - if (!(newObj == null)) { - /* begin fillObj:numSlots:with: */ - assert(oopisLessThan(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1, addressAfter(newObj))); - for (p = (((usqInt)(newObj + BaseHeaderSize))); p <= (((usqInt)(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { - longAtput(p, fillValue); - } - } - return newObj; -} - - /* Allocate an instance of a variable class, excepting CompiledMethod. */ /* Spur64BitMemoryManager>>#instantiateClass:indexableSize: */ @@ -30299,130 +30181,6 @@ instantiateClassindexableSize(sqInt classObj, usqInt nElements) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur64BitMemoryManager>>#instantiateUninitializedClass:indexableSize: */ -sqInt -instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt newObj1; - usqInt numBytes; - usqInt numSlots; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - assert(isPureBitsFormat(instSpec)); - switch (instSpec) { - case sixtyFourBitIndexableFormat(): - numSlots = nElements; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstShortFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - case firstByteFormat(): - numSlots = (nElements + 7) / 8; - instSpec += (8 - nElements) & 7; - break; - default: - - /* not bits indexable */ - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > ((1U << (fixedFieldsFieldWidth())) - 1)) { - if (numSlots > (0x10000000000LL)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : (numSlots << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - } - else { - /* begin allocateSlots:format:classIndex: */ - if (numSlots >= (numSlotsMask())) { - if (((numSlots) >> 56) > 0) { - newObj = null; - goto l7; - } - newObj1 = GIV(freeStart) + BaseHeaderSize; - numBytes = (BaseHeaderSize + BaseHeaderSize) + (numSlots * BytesPerOop); - } - else { - newObj1 = GIV(freeStart); - numBytes = BaseHeaderSize + ((numSlots < 1 - ? /* begin allocationUnit */ 8 - : numSlots * BytesPerOop)); - } - if ((GIV(freeStart) + numBytes) > GIV(scavengeThreshold)) { - if (!GIV(needGCFlag)) { - /* begin scheduleScavenge */ - GIV(needGCFlag) = 1; - forceInterruptCheck(); - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, instSpec, classIndex); - goto l7; - } - if (numSlots >= (numSlotsMask())) { - - /* for header parsing we put a saturated slot count in the prepended overflow size word */ - flag("endianness"); - longAtput(GIV(freeStart), (((sqInt)((usqInt)((numSlotsMask())) << (numSlotsFullShift())))) + numSlots); - longAtput(newObj1, headerForSlotsformatclassIndex(numSlotsMask(), instSpec, classIndex)); - } - else { - longAtput(newObj1, (((((usqLong) numSlots)) << (numSlotsFullShift())) + (((sqInt)((usqInt)(instSpec) << (formatShift()))))) + classIndex); - } - assert((numBytes % (allocationUnit())) == 0); - assert((newObj1 % (allocationUnit())) == 0); - GIV(freeStart) += numBytes; - newObj = newObj1; - l7: /* end allocateSlots:format:classIndex: */; - } - return newObj; -} - - /* Convert the integer value, assumed to be in SmallInteger range, into a tagged SmallInteger object. In C, use a shift and an add to set the tag bit. @@ -30907,8 +30665,8 @@ allWeakSurvivorsOnWeakList(void) writes code that stresses the remembered table. One might conclude that if the remembered table is full, then the right thing - to do is simply to tenure everything, emptying the remembered table. Bt in - some circumstances this + to do is simply to tenure everything, emptying the remembered table. But + in some circumstances this can be counter-productive, and result in the same situation arising soon after tenuring everything. Instead, we can try and selectively prune the remembered table, tenuring @@ -31300,6 +31058,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj3 == null)) { + assert(isPinned(obj3)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1, addressAfter(obj3))); for (p2 = (((usqInt)(obj3 + BaseHeaderSize))); p2 <= (((usqInt)(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1))); p2 += 8 /* allocationUnit */) { @@ -31316,6 +31075,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj2 == null)) { + assert(isPinned(obj2)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1, addressAfter(obj2))); for (p1 = (((usqInt)(obj2 + BaseHeaderSize))); p1 <= (((usqInt)(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1))); p1 += 8 /* allocationUnit */) { @@ -31335,6 +31095,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -31535,6 +31296,7 @@ openScavengeLog(void) /* Print the objects in the remembered set. */ +/* useful for debugging */ /* SpurGenerationScavenger>>#printRememberedSet */ void @@ -33821,6 +33583,7 @@ allocatePinnedSlots(sqInt nSlots) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj == null)) { + assert(isPinned(obj)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj))); for (p = (((usqInt)(obj + BaseHeaderSize))); p <= (((usqInt)(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -34788,30 +34551,6 @@ checkedLongAt(sqInt byteAddress) return longAt(byteAddress); } - /* SpurMemoryManager>>#checkFreeSpace: */ -void -checkFreeSpace(sqInt gcModes) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, null); - } -} - - /* SpurMemoryManager>>#checkFreeSpace:ignoring: */ -void -checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, anOopToIgnore); - } -} - /* Perform an integrity/leak check using the heapMap. Assume clearLeakMapAndMapAccessibleFreeSpace has set a bit at each free chunk's @@ -35778,6 +35517,7 @@ checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt cla /* Verify that the given oop is legitimate. Check address, header, and size but not class. Answer true if OK. Otherwise print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOkayOop: */ sqInt @@ -35872,6 +35612,7 @@ checkOkayOop(usqInt oop) or more fields. Finally, the instance specification field of the behavior must match that of the instance. If OK answer true. If not, print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOopHasOkayClass: */ sqInt @@ -36731,7 +36472,7 @@ cloneObject(sqInt objOop) } /* SpurMemoryManager>>#compactClassIndexOf: */ -sqInt +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop) { /* begin classIndexOf: */ @@ -36881,6 +36622,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS /* print the count of marked and unmarked objects. In addition if 1 is set in printFlags, short-print marked objects, and/or if 2 is set, short-print unmarked obejcts. */ +/* useful for debugging */ /* SpurMemoryManager>>#countMarkedAndUnmarkdObjects: */ void @@ -36978,7 +36720,8 @@ currentAllocatedBytes(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt use; - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); return (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); } @@ -37005,7 +36748,8 @@ doScavenge(sqInt tenuringCriterion) usqInt use; /* begin doAllocationAccountingForScavenge */ - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); GIV(statAllocatedBytes) = (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); GIV(gcPhaseInProgress) = ScavengeInProgress; /* begin scavenge: */ @@ -37056,7 +36800,8 @@ doScavenge(sqInt tenuringCriterion) GIV(freeStart) = ((eden()).start); GIV(gcPhaseInProgress) = 0; /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); } @@ -37070,7 +36815,7 @@ doScavenge(sqInt tenuringCriterion) was possible. */ /* SpurMemoryManager>>#doShorten:toIndexableSize: */ -sqInt +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt bytesBefore; @@ -37927,6 +37672,7 @@ findLargestFreeChunk(void) /* Print the oops of all string-like things that start with the same characters as aCString */ +/* useful for debugging */ /* SpurMemoryManager>>#findStringBeginningWith: */ void @@ -38314,7 +38060,7 @@ followFieldofObject(sqInt fieldIndex, sqInt anObject) need since depth is always finite. */ /* SpurMemoryManager>>#followForwardedObjectFields:toDepth: */ -sqInt +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -38731,7 +38477,6 @@ fullGC(void) runLeakCheckerForexcludeUnmarkedObjsclassIndicesShouldBeValid(GCModeFull, 1, 1); compactionStartUsecs = ioUTCMicrosecondsNow(); /* begin prepareForGlobalSweep */ - GIV(sweepIndex) = 0; for (i = 0; i < GIV(numSegments); i += 1) { ((GIV(segments)[i]).containsPinned = 0); } @@ -38751,9 +38496,11 @@ fullGC(void) GIV(statShrinkMemory) += 1; } /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); assert(validObjStacks()); assert(isEmptyObjStack(GIV(markStack))); assert(isEmptyObjStack(GIV(weaklingStack))); @@ -38812,12 +38559,10 @@ growOldSpaceByAtLeast(sqInt minAmmount) sqInt ammount; sqInt bytes; sqInt headroom; - sqInt i; sqInt interval; SpurSegmentInfo *segInfo; sqInt start; usqInt total; - usqInt total1; /* statGrowMemory counts attempts, not successes. */ @@ -38834,13 +38579,8 @@ growOldSpaceByAtLeast(sqInt minAmmount) /* Now apply the maxOldSpaceSize limit, if one is in effect. */ ammount = ((ammount < GIV(growHeadroom)) ? GIV(growHeadroom) : ammount); if (maxOldSpaceSize > 0) { - /* begin totalBytesInSegments */ - total1 = 0; - for (i = 0; i < GIV(numSegments); i += 1) { - total1 += ((GIV(segments)[i]).segSize); - } - assert(GIV(totalHeapSizeIncludingBridges) == total1); - total = total1; + assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)); + total = GIV(totalHeapSizeIncludingBridges); if (total >= maxOldSpaceSize) { GIV(needGCFlag) = 1; return null; @@ -39009,73 +38749,6 @@ incrementalGC(void) error("shouldNotImplement"); } - /* SpurMemoryManager>>#indexOf:in: */ -sqInt -indexOfin(sqInt anElement, sqInt anObject) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt fmt; - sqInt fmt1; - sqInt i; - usqInt numSlots; - usqInt numSlots1; - - /* begin formatOf: */ - fmt = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - if (fmt <= 5 /* lastPointerFormat */) { - /* begin numSlotsOf: */ - assert((classIndexOf(anObject)) > (isForwardedObjectClassIndexPun())); - numSlots1 = byteAt(anObject + 7); - numSlots = (numSlots1 == (numSlotsMask()) - ? ((((usqInt)(((sqInt)((usqInt)((longAt(anObject - BaseHeaderSize))) << 8)))))) >> 8 - : numSlots1); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (longAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) { - return i; - } - } - } - if (fmt >= (firstByteFormat())) { - if (fmt >= (firstCompiledMethodFormat())) { - /* begin primitiveFailFor: */ - return (GIV(primFailCode) = PrimErrUnsupported); - } - /* begin numBytesOfBytes: */ - fmt1 = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - assert(fmt1 >= (firstByteFormat())); - numSlots = ((numSlotsOf(anObject)) << (shiftForWord())) - (fmt1 & 7); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (byteAt((anObject + BaseHeaderSize) + i))) { - return i; - } - } - } - if (fmt >= (firstShortFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 1; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (((unsigned short) (shortAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 1)))))))) { - return i; - } - } - } - if (fmt == (sixtyFourBitIndexableFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 3; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long64At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 3)))))) { - return i; - } - } - } - if (fmt >= (firstLongFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 2; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long32At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 2)))))) { - return i; - } - } - } - return -1; -} - /* Part of reorderReversedTreeList:. Switch treeNode with newNode in the tree, but do nothing to the list linked through freeChunkNextIndex. */ @@ -39541,6 +39214,7 @@ initializeObjectMemory(sqInt bytesToShift) /* begin allocatePinnedSlots: */ obj1 = allocateSlotsForPinningInOldSpacebytesformatclassIndex(0x400, (1024U << (shiftForWord())) + (BaseHeaderSize + BaseHeaderSize), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -39556,7 +39230,7 @@ initializeObjectMemory(sqInt bytesToShift) else { /* The Spur32to64BitBootstrap failed to set the type of rememberedSetObj to 64-bit indexability. - This is unimportant except for simulation; rememberedSet is declared as sqInt *, but in to have + This is unimportant except for simulation; rememberedSet is declared as sqInt *, but to have firstIndexableField: below answer a suitable type the format must be wordIndexableFormat. */ /* begin setFormatOf:to: */ format = sixtyFourBitIndexableFormat(); @@ -39586,9 +39260,11 @@ initializeObjectMemory(sqInt bytesToShift) /* free space before shrinking */ GIV(shrinkThreshold) = 0x2000000; /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* By default GC after scavenge if heap has grown by a third since the last GC */ GIV(heapGrowthToSizeGCRatio) = 0.333333; @@ -39596,12 +39272,10 @@ initializeObjectMemory(sqInt bytesToShift) /* print free chunks in freeTree in order. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#inOrderPrintFreeTree:printList: */ -EXPORT(void) +void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList) { sqInt next; @@ -39856,18 +39530,6 @@ isAnyPointerFormat(sqInt format) } -/* Answer if this is an indexable object with pointer elements, e.g., an - array - */ - - /* SpurMemoryManager>>#isArrayNonImm: */ -sqInt -isArrayNonImm(sqInt oop) -{ - return ((((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask())) == 2 /* arrayFormat */; -} - - /* Answer true if this is an indexable object with pointer elements, e.g., an array */ @@ -40290,7 +39952,7 @@ isObjImmutable(sqInt anOop) /* Answer if obj is old. Require that obj is non-immediate. */ /* SpurMemoryManager>>#isOldObject: */ -sqInt +static sqInt NoDbgRegParms isOldObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(isNonImmediate(objOop)); @@ -40375,18 +40037,6 @@ isReallyYoungObject(sqInt obj) oopisLessThan(obj, GIV(oldSpaceStart))); } - -/* Answer if oop is young. */ - - /* SpurMemoryManager>>#isReallyYoung: */ -sqInt -isReallyYoung(sqInt oop) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return ((!(oop & (tagMask())))) - && ((assert(isNonImmediate(oop)), - oopisLessThan(oop, GIV(oldSpaceStart)))); -} - /* SpurMemoryManager>>#isRemembered: */ static sqInt NoDbgRegParms isRemembered(sqInt objOop) @@ -40419,10 +40069,10 @@ isShorts(sqInt oop) /* This version is private to SpurMemoryManager (for asserts, etc). It does - not take advantage of the power-of0two optimization in isForwarded:. */ + not take advantage of the power-of-two optimization in isForwarded:. */ /* SpurMemoryManager>>#isUnambiguouslyForwarder: */ -sqInt +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop) { return ((longAt(objOop)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()); @@ -40813,7 +40463,7 @@ lastPointerFormat(void) pointer, and the image contains no forwarders (see class comment). */ /* SpurMemoryManager>>#lastPointerOfWhileSwizzling: */ -sqInt +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop) { sqInt fmt; @@ -40841,7 +40491,7 @@ lastPointerOfWhileSwizzling(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#lastPointerOf: */ -sqInt +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop) { sqInt contextSize; @@ -40881,13 +40531,6 @@ lastPointerOf(sqInt objOop) ((header >> 3)) & AlternateHeaderNumLiteralsMask)) + LiteralStart) - 1) * BytesPerOop) + BaseHeaderSize; } - /* SpurMemoryManager>>#leakCheckBecome */ -sqInt -leakCheckBecome(void) -{ - return ((checkForLeaks & GCModeBecome) != 0); -} - /* SpurMemoryManager>>#leakCheckFullGC */ sqInt leakCheckFullGC(void) @@ -40895,13 +40538,6 @@ leakCheckFullGC(void) return ((checkForLeaks & GCModeFull) != 0); } - /* SpurMemoryManager>>#leakCheckIncremental */ -sqInt -leakCheckIncremental(void) -{ - return ((checkForLeaks & GCModeIncremental) != 0); -} - /* SpurMemoryManager>>#leakCheckNewSpaceGC */ sqInt leakCheckNewSpaceGC(void) @@ -41492,12 +41128,10 @@ loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesOf: */ -EXPORT(void) +void longPrintInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -41512,12 +41146,10 @@ longPrintInstancesOf(sqInt aClassOop) /* Scan the heap printing any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesWithClassIndex: */ -EXPORT(void) +void longPrintInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -41625,12 +41257,10 @@ longPrintInstancesWithClassIndex(sqInt classIndex) /* Scan the heap long printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintReferencesTo: */ -EXPORT(void) +void longPrintReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -43062,21 +42692,6 @@ maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format) } -/* Answer one of the objects in the SpecialObjectsArray, if in range, - otherwise answer nil. - */ - - /* SpurMemoryManager>>#maybeSplObj: */ -sqInt -maybeSplObj(sqInt index) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return (index < (numSlotsOf(GIV(specialObjectsOop))) - ? (/* begin fetchPointer:ofObject: */ - longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) - : 0); -} - - /* Answer the method header of a CompiledMethod object. */ /* SpurMemoryManager>>#methodHeaderOf: */ @@ -43500,7 +43115,7 @@ numBytesOf(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#numPointerSlotsOf: */ -usqInt +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop) { sqInt contextSize; @@ -43664,24 +43279,6 @@ numStrongSlotsOfInephemeral(sqInt objOop) } -/* Answer the number of strong pointer fields in the given weakling. */ - - /* SpurMemoryManager>>#numStrongSlotsOfWeakling: */ -sqInt -numStrongSlotsOfWeakling(sqInt objOop) -{ - sqInt classFormat; - sqInt objOop1; - - assert((formatOf(objOop)) == (weakArrayFormat())); - /* begin fixedFieldsOfClass: */ - objOop1 = fetchClassOfNonImm(objOop); - /* begin fixedFieldsOfClassFormat: */ - classFormat = ((longAt((objOop1 + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - return classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); -} - - /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -43753,6 +43350,9 @@ objectAfter(sqInt objOop) : followingWordAddress3); } + +/* useful for debugging */ + /* SpurMemoryManager>>#objectBefore: */ sqInt objectBefore(sqInt objOop) @@ -44341,6 +43941,7 @@ okayOop(sqInt signedOop) } +/* useful for debugging */ /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -44521,7 +44122,6 @@ pinObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt format; - sqInt i; sqInt oldClone; sqInt referent; SpurSegmentInfo *seg; @@ -44536,15 +44136,7 @@ pinObject(sqInt objOop) longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); return objOop; } - /* begin segmentContainingObj: */ - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - seg = (&(GIV(segments)[i])); - goto l1; - } - } - seg = null; - l1: /* end segmentContainingObj: */; + seg = segmentContainingObj(objOop); if ((seg->containsPinned)) { /* begin setIsPinnedOf:to: */ longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); @@ -44784,12 +44376,10 @@ primitiveErrorTable(void) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printActivationsOf: */ -EXPORT(void) +void printActivationsOf(sqInt aMethodObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -44857,12 +44447,10 @@ printActivationsOf(sqInt aMethodObj) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printBogons */ -EXPORT(void) +void printBogons(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT /* begin printTheBogons: */ @@ -44879,16 +44467,34 @@ printBogons(void) cr(); } + /* SpurMemoryManager>>#printBridge:on: */ +static void NoDbgRegParms +printBridgeon(sqInt oop, FILE *aStream) +{ + fprintf(aStream, + "%p is a bridge hdr%d slot size %ul\n", + ((void *)oop), + ((byteAt(oop + 7)) == (numSlotsMask()) + ? 16 + : 8), + numSlotsOfAny(oop)); +} + /* SpurMemoryManager>>#printCantBeObject:on: */ static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (((oop & (7)) == 0) - && (((oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) - && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))))) { - printForwarderon(oop, aStream); - return; + if ((oop & (7)) == 0) { + if (((oopisLessThan(oop, GIV(oldSpaceStart))) + && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) + && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { + printForwarderon(oop, aStream); + return; + } + if (oop == (bridgeAt((numSegments()) - 1))) { + printBridgeon(oop, aStream); + return; + } } fprintf(aStream, "%p%s\n", @@ -44902,12 +44508,10 @@ printCantBeObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printContextReferencesTo: */ -EXPORT(void) +void printContextReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -44987,12 +44591,10 @@ printContextReferencesTo(sqInt anOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printEntity: */ -EXPORT(void) +void printEntity(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -45126,12 +44728,10 @@ printEntity(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printForwarders */ -EXPORT(void) +void printForwarders(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45240,7 +44840,7 @@ static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream) { fprintf(aStream, - "%p is a forwarded hdr%d slot size %ud object to %p\n", + "%p is a forwarded hdr%d slot size %ul object to %p\n", ((void *)oop), ((byteAt(oop + 7)) == (numSlotsMask()) ? 16 @@ -45253,6 +44853,7 @@ printForwarderon(sqInt oop, FILE *aStream) /* This version goes through memory, printing all free chunks. Other versions go through the free lists. This one will show all free chunks even if the free lists are corrupt. */ +/* useful for debugging */ /* SpurMemoryManager>>#printFreeChunks */ void @@ -45368,12 +44969,10 @@ printFreeChunks(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeChunk: */ -EXPORT(void) +void printFreeChunk(sqInt freeChunk) { printFreeChunkprintAsTreeNode(freeChunk, 1); @@ -45463,12 +45062,10 @@ printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeListHeads */ -EXPORT(void) +void printFreeListHeads(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt expectedMask; @@ -45504,12 +45101,10 @@ printFreeListHeads(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeList: */ -EXPORT(sqInt) +sqInt printFreeList(sqInt chunkOrIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fieldIndex; @@ -45542,12 +45137,10 @@ printFreeObjecton(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeTree */ -EXPORT(void) +void printFreeTree(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFreeTreeChunk(GIV(freeLists)[0]); @@ -45571,13 +45164,11 @@ printFreeTreeChunk(sqInt chunkOrZero) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* N.B. No safety bounds checks!! We need to look e.g. at corpses. */ /* SpurMemoryManager>>#printHeaderOf: */ -EXPORT(void) +void printHeaderOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -45694,12 +45285,10 @@ printImmediateObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesOf: */ -EXPORT(void) +void printInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -45714,12 +45303,10 @@ printInstancesOf(sqInt aClassOop) /* Scan the heap printing the oops of any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesWithClassIndex: */ -EXPORT(void) +void printInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45825,6 +45412,7 @@ printInstancesWithClassIndex(sqInt classIndex) /* Print the objects in the classTable that have bad hashes. */ +/* useful for debugging */ /* SpurMemoryManager>>#printInvalidClassTableEntries */ void @@ -45874,13 +45462,11 @@ printInvalidClassTableEntries(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMarkedOops */ #if LLDB -EXPORT(void) +void printMarkedOops(void) { printOopsSuchThat(isMarked); @@ -45891,12 +45477,10 @@ printMarkedOops(void) /* Scan the heap printing the oops of any and all methods that implement anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodImplementorsOf: */ -EXPORT(void) +void printMethodImplementorsOf(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -45962,12 +45546,10 @@ printMethodImplementorsOf(sqInt anOop) /* Scan the heap printing the oops of any and all methods that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodReferencesTo: */ -EXPORT(void) +void printMethodReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -46153,12 +45735,10 @@ printNonPointerDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsFrom:to: */ -EXPORT(void) +void printObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -46182,12 +45762,10 @@ printObjectsFromto(sqInt startAddress, sqInt endAddress) /* Scan the heap printing the oops of any and all objects whose hash equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsWithHash: */ -EXPORT(void) +void printObjectsWithHash(sqInt hash) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -46289,6 +45867,21 @@ printObjectsWithHash(sqInt hash) l4: /* end allNewSpaceEntitiesDo: */; } + /* SpurMemoryManager>>#printObjStackAndContents: */ +void +printObjStackAndContents(sqInt objStack) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + /* begin printObjStack:printContents: */ + if (objStack == GIV(nilObj)) { + /* begin print: */ + fprintf(GIV(transcript), "nil"); + cr(); + } + else { + printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((sqInt)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, 1); + } +} + /* SpurMemoryManager>>#printObjStackPage:myIndex:pageType:printContents: */ static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents) @@ -46451,6 +46044,9 @@ printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType) cr(); } + +/* useful for debugging */ + /* SpurMemoryManager>>#printObjStack: */ void printObjStack(sqInt objStack) @@ -46466,27 +46062,11 @@ printObjStack(sqInt objStack) } } - /* SpurMemoryManager>>#printObjStack:printContents: */ -void -printObjStackprintContents(sqInt objStack, sqInt printContents) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - if (objStack == GIV(nilObj)) { - /* begin print: */ - fprintf(GIV(transcript), "nil"); - cr(); - } - else { - printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((sqInt)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, printContents); - } -} - -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsExcept: */ -EXPORT(void) NeverInline +void NeverInline printOopsExcept(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -46604,12 +46184,10 @@ printOopsExcept(sqInt (*function)(sqInt)) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsFrom:to: */ -EXPORT(void) +void printOopsFromto(sqInt startAddress, sqInt endAddress) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstNonEntity; @@ -46662,12 +46240,10 @@ printOopsFromto(sqInt startAddress, sqInt endAddress) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsSuchThat: */ -EXPORT(void) NeverInline +void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -46786,12 +46362,10 @@ printOopsSuchThat(sqInt (*function)(sqInt)) /* Scan the heap printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printReferencesTo: */ -EXPORT(void) +void printReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -47027,13 +46601,11 @@ printStringDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printUnmarkedOops */ #if LLDB -EXPORT(void) +void printUnmarkedOops(void) { printOopsExcept(isMarked); @@ -47641,12 +47213,10 @@ shortentoIndexableSize(sqInt objOop, sqInt indexableSize) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#shortPrintObjectsFrom:to: */ -EXPORT(void) +void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -47784,7 +47354,7 @@ startOfObject(sqInt objOop) /* Part of InterpreterProxy's 1.14 API */ /* SpurMemoryManager>>#statNumGCs */ -EXPORT(sqInt) +sqInt statNumGCs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT return (GIV(statScavenges) + GIV(statIncrGCs)) + GIV(statFullGCs); @@ -47826,13 +47396,21 @@ storeCheckBoundary(void) The primitive can fail for the following reasons with the specified failure codes: - PrimErrGenericError: the segmentWordArray is too small for the version - stamp PrimErrWritePastObject: the segmentWordArray is too small to contain - the reachable objects - PrimErrBadIndex: the outPointerArray is too small - PrimErrNoMemory: additional allocations failed + PrimErrGenericFailure: the segmentWordArray is too small for the version + stamp PrimErrWritePastObject: the segmentWordArray is too small to + contain the reachable objects + PrimErrBadIndex: the outPointerArray is too small + PrimErrNoMemory: there is insufficient free space to store the array + answered by objectsReachableFromRoots:, + or the savedFirstFields and savedOutHashes arrays. + PrimErrNeedCompaction: a GC is needed to make room for the array answered + by objectsReachableFromRoots: PrimErrLimitExceeded: there is no room in the hash field to store out - pointer indices or class references. */ + pointer indices or class references, + or the outPointerArray is larger than the max value of the hash field. + PrimErrNoModification: the segmentWordArrayArg or outPointerArrayArg are + immutable PrimErrObjectIsPinned: the segmentWordArrayArg or + outPointerArrayArg are pinned */ /* SpurMemoryManager>>#storeImageSegmentInto:outPointers:roots: */ static sqInt NoDbgRegParms @@ -48085,6 +47663,7 @@ storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt val /* Note must check here for stores of young objects into old ones. */ +/* See SistaCogit */ /* SpurMemoryManager>>#storePointer:ofObject:withValue: */ sqInt @@ -48182,7 +47761,8 @@ sufficientSpaceAfterGC(sqInt numBytes) assert(numBytes == 0); scavengingGCTenuringIf(TenureByAge); - heapSizePostGC = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + heapSizePostGC = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); if (((((double) (heapSizePostGC - GIV(heapSizeAtPreviousGC)) )) / GIV(heapSizeAtPreviousGC)) >= GIV(heapGrowthToSizeGCRatio)) { fullGC(); } @@ -48801,6 +48381,9 @@ validClassTableRootPages(void) return 1; } + +/* useful for debugging */ + /* SpurMemoryManager>>#validFreeTree */ sqInt validFreeTree(void) @@ -49211,6 +48794,7 @@ copyAndUnmarkMobileObjects(void) usqInt previousPin; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt start; usqInt startOfPreviousPin; usqInt toFinger; @@ -49288,23 +48872,18 @@ copyAndUnmarkMobileObjects(void) assert((isMarked(previousPin)) && (isPinned(previousPin))); /* begin unmarkPinned: */ - if (!(((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(previousPin)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(previousPin))); longAtput(previousPin, (longAt(previousPin)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(previousPin)); - if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(previousPin))); - longAtput(previousPin, (longAt(previousPin)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), previousPin)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(previousPin)))); + seg = segmentContainingObj(previousPin); + (seg->containsPinned = 1); } toFinger = addressAfter(previousPin); /* begin objectStartingAt: */ @@ -49550,6 +49129,7 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) usqInt numSlots; sqInt obj; usqInt objStart; + SpurSegmentInfo *seg; usqInt toFinger; toFinger = initialToFinger; @@ -49572,23 +49152,18 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) if ((((((usqInt)((longAt(obj)))) >> (markedBitFullShift())) & 1) != 0) && (((((usqInt)((longAt(obj)))) >> (pinnedBitShift())) & 1) != 0)) { /* begin unmarkPinned: */ - if (!(((longAt(obj)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(obj)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(obj))); longAtput(obj, (longAt(obj)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(obj)); - if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(obj))); - longAtput(obj, (longAt(obj)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), obj)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(obj)))); + seg = segmentContainingObj(obj); + (seg->containsPinned = 1); } if (toFinger < objStart) { /* begin addFreeChunkWithBytes:at: */ @@ -50001,6 +49576,7 @@ unmarkObjectsFromFirstFreeObject(void) sqInt objOop; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt startOfFree; startOfFree = 0; @@ -50023,23 +49599,18 @@ unmarkObjectsFromFirstFreeObject(void) } if (((((usqInt)((longAt(objOop)))) >> (pinnedBitShift())) & 1) != 0) { /* begin unmarkPinned: */ - if (!(((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(objOop)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(objOop))); longAtput(objOop, (longAt(objOop)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(objOop)); - if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(objOop))); - longAtput(objOop, (longAt(objOop)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), objOop)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(objOop)))); + seg = segmentContainingObj(objOop); + (seg->containsPinned = 1); } } else { @@ -51065,9 +50636,11 @@ collapseSegmentsPostSwizzle(void) GIV(canSwizzle) = 0; GIV(numSegments) = 1; + /* begin computeTotalHeapSizeIncludingBridges */ + GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()); cascade0 = (&(GIV(segments)[0])); (cascade0->segStart = oldSpaceStart()); - (cascade0->segSize = (GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()))); + (cascade0->segSize = GIV(totalHeapSizeIncludingBridges)); assert(isSegmentBridge(bridgeAt(0))); assert((numSlotsOfAny(bridgeAt(0))) == 0); } @@ -51249,7 +50822,6 @@ prepareForSnapshot(void) usqInt followingWordAddress; usqInt freeChunk; sqInt i; - sqInt i1; sqInt largeChild; sqInt limit; sqInt newEndOfMemory; @@ -51297,24 +50869,16 @@ prepareForSnapshot(void) followingWordAddress = addressAfter(node); if (oopisGreaterThanOrEqualTo(followingWordAddress, limit)) { next = limit; - goto l9; + goto l7; } flag("endianness"); followingWord = longAt(followingWordAddress); next = ((((usqInt)(followingWord)) >> (numSlotsFullShift())) == (numSlotsMask()) ? followingWordAddress + BaseHeaderSize : followingWordAddress); - l9: /* end objectAfter:limit: */; + l7: /* end objectAfter:limit: */; if (((longAt(next)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin segmentContainingObj: */ - for (i1 = (GIV(numSegments) - 1); i1 >= 0; i1 += -1) { - if (node >= (((GIV(segments)[i1]).segStart))) { - seg = (&(GIV(segments)[i1])); - goto l8; - } - } - seg = null; - l8: /* end segmentContainingObj: */; + seg = segmentContainingObj(node); (seg->lastFreeObject = node); node = 0; } @@ -51429,17 +50993,51 @@ readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes) return totalBytesRead; } + +/* Answer the segment containing an object. This is mostly for assert + checking, but + variations on the incremental GC may use it in anger. Binary search is (of + course) marginally slower than linear search for a single segment (e.g. in + a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every + old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or + 20% faster + in the same heap extended with enough large arrays to require 11 segments; + and this + is pessimal; there are fewer objects at high addresses since the large + arrays are there). */ + /* SpurSegmentManager>>#segmentContainingObj: */ -EXPORT(SpurSegmentInfo *) +SpurSegmentInfo * segmentContainingObj(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; + sqInt high; + sqInt low; + sqInt mid; + SpurSegmentInfo *seg; - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - return (&(GIV(segments)[i])); + low = 0; + mid = GIV(numSegments) / 2; + high = GIV(numSegments) - 1; + do { + seg = (&(GIV(segments)[mid])); + if (oopisGreaterThanOrEqualTo(objOop, (seg->segStart))) { + if (mid == high) { + return (oopisLessThan(objOop, ((seg->segSize)) + ((seg->segStart))) + ? seg + : 0); + } + else { + low = mid; + mid = ((mid + high) + 1) / 2; + } } - } + else { + high = mid - 1; + mid = (low + mid) / 2; + } + } while(low <= high); return null; } @@ -51616,6 +51214,9 @@ swizzleObj(sqInt objOop) return objOop + (((GIV(segments)[0]).swizzle)); } + +/* This ``slow'' count is for asserts only. */ + /* SpurSegmentManager>>#totalBytesInSegments */ static usqInt totalBytesInSegments(void) @@ -51627,7 +51228,6 @@ totalBytesInSegments(void) for (i = 0; i < GIV(numSegments); i += 1) { total += ((GIV(segments)[i]).segSize); } - assert(GIV(totalHeapSizeIncludingBridges) == total); return total; } @@ -51736,12 +51336,10 @@ accessorDepthForPrimitiveMethod(sqInt aMethodObj) /* Answer the current activeProcess. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#activeProcess */ -EXPORT(sqInt) +sqInt activeProcess(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt objOop; @@ -52243,7 +51841,7 @@ booleanValueOf(sqInt obj) /* Re-enter the interpreter to execute a (non-Alien) callback. */ /* StackInterpreter>>#callbackEnter: */ -EXPORT(sqInt) +sqInt callbackEnter(sqInt *callbackID) { warning("callbackEnter: is obsolete"); @@ -52254,7 +51852,7 @@ callbackEnter(sqInt *callbackID) /* Leave from a previous callback */ /* StackInterpreter>>#callbackLeave: */ -EXPORT(sqInt) +sqInt callbackLeave(sqInt cbID) { warning("callbackLeave: is obsolete"); @@ -52308,12 +51906,10 @@ characterForAscii(sqInt ascii) /* Ensure that all accessible objects in the heap are okay. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkAllAccessibleObjectsOkay */ -EXPORT(sqInt) +sqInt checkAllAccessibleObjectsOkay(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -52815,12 +52411,10 @@ checkOkayFields(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkOkayInterpreterObjects: */ -EXPORT(sqInt) +sqInt checkOkayInterpreterObjects(sqInt writeBack) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -53243,19 +52837,10 @@ contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP) /* StackInterpreter>>#copiedValueCountOfClosure: */ sqInt -copiedValueCountOfClosure(sqInt closurePointer) -{ - return (numSlotsOf(closurePointer)) - ClosureFirstCopiedValueIndex; -} - - -/* for Cogit */ - - /* StackInterpreter>>#copiedValueCountOfFullClosure: */ -sqInt -copiedValueCountOfFullClosure(sqInt closurePointer) +copiedValueCountOfClosure(sqInt closureObj) { - return (numSlotsOf(closurePointer)) - FullClosureFirstCopiedValueIndex; + return (assert(isVanillaBlockClosure(closureObj)), + (numSlotsOf(closureObj)) - ClosureFirstCopiedValueIndex); } @@ -53785,7 +53370,7 @@ dumpPrimTraceLog(void) */ /* StackInterpreter>>#dumpPrimTraceLogOn: */ -EXPORT(void) +void dumpPrimTraceLogOn(FILE *aStdioStream) { } @@ -55602,19 +55187,6 @@ fullDisplayUpdate(void) } -/* Find an actual function pointer for this primitiveIndex. This is an - opportunity to specialise the prim for the relevant class (format for - example). Default for now is simply the entry in the base primitiveTable. */ - - /* StackInterpreter>>#functionPointerFor:inClass: */ -void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) -{ - return (primIdx > MaxPrimitiveIndex - ? 0 - : primitiveTable[primIdx]); -} - - /* Answer an array of flags indicating various optional features of the Cog VM. If the bit is set then... Bit 0: supports two bytecode sets (MULTIPLEBYTECODESETS) @@ -56658,6 +56230,21 @@ isSingleContext(sqInt aContext) } +/* Answer if aClosure is a vanilla BlockClosure as in the first Cog release, + BlockClosure laid out as + 'outerContext, startpc, numArgs. FullBlockClosure is laid out as + outerContext, method, numArgs, receiver. + So either answer true if we're not supporting FullBlockClosure, or test + the startpc/method field. */ + + /* StackInterpreter>>#isVanillaBlockClosure: */ +static sqInt NoDbgRegParms +isVanillaBlockClosure(sqInt aClosure) +{ + return 1; +} + + /* See if the argument is married to a live frame or not. i.e. see if there is a matching frame whose frameContext field is aOnceMarriedContext, or a forwarder to @@ -57074,12 +56661,10 @@ loadInitialContext(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#longPrintOop: */ -EXPORT(void) +void longPrintOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -60008,19 +59593,6 @@ pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod return pcPreviousToinSqueakV3PlusClosuresMethod(theIP, aMethod); } - /* StackInterpreter>>#penultimateLiteralOf: */ -sqInt -penultimateLiteralOf(sqInt aMethodOop) -{ - sqInt offset; - - assert(isOopCompiledMethod(aMethodOop)); - /* begin literal:ofMethod: */ - offset = (literalCountOf(aMethodOop)) - 2; - /* begin fetchPointer:ofObject: */ - return longAt((aMethodOop + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); -} - /* In the StackInterpreter stacks grow down. */ @@ -60998,12 +60570,10 @@ printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObjec /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacks */ -EXPORT(void) +void printAllStacks(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -61202,12 +60772,10 @@ printAllStacks(void) /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacksOn: */ -EXPORT(void) +void printAllStacksOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -61222,12 +60790,10 @@ printAllStacksOn(FILE *aStdioStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStack */ -EXPORT(void) +void printCallStack(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (GIV(framePointer) == null) { @@ -61261,12 +60827,10 @@ printCallStackFP(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOf: */ -EXPORT(sqInt) +sqInt printCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -61358,12 +60922,10 @@ printCallStackOfcurrentFP(sqInt aContext, char *currFP) /* Print the call stack on a specific output stream. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOn: */ -EXPORT(void) +void printCallStackOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -61397,12 +60959,10 @@ printContextCallStackOf(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printContext: */ -EXPORT(void) +void printContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -61522,12 +61082,10 @@ printContext(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printExternalHeadFrame */ -EXPORT(void) +void printExternalHeadFrame(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFrameWithSP(GIV(framePointer), GIV(stackPointer)); @@ -61608,19 +61166,20 @@ printFrameOopat(char *name, char *address) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFramesInPage: */ -EXPORT(void) +void printFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 0); } + +/* useful for VM debugging */ + /* StackInterpreter>>#printFramesOnStackPageListInUse */ -EXPORT(void) +void printFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -61693,12 +61252,10 @@ printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame: */ -EXPORT(sqInt) +sqInt printFrame(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *aFrame; @@ -61782,12 +61339,10 @@ printFrame(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame:WithSP: */ -EXPORT(sqInt) +sqInt printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -61841,18 +61396,6 @@ printFrameWithSP(char *theFP, char *theSP) } -/* Print n in hex, in the form '0x1234', unpadded */ - - /* StackInterpreter>>#printHexnp: */ -sqInt -printHexnp(usqInt n) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return fprintf(GIV(transcript), - "%p", - ((void *)n)); -} - - /* Print p in hex, unpadded, in the form 0x1234 (C)/16r1234 (here) */ /* StackInterpreter>>#printHexPtrnp: */ @@ -61884,12 +61427,10 @@ printHex(usqInt n) /* Print all methods whose penultimate literal is either selector, or an object whose first inst var is the method and whose second is selector (e.g. an AdditionalMethodState). */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printLikelyImplementorsOfSelector: */ -EXPORT(void) +void printLikelyImplementorsOfSelector(sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -61967,12 +61508,10 @@ printLikelyImplementorsOfSelector(sqInt selector) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCache */ -EXPORT(void) +void printMethodCache(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -62062,12 +61601,10 @@ printMethodCache(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCacheFor: */ -EXPORT(void) +void printMethodCacheFor(sqInt thing) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -62161,12 +61698,10 @@ printMethodCacheFor(sqInt thing) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionaryOf: */ -EXPORT(void) +void printMethodDictionaryOf(sqInt behavior) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt dictionary; @@ -62209,12 +61744,10 @@ printMethodDictionaryOf(sqInt behavior) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionary: */ -EXPORT(void) +void printMethodDictionary(sqInt dictionary) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt index; @@ -62494,10 +62027,10 @@ printOopShortInner(sqInt oop) } -/* use export: not api, so it won't be written to cointerp.h */ +/* useful for VM debugging */ /* StackInterpreter>>#printOop: */ -EXPORT(void) +void printOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -62679,12 +62212,10 @@ printOop(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcessStack: */ -EXPORT(void) +void printProcessStack(sqInt aProcess) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ctx; @@ -62723,12 +62254,10 @@ printProcessStack(sqInt aProcess) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcsOnList: */ -EXPORT(sqInt) +sqInt printProcsOnList(sqInt procList) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstProc; @@ -62754,12 +62283,10 @@ printProcsOnList(sqInt procList) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackCallStackOf: */ -EXPORT(sqInt) +sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -62792,12 +62319,10 @@ printStackCallStackOf(sqInt aContextOrProcessOrFrame) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageList */ -EXPORT(void) +void printStackPageList(void) { StackPage *page; @@ -62811,12 +62336,10 @@ printStackPageList(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageListInUse */ -EXPORT(void) +void printStackPageListInUse(void) { sqInt n; @@ -62833,12 +62356,10 @@ printStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPages */ -EXPORT(void) +void printStackPages(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -62853,12 +62374,10 @@ printStackPages(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPagesInUse */ -EXPORT(void) +void printStackPagesInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -62984,12 +62503,10 @@ printStackPageuseCount(StackPage *page, sqInt n) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackReferencesTo: */ -EXPORT(void) +void printStackReferencesTo(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *callerFP; @@ -63367,7 +62884,7 @@ putWord32toFile(int aWord32, sqImageFile aFile) } -/* Anwer true if images of the given format are readable by this interpreter. +/* Anwer if images of the given format are readable by this interpreter. Allows a virtual machine to accept selected older image formats. */ /* StackInterpreter>>#readableFormat: */ @@ -63818,7 +63335,7 @@ reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader) and mark calloutContext as dead. */ /* StackInterpreter>>#reestablishContextPriorToCallback: */ -EXPORT(sqInt) +sqInt reestablishContextPriorToCallback(sqInt callbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; @@ -64350,7 +63867,7 @@ retryPrimitiveOnFailure(void) and mark callbackMethodContext as dead. */ /* StackInterpreter>>#returnAs:ThroughCallback:Context: */ -EXPORT(sqInt) +sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutMethodContext; @@ -64681,7 +64198,7 @@ saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex) arguments on primitive return. */ /* StackInterpreter>>#sendInvokeCallbackContext: */ -EXPORT(sqInt) +sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classTag; @@ -64826,12 +64343,10 @@ GIV(bytecodeSetSelector) = ((((sqLong) methodHeader)) < 0 } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakMNUSelector: */ -EXPORT(void) +void setBreakMNUSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -64845,12 +64360,10 @@ setBreakMNUSelector(char *aString) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakSelector: */ -EXPORT(void) +void setBreakSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -64871,7 +64384,7 @@ setFullScreenFlag(sqInt value) } /* StackInterpreter>>#setInterruptCheckChain: */ -EXPORT(void *) +void * setInterruptCheckChain(void (*aFunction)()) { void (*prevFunction)(); @@ -64993,6 +64506,7 @@ static sqInt NoDbgRegParms shortPrintContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt home; + sqInt rcvr; sqInt senderOop; char *theFP; @@ -65030,15 +64544,16 @@ shortPrintContext(sqInt aContext) if (home == null) { /* begin print: */ fprintf(GIV(transcript), " BOGUS CONTEXT (can't determine home)"); + cr(); } else { - printActivationNameForreceiverisBlockfirstTemporary(fetchPointerofObject(MethodIndex, (!(home) - ? aContext - : home)), (home == null - ? /* begin nilObject */ GIV(nilObj) - : (longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)(ReceiverIndex) << (shiftForWord()))))))), home != aContext, longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin fetchPointer:ofObject: */ + rcvr = longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)(ReceiverIndex) << (shiftForWord()))))); + printActivationNameForreceiverisBlockfirstTemporary(longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))), rcvr, home != aContext, longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin space */ + printChar(' '); + shortPrintOop(rcvr); } - cr(); return 0; } @@ -65058,19 +64573,20 @@ shortPrintFrameAndCallers(char *theFP) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFramesInPage: */ -EXPORT(void) +void shortPrintFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 1); } + +/* useful for VM debugging */ + /* StackInterpreter>>#shortPrintFramesOnStackPageListInUse */ -EXPORT(void) +void shortPrintFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -65117,12 +64633,10 @@ shortPrintFrame(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFrame:AndNCallers: */ -EXPORT(void) +void shortPrintFrameAndNCallers(char *theFP, sqInt n) { DECL_MAYBE_SQ_GLOBAL_STRUCT if ((n != 0) @@ -67517,12 +67031,10 @@ wakeHighestPriority(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#whereIs: */ -EXPORT(char *) +char * whereIs(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *where; @@ -72328,7 +71840,8 @@ primitiveUnloadModule(void) 48 various header flags. See getImageHeaderFlags. 49 max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing) - 50 max literal count for JIT compile (stored in image file header; Cog + + 50 max literal count for JIT compile (stored in image file header; Cog only; otherwise nil) 51 nil; reserved for VM parameters that persist in the image (such as eden above) 52 root/remembered table capacity @@ -72469,7 +71982,8 @@ primitiveVMParameter(void) /* begin primitiveAllVMParameters: */ result1 = instantiateClassindexableSize(splObj(ClassArray), paramsArraySize); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer8 = positiveMachineIntegerFor(totalBytesInSegments()); + valuePointer8 = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (0U << (shiftForWord())), valuePointer8); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -72477,7 +71991,8 @@ primitiveVMParameter(void) assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (1U << (shiftForWord())), valuePointer9); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (2U << (shiftForWord())), valuePointer10); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -72813,7 +72328,8 @@ primitiveVMParameter(void) /* begin primitiveGetVMParameter: */ switch (index) { case 1: - result = positiveMachineIntegerFor(totalBytesInSegments()); + result = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); goto l93; break; case 2: @@ -72821,7 +72337,8 @@ primitiveVMParameter(void) goto l93; break; case 3: - result = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + result = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); goto l93; break; case 6: @@ -73783,17 +73300,6 @@ unmarkAllFrames(void) static char _m[] = ""; void* vm_exports[][3] = { - {(void*)_m, "activeProcess", (void*)activeProcess}, - {(void*)_m, "callbackEnter", (void*)callbackEnter}, - {(void*)_m, "callbackLeave", (void*)callbackLeave}, - {(void*)_m, "checkAllAccessibleObjectsOkay", (void*)checkAllAccessibleObjectsOkay}, - {(void*)_m, "checkOkayInterpreterObjects", (void*)checkOkayInterpreterObjects}, - {(void*)_m, "dumpPrimTraceLogOn", (void*)dumpPrimTraceLogOn}, - {(void*)_m, "inOrderPrintFreeTreeprintList", (void*)inOrderPrintFreeTreeprintList}, - {(void*)_m, "longPrintInstancesOf", (void*)longPrintInstancesOf}, - {(void*)_m, "longPrintInstancesWithClassIndex", (void*)longPrintInstancesWithClassIndex}, - {(void*)_m, "longPrintOop", (void*)longPrintOop}, - {(void*)_m, "longPrintReferencesTo", (void*)longPrintReferencesTo}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, {(void*)_m, "primitiveAddLargeIntegers\000\000\001", (void*)primitiveAddLargeIntegers}, {(void*)_m, "primitiveAllInstances\000\000\000", (void*)primitiveAllInstances}, @@ -73857,69 +73363,5 @@ void* vm_exports[][3] = { #endif /* TestingPrimitives */ {(void*)_m, "primitiveUtcWithOffset\000\001\000", (void*)primitiveUtcWithOffset}, {(void*)_m, "primitiveVoidReceiver\000\377\000", (void*)primitiveVoidReceiver}, - {(void*)_m, "printActivationsOf", (void*)printActivationsOf}, - {(void*)_m, "printAllStacks", (void*)printAllStacks}, - {(void*)_m, "printAllStacksOn", (void*)printAllStacksOn}, - {(void*)_m, "printBogons", (void*)printBogons}, - {(void*)_m, "printCallStack", (void*)printCallStack}, - {(void*)_m, "printCallStackOf", (void*)printCallStackOf}, - {(void*)_m, "printCallStackOn", (void*)printCallStackOn}, - {(void*)_m, "printContextReferencesTo", (void*)printContextReferencesTo}, - {(void*)_m, "printContext", (void*)printContext}, - {(void*)_m, "printEntity", (void*)printEntity}, - {(void*)_m, "printExternalHeadFrame", (void*)printExternalHeadFrame}, - {(void*)_m, "printForwarders", (void*)printForwarders}, - {(void*)_m, "printFramesInPage", (void*)printFramesInPage}, - {(void*)_m, "printFramesOnStackPageListInUse", (void*)printFramesOnStackPageListInUse}, - {(void*)_m, "printFrame", (void*)printFrame}, - {(void*)_m, "printFrameWithSP", (void*)printFrameWithSP}, - {(void*)_m, "printFreeChunk", (void*)printFreeChunk}, - {(void*)_m, "printFreeListHeads", (void*)printFreeListHeads}, - {(void*)_m, "printFreeList", (void*)printFreeList}, - {(void*)_m, "printFreeTree", (void*)printFreeTree}, - {(void*)_m, "printHeaderOf", (void*)printHeaderOf}, - {(void*)_m, "printInstancesOf", (void*)printInstancesOf}, - {(void*)_m, "printInstancesWithClassIndex", (void*)printInstancesWithClassIndex}, - {(void*)_m, "printLikelyImplementorsOfSelector", (void*)printLikelyImplementorsOfSelector}, -#if LLDB - {(void*)_m, "printMarkedOops", (void*)printMarkedOops}, -#endif /* LLDB */ - {(void*)_m, "printMethodCache", (void*)printMethodCache}, - {(void*)_m, "printMethodCacheFor", (void*)printMethodCacheFor}, - {(void*)_m, "printMethodDictionaryOf", (void*)printMethodDictionaryOf}, - {(void*)_m, "printMethodDictionary", (void*)printMethodDictionary}, - {(void*)_m, "printMethodImplementorsOf", (void*)printMethodImplementorsOf}, - {(void*)_m, "printMethodReferencesTo", (void*)printMethodReferencesTo}, - {(void*)_m, "printObjectsFromto", (void*)printObjectsFromto}, - {(void*)_m, "printObjectsWithHash", (void*)printObjectsWithHash}, - {(void*)_m, "printOopsExcept", (void*)printOopsExcept}, - {(void*)_m, "printOopsFromto", (void*)printOopsFromto}, - {(void*)_m, "printOopsSuchThat", (void*)printOopsSuchThat}, - {(void*)_m, "printOop", (void*)printOop}, - {(void*)_m, "printProcessStack", (void*)printProcessStack}, - {(void*)_m, "printProcsOnList", (void*)printProcsOnList}, - {(void*)_m, "printReferencesTo", (void*)printReferencesTo}, - {(void*)_m, "printStackCallStackOf", (void*)printStackCallStackOf}, - {(void*)_m, "printStackPageList", (void*)printStackPageList}, - {(void*)_m, "printStackPageListInUse", (void*)printStackPageListInUse}, - {(void*)_m, "printStackPages", (void*)printStackPages}, - {(void*)_m, "printStackPagesInUse", (void*)printStackPagesInUse}, - {(void*)_m, "printStackReferencesTo", (void*)printStackReferencesTo}, -#if LLDB - {(void*)_m, "printUnmarkedOops", (void*)printUnmarkedOops}, -#endif /* LLDB */ - {(void*)_m, "reestablishContextPriorToCallback", (void*)reestablishContextPriorToCallback}, - {(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext}, - {(void*)_m, "segmentContainingObj", (void*)segmentContainingObj}, - {(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext}, - {(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector}, - {(void*)_m, "setBreakSelector", (void*)setBreakSelector}, - {(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain}, - {(void*)_m, "shortPrintFramesInPage", (void*)shortPrintFramesInPage}, - {(void*)_m, "shortPrintFramesOnStackPageListInUse", (void*)shortPrintFramesOnStackPageListInUse}, - {(void*)_m, "shortPrintFrameAndNCallers", (void*)shortPrintFrameAndNCallers}, - {(void*)_m, "shortPrintObjectsFromto", (void*)shortPrintObjectsFromto}, - {(void*)_m, "statNumGCs", (void*)statNumGCs}, - {(void*)_m, "whereIs", (void*)whereIs}, {NULL, NULL, NULL} }; diff --git a/src/spur64.stack.newspeak/interp.c b/src/spur64.stack.newspeak/interp.c index d5fa925624..a32a4b1cb7 100644 --- a/src/spur64.stack.newspeak/interp.c +++ b/src/spur64.stack.newspeak/interp.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 + StackInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3310 uuid: ccb9d141-68dd-4a1a-86b9-906b72753322 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -157,7 +157,6 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define GCCheckShorten 64 #define GCModeBecome 8 #define GCModeFull 1 -#define GCModeIncremental 4 #define GCModeNewSpace 2 #define HashMultiplyConstant 1664525 #define HeaderIndex 0 @@ -250,6 +249,7 @@ warningat(const char *s, int l) { /* ditto with line number. */ #define SelectorStart 2 #define SelectorUnknownBytecode 57 #define SenderIndex 0 +#define SistaV1BytecodeSet 0 #define SlidingCompactionInProgress 2 #define SmallContextSlots 22 #define SpecialSelectors 23 @@ -643,9 +643,7 @@ static void NoDbgRegParms hackSlimBridgeToat(sqInt objOop, sqInt startAddress); extern sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader); static sqInt NoDbgRegParms initFreeChunkWithBytesat(usqLong numBytes, sqInt address); static void NoDbgRegParms initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address); -extern sqInt inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt instantiateClassindexableSize(sqInt classObj, usqInt nElements); -extern sqInt instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements); extern sqInt integerObjectOf(sqInt value); extern sqInt integerValueOf(sqInt oop); static sqInt NoDbgRegParms isFloatInstance(sqInt oop); @@ -727,8 +725,6 @@ extern sqInt characterObjectOf(sqInt characterCode); extern void characterTable(void); extern usqInt characterValueOf(sqInt oop); extern sqInt checkedLongAt(sqInt byteAddress); -extern void checkFreeSpace(sqInt gcModes); -extern void checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore); static sqInt checkHeapFreeSpaceIntegrity(void); static sqInt NoDbgRegParms checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt classIndicesShouldBeValid); extern sqInt checkOkayOop(usqInt oop); @@ -772,13 +768,13 @@ static void clearLeakMapAndMapAccessibleFreeSpace(void); static void clearLeakMapAndMapAccessibleObjects(void); static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning); extern sqInt cloneObject(sqInt objOop); -extern sqInt compactClassIndexOf(sqInt objOop); +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop); static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i); extern void countMarkedAndUnmarkdObjects(sqInt printFlags); static usqLong currentAllocatedBytes(void); extern sqInt displayObject(void); static void NoDbgRegParms doScavenge(sqInt tenuringCriterion); -extern sqInt doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize); extern usqInt eeInstantiateClassIndexformatnumSlots(sqInt knownClassIndex, sqInt objFormat, sqInt numSlots); static void NoDbgRegParms emptyObjStack(sqInt objStack); static void NoDbgRegParms enableObjectEnumerationFrom(sqInt initialObject); @@ -810,7 +806,7 @@ static sqInt NoDbgRegParms fixedFieldsOfClass(sqInt objOop); static sqInt NoDbgRegParms fixedFieldsOfformatlength(sqInt objOop, sqInt fmt, sqInt wordLength); static sqInt NoDbgRegParms NeverInline fixFollowedFieldofObjectwithInitialValue(sqInt fieldIndex, sqInt anObject, sqInt initialValue); static sqInt NoDbgRegParms followFieldofObject(sqInt fieldIndex, sqInt anObject); -extern sqInt followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth); extern sqInt followForwarded(sqInt objOop); static sqInt NoDbgRegParms followMaybeForwarded(sqInt objOop); static sqInt NoDbgRegParms followObjFieldofObject(sqInt fieldIndex, sqInt anObject); @@ -836,12 +832,11 @@ static sqInt imageSegmentVersion(void); extern sqInt immutableBitMask(void); #endif /* IMMUTABILITY */ extern void incrementalGC(void); -extern sqInt indexOfin(sqInt anElement, sqInt anObject); static void NoDbgRegParms inFreeTreeReplacewith(sqInt treeNode, sqInt newNode); static sqInt NoDbgRegParms initialInstanceOf(sqInt classObj); static void NeverInline initializeNewSpaceVariables(void); static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift); -EXPORT(void) inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); +extern void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList); static void NoDbgRegParms NeverInline inPlaceBecomeandcopyHashFlag(sqInt obj1, sqInt obj2, sqInt copyHashFlag); extern sqInt instanceSizeOf(sqInt classObj); static sqInt NoDbgRegParms instantiateClass(sqInt classObj); @@ -849,7 +844,6 @@ extern sqInt instSpecOfClassFormat(sqInt classFormat); static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer); static void NoDbgRegParms invalidCompactClassError(const char *className); static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format); -extern sqInt isArrayNonImm(sqInt oop); extern sqInt isArray(sqInt oop); static sqInt NoDbgRegParms isBridgeOrEnumerableObjectNoAssert(sqInt objOop); extern sqInt isBytes(sqInt oop); @@ -887,7 +881,7 @@ static sqInt NoDbgRegParms isMaybeFiredEphemeron(sqInt objOop); extern sqInt isNonImmediate(sqInt oop); static sqInt NoDbgRegParms isObjEphemeron(sqInt objOop); static sqInt NoDbgRegParms isObjImmutable(sqInt anOop); -extern sqInt isOldObject(sqInt objOop); +static sqInt NoDbgRegParms isOldObject(sqInt objOop); extern sqInt isOopCompiledMethod(sqInt oop); extern sqInt isOopForwarded(sqInt oop); extern sqInt isOopImmutable(sqInt oop); @@ -896,11 +890,10 @@ extern sqInt isPinned(sqInt objOop); extern sqInt isPointers(sqInt oop); static sqInt NoDbgRegParms isPureBitsFormat(sqInt format); extern sqInt isReallyYoungObject(sqInt obj); -extern sqInt isReallyYoung(sqInt oop); static sqInt NoDbgRegParms isRemembered(sqInt objOop); static sqInt NoDbgRegParms isSegmentBridge(sqInt objOop); extern sqInt isShorts(sqInt oop); -extern sqInt isUnambiguouslyForwarder(sqInt objOop); +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop); extern sqInt isUnmarked(sqInt objOop); extern sqInt isValidClassTag(sqInt classIndex); static sqInt NoDbgRegParms isValidObjStackAt(sqInt objStackRootIndex); @@ -921,20 +914,18 @@ static sqInt NoDbgRegParms isonObjStack(sqInt oop, sqInt objStack); static sqInt NoDbgRegParms keyOfEphemeron(sqInt objOop); static sqInt NoDbgRegParms knownClassAtIndex(sqInt classIndex); static sqInt lastPointerFormat(void); -extern sqInt lastPointerOfWhileSwizzling(sqInt objOop); -extern sqInt lastPointerOf(sqInt objOop); -extern sqInt leakCheckBecome(void); +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop); +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop); extern sqInt leakCheckFullGC(void); -extern sqInt leakCheckIncremental(void); extern sqInt leakCheckNewSpaceGC(void); static sqInt NoDbgRegParms lengthOfMaybeImmediate(sqInt oop); static sqInt NoDbgRegParms lengthOf(sqInt objOop); extern sqInt literalCountOfMethodHeader(sqInt header); extern sqInt literalCountOf(sqInt methodPointer); static sqInt NoDbgRegParms NeverInline loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray); -EXPORT(void) longPrintInstancesOf(sqInt aClassOop); -EXPORT(void) longPrintInstancesWithClassIndex(sqInt classIndex); -EXPORT(void) longPrintReferencesTo(sqInt anOop); +extern void longPrintInstancesOf(sqInt aClassOop); +extern void longPrintInstancesWithClassIndex(sqInt classIndex); +extern void longPrintReferencesTo(sqInt anOop); static void mapExtraRoots(void); static void NeverInline mapMournQueue(void); static sqInt NoDbgRegParms mapOopsFromtooutPointersoutHashes(sqInt segStart, sqInt segAddr, sqInt outPointerArray, sqInt savedOutHashes); @@ -946,7 +937,6 @@ static void NoDbgRegParms NeverInline markObjects(sqInt objectsShouldBeUnmarkedA static void markWeaklingsAndMarkAndFireEphemerons(void); extern sqInt maxSlotsForNewSpaceAlloc(void); extern sqInt maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format); -extern sqInt maybeSplObj(sqInt index); static sqInt NoDbgRegParms methodHeaderOf(sqInt methodObj); extern sqInt minSlotsForShortening(void); static usqInt newObjectHash(void); @@ -964,12 +954,11 @@ static sqInt noUnscannedEphemerons(void); static sqInt NoDbgRegParms numBytesOfBitsformat(sqInt objOop, sqInt format); static sqInt NoDbgRegParms numBytesOfBytes(sqInt objOop); extern sqInt numBytesOf(sqInt objOop); -extern usqInt numPointerSlotsOf(sqInt objOop); +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numSlotsForBytes(sqInt numBytes); static usqInt NoDbgRegParms numSlotsOfAny(sqInt objOop); extern usqInt numSlotsOf(sqInt objOop); static sqInt NoDbgRegParms numStrongSlotsOfInephemeral(sqInt objOop); -extern sqInt numStrongSlotsOfWeakling(sqInt objOop); extern sqInt objectAfter(sqInt objOop); extern sqInt objectBefore(sqInt objOop); static sqInt NoDbgRegParms objectInPastSpaceBefore(sqInt objOop); @@ -984,45 +973,46 @@ static sqInt NoDbgRegParms popObjStack(sqInt objStack); extern sqInt popRemappableOop(void); static void NoDbgRegParms postBecomeScanClassTable(sqInt effectsFlags); extern sqInt primitiveErrorTable(void); -EXPORT(void) printActivationsOf(sqInt aMethodObj); -EXPORT(void) printBogons(void); +extern void printActivationsOf(sqInt aMethodObj); +extern void printBogons(void); +static void NoDbgRegParms printBridgeon(sqInt oop, FILE *aStream); static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printContextReferencesTo(sqInt anOop); -EXPORT(void) printEntity(sqInt oop); -EXPORT(void) printForwarders(void); +extern void printContextReferencesTo(sqInt anOop); +extern void printEntity(sqInt oop); +extern void printForwarders(void); static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream); extern void printFreeChunks(void); -EXPORT(void) printFreeChunk(sqInt freeChunk); +extern void printFreeChunk(sqInt freeChunk); static void NoDbgRegParms printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode); -EXPORT(void) printFreeListHeads(void); -EXPORT(sqInt) printFreeList(sqInt chunkOrIndex); +extern void printFreeListHeads(void); +extern sqInt printFreeList(sqInt chunkOrIndex); static void NoDbgRegParms printFreeObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printFreeTree(void); +extern void printFreeTree(void); static void NoDbgRegParms printFreeTreeChunk(sqInt chunkOrZero); -EXPORT(void) printHeaderOf(sqInt objOop); +extern void printHeaderOf(sqInt objOop); static void NoDbgRegParms printImmediateObjecton(sqInt oop, FILE *aStream); -EXPORT(void) printInstancesOf(sqInt aClassOop); -EXPORT(void) printInstancesWithClassIndex(sqInt classIndex); +extern void printInstancesOf(sqInt aClassOop); +extern void printInstancesWithClassIndex(sqInt classIndex); extern void printInvalidClassTableEntries(void); #if LLDB -EXPORT(void) printMarkedOops(void); +extern void printMarkedOops(void); #endif /* LLDB */ -EXPORT(void) printMethodImplementorsOf(sqInt anOop); -EXPORT(void) printMethodReferencesTo(sqInt anOop); +extern void printMethodImplementorsOf(sqInt anOop); +extern void printMethodReferencesTo(sqInt anOop); static void NoDbgRegParms printNonPointerDataOfon(sqInt oop, FILE *aStream); -EXPORT(void) printObjectsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) printObjectsWithHash(sqInt hash); +extern void printObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void printObjectsWithHash(sqInt hash); +extern void printObjStackAndContents(sqInt objStack); static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents); static void NoDbgRegParms printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType); extern void printObjStack(sqInt objStack); -extern void printObjStackprintContents(sqInt objStack, sqInt printContents); -EXPORT(void) NeverInline printOopsExcept(sqInt (*function)(sqInt)); -EXPORT(void) printOopsFromto(sqInt startAddress, sqInt endAddress); -EXPORT(void) NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); -EXPORT(void) printReferencesTo(sqInt anOop); +extern void NeverInline printOopsExcept(sqInt (*function)(sqInt)); +extern void printOopsFromto(sqInt startAddress, sqInt endAddress); +extern void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)); +extern void printReferencesTo(sqInt anOop); static void NoDbgRegParms printStringDataOfon(sqInt oop, FILE *aStream); #if LLDB -EXPORT(void) printUnmarkedOops(void); +extern void printUnmarkedOops(void); #endif /* LLDB */ static sqInt NoDbgRegParms pushOnUnscannedEphemeronsStack(sqInt anEphemeron); extern void pushRemappableOop(sqInt oop); @@ -1039,14 +1029,14 @@ static void NoDbgRegParms runLeakCheckerForexcludeUnmarkedObjsclassIndicesShould static void NoDbgRegParms scavengingGCTenuringIf(sqInt tenuringCriterion); static sqInt NoDbgRegParms NeverInline setHeapBasememoryLimitendOfMemory(sqInt baseOfHeap, sqInt memLimit, sqInt memEnd); extern sqInt shortentoIndexableSize(sqInt objOop, sqInt indexableSize); -EXPORT(void) shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); +extern void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress); extern sqInt shouldRemapOop(sqInt oop); static sqInt NoDbgRegParms sizeOfObjStack(sqInt objStack); static sqInt slidingCompactionInProgress(void); extern sqInt slotSizeOf(sqInt oop); extern sqInt splObj(sqInt index); static usqInt NoDbgRegParms startOfObject(sqInt objOop); -EXPORT(sqInt) statNumGCs(void); +extern sqInt statNumGCs(void); extern usqInt storeCheckBoundary(void); static sqInt NoDbgRegParms storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointerArrayArg, sqInt arrayOfRootsArg); extern sqInt storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord); @@ -1110,7 +1100,7 @@ static SpurSegmentInfo * NoDbgRegParms nextNonEmptySegmentAfter(sqInt i); static void postSnapshot(void); static void NeverInline prepareForSnapshot(void); static sqInt NoDbgRegParms readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes); -EXPORT(SpurSegmentInfo *) segmentContainingObj(sqInt objOop); +extern SpurSegmentInfo * segmentContainingObj(sqInt objOop); static sqInt segmentOverlap(void); static sqInt NoDbgRegParms shrinkObjectMemory(usqInt delta); static sqInt someSegmentContainsPinned(void); @@ -1120,7 +1110,7 @@ static sqInt NoDbgRegParms writeImageSegmentsToFile(sqImageFile aBinaryStream); static sqInt NoDbgRegParms writeSegmentnextSegmenttoFile(SpurSegmentInfo *segment, SpurSegmentInfo *nextSegment, sqImageFile aBinaryStream); static sqInt NoDbgRegParms accessModifierOfMethod(sqInt methodObj); extern sqInt accessorDepthForPrimitiveMethod(sqInt aMethodObj); -EXPORT(sqInt) activeProcess(void); +extern sqInt activeProcess(void); extern void addIdleUsecs(sqInt idleUsecs); static void NoDbgRegParms addLastLinktoList(sqInt proc, sqInt aList); static void NoDbgRegParms addNewMethodToCache(sqInt classObj); @@ -1136,11 +1126,11 @@ extern void assertValidExecutionPointers(usqInt lip, char *lifp, char *lisp); static void NoDbgRegParms assertValidExecutionPointersimbarline(usqInt lip, char *lfp, char *lsp, sqInt inInterpreter, sqInt ln); static void NoDbgRegParms backupContexttoBlockingSendTo(sqInt suspendedContext, sqInt conditionVariable); extern sqInt booleanValueOf(sqInt obj); -EXPORT(sqInt) callbackEnter(sqInt *callbackID); -EXPORT(sqInt) callbackLeave(sqInt cbID); +extern sqInt callbackEnter(sqInt *callbackID); +extern sqInt callbackLeave(sqInt cbID); extern sqInt canContextSwitchIfActivatingheader(sqInt theMethod, sqInt methodHeader); extern sqInt characterForAscii(sqInt ascii); -EXPORT(sqInt) checkAllAccessibleObjectsOkay(void); +extern sqInt checkAllAccessibleObjectsOkay(void); static sqInt NoDbgRegParms checkCodeIntegrity(sqInt fullGCFlag); #if LRPCheck static sqInt NeverInline checkDeliveryOfLongRunningPrimitiveSignal(void); @@ -1151,7 +1141,7 @@ static sqInt NoDbgRegParms checkImageVersionFromstartingAt(sqImageFile f, squeak static sqInt checkInterpreterIntegrity(void); static sqInt NoDbgRegParms checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP); static sqInt NoDbgRegParms checkOkayFields(sqInt oop); -EXPORT(sqInt) checkOkayInterpreterObjects(sqInt writeBack); +extern sqInt checkOkayInterpreterObjects(sqInt writeBack); static sqInt NoDbgRegParms checkOkayStackPage(StackPage *thePage); static sqInt NoDbgRegParms checkOkayStackZone(sqInt writeBack); static void NoDbgRegParms checkProfileTick(sqInt aPrimitiveMethod); @@ -1161,8 +1151,7 @@ static sqInt NoDbgRegParms checkStackPointerIndexForFrame(char *theFP); static sqInt NoDbgRegParms classNameOfIs(sqInt aClass, char *className); static sqInt NoDbgRegParms contexthasSender(sqInt thisCntx, sqInt aContext); static sqInt NoDbgRegParms contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP); -extern sqInt copiedValueCountOfClosure(sqInt closurePointer); -extern sqInt copiedValueCountOfFullClosure(sqInt closurePointer); +extern sqInt copiedValueCountOfClosure(sqInt closureObj); extern sqInt copyBits(void); extern sqInt copyBitsFromtoat(sqInt x0, sqInt x1, sqInt y); static sqInt NoDbgRegParms NeverInline couldBeProcess(sqInt oop); @@ -1176,7 +1165,7 @@ static sqInt NoDbgRegParms doPrimitiveModby(sqInt rcvr, sqInt arg); extern sqInt doSignalSemaphoreWithIndex(sqInt index); static void dummyReferToProxy(void); extern void dumpPrimTraceLog(void); -EXPORT(void) dumpPrimTraceLogOn(FILE *aStdioStream); +extern void dumpPrimTraceLogOn(FILE *aStdioStream); extern void NeverInline eekcr(void); static sqInt NoDbgRegParms enclosingObjectAtwithObjectwithMixin(sqInt depth, sqInt methodReceiver, sqInt methodMixin); static sqInt NoDbgRegParms ensureCallerContext(char *theFP); @@ -1223,7 +1212,6 @@ static sqInt NoDbgRegParms frameReceiver(char *theFP); static sqInt NoDbgRegParms frameStackedReceiverOffset(char *theFP); static void freeUntracedStackPages(void); extern sqInt fullDisplayUpdate(void); -extern void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void); static sqInt getCogVMFeatureFlags(void); extern sqInt getCurrentBytecode(void); static sqInt getDesiredCogCodeSize(void); @@ -1273,6 +1261,7 @@ static sqInt isPrimitiveFunctionPointerAnIndex(void); extern sqInt isQuickPrimitiveIndex(sqInt anInteger); extern sqInt isReadMediatedContextInstVarIndex(sqInt index); static sqInt NoDbgRegParms isSingleContext(sqInt aContext); +static sqInt NoDbgRegParms isVanillaBlockClosure(sqInt aClosure); static sqInt NoDbgRegParms isWidowedContextDuringGC(sqInt aOnceMarriedContext); static sqInt NoDbgRegParms isWidowedContextNoConvert(sqInt aOnceMarriedContext); static sqInt NoDbgRegParms isWidowedContext(sqInt aOnceMarriedContext); @@ -1284,7 +1273,7 @@ static sqInt NoDbgRegParms lengthOfNameOfClass(sqInt classOop); extern sqInt literalofMethod(sqInt offset, sqInt methodPointer); extern sqInt loadBitBltFrom(sqInt bb); extern void loadInitialContext(void); -EXPORT(void) longPrintOop(sqInt oop); +extern void longPrintOop(sqInt oop); extern sqInt longStoreBytecodeForHeader(sqInt methodHeader); static sqInt NoDbgRegParms lookupInMethodCacheSelclassTag(sqInt selector, sqInt classTag); static sqInt NoDbgRegParms lookupLexicalfromrule(sqInt selector, sqInt mixin, sqInt rule); @@ -1334,7 +1323,6 @@ static sqInt NoDbgRegParms objectequalsString(sqInt anOop, char *aCString); extern sqInt ownVM(sqInt threadIndexAndFlags); static sqInt NoDbgRegParms pcPreviousToinSqueakV3PlusClosuresMethod(sqInt theIP, sqInt aMethod); extern sqInt pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod); -extern sqInt penultimateLiteralOf(sqInt aMethodOop); extern sqInt popStack(void); extern sqInt pop(sqInt nItems); extern void popthenPush(sqInt nItems, sqInt oop); @@ -1352,45 +1340,44 @@ extern sqInt primitiveIndexOfMethodheader(sqInt theMethod, sqInt methodHeader); extern sqInt primitiveIndexOf(sqInt methodPointer); static void NoDbgRegParms printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void NoDbgRegParms printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); -EXPORT(void) printAllStacks(void); -EXPORT(void) printAllStacksOn(FILE *aStdioStream); -EXPORT(void) printCallStack(void); +extern void printAllStacks(void); +extern void printAllStacksOn(FILE *aStdioStream); +extern void printCallStack(void); static sqInt NoDbgRegParms printCallStackFP(char *theFP); -EXPORT(sqInt) printCallStackOf(sqInt aContextOrProcessOrFrame); +extern sqInt printCallStackOf(sqInt aContextOrProcessOrFrame); static sqInt NoDbgRegParms printCallStackOfcurrentFP(sqInt aContext, char *currFP); -EXPORT(void) printCallStackOn(FILE *aStdioStream); +extern void printCallStackOn(FILE *aStdioStream); static sqInt NoDbgRegParms printContextCallStackOf(sqInt aContext); -EXPORT(void) printContext(sqInt aContext); -EXPORT(void) printExternalHeadFrame(void); +extern void printContext(sqInt aContext); +extern void printExternalHeadFrame(void); static sqInt NoDbgRegParms printFrameAndCallersSPshort(char *theFP, char *theSP, sqInt printShort); static void NoDbgRegParms printFrameFlagsForFP(char *theFP); static void NoDbgRegParms printFrameOopat(char *name, char *address); -EXPORT(void) printFramesInPage(StackPage *thePage); -EXPORT(void) printFramesOnStackPageListInUse(void); +extern void printFramesInPage(StackPage *thePage); +extern void printFramesOnStackPageListInUse(void); static void NoDbgRegParms printFrameThingandFrameat(char *name, char *theFP, char *address); static void NoDbgRegParms printFrameThingatextraString(char *name, char *address, char *extraStringOrNil); -EXPORT(sqInt) printFrame(char *theFP); -EXPORT(sqInt) printFrameWithSP(char *theFP, char *theSP); -extern sqInt printHexnp(usqInt n); +extern sqInt printFrame(char *theFP); +extern sqInt printFrameWithSP(char *theFP, char *theSP); static sqInt NoDbgRegParms printHexPtrnp(void *p); extern void printHex(usqInt n); -EXPORT(void) printLikelyImplementorsOfSelector(sqInt selector); -EXPORT(void) printMethodCache(void); -EXPORT(void) printMethodCacheFor(sqInt thing); -EXPORT(void) printMethodDictionaryOf(sqInt behavior); -EXPORT(void) printMethodDictionary(sqInt dictionary); +extern void printLikelyImplementorsOfSelector(sqInt selector); +extern void printMethodCache(void); +extern void printMethodCacheFor(sqInt thing); +extern void printMethodDictionaryOf(sqInt behavior); +extern void printMethodDictionary(sqInt dictionary); static void NoDbgRegParms printNameOfClasscount(sqInt classOop, sqInt cnt); static void NoDbgRegParms printOopShortInner(sqInt oop); -EXPORT(void) printOop(sqInt oop); -EXPORT(void) printProcessStack(sqInt aProcess); -EXPORT(sqInt) printProcsOnList(sqInt procList); -EXPORT(sqInt) printStackCallStackOf(sqInt aContextOrProcessOrFrame); -EXPORT(void) printStackPageList(void); -EXPORT(void) printStackPageListInUse(void); -EXPORT(void) printStackPages(void); -EXPORT(void) printStackPagesInUse(void); +extern void printOop(sqInt oop); +extern void printProcessStack(sqInt aProcess); +extern sqInt printProcsOnList(sqInt procList); +extern sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame); +extern void printStackPageList(void); +extern void printStackPageListInUse(void); +extern void printStackPages(void); +extern void printStackPagesInUse(void); static void NoDbgRegParms printStackPageuseCount(StackPage *page, sqInt n); -EXPORT(void) printStackReferencesTo(sqInt oop); +extern void printStackReferencesTo(sqInt oop); static void NoDbgRegParms printStringOf(sqInt oop); extern void print(char *s); extern void pushBool(sqInt trueOrFalse); @@ -1405,22 +1392,22 @@ static void NoDbgRegParms putWord32toFile(int aWord32, sqImageFile aFile); extern sqInt readableFormat(sqInt imageVersion); extern size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset); static void NoDbgRegParms NeverInline reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader); -EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext); +extern sqInt reestablishContextPriorToCallback(sqInt callbackContext); static sqInt NoDbgRegParms removeFirstLinkOfList(sqInt aList); static sqInt NoDbgRegParms removeProcessfromList(sqInt aProcess, sqInt aList); static sqInt NoDbgRegParms resumepreemptedYieldingIf(sqInt aProcess, sqInt yieldImplicitly); static sqInt retryPrimitiveOnFailure(void); -EXPORT(sqInt) returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); +extern sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext); static void NoDbgRegParms reverseDisplayFromto(sqInt startIndex, sqInt endIndex); static void NoDbgRegParms rewriteMethodCacheEntryForExternalPrimitiveToFunction(void (*localPrimAddress)()); static sqInt NoDbgRegParms roomToPushNArgs(sqInt n); static sqInt NoDbgRegParms safeMethodClassOf(sqInt methodPointer); static sqInt NoDbgRegParms saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex); -EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); -EXPORT(void) setBreakMNUSelector(char *aString); -EXPORT(void) setBreakSelector(char *aString); +extern sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext); +extern void setBreakMNUSelector(char *aString); +extern void setBreakSelector(char *aString); extern void setFullScreenFlag(sqInt value); -EXPORT(void *) setInterruptCheckChain(void (*aFunction)()); +extern void * setInterruptCheckChain(void (*aFunction)()); extern void setInterruptKeycode(sqInt value); extern void setInterruptPending(sqInt value); extern void setNextWakeupUsecs(usqLong value); @@ -1429,10 +1416,10 @@ static void setSignalLowSpaceFlagAndSaveProcess(void); static void NoDbgRegParms setTraceFlagOnContextsFramesPageIfNeeded(sqInt aContext); static sqInt NoDbgRegParms shortPrintContext(sqInt aContext); static sqInt NoDbgRegParms shortPrintFrameAndCallers(char *theFP); -EXPORT(void) shortPrintFramesInPage(StackPage *thePage); -EXPORT(void) shortPrintFramesOnStackPageListInUse(void); +extern void shortPrintFramesInPage(StackPage *thePage); +extern void shortPrintFramesOnStackPageListInUse(void); static sqInt NoDbgRegParms shortPrintFrame(char *theFP); -EXPORT(void) shortPrintFrameAndNCallers(char *theFP, sqInt n); +extern void shortPrintFrameAndNCallers(char *theFP, sqInt n); static void NoDbgRegParms shortPrintOop(sqInt oop); static sqInt NoDbgRegParms shortReversePrintFrameAndCallers(char *aFramePointer); extern sqInt showDisplayBitsLeftTopRightBottom(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b); @@ -1482,7 +1469,7 @@ static void NoDbgRegParms NeverInline voidLongRunningPrimitive(char *reason); #endif /* LRPCheck */ static sqInt NoDbgRegParms voidVMStateForSnapshotFlushingExternalPrimitivesIf(sqInt flushExtPrims); static sqInt wakeHighestPriority(void); -EXPORT(char *) whereIs(sqInt anOop); +extern char * whereIs(sqInt anOop); static sqInt NeverInline writeImageFileIO(void); static usqInt NoDbgRegParms cloneContext(sqInt aContext); static sqInt NoDbgRegParms fieldOrSenderFPofContext(sqInt index, sqInt contextObj); @@ -1563,14 +1550,14 @@ _iss usqInt endOfMemory; _iss usqInt pastSpaceStart; _iss usqInt instructionPointer; _iss sqInt trueObj; -_iss usqInt totalFreeOldSpace; _iss sqInt falseObj; -_iss SpurSegmentInfo * segments; +_iss usqInt totalFreeOldSpace; _iss sqInt lkupClassTag; +_iss SpurSegmentInfo * segments; _iss sqInt hiddenRootsObj; _iss sqInt needGCFlag; -_iss sqInt numSegments; _iss StackPage * pages; +_iss sqInt numSegments; _iss sqInt * freeLists; _iss char * stackMemory; _iss sqInt markStack; @@ -1588,6 +1575,7 @@ _iss StackPage * mostRecentlyUsedPage; _iss sqInt lkupClass; _iss sqInt remapBufferCount; _iss usqInt newSpaceStart; +_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classTableIndex; _iss sqInt tempOop; _iss usqInt lastMobileObject; @@ -1605,7 +1593,6 @@ _iss sqInt becomeEffectsFlags; _iss sqInt growHeadroom; _iss sqInt tenureThreshold; _iss char * objStackInvalidBecause; -_iss sqInt sweepIndex; _iss sqInt ephemeronList; _iss sqInt imageHeaderFlags; #if LRPCheck @@ -1616,7 +1603,6 @@ _iss sqInt longRunningPrimitiveCheckSemaphore; #endif _iss sqInt profileSemaphore; _iss sqInt tenureCriterion; -_iss usqInt totalHeapSizeIncludingBridges; _iss sqInt classNameIndex; _iss usqInt freeOldSpaceStart; _iss sqInt extraRootCount; @@ -1736,7 +1722,6 @@ _iss sqInt atCache[AtCacheTotalSize + 1 /* 65 */]; _iss sqInt remapBuffer[RemapBufferSize + 1 /* 26 */]; _iss sqInt *extraRoots[ExtraRootsSize + 1 /* 65 */]; _iss usqLong byteCount; -_iss sqInt preferredPinningSegment; _iss sqInt statCoalesces; _iss usqLong statFGCDeltaUsecs; _iss usqLong statIncrGCUsecs; @@ -1782,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, 2, 2,-1, 2,-1,-1,-1,-1, 0, 1, 0, 0,-1, 1, 0, 0, 1, 0, +/*100*/ 1, 2, 1, 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, @@ -2420,7 +2405,7 @@ sqInt debugCallbackInvokes; sqInt debugCallbackReturns; sqInt cannotDeferDisplayUpdates; sqInt checkedPluginName; -const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] StackInterpreterPrimitives_VMMaker.oscog-eem.3310"; +const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] StackInterpreterPrimitives_VMMaker.oscog-eem.3329"; sqInt suppressHeartbeatFlag; int displayWidth; int displayDepth; @@ -17403,6 +17388,7 @@ primitiveClosureValue(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -17521,6 +17507,7 @@ primitiveClosureValueNoContextSwitch(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -17671,6 +17658,7 @@ primitiveClosureValueWithArgs(void) } /* begin activateNewClosure:outer:method:numArgs:mayContextSwitch: */ assert(isContext(outerContext)); + assert(isVanillaBlockClosure(blockClosure)); numCopied = (numSlotsOf(blockClosure)) - ClosureFirstCopiedValueIndex; assert(closureMethod == (fetchPointerofObject(MethodIndex, outerContext))); assert(isOopCompiledMethod(closureMethod)); @@ -27260,10 +27248,8 @@ primitiveStoreImageSegment(void) && (((((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) >= (firstLongFormat())) && (((((usqInt)((longAt(segmentWordArray)))) >> (formatShift())) & (formatMask())) <= ((firstShortFormat()) - 1)))))))) { /* Must be indexable words */ - /* begin primitiveFail */ - if (!GIV(primFailCode)) { - GIV(primFailCode) = 1; - } + /* begin primitiveFailFor: */ + GIV(primFailCode) = PrimErrBadArgument; return; } ecode = storeImageSegmentIntooutPointersroots(segmentWordArray, outPointerArray, arrayOfRoots); @@ -27932,7 +27918,8 @@ primitiveStringReplace(void) replFmt = replFmt & -4; l10: /* end classFormatFromInstFormat: */; if (!((arrayFmt == replFmt) - && (arrayFmt < (firstCompiledMethodFormat())))) { + && ((arrayFmt >= (sixtyFourBitIndexableFormat())) + && (arrayFmt < (firstCompiledMethodFormat()))))) { /* begin primitiveFailFor: */ GIV(primFailCode) = PrimErrInappropriate; goto l17; @@ -30035,111 +30022,6 @@ initSegmentBridgeWithBytesat(usqLong numBytes, sqInt address) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur64BitMemoryManager>>#inOldSpaceInstantiatePinnedClass:indexableSize: */ -sqInt -inOldSpaceInstantiatePinnedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt fillValue; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt numSlots; - usqInt p; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - fillValue = 0; - switch (instSpec) { - case 2 /* arrayFormat */: - numSlots = nElements; - fillValue = GIV(nilObj); - break; - case indexablePointersFormat(): - case weakArrayFormat(): - numSlots = (classFormat & ((1U << (fixedFieldsFieldWidth())) - 1)) + nElements; - fillValue = GIV(nilObj); - break; - case sixtyFourBitIndexableFormat(): - numSlots = nElements; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstShortFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - case firstByteFormat(): - numSlots = (nElements + 7) / 8; - instSpec += (8 - nElements) & 7; - break; - default: - - /* non-indexable */ - /* Some Squeak images include funky fixed subclasses of abstract variable - superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection. - The (Threaded)FFIPlugin expects to be able to instantiate ExternalData via - this method. - Hence allow fixed classes to be instantiated here iff nElements = 0. */ - if ((nElements != 0) - || (instSpec > 5 /* lastPointerFormat */)) { - return null; - } - numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); - fillValue = GIV(nilObj); - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > (0x10000000000LL)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsForPinningInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : (numSlots << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - if (!(newObj == null)) { - /* begin fillObj:numSlots:with: */ - assert(oopisLessThan(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1, addressAfter(newObj))); - for (p = (((usqInt)(newObj + BaseHeaderSize))); p <= (((usqInt)(((newObj + BaseHeaderSize) + (numSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { - longAtput(p, fillValue); - } - } - return newObj; -} - - /* Allocate an instance of a variable class, excepting CompiledMethod. */ /* Spur64BitMemoryManager>>#instantiateClass:indexableSize: */ @@ -30290,130 +30172,6 @@ instantiateClassindexableSize(sqInt classObj, usqInt nElements) } -/* Allocate an instance of a variable class, excepting CompiledMethod. */ - - /* Spur64BitMemoryManager>>#instantiateUninitializedClass:indexableSize: */ -sqInt -instantiateUninitializedClassindexableSize(sqInt classObj, usqInt nElements) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt classFormat; - sqInt classIndex; - sqInt err; - sqInt hash; - sqInt instSpec; - sqInt newObj; - usqInt newObj1; - usqInt numBytes; - usqInt numSlots; - - classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - instSpec = (((usqInt)(classFormat)) >> (fixedFieldsFieldWidth())) & (formatMask()); - classIndex = (long32At(classObj + 4)) & (identityHashHalfWordMask()); - assert(isPureBitsFormat(instSpec)); - switch (instSpec) { - case sixtyFourBitIndexableFormat(): - numSlots = nElements; - break; - case firstLongFormat(): - if ((classIndex == ClassFloatCompactIndex) - && (nElements != 2)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - } - numSlots = (nElements + 1) / 2; - instSpec += nElements & 1; - break; - case firstShortFormat(): - numSlots = (nElements + 3) / 4; - instSpec += (4 - nElements) & 3; - break; - case firstByteFormat(): - numSlots = (nElements + 7) / 8; - instSpec += (8 - nElements) & 7; - break; - default: - - /* not bits indexable */ - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrBadReceiver; - return null; - - } - if (classIndex == 0) { - /* begin ensureBehaviorHash: */ - assert(addressCouldBeClassObj(classObj)); - flag("todo"); - classIndex = (((hash = (long32At(classObj + 4)) & (identityHashHalfWordMask()))) != 0 - ? hash - : (objCouldBeClassObj(classObj) - ? (((err = enterIntoClassTable(classObj))) != 0 - ? -err - : (long32At(classObj + 4)) & (identityHashHalfWordMask())) - : -PrimErrBadReceiver)); - if (classIndex < 0) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = -classIndex; - return null; - } - } - if (numSlots > ((1U << (fixedFieldsFieldWidth())) - 1)) { - if (numSlots > (0x10000000000LL)) { - /* begin primitiveFailFor: */ - GIV(primFailCode) = PrimErrUnsupported; - return null; - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, (numSlots == 0 - ? 8 /* allocationUnit */ + BaseHeaderSize - : (numSlots << (shiftForWord())) + ((numSlots >= (numSlotsMask()) - ? BaseHeaderSize + BaseHeaderSize - : BaseHeaderSize))), instSpec, classIndex); - } - else { - /* begin allocateSlots:format:classIndex: */ - if (numSlots >= (numSlotsMask())) { - if (((numSlots) >> 56) > 0) { - newObj = null; - goto l7; - } - newObj1 = GIV(freeStart) + BaseHeaderSize; - numBytes = (BaseHeaderSize + BaseHeaderSize) + (numSlots * BytesPerOop); - } - else { - newObj1 = GIV(freeStart); - numBytes = BaseHeaderSize + ((numSlots < 1 - ? /* begin allocationUnit */ 8 - : numSlots * BytesPerOop)); - } - if ((GIV(freeStart) + numBytes) > GIV(scavengeThreshold)) { - if (!GIV(needGCFlag)) { - /* begin scheduleScavenge */ - GIV(needGCFlag) = 1; - forceInterruptCheck(); - } - newObj = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, instSpec, classIndex); - goto l7; - } - if (numSlots >= (numSlotsMask())) { - - /* for header parsing we put a saturated slot count in the prepended overflow size word */ - flag("endianness"); - longAtput(GIV(freeStart), (((sqInt)((usqInt)((numSlotsMask())) << (numSlotsFullShift())))) + numSlots); - longAtput(newObj1, headerForSlotsformatclassIndex(numSlotsMask(), instSpec, classIndex)); - } - else { - longAtput(newObj1, (((((usqLong) numSlots)) << (numSlotsFullShift())) + (((sqInt)((usqInt)(instSpec) << (formatShift()))))) + classIndex); - } - assert((numBytes % (allocationUnit())) == 0); - assert((newObj1 % (allocationUnit())) == 0); - GIV(freeStart) += numBytes; - newObj = newObj1; - l7: /* end allocateSlots:format:classIndex: */; - } - return newObj; -} - - /* Convert the integer value, assumed to be in SmallInteger range, into a tagged SmallInteger object. In C, use a shift and an add to set the tag bit. @@ -30898,8 +30656,8 @@ allWeakSurvivorsOnWeakList(void) writes code that stresses the remembered table. One might conclude that if the remembered table is full, then the right thing - to do is simply to tenure everything, emptying the remembered table. Bt in - some circumstances this + to do is simply to tenure everything, emptying the remembered table. But + in some circumstances this can be counter-productive, and result in the same situation arising soon after tenuring everything. Instead, we can try and selectively prune the remembered table, tenuring @@ -31291,6 +31049,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj3 == null)) { + assert(isPinned(obj3)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1, addressAfter(obj3))); for (p2 = (((usqInt)(obj3 + BaseHeaderSize))); p2 <= (((usqInt)(((obj3 + BaseHeaderSize) + (nSlots2 * BytesPerOop)) - 1))); p2 += 8 /* allocationUnit */) { @@ -31307,6 +31066,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj2 == null)) { + assert(isPinned(obj2)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1, addressAfter(obj2))); for (p1 = (((usqInt)(obj2 + BaseHeaderSize))); p1 <= (((usqInt)(((obj2 + BaseHeaderSize) + (nSlots1 * BytesPerOop)) - 1))); p1 += 8 /* allocationUnit */) { @@ -31326,6 +31086,7 @@ growRememberedSet(void) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -31526,6 +31287,7 @@ openScavengeLog(void) /* Print the objects in the remembered set. */ +/* useful for debugging */ /* SpurGenerationScavenger>>#printRememberedSet */ void @@ -33812,6 +33574,7 @@ allocatePinnedSlots(sqInt nSlots) ? BaseHeaderSize + BaseHeaderSize : BaseHeaderSize))), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj == null)) { + assert(isPinned(obj)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1, addressAfter(obj))); for (p = (((usqInt)(obj + BaseHeaderSize))); p <= (((usqInt)(((obj + BaseHeaderSize) + (nSlots * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -34779,30 +34542,6 @@ checkedLongAt(sqInt byteAddress) return longAt(byteAddress); } - /* SpurMemoryManager>>#checkFreeSpace: */ -void -checkFreeSpace(sqInt gcModes) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, null); - } -} - - /* SpurMemoryManager>>#checkFreeSpace:ignoring: */ -void -checkFreeSpaceignoring(sqInt gcModes, sqInt anOopToIgnore) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - assert(bitsSetInFreeSpaceMaskForAllFreeLists()); - assert(GIV(totalFreeOldSpace) == (totalFreeListBytes())); - if ((gcModes > 0) - && (((checkForLeaks & (GCCheckFreeSpace | gcModes)) == (GCCheckFreeSpace | gcModes)))) { - runLeakCheckerForFreeSpaceignoring(GCCheckFreeSpace, anOopToIgnore); - } -} - /* Perform an integrity/leak check using the heapMap. Assume clearLeakMapAndMapAccessibleFreeSpace has set a bit at each free chunk's @@ -35769,6 +35508,7 @@ checkHeapIntegrityclassIndicesShouldBeValid(sqInt excludeUnmarkedObjs, sqInt cla /* Verify that the given oop is legitimate. Check address, header, and size but not class. Answer true if OK. Otherwise print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOkayOop: */ sqInt @@ -35863,6 +35603,7 @@ checkOkayOop(usqInt oop) or more fields. Finally, the instance specification field of the behavior must match that of the instance. If OK answer true. If not, print reason and answer false. */ +/* useful for debugging */ /* SpurMemoryManager>>#checkOopHasOkayClass: */ sqInt @@ -36722,7 +36463,7 @@ cloneObject(sqInt objOop) } /* SpurMemoryManager>>#compactClassIndexOf: */ -sqInt +static sqInt NoDbgRegParms compactClassIndexOf(sqInt objOop) { /* begin classIndexOf: */ @@ -36872,6 +36613,7 @@ copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endS /* print the count of marked and unmarked objects. In addition if 1 is set in printFlags, short-print marked objects, and/or if 2 is set, short-print unmarked obejcts. */ +/* useful for debugging */ /* SpurMemoryManager>>#countMarkedAndUnmarkdObjects: */ void @@ -36969,7 +36711,8 @@ currentAllocatedBytes(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt use; - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); return (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); } @@ -36996,7 +36739,8 @@ doScavenge(sqInt tenuringCriterion) usqInt use; /* begin doAllocationAccountingForScavenge */ - use = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + use = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); GIV(statAllocatedBytes) = (GIV(statAllocatedBytes) + (GIV(freeStart) - (((eden()).start)))) + (use - GIV(oldSpaceUsePriorToScavenge)); GIV(gcPhaseInProgress) = ScavengeInProgress; /* begin scavenge: */ @@ -37047,7 +36791,8 @@ doScavenge(sqInt tenuringCriterion) GIV(freeStart) = ((eden()).start); GIV(gcPhaseInProgress) = 0; /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); } @@ -37061,7 +36806,7 @@ doScavenge(sqInt tenuringCriterion) was possible. */ /* SpurMemoryManager>>#doShorten:toIndexableSize: */ -sqInt +static sqInt NoDbgRegParms doShortentoIndexableSize(sqInt objOop, sqInt indexableSize) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt bytesBefore; @@ -37918,6 +37663,7 @@ findLargestFreeChunk(void) /* Print the oops of all string-like things that start with the same characters as aCString */ +/* useful for debugging */ /* SpurMemoryManager>>#findStringBeginningWith: */ void @@ -38305,7 +38051,7 @@ followFieldofObject(sqInt fieldIndex, sqInt anObject) need since depth is always finite. */ /* SpurMemoryManager>>#followForwardedObjectFields:toDepth: */ -sqInt +static sqInt NoDbgRegParms followForwardedObjectFieldstoDepth(sqInt objOop, sqInt depth) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt contextSize; @@ -38722,7 +38468,6 @@ fullGC(void) runLeakCheckerForexcludeUnmarkedObjsclassIndicesShouldBeValid(GCModeFull, 1, 1); compactionStartUsecs = ioUTCMicrosecondsNow(); /* begin prepareForGlobalSweep */ - GIV(sweepIndex) = 0; for (i = 0; i < GIV(numSegments); i += 1) { ((GIV(segments)[i]).containsPinned = 0); } @@ -38742,9 +38487,11 @@ fullGC(void) GIV(statShrinkMemory) += 1; } /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); assert(validObjStacks()); assert(isEmptyObjStack(GIV(markStack))); assert(isEmptyObjStack(GIV(weaklingStack))); @@ -38803,12 +38550,10 @@ growOldSpaceByAtLeast(sqInt minAmmount) sqInt ammount; sqInt bytes; sqInt headroom; - sqInt i; sqInt interval; SpurSegmentInfo *segInfo; sqInt start; usqInt total; - usqInt total1; /* statGrowMemory counts attempts, not successes. */ @@ -38825,13 +38570,8 @@ growOldSpaceByAtLeast(sqInt minAmmount) /* Now apply the maxOldSpaceSize limit, if one is in effect. */ ammount = ((ammount < GIV(growHeadroom)) ? GIV(growHeadroom) : ammount); if (maxOldSpaceSize > 0) { - /* begin totalBytesInSegments */ - total1 = 0; - for (i = 0; i < GIV(numSegments); i += 1) { - total1 += ((GIV(segments)[i]).segSize); - } - assert(GIV(totalHeapSizeIncludingBridges) == total1); - total = total1; + assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)); + total = GIV(totalHeapSizeIncludingBridges); if (total >= maxOldSpaceSize) { GIV(needGCFlag) = 1; return null; @@ -39000,73 +38740,6 @@ incrementalGC(void) error("shouldNotImplement"); } - /* SpurMemoryManager>>#indexOf:in: */ -sqInt -indexOfin(sqInt anElement, sqInt anObject) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt fmt; - sqInt fmt1; - sqInt i; - usqInt numSlots; - usqInt numSlots1; - - /* begin formatOf: */ - fmt = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - if (fmt <= 5 /* lastPointerFormat */) { - /* begin numSlotsOf: */ - assert((classIndexOf(anObject)) > (isForwardedObjectClassIndexPun())); - numSlots1 = byteAt(anObject + 7); - numSlots = (numSlots1 == (numSlotsMask()) - ? ((((usqInt)(((sqInt)((usqInt)((longAt(anObject - BaseHeaderSize))) << 8)))))) >> 8 - : numSlots1); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (longAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << (shiftForWord()))))))) { - return i; - } - } - } - if (fmt >= (firstByteFormat())) { - if (fmt >= (firstCompiledMethodFormat())) { - /* begin primitiveFailFor: */ - return (GIV(primFailCode) = PrimErrUnsupported); - } - /* begin numBytesOfBytes: */ - fmt1 = (((usqInt)((longAt(anObject)))) >> (formatShift())) & (formatMask()); - assert(fmt1 >= (firstByteFormat())); - numSlots = ((numSlotsOf(anObject)) << (shiftForWord())) - (fmt1 & 7); - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (byteAt((anObject + BaseHeaderSize) + i))) { - return i; - } - } - } - if (fmt >= (firstShortFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 1; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (((unsigned short) (shortAt((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 1)))))))) { - return i; - } - } - } - if (fmt == (sixtyFourBitIndexableFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 3; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long64At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 3)))))) { - return i; - } - } - } - if (fmt >= (firstLongFormat())) { - numSlots = ((usqInt)((numBytesOf(anObject)))) >> 2; - for (i = 0; i <= numSlots; i += 1) { - if (anElement == (long32At((anObject + BaseHeaderSize) + (((sqInt)((usqInt)(i) << 2)))))) { - return i; - } - } - } - return -1; -} - /* Part of reorderReversedTreeList:. Switch treeNode with newNode in the tree, but do nothing to the list linked through freeChunkNextIndex. */ @@ -39532,6 +39205,7 @@ initializeObjectMemory(sqInt bytesToShift) /* begin allocatePinnedSlots: */ obj1 = allocateSlotsForPinningInOldSpacebytesformatclassIndex(0x400, (1024U << (shiftForWord())) + (BaseHeaderSize + BaseHeaderSize), sixtyFourBitIndexableFormat(), sixtyFourBitLongsClassIndexPun()); if (!(obj1 == null)) { + assert(isPinned(obj1)); /* begin fillObj:numSlots:with: */ assert(oopisLessThan(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1, addressAfter(obj1))); for (p = (((usqInt)(obj1 + BaseHeaderSize))); p <= (((usqInt)(((obj1 + BaseHeaderSize) + (0x400 * BytesPerOop)) - 1))); p += 8 /* allocationUnit */) { @@ -39547,7 +39221,7 @@ initializeObjectMemory(sqInt bytesToShift) else { /* The Spur32to64BitBootstrap failed to set the type of rememberedSetObj to 64-bit indexability. - This is unimportant except for simulation; rememberedSet is declared as sqInt *, but in to have + This is unimportant except for simulation; rememberedSet is declared as sqInt *, but to have firstIndexableField: below answer a suitable type the format must be wordIndexableFormat. */ /* begin setFormatOf:to: */ format = sixtyFourBitIndexableFormat(); @@ -39577,9 +39251,11 @@ initializeObjectMemory(sqInt bytesToShift) /* free space before shrinking */ GIV(shrinkThreshold) = 0x2000000; /* begin setHeapSizeAtPreviousGC */ - GIV(heapSizeAtPreviousGC) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(heapSizeAtPreviousGC) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* begin resetAllocationAccountingAfterGC */ - GIV(oldSpaceUsePriorToScavenge) = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + GIV(oldSpaceUsePriorToScavenge) = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); /* By default GC after scavenge if heap has grown by a third since the last GC */ GIV(heapGrowthToSizeGCRatio) = 0.333333; @@ -39587,12 +39263,10 @@ initializeObjectMemory(sqInt bytesToShift) /* print free chunks in freeTree in order. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#inOrderPrintFreeTree:printList: */ -EXPORT(void) +void inOrderPrintFreeTreeprintList(sqInt freeChunk, sqInt printNextList) { sqInt next; @@ -39847,18 +39521,6 @@ isAnyPointerFormat(sqInt format) } -/* Answer if this is an indexable object with pointer elements, e.g., an - array - */ - - /* SpurMemoryManager>>#isArrayNonImm: */ -sqInt -isArrayNonImm(sqInt oop) -{ - return ((((usqInt)((longAt(oop)))) >> (formatShift())) & (formatMask())) == 2 /* arrayFormat */; -} - - /* Answer true if this is an indexable object with pointer elements, e.g., an array */ @@ -40281,7 +39943,7 @@ isObjImmutable(sqInt anOop) /* Answer if obj is old. Require that obj is non-immediate. */ /* SpurMemoryManager>>#isOldObject: */ -sqInt +static sqInt NoDbgRegParms isOldObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT assert(isNonImmediate(objOop)); @@ -40366,18 +40028,6 @@ isReallyYoungObject(sqInt obj) oopisLessThan(obj, GIV(oldSpaceStart))); } - -/* Answer if oop is young. */ - - /* SpurMemoryManager>>#isReallyYoung: */ -sqInt -isReallyYoung(sqInt oop) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return ((!(oop & (tagMask())))) - && ((assert(isNonImmediate(oop)), - oopisLessThan(oop, GIV(oldSpaceStart)))); -} - /* SpurMemoryManager>>#isRemembered: */ static sqInt NoDbgRegParms isRemembered(sqInt objOop) @@ -40410,10 +40060,10 @@ isShorts(sqInt oop) /* This version is private to SpurMemoryManager (for asserts, etc). It does - not take advantage of the power-of0two optimization in isForwarded:. */ + not take advantage of the power-of-two optimization in isForwarded:. */ /* SpurMemoryManager>>#isUnambiguouslyForwarder: */ -sqInt +static sqInt NoDbgRegParms isUnambiguouslyForwarder(sqInt objOop) { return ((longAt(objOop)) & (classIndexMask())) == (isForwardedObjectClassIndexPun()); @@ -40804,7 +40454,7 @@ lastPointerFormat(void) pointer, and the image contains no forwarders (see class comment). */ /* SpurMemoryManager>>#lastPointerOfWhileSwizzling: */ -sqInt +static sqInt NoDbgRegParms lastPointerOfWhileSwizzling(sqInt objOop) { sqInt fmt; @@ -40832,7 +40482,7 @@ lastPointerOfWhileSwizzling(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#lastPointerOf: */ -sqInt +static sqInt NoDbgRegParms lastPointerOf(sqInt objOop) { sqInt contextSize; @@ -40872,13 +40522,6 @@ lastPointerOf(sqInt objOop) ((header >> 3)) & AlternateHeaderNumLiteralsMask)) + LiteralStart) - 1) * BytesPerOop) + BaseHeaderSize; } - /* SpurMemoryManager>>#leakCheckBecome */ -sqInt -leakCheckBecome(void) -{ - return ((checkForLeaks & GCModeBecome) != 0); -} - /* SpurMemoryManager>>#leakCheckFullGC */ sqInt leakCheckFullGC(void) @@ -40886,13 +40529,6 @@ leakCheckFullGC(void) return ((checkForLeaks & GCModeFull) != 0); } - /* SpurMemoryManager>>#leakCheckIncremental */ -sqInt -leakCheckIncremental(void) -{ - return ((checkForLeaks & GCModeIncremental) != 0); -} - /* SpurMemoryManager>>#leakCheckNewSpaceGC */ sqInt leakCheckNewSpaceGC(void) @@ -41483,12 +41119,10 @@ loadImageSegmentFromoutPointers(sqInt segmentWordArray, sqInt outPointerArray) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesOf: */ -EXPORT(void) +void longPrintInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -41503,12 +41137,10 @@ longPrintInstancesOf(sqInt aClassOop) /* Scan the heap printing any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintInstancesWithClassIndex: */ -EXPORT(void) +void longPrintInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -41616,12 +41248,10 @@ longPrintInstancesWithClassIndex(sqInt classIndex) /* Scan the heap long printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#longPrintReferencesTo: */ -EXPORT(void) +void longPrintReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -43053,21 +42683,6 @@ maybeMethodClassOfseemsToBeInstantiating(sqInt methodObj, sqInt format) } -/* Answer one of the objects in the SpecialObjectsArray, if in range, - otherwise answer nil. - */ - - /* SpurMemoryManager>>#maybeSplObj: */ -sqInt -maybeSplObj(sqInt index) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return (index < (numSlotsOf(GIV(specialObjectsOop))) - ? (/* begin fetchPointer:ofObject: */ - longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((sqInt)((usqInt)(index) << (shiftForWord())))))) - : 0); -} - - /* Answer the method header of a CompiledMethod object. */ /* SpurMemoryManager>>#methodHeaderOf: */ @@ -43491,7 +43106,7 @@ numBytesOf(sqInt objOop) Works with CompiledMethods, as well as ordinary objects. */ /* SpurMemoryManager>>#numPointerSlotsOf: */ -usqInt +static usqInt NoDbgRegParms numPointerSlotsOf(sqInt objOop) { sqInt contextSize; @@ -43655,24 +43270,6 @@ numStrongSlotsOfInephemeral(sqInt objOop) } -/* Answer the number of strong pointer fields in the given weakling. */ - - /* SpurMemoryManager>>#numStrongSlotsOfWeakling: */ -sqInt -numStrongSlotsOfWeakling(sqInt objOop) -{ - sqInt classFormat; - sqInt objOop1; - - assert((formatOf(objOop)) == (weakArrayFormat())); - /* begin fixedFieldsOfClass: */ - objOop1 = fetchClassOfNonImm(objOop); - /* begin fixedFieldsOfClassFormat: */ - classFormat = ((longAt((objOop1 + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3); - return classFormat & ((1U << (fixedFieldsFieldWidth())) - 1); -} - - /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -43744,6 +43341,9 @@ objectAfter(sqInt objOop) : followingWordAddress3); } + +/* useful for debugging */ + /* SpurMemoryManager>>#objectBefore: */ sqInt objectBefore(sqInt objOop) @@ -44332,6 +43932,7 @@ okayOop(sqInt signedOop) } +/* useful for debugging */ /* Object parsing. 1. all objects have at least a word following the header, for a forwarding pointer. 2. objects with an overflow size have a preceeing word with a @@ -44512,7 +44113,6 @@ pinObject(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classIndex; sqInt format; - sqInt i; sqInt oldClone; sqInt referent; SpurSegmentInfo *seg; @@ -44527,15 +44127,7 @@ pinObject(sqInt objOop) longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); return objOop; } - /* begin segmentContainingObj: */ - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - seg = (&(GIV(segments)[i])); - goto l1; - } - } - seg = null; - l1: /* end segmentContainingObj: */; + seg = segmentContainingObj(objOop); if ((seg->containsPinned)) { /* begin setIsPinnedOf:to: */ longAtput(objOop, (longAt(objOop)) | (1U << (pinnedBitShift()))); @@ -44775,12 +44367,10 @@ primitiveErrorTable(void) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printActivationsOf: */ -EXPORT(void) +void printActivationsOf(sqInt aMethodObj) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -44848,12 +44438,10 @@ printActivationsOf(sqInt aMethodObj) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printBogons */ -EXPORT(void) +void printBogons(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT /* begin printTheBogons: */ @@ -44870,16 +44458,34 @@ printBogons(void) cr(); } + /* SpurMemoryManager>>#printBridge:on: */ +static void NoDbgRegParms +printBridgeon(sqInt oop, FILE *aStream) +{ + fprintf(aStream, + "%p is a bridge hdr%d slot size %ul\n", + ((void *)oop), + ((byteAt(oop + 7)) == (numSlotsMask()) + ? 16 + : 8), + numSlotsOfAny(oop)); +} + /* SpurMemoryManager>>#printCantBeObject:on: */ static void NoDbgRegParms printCantBeObjecton(sqInt oop, FILE *aStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT - if (((oop & (7)) == 0) - && (((oopisLessThan(oop, GIV(oldSpaceStart))) - && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) - && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))))))) { - printForwarderon(oop, aStream); - return; + if ((oop & (7)) == 0) { + if (((oopisLessThan(oop, GIV(oldSpaceStart))) + && (oopisGreaterThanOrEqualTo(oop, GIV(newSpaceStart)))) + && ((!((longAt(oop)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun())))))) { + printForwarderon(oop, aStream); + return; + } + if (oop == (bridgeAt((numSegments()) - 1))) { + printBridgeon(oop, aStream); + return; + } } fprintf(aStream, "%p%s\n", @@ -44893,12 +44499,10 @@ printCantBeObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all contexts that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printContextReferencesTo: */ -EXPORT(void) +void printContextReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -44978,12 +44582,10 @@ printContextReferencesTo(sqInt anOop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printEntity: */ -EXPORT(void) +void printEntity(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -45117,12 +44719,10 @@ printEntity(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printForwarders */ -EXPORT(void) +void printForwarders(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45231,7 +44831,7 @@ static void NoDbgRegParms printForwarderon(sqInt oop, FILE *aStream) { fprintf(aStream, - "%p is a forwarded hdr%d slot size %ud object to %p\n", + "%p is a forwarded hdr%d slot size %ul object to %p\n", ((void *)oop), ((byteAt(oop + 7)) == (numSlotsMask()) ? 16 @@ -45244,6 +44844,7 @@ printForwarderon(sqInt oop, FILE *aStream) /* This version goes through memory, printing all free chunks. Other versions go through the free lists. This one will show all free chunks even if the free lists are corrupt. */ +/* useful for debugging */ /* SpurMemoryManager>>#printFreeChunks */ void @@ -45359,12 +44960,10 @@ printFreeChunks(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeChunk: */ -EXPORT(void) +void printFreeChunk(sqInt freeChunk) { printFreeChunkprintAsTreeNode(freeChunk, 1); @@ -45454,12 +45053,10 @@ printFreeChunkprintAsTreeNode(sqInt freeChunk, sqInt printAsTreeNode) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeListHeads */ -EXPORT(void) +void printFreeListHeads(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt expectedMask; @@ -45495,12 +45092,10 @@ printFreeListHeads(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeList: */ -EXPORT(sqInt) +sqInt printFreeList(sqInt chunkOrIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt fieldIndex; @@ -45533,12 +45128,10 @@ printFreeObjecton(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printFreeTree */ -EXPORT(void) +void printFreeTree(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFreeTreeChunk(GIV(freeLists)[0]); @@ -45562,13 +45155,11 @@ printFreeTreeChunk(sqInt chunkOrZero) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* N.B. No safety bounds checks!! We need to look e.g. at corpses. */ /* SpurMemoryManager>>#printHeaderOf: */ -EXPORT(void) +void printHeaderOf(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT usqInt n; @@ -45685,12 +45276,10 @@ printImmediateObjecton(sqInt oop, FILE *aStream) /* Scan the heap printing the oops of any and all objects that are instances of aClassOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesOf: */ -EXPORT(void) +void printInstancesOf(sqInt aClassOop) { sqInt classIndex; @@ -45705,12 +45294,10 @@ printInstancesOf(sqInt aClassOop) /* Scan the heap printing the oops of any and all objects whose classIndex equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printInstancesWithClassIndex: */ -EXPORT(void) +void printInstancesWithClassIndex(sqInt classIndex) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -45816,6 +45403,7 @@ printInstancesWithClassIndex(sqInt classIndex) /* Print the objects in the classTable that have bad hashes. */ +/* useful for debugging */ /* SpurMemoryManager>>#printInvalidClassTableEntries */ void @@ -45865,13 +45453,11 @@ printInvalidClassTableEntries(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMarkedOops */ #if LLDB -EXPORT(void) +void printMarkedOops(void) { printOopsSuchThat(isMarked); @@ -45882,12 +45468,10 @@ printMarkedOops(void) /* Scan the heap printing the oops of any and all methods that implement anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodImplementorsOf: */ -EXPORT(void) +void printMethodImplementorsOf(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -45953,12 +45537,10 @@ printMethodImplementorsOf(sqInt anOop) /* Scan the heap printing the oops of any and all methods that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printMethodReferencesTo: */ -EXPORT(void) +void printMethodReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -46144,12 +45726,10 @@ printNonPointerDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsFrom:to: */ -EXPORT(void) +void printObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -46173,12 +45753,10 @@ printObjectsFromto(sqInt startAddress, sqInt endAddress) /* Scan the heap printing the oops of any and all objects whose hash equals the argument. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printObjectsWithHash: */ -EXPORT(void) +void printObjectsWithHash(sqInt hash) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -46280,6 +45858,21 @@ printObjectsWithHash(sqInt hash) l4: /* end allNewSpaceEntitiesDo: */; } + /* SpurMemoryManager>>#printObjStackAndContents: */ +void +printObjStackAndContents(sqInt objStack) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + /* begin printObjStack:printContents: */ + if (objStack == GIV(nilObj)) { + /* begin print: */ + fprintf(GIV(transcript), "nil"); + cr(); + } + else { + printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((sqInt)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, 1); + } +} + /* SpurMemoryManager>>#printObjStackPage:myIndex:pageType:printContents: */ static void NoDbgRegParms printObjStackPagemyIndexpageTypeprintContents(sqInt objStackPage, sqInt myx, sqInt pageType, sqInt printContents) @@ -46442,6 +46035,9 @@ printObjStackPagemyIndextag(sqInt objStackPage, sqInt myx, char *pageType) cr(); } + +/* useful for debugging */ + /* SpurMemoryManager>>#printObjStack: */ void printObjStack(sqInt objStack) @@ -46457,27 +46053,11 @@ printObjStack(sqInt objStack) } } - /* SpurMemoryManager>>#printObjStack:printContents: */ -void -printObjStackprintContents(sqInt objStack, sqInt printContents) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - if (objStack == GIV(nilObj)) { - /* begin print: */ - fprintf(GIV(transcript), "nil"); - cr(); - } - else { - printObjStackPagemyIndexpageTypeprintContents(objStack, longAt((objStack + BaseHeaderSize) + (((sqInt)((usqInt)(ObjStackMyx) << (shiftForWord()))))), ObjStackMyx, printContents); - } -} - -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsExcept: */ -EXPORT(void) NeverInline +void NeverInline printOopsExcept(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -46595,12 +46175,10 @@ printOopsExcept(sqInt (*function)(sqInt)) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsFrom:to: */ -EXPORT(void) +void printOopsFromto(sqInt startAddress, sqInt endAddress) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstNonEntity; @@ -46653,12 +46231,10 @@ printOopsFromto(sqInt startAddress, sqInt endAddress) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printOopsSuchThat: */ -EXPORT(void) NeverInline +void NeverInline printOopsSuchThat(sqInt (*function)(sqInt)) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt followingWord; @@ -46777,12 +46353,10 @@ printOopsSuchThat(sqInt (*function)(sqInt)) /* Scan the heap printing the oops of any and all objects that refer to anOop */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printReferencesTo: */ -EXPORT(void) +void printReferencesTo(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -47018,13 +46592,11 @@ printStringDataOfon(sqInt oop, FILE *aStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#printUnmarkedOops */ #if LLDB -EXPORT(void) +void printUnmarkedOops(void) { printOopsExcept(isMarked); @@ -47632,12 +47204,10 @@ shortentoIndexableSize(sqInt objOop, sqInt indexableSize) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* SpurMemoryManager>>#shortPrintObjectsFrom:to: */ -EXPORT(void) +void shortPrintObjectsFromto(sqInt startAddress, sqInt endAddress) { sqInt oop; @@ -47775,7 +47345,7 @@ startOfObject(sqInt objOop) /* Part of InterpreterProxy's 1.14 API */ /* SpurMemoryManager>>#statNumGCs */ -EXPORT(sqInt) +sqInt statNumGCs(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT return (GIV(statScavenges) + GIV(statIncrGCs)) + GIV(statFullGCs); @@ -47817,13 +47387,21 @@ storeCheckBoundary(void) The primitive can fail for the following reasons with the specified failure codes: - PrimErrGenericError: the segmentWordArray is too small for the version - stamp PrimErrWritePastObject: the segmentWordArray is too small to contain - the reachable objects - PrimErrBadIndex: the outPointerArray is too small - PrimErrNoMemory: additional allocations failed + PrimErrGenericFailure: the segmentWordArray is too small for the version + stamp PrimErrWritePastObject: the segmentWordArray is too small to + contain the reachable objects + PrimErrBadIndex: the outPointerArray is too small + PrimErrNoMemory: there is insufficient free space to store the array + answered by objectsReachableFromRoots:, + or the savedFirstFields and savedOutHashes arrays. + PrimErrNeedCompaction: a GC is needed to make room for the array answered + by objectsReachableFromRoots: PrimErrLimitExceeded: there is no room in the hash field to store out - pointer indices or class references. */ + pointer indices or class references, + or the outPointerArray is larger than the max value of the hash field. + PrimErrNoModification: the segmentWordArrayArg or outPointerArrayArg are + immutable PrimErrObjectIsPinned: the segmentWordArrayArg or + outPointerArrayArg are pinned */ /* SpurMemoryManager>>#storeImageSegmentInto:outPointers:roots: */ static sqInt NoDbgRegParms @@ -48076,6 +47654,7 @@ storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt val /* Note must check here for stores of young objects into old ones. */ +/* See SistaCogit */ /* SpurMemoryManager>>#storePointer:ofObject:withValue: */ sqInt @@ -48173,7 +47752,8 @@ sufficientSpaceAfterGC(sqInt numBytes) assert(numBytes == 0); scavengingGCTenuringIf(TenureByAge); - heapSizePostGC = (GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize))) - GIV(totalFreeOldSpace); + heapSizePostGC = ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges) - (GIV(numSegments) * (2 * BaseHeaderSize)))) - GIV(totalFreeOldSpace); if (((((double) (heapSizePostGC - GIV(heapSizeAtPreviousGC)) )) / GIV(heapSizeAtPreviousGC)) >= GIV(heapGrowthToSizeGCRatio)) { fullGC(); } @@ -48792,6 +48372,9 @@ validClassTableRootPages(void) return 1; } + +/* useful for debugging */ + /* SpurMemoryManager>>#validFreeTree */ sqInt validFreeTree(void) @@ -49202,6 +48785,7 @@ copyAndUnmarkMobileObjects(void) usqInt previousPin; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt start; usqInt startOfPreviousPin; usqInt toFinger; @@ -49279,23 +48863,18 @@ copyAndUnmarkMobileObjects(void) assert((isMarked(previousPin)) && (isPinned(previousPin))); /* begin unmarkPinned: */ - if (!(((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(previousPin)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(previousPin))); longAtput(previousPin, (longAt(previousPin)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(previousPin)); - if (((longAt(previousPin)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(previousPin))); - longAtput(previousPin, (longAt(previousPin)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), previousPin)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(previousPin)))); + seg = segmentContainingObj(previousPin); + (seg->containsPinned = 1); } toFinger = addressAfter(previousPin); /* begin objectStartingAt: */ @@ -49541,6 +49120,7 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) usqInt numSlots; sqInt obj; usqInt objStart; + SpurSegmentInfo *seg; usqInt toFinger; toFinger = initialToFinger; @@ -49563,23 +49143,18 @@ freeFromupTonextObject(usqInt initialToFinger, usqInt limit, sqInt nextObject) if ((((((usqInt)((longAt(obj)))) >> (markedBitFullShift())) & 1) != 0) && (((((usqInt)((longAt(obj)))) >> (pinnedBitShift())) & 1) != 0)) { /* begin unmarkPinned: */ - if (!(((longAt(obj)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(obj)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(obj))); longAtput(obj, (longAt(obj)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(obj)); - if (((longAt(obj)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(obj))); - longAtput(obj, (longAt(obj)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), obj)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(obj)))); + seg = segmentContainingObj(obj); + (seg->containsPinned = 1); } if (toFinger < objStart) { /* begin addFreeChunkWithBytes:at: */ @@ -49992,6 +49567,7 @@ unmarkObjectsFromFirstFreeObject(void) sqInt objOop; sqInt prevObj; sqInt prevPrevObj; + SpurSegmentInfo *seg; usqInt startOfFree; startOfFree = 0; @@ -50014,23 +49590,18 @@ unmarkObjectsFromFirstFreeObject(void) } if (((((usqInt)((longAt(objOop)))) >> (pinnedBitShift())) & 1) != 0) { /* begin unmarkPinned: */ - if (!(((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun()))) { + if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { + assert(isMarked(objOop)); + } + else { /* begin setIsMarkedOf:to: */ assert(!(isFreeObject(objOop))); longAtput(objOop, (longAt(objOop)) & (~(usqIntptr_t)(1ULL << (markedBitFullShift())))); /* begin notePinned: */ assert(isPinned(objOop)); - if (((longAt(objOop)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin setIsMarkedOf:to: */ - assert(!(isFreeObject(objOop))); - longAtput(objOop, (longAt(objOop)) | (1ULL << (markedBitFullShift()))); - } - else { - while (oopisLessThan((((GIV(segments)[GIV(sweepIndex)]).segSize)) + (((GIV(segments)[GIV(sweepIndex)]).segStart)), objOop)) { - GIV(sweepIndex) += 1; - } - ((GIV(segments)[GIV(sweepIndex)]).containsPinned = 1); - } + assert(!((isSegmentBridge(objOop)))); + seg = segmentContainingObj(objOop); + (seg->containsPinned = 1); } } else { @@ -51056,9 +50627,11 @@ collapseSegmentsPostSwizzle(void) GIV(canSwizzle) = 0; GIV(numSegments) = 1; + /* begin computeTotalHeapSizeIncludingBridges */ + GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()); cascade0 = (&(GIV(segments)[0])); (cascade0->segStart = oldSpaceStart()); - (cascade0->segSize = (GIV(totalHeapSizeIncludingBridges) = (endOfMemory()) - (oldSpaceStart()))); + (cascade0->segSize = GIV(totalHeapSizeIncludingBridges)); assert(isSegmentBridge(bridgeAt(0))); assert((numSlotsOfAny(bridgeAt(0))) == 0); } @@ -51240,7 +50813,6 @@ prepareForSnapshot(void) usqInt followingWordAddress; usqInt freeChunk; sqInt i; - sqInt i1; sqInt largeChild; sqInt limit; sqInt newEndOfMemory; @@ -51288,24 +50860,16 @@ prepareForSnapshot(void) followingWordAddress = addressAfter(node); if (oopisGreaterThanOrEqualTo(followingWordAddress, limit)) { next = limit; - goto l9; + goto l7; } flag("endianness"); followingWord = longAt(followingWordAddress); next = ((((usqInt)(followingWord)) >> (numSlotsFullShift())) == (numSlotsMask()) ? followingWordAddress + BaseHeaderSize : followingWordAddress); - l9: /* end objectAfter:limit: */; + l7: /* end objectAfter:limit: */; if (((longAt(next)) & (classIndexMask())) == (segmentBridgePun())) { - /* begin segmentContainingObj: */ - for (i1 = (GIV(numSegments) - 1); i1 >= 0; i1 += -1) { - if (node >= (((GIV(segments)[i1]).segStart))) { - seg = (&(GIV(segments)[i1])); - goto l8; - } - } - seg = null; - l8: /* end segmentContainingObj: */; + seg = segmentContainingObj(node); (seg->lastFreeObject = node); node = 0; } @@ -51420,17 +50984,51 @@ readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes) return totalBytesRead; } + +/* Answer the segment containing an object. This is mostly for assert + checking, but + variations on the incremental GC may use it in anger. Binary search is (of + course) marginally slower than linear search for a single segment (e.g. in + a 720k object heap, + 67.1ms vs 61.3ms, or 9.5% slower to derive the segment containing every + old space + entity), but usefully faster for many segments (e.g. 92.7ms vs 116ms, or + 20% faster + in the same heap extended with enough large arrays to require 11 segments; + and this + is pessimal; there are fewer objects at high addresses since the large + arrays are there). */ + /* SpurSegmentManager>>#segmentContainingObj: */ -EXPORT(SpurSegmentInfo *) +SpurSegmentInfo * segmentContainingObj(sqInt objOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; + sqInt high; + sqInt low; + sqInt mid; + SpurSegmentInfo *seg; - for (i = (GIV(numSegments) - 1); i >= 0; i += -1) { - if (objOop >= (((GIV(segments)[i]).segStart))) { - return (&(GIV(segments)[i])); + low = 0; + mid = GIV(numSegments) / 2; + high = GIV(numSegments) - 1; + do { + seg = (&(GIV(segments)[mid])); + if (oopisGreaterThanOrEqualTo(objOop, (seg->segStart))) { + if (mid == high) { + return (oopisLessThan(objOop, ((seg->segSize)) + ((seg->segStart))) + ? seg + : 0); + } + else { + low = mid; + mid = ((mid + high) + 1) / 2; + } } - } + else { + high = mid - 1; + mid = (low + mid) / 2; + } + } while(low <= high); return null; } @@ -51607,6 +51205,9 @@ swizzleObj(sqInt objOop) return objOop + (((GIV(segments)[0]).swizzle)); } + +/* This ``slow'' count is for asserts only. */ + /* SpurSegmentManager>>#totalBytesInSegments */ static usqInt totalBytesInSegments(void) @@ -51618,7 +51219,6 @@ totalBytesInSegments(void) for (i = 0; i < GIV(numSegments); i += 1) { total += ((GIV(segments)[i]).segSize); } - assert(GIV(totalHeapSizeIncludingBridges) == total); return total; } @@ -51727,12 +51327,10 @@ accessorDepthForPrimitiveMethod(sqInt aMethodObj) /* Answer the current activeProcess. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#activeProcess */ -EXPORT(sqInt) +sqInt activeProcess(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt objOop; @@ -52234,7 +51832,7 @@ booleanValueOf(sqInt obj) /* Re-enter the interpreter to execute a (non-Alien) callback. */ /* StackInterpreter>>#callbackEnter: */ -EXPORT(sqInt) +sqInt callbackEnter(sqInt *callbackID) { warning("callbackEnter: is obsolete"); @@ -52245,7 +51843,7 @@ callbackEnter(sqInt *callbackID) /* Leave from a previous callback */ /* StackInterpreter>>#callbackLeave: */ -EXPORT(sqInt) +sqInt callbackLeave(sqInt cbID) { warning("callbackLeave: is obsolete"); @@ -52299,12 +51897,10 @@ characterForAscii(sqInt ascii) /* Ensure that all accessible objects in the heap are okay. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkAllAccessibleObjectsOkay */ -EXPORT(sqInt) +sqInt checkAllAccessibleObjectsOkay(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -52806,12 +52402,10 @@ checkOkayFields(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#checkOkayInterpreterObjects: */ -EXPORT(sqInt) +sqInt checkOkayInterpreterObjects(sqInt writeBack) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -53234,19 +52828,10 @@ contexthasValidInversePCMappingOfin(sqInt aContext, sqInt theIP, char *theFP) /* StackInterpreter>>#copiedValueCountOfClosure: */ sqInt -copiedValueCountOfClosure(sqInt closurePointer) -{ - return (numSlotsOf(closurePointer)) - ClosureFirstCopiedValueIndex; -} - - -/* for Cogit */ - - /* StackInterpreter>>#copiedValueCountOfFullClosure: */ -sqInt -copiedValueCountOfFullClosure(sqInt closurePointer) +copiedValueCountOfClosure(sqInt closureObj) { - return (numSlotsOf(closurePointer)) - FullClosureFirstCopiedValueIndex; + return (assert(isVanillaBlockClosure(closureObj)), + (numSlotsOf(closureObj)) - ClosureFirstCopiedValueIndex); } @@ -53776,7 +53361,7 @@ dumpPrimTraceLog(void) */ /* StackInterpreter>>#dumpPrimTraceLogOn: */ -EXPORT(void) +void dumpPrimTraceLogOn(FILE *aStdioStream) { } @@ -55593,19 +55178,6 @@ fullDisplayUpdate(void) } -/* Find an actual function pointer for this primitiveIndex. This is an - opportunity to specialise the prim for the relevant class (format for - example). Default for now is simply the entry in the base primitiveTable. */ - - /* StackInterpreter>>#functionPointerFor:inClass: */ -void (*functionPointerForinClass(sqInt primIdx,sqInt theClass))(void) -{ - return (primIdx > MaxPrimitiveIndex - ? 0 - : primitiveTable[primIdx]); -} - - /* Answer an array of flags indicating various optional features of the Cog VM. If the bit is set then... Bit 0: supports two bytecode sets (MULTIPLEBYTECODESETS) @@ -56649,6 +56221,21 @@ isSingleContext(sqInt aContext) } +/* Answer if aClosure is a vanilla BlockClosure as in the first Cog release, + BlockClosure laid out as + 'outerContext, startpc, numArgs. FullBlockClosure is laid out as + outerContext, method, numArgs, receiver. + So either answer true if we're not supporting FullBlockClosure, or test + the startpc/method field. */ + + /* StackInterpreter>>#isVanillaBlockClosure: */ +static sqInt NoDbgRegParms +isVanillaBlockClosure(sqInt aClosure) +{ + return 1; +} + + /* See if the argument is married to a live frame or not. i.e. see if there is a matching frame whose frameContext field is aOnceMarriedContext, or a forwarder to @@ -57065,12 +56652,10 @@ loadInitialContext(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#longPrintOop: */ -EXPORT(void) +void longPrintOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -59999,19 +59584,6 @@ pcPreviousToinSqueakV3PlusClosuresOrNewsqueakV4Method(sqInt theIP, sqInt aMethod return pcPreviousToinSqueakV3PlusClosuresMethod(theIP, aMethod); } - /* StackInterpreter>>#penultimateLiteralOf: */ -sqInt -penultimateLiteralOf(sqInt aMethodOop) -{ - sqInt offset; - - assert(isOopCompiledMethod(aMethodOop)); - /* begin literal:ofMethod: */ - offset = (literalCountOf(aMethodOop)) - 2; - /* begin fetchPointer:ofObject: */ - return longAt((aMethodOop + BaseHeaderSize) + (((sqInt)((usqInt)((offset + LiteralStart)) << (shiftForWord()))))); -} - /* In the StackInterpreter stacks grow down. */ @@ -60989,12 +60561,10 @@ printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObjec /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacks */ -EXPORT(void) +void printAllStacks(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -61193,12 +60763,10 @@ printAllStacks(void) /* Print all the stacks of all running processes, including those that are currently suspended. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printAllStacksOn: */ -EXPORT(void) +void printAllStacksOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -61213,12 +60781,10 @@ printAllStacksOn(FILE *aStdioStream) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStack */ -EXPORT(void) +void printCallStack(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT if (GIV(framePointer) == null) { @@ -61252,12 +60818,10 @@ printCallStackFP(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOf: */ -EXPORT(sqInt) +sqInt printCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -61349,12 +60913,10 @@ printCallStackOfcurrentFP(sqInt aContext, char *currFP) /* Print the call stack on a specific output stream. */ -/* essential for writing crash.dmp; use export: not api, so it will be - accessible on win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printCallStackOn: */ -EXPORT(void) +void printCallStackOn(FILE *aStdioStream) { DECL_MAYBE_SQ_GLOBAL_STRUCT FILE *savedTranscript; @@ -61388,12 +60950,10 @@ printContextCallStackOf(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printContext: */ -EXPORT(void) +void printContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -61513,12 +61073,10 @@ printContext(sqInt aContext) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printExternalHeadFrame */ -EXPORT(void) +void printExternalHeadFrame(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT printFrameWithSP(GIV(framePointer), GIV(stackPointer)); @@ -61599,19 +61157,20 @@ printFrameOopat(char *name, char *address) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFramesInPage: */ -EXPORT(void) +void printFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 0); } + +/* useful for VM debugging */ + /* StackInterpreter>>#printFramesOnStackPageListInUse */ -EXPORT(void) +void printFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -61684,12 +61243,10 @@ printFrameThingatextraString(char *name, char *address, char *extraStringOrNil) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame: */ -EXPORT(sqInt) +sqInt printFrame(char *theFP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *aFrame; @@ -61773,12 +61330,10 @@ printFrame(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printFrame:WithSP: */ -EXPORT(sqInt) +sqInt printFrameWithSP(char *theFP, char *theSP) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *addr; @@ -61832,18 +61387,6 @@ printFrameWithSP(char *theFP, char *theSP) } -/* Print n in hex, in the form '0x1234', unpadded */ - - /* StackInterpreter>>#printHexnp: */ -sqInt -printHexnp(usqInt n) -{ DECL_MAYBE_SQ_GLOBAL_STRUCT - return fprintf(GIV(transcript), - "%p", - ((void *)n)); -} - - /* Print p in hex, unpadded, in the form 0x1234 (C)/16r1234 (here) */ /* StackInterpreter>>#printHexPtrnp: */ @@ -61875,12 +61418,10 @@ printHex(usqInt n) /* Print all methods whose penultimate literal is either selector, or an object whose first inst var is the method and whose second is selector (e.g. an AdditionalMethodState). */ -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printLikelyImplementorsOfSelector: */ -EXPORT(void) +void printLikelyImplementorsOfSelector(sqInt selector) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt address; @@ -61958,12 +61499,10 @@ printLikelyImplementorsOfSelector(sqInt selector) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCache */ -EXPORT(void) +void printMethodCache(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -62053,12 +61592,10 @@ printMethodCache(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodCacheFor: */ -EXPORT(void) +void printMethodCacheFor(sqInt thing) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqIntptr_t c; @@ -62152,12 +61689,10 @@ printMethodCacheFor(sqInt thing) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionaryOf: */ -EXPORT(void) +void printMethodDictionaryOf(sqInt behavior) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt dictionary; @@ -62200,12 +61735,10 @@ printMethodDictionaryOf(sqInt behavior) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printMethodDictionary: */ -EXPORT(void) +void printMethodDictionary(sqInt dictionary) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt index; @@ -62485,10 +62018,10 @@ printOopShortInner(sqInt oop) } -/* use export: not api, so it won't be written to cointerp.h */ +/* useful for VM debugging */ /* StackInterpreter>>#printOop: */ -EXPORT(void) +void printOop(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt byte; @@ -62670,12 +62203,10 @@ printOop(sqInt oop) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcessStack: */ -EXPORT(void) +void printProcessStack(sqInt aProcess) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ctx; @@ -62714,12 +62245,10 @@ printProcessStack(sqInt aProcess) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printProcsOnList: */ -EXPORT(sqInt) +sqInt printProcsOnList(sqInt procList) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt firstProc; @@ -62745,12 +62274,10 @@ printProcsOnList(sqInt procList) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackCallStackOf: */ -EXPORT(sqInt) +sqInt printStackCallStackOf(sqInt aContextOrProcessOrFrame) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt context; @@ -62783,12 +62310,10 @@ printStackCallStackOf(sqInt aContextOrProcessOrFrame) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageList */ -EXPORT(void) +void printStackPageList(void) { StackPage *page; @@ -62802,12 +62327,10 @@ printStackPageList(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPageListInUse */ -EXPORT(void) +void printStackPageListInUse(void) { sqInt n; @@ -62824,12 +62347,10 @@ printStackPageListInUse(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPages */ -EXPORT(void) +void printStackPages(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -62844,12 +62365,10 @@ printStackPages(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackPagesInUse */ -EXPORT(void) +void printStackPagesInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; @@ -62975,12 +62494,10 @@ printStackPageuseCount(StackPage *page, sqInt n) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#printStackReferencesTo: */ -EXPORT(void) +void printStackReferencesTo(sqInt oop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *callerFP; @@ -63358,7 +62875,7 @@ putWord32toFile(int aWord32, sqImageFile aFile) } -/* Anwer true if images of the given format are readable by this interpreter. +/* Anwer if images of the given format are readable by this interpreter. Allows a virtual machine to accept selected older image formats. */ /* StackInterpreter>>#readableFormat: */ @@ -63809,7 +63326,7 @@ reapAndResetErrorCodeToheader(char *theSP, sqInt methodHeader) and mark calloutContext as dead. */ /* StackInterpreter>>#reestablishContextPriorToCallback: */ -EXPORT(sqInt) +sqInt reestablishContextPriorToCallback(sqInt callbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; @@ -64341,7 +63858,7 @@ retryPrimitiveOnFailure(void) and mark callbackMethodContext as dead. */ /* StackInterpreter>>#returnAs:ThroughCallback:Context: */ -EXPORT(sqInt) +sqInt returnAsThroughCallbackContext(sqInt returnTypeOop, VMCallbackContext *vmCallbackContext, sqInt callbackMethodContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutMethodContext; @@ -64672,7 +64189,7 @@ saneFunctionPointerForFailureOfPrimIndex(sqInt primIndex) arguments on primitive return. */ /* StackInterpreter>>#sendInvokeCallbackContext: */ -EXPORT(sqInt) +sqInt sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt classTag; @@ -64817,12 +64334,10 @@ GIV(bytecodeSetSelector) = ((((sqLong) methodHeader)) < 0 } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakMNUSelector: */ -EXPORT(void) +void setBreakMNUSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -64836,12 +64351,10 @@ setBreakMNUSelector(char *aString) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#setBreakSelector: */ -EXPORT(void) +void setBreakSelector(char *aString) { if (((breakSelector = aString)) == null) { @@ -64862,7 +64375,7 @@ setFullScreenFlag(sqInt value) } /* StackInterpreter>>#setInterruptCheckChain: */ -EXPORT(void *) +void * setInterruptCheckChain(void (*aFunction)()) { void (*prevFunction)(); @@ -64984,6 +64497,7 @@ static sqInt NoDbgRegParms shortPrintContext(sqInt aContext) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt home; + sqInt rcvr; sqInt senderOop; char *theFP; @@ -65021,15 +64535,16 @@ shortPrintContext(sqInt aContext) if (home == null) { /* begin print: */ fprintf(GIV(transcript), " BOGUS CONTEXT (can't determine home)"); + cr(); } else { - printActivationNameForreceiverisBlockfirstTemporary(fetchPointerofObject(MethodIndex, (!(home) - ? aContext - : home)), (home == null - ? /* begin nilObject */ GIV(nilObj) - : (longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)(ReceiverIndex) << (shiftForWord()))))))), home != aContext, longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin fetchPointer:ofObject: */ + rcvr = longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)(ReceiverIndex) << (shiftForWord()))))); + printActivationNameForreceiverisBlockfirstTemporary(longAt((aContext + BaseHeaderSize) + (((sqInt)((usqInt)(MethodIndex) << (shiftForWord()))))), rcvr, home != aContext, longAt((home + BaseHeaderSize) + (((sqInt)((usqInt)((0 + CtxtTempFrameStart)) << (shiftForWord())))))); + /* begin space */ + printChar(' '); + shortPrintOop(rcvr); } - cr(); return 0; } @@ -65049,19 +64564,20 @@ shortPrintFrameAndCallers(char *theFP) } -/* use export: not api, so it won't be written to cointerp.h. cogit.c is - unaware of StackPage - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFramesInPage: */ -EXPORT(void) +void shortPrintFramesInPage(StackPage *thePage) { printFrameAndCallersSPshort((thePage->headFP), (thePage->headSP), 1); } + +/* useful for VM debugging */ + /* StackInterpreter>>#shortPrintFramesOnStackPageListInUse */ -EXPORT(void) +void shortPrintFramesOnStackPageListInUse(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT StackPage *page; @@ -65108,12 +64624,10 @@ shortPrintFrame(char *theFP) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#shortPrintFrame:AndNCallers: */ -EXPORT(void) +void shortPrintFrameAndNCallers(char *theFP, sqInt n) { DECL_MAYBE_SQ_GLOBAL_STRUCT if ((n != 0) @@ -67508,12 +67022,10 @@ wakeHighestPriority(void) } -/* useful for VM debugging; use export: not api, so it will be accessible on - win32 and won't be written to cointerp.h - */ +/* useful for VM debugging */ /* StackInterpreter>>#whereIs: */ -EXPORT(char *) +char * whereIs(sqInt anOop) { DECL_MAYBE_SQ_GLOBAL_STRUCT char *where; @@ -72319,7 +71831,8 @@ primitiveUnloadModule(void) 48 various header flags. See getImageHeaderFlags. 49 max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing) - 50 max literal count for JIT compile (stored in image file header; Cog + + 50 max literal count for JIT compile (stored in image file header; Cog only; otherwise nil) 51 nil; reserved for VM parameters that persist in the image (such as eden above) 52 root/remembered table capacity @@ -72460,7 +71973,8 @@ primitiveVMParameter(void) /* begin primitiveAllVMParameters: */ result1 = instantiateClassindexableSize(splObj(ClassArray), paramsArraySize); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer8 = positiveMachineIntegerFor(totalBytesInSegments()); + valuePointer8 = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (0U << (shiftForWord())), valuePointer8); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -72468,7 +71982,8 @@ primitiveVMParameter(void) assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (1U << (shiftForWord())), valuePointer9); /* begin storePointerUnchecked:ofObject:withValue: */ - valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + valuePointer10 = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); assert(!(isOopForwarded(result1))); longAtput((result1 + BaseHeaderSize) + (2U << (shiftForWord())), valuePointer10); /* begin storePointerUnchecked:ofObject:withValue: */ @@ -72804,7 +72319,8 @@ primitiveVMParameter(void) /* begin primitiveGetVMParameter: */ switch (index) { case 1: - result = positiveMachineIntegerFor(totalBytesInSegments()); + result = positiveMachineIntegerFor((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), + GIV(totalHeapSizeIncludingBridges))); goto l93; break; case 2: @@ -72812,7 +72328,8 @@ primitiveVMParameter(void) goto l93; break; case 3: - result = positiveMachineIntegerFor((newSpaceCapacity()) + (totalBytesInSegments())); + result = positiveMachineIntegerFor((newSpaceCapacity()) + ((assert((totalBytesInSegments()) == GIV(totalHeapSizeIncludingBridges)), +GIV(totalHeapSizeIncludingBridges)))); goto l93; break; case 6: @@ -73774,17 +73291,6 @@ unmarkAllFrames(void) static char _m[] = ""; void* vm_exports[][3] = { - {(void*)_m, "activeProcess", (void*)activeProcess}, - {(void*)_m, "callbackEnter", (void*)callbackEnter}, - {(void*)_m, "callbackLeave", (void*)callbackLeave}, - {(void*)_m, "checkAllAccessibleObjectsOkay", (void*)checkAllAccessibleObjectsOkay}, - {(void*)_m, "checkOkayInterpreterObjects", (void*)checkOkayInterpreterObjects}, - {(void*)_m, "dumpPrimTraceLogOn", (void*)dumpPrimTraceLogOn}, - {(void*)_m, "inOrderPrintFreeTreeprintList", (void*)inOrderPrintFreeTreeprintList}, - {(void*)_m, "longPrintInstancesOf", (void*)longPrintInstancesOf}, - {(void*)_m, "longPrintInstancesWithClassIndex", (void*)longPrintInstancesWithClassIndex}, - {(void*)_m, "longPrintOop", (void*)longPrintOop}, - {(void*)_m, "longPrintReferencesTo", (void*)longPrintReferencesTo}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, {(void*)_m, "primitiveAddLargeIntegers\000\000\001", (void*)primitiveAddLargeIntegers}, {(void*)_m, "primitiveAllInstances\000\000\000", (void*)primitiveAllInstances}, @@ -73848,69 +73354,5 @@ void* vm_exports[][3] = { #endif /* TestingPrimitives */ {(void*)_m, "primitiveUtcWithOffset\000\001\000", (void*)primitiveUtcWithOffset}, {(void*)_m, "primitiveVoidReceiver\000\377\000", (void*)primitiveVoidReceiver}, - {(void*)_m, "printActivationsOf", (void*)printActivationsOf}, - {(void*)_m, "printAllStacks", (void*)printAllStacks}, - {(void*)_m, "printAllStacksOn", (void*)printAllStacksOn}, - {(void*)_m, "printBogons", (void*)printBogons}, - {(void*)_m, "printCallStack", (void*)printCallStack}, - {(void*)_m, "printCallStackOf", (void*)printCallStackOf}, - {(void*)_m, "printCallStackOn", (void*)printCallStackOn}, - {(void*)_m, "printContextReferencesTo", (void*)printContextReferencesTo}, - {(void*)_m, "printContext", (void*)printContext}, - {(void*)_m, "printEntity", (void*)printEntity}, - {(void*)_m, "printExternalHeadFrame", (void*)printExternalHeadFrame}, - {(void*)_m, "printForwarders", (void*)printForwarders}, - {(void*)_m, "printFramesInPage", (void*)printFramesInPage}, - {(void*)_m, "printFramesOnStackPageListInUse", (void*)printFramesOnStackPageListInUse}, - {(void*)_m, "printFrame", (void*)printFrame}, - {(void*)_m, "printFrameWithSP", (void*)printFrameWithSP}, - {(void*)_m, "printFreeChunk", (void*)printFreeChunk}, - {(void*)_m, "printFreeListHeads", (void*)printFreeListHeads}, - {(void*)_m, "printFreeList", (void*)printFreeList}, - {(void*)_m, "printFreeTree", (void*)printFreeTree}, - {(void*)_m, "printHeaderOf", (void*)printHeaderOf}, - {(void*)_m, "printInstancesOf", (void*)printInstancesOf}, - {(void*)_m, "printInstancesWithClassIndex", (void*)printInstancesWithClassIndex}, - {(void*)_m, "printLikelyImplementorsOfSelector", (void*)printLikelyImplementorsOfSelector}, -#if LLDB - {(void*)_m, "printMarkedOops", (void*)printMarkedOops}, -#endif /* LLDB */ - {(void*)_m, "printMethodCache", (void*)printMethodCache}, - {(void*)_m, "printMethodCacheFor", (void*)printMethodCacheFor}, - {(void*)_m, "printMethodDictionaryOf", (void*)printMethodDictionaryOf}, - {(void*)_m, "printMethodDictionary", (void*)printMethodDictionary}, - {(void*)_m, "printMethodImplementorsOf", (void*)printMethodImplementorsOf}, - {(void*)_m, "printMethodReferencesTo", (void*)printMethodReferencesTo}, - {(void*)_m, "printObjectsFromto", (void*)printObjectsFromto}, - {(void*)_m, "printObjectsWithHash", (void*)printObjectsWithHash}, - {(void*)_m, "printOopsExcept", (void*)printOopsExcept}, - {(void*)_m, "printOopsFromto", (void*)printOopsFromto}, - {(void*)_m, "printOopsSuchThat", (void*)printOopsSuchThat}, - {(void*)_m, "printOop", (void*)printOop}, - {(void*)_m, "printProcessStack", (void*)printProcessStack}, - {(void*)_m, "printProcsOnList", (void*)printProcsOnList}, - {(void*)_m, "printReferencesTo", (void*)printReferencesTo}, - {(void*)_m, "printStackCallStackOf", (void*)printStackCallStackOf}, - {(void*)_m, "printStackPageList", (void*)printStackPageList}, - {(void*)_m, "printStackPageListInUse", (void*)printStackPageListInUse}, - {(void*)_m, "printStackPages", (void*)printStackPages}, - {(void*)_m, "printStackPagesInUse", (void*)printStackPagesInUse}, - {(void*)_m, "printStackReferencesTo", (void*)printStackReferencesTo}, -#if LLDB - {(void*)_m, "printUnmarkedOops", (void*)printUnmarkedOops}, -#endif /* LLDB */ - {(void*)_m, "reestablishContextPriorToCallback", (void*)reestablishContextPriorToCallback}, - {(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext}, - {(void*)_m, "segmentContainingObj", (void*)segmentContainingObj}, - {(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext}, - {(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector}, - {(void*)_m, "setBreakSelector", (void*)setBreakSelector}, - {(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain}, - {(void*)_m, "shortPrintFramesInPage", (void*)shortPrintFramesInPage}, - {(void*)_m, "shortPrintFramesOnStackPageListInUse", (void*)shortPrintFramesOnStackPageListInUse}, - {(void*)_m, "shortPrintFrameAndNCallers", (void*)shortPrintFrameAndNCallers}, - {(void*)_m, "shortPrintObjectsFromto", (void*)shortPrintObjectsFromto}, - {(void*)_m, "statNumGCs", (void*)statNumGCs}, - {(void*)_m, "whereIs", (void*)whereIs}, {NULL, NULL, NULL} }; diff --git a/src/v3.cog/cogit.h b/src/v3.cog/cogit.h index c76679a0bc..03e437f036 100644 --- a/src/v3.cog/cogit.h +++ b/src/v3.cog/cogit.h @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ @@ -26,6 +26,7 @@ extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogBlockMetho extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes); extern char * codeEntryFor(char *address); extern char * codeEntryNameFor(char *address); +extern sqInt cogCodeBase(void); extern sqInt cogCodeConstituents(sqInt withDetails); extern void cogitPostGCAction(sqInt gcMode); extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs); diff --git a/src/v3.cog/cogitARMv5.c b/src/v3.cog/cogitARMv5.c index 3861130721..4735b6fb0b 100644 --- a/src/v3.cog/cogitARMv5.c +++ b/src/v3.cog/cogitARMv5.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -8668,7 +8668,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt diff --git a/src/v3.cog/cogitIA32.c b/src/v3.cog/cogitIA32.c index 4b1ee13739..a3b0ed96a2 100644 --- a/src/v3.cog/cogitIA32.c +++ b/src/v3.cog/cogitIA32.c @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + CCodeGenerator VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef + StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3328 uuid: a1c7c55f-8829-4fcc-9a66-55ba7d1a8cef " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3329 uuid: 31a93bfc-1d06-4008-9439-27c01b0644f9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -8334,7 +8334,9 @@ codeEntryNameFor(char *address) } -/* used e.g. in the platform's backtrace generators */ +/* used e.g. in the platform's backtrace generators. Declared api to place it + in cogit.h + */ /* Cogit>>#cogCodeBase */ sqInt