Revision: 2938 Author: eliot Date: 2014-06-01 18:11:49 -0700 (Sun, 01 Jun 2014) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.746 Implement a peephole in the Spur Cogit for an indirection vector initialized with a single value Avoid initializing the slot in the array to nil and instead initialize it with the value. Refactor setting byte1, byte2 & byte3 into loadSubsequentBytesForDescriptor:at: for the peephole tryCollapseTempVectorInitializationOfSize:. No longer inline CoInterpreter>>pre/postGCAction: for VM profiling. Increase the number of trampoline table slots. Modified Paths: -------------- branches/Cog/nscogsrc/vm/cogit.c branches/Cog/nscogsrc/vm/cogit.h branches/Cog/nscogsrc/vm/cogmethod.h branches/Cog/nscogsrc/vm/cointerp.c branches/Cog/nscogsrc/vm/cointerp.h branches/Cog/nscogsrc/vm/gcc3x-cointerp.c branches/Cog/nscogsrc/vm/interp.h branches/Cog/nscogsrc/vm/vmCallback.h branches/Cog/nsspursrc/vm/cogit.c branches/Cog/nsspursrc/vm/cogit.h branches/Cog/nsspursrc/vm/cogmethod.h branches/Cog/nsspursrc/vm/cointerp.c branches/Cog/nsspursrc/vm/cointerp.h branches/Cog/nsspursrc/vm/gcc3x-cointerp.c branches/Cog/nsspursrc/vm/interp.h branches/Cog/nsspursrc/vm/vmCallback.h branches/Cog/sistasrc/vm/cogit.c branches/Cog/sistasrc/vm/cogit.h branches/Cog/sistasrc/vm/cogmethod.h branches/Cog/sistasrc/vm/cointerp.c branches/Cog/sistasrc/vm/cointerp.h branches/Cog/sistasrc/vm/gcc3x-cointerp.c branches/Cog/sistasrc/vm/interp.h branches/Cog/sistasrc/vm/vmCallback.h branches/Cog/spursistasrc/vm/cogit.c branches/Cog/spursistasrc/vm/cogit.h branches/Cog/spursistasrc/vm/cogmethod.h branches/Cog/spursistasrc/vm/cointerp.c branches/Cog/spursistasrc/vm/cointerp.h branches/Cog/spursistasrc/vm/gcc3x-cointerp.c branches/Cog/spursistasrc/vm/interp.h branches/Cog/spursistasrc/vm/vmCallback.h branches/Cog/spursrc/vm/cogit.c branches/Cog/spursrc/vm/cogit.h branches/Cog/spursrc/vm/cogmethod.h branches/Cog/spursrc/vm/cointerp.c branches/Cog/spursrc/vm/cointerp.h branches/Cog/spursrc/vm/gcc3x-cointerp.c branches/Cog/spursrc/vm/interp.h branches/Cog/spursrc/vm/vmCallback.h branches/Cog/src/vm/cogit.c branches/Cog/src/vm/cogit.h branches/Cog/src/vm/cogmethod.h branches/Cog/src/vm/cointerp.c branches/Cog/src/vm/cointerp.h branches/Cog/src/vm/cointerpmt.c branches/Cog/src/vm/cointerpmt.h branches/Cog/src/vm/gcc3x-cointerp.c branches/Cog/src/vm/gcc3x-cointerpmt.c branches/Cog/src/vm/interp.h branches/Cog/src/vm/vmCallback.h Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h Modified: branches/Cog/nscogsrc/vm/cogit.c =================================================================== --- branches/Cog/nscogsrc/vm/cogit.c 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nscogsrc/vm/cogit.c 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 + CCodeGenerator VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 + StackToRegisterMappingCogit VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -297,7 +297,7 @@ #define NSSendIsPCAnnotated 1 #define NumObjRefsInRuntime 2 #define NumSendTrampolines 4 -#define NumTrampolines 58 +#define NumTrampolines 60 #define OrCqR 93 #define OrCwR 100 #define OrRR 86 @@ -565,6 +565,7 @@ void enterCogCodePopReceiverAndClassRegs(void); void enterCogCodePopReceiverArg0Regs(void); void enterCogCodePopReceiverArg1Arg0Regs(void); +static void evaluateat(BytecodeDescriptor *descriptor, sqInt pc) NoDbgRegParms; static sqInt extABytecode(void); static sqInt extBBytecode(void); static sqInt extendedPushBytecode(void); @@ -917,6 +918,7 @@ static sqInt literalBeforeFollowingAddress(AbstractInstruction * self_in_literalBeforeFollowingAddress, sqInt followingAddress) NoDbgRegParms; static sqInt liveRegisters(void); static sqInt loadLiteralByteSize(AbstractInstruction * self_in_loadLiteralByteSize) NoDbgRegParms; +static void loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc) NoDbgRegParms; static AbstractInstruction * longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress) NoDbgRegParms; static AbstractInstruction * gMoveAwR(sqInt address, sqInt reg) NoDbgRegParms; static AbstractInstruction * gMoveCwR(sqInt wordConstant, sqInt reg) NoDbgRegParms; @@ -1086,6 +1088,7 @@ static sqInt sib(AbstractInstruction * self_in_sib, sqInt scale, sqInt indexReg, sqInt baseReg) NoDbgRegParms; sqInt traceLinkedSendOffset(void); static char * trampolineNamenumArgs(char *routinePrefix, sqInt numArgs) NoDbgRegParms; +static sqInt tryCollapseTempVectorInitializationOfSize(sqInt slots) NoDbgRegParms; static sqInt twoByteInstructionSizeAt(AbstractInstruction * self_in_twoByteInstructionSizeAt, sqInt pc) NoDbgRegParms; static sqInt unimplementedPrimitive(void); static sqInt unknownBytecode(void); @@ -4170,18 +4173,7 @@ byte0 = (fetchByteofObject(bytecodePC, methodObj)) + bytecodeSetOffset; descriptor = generatorAt(byte0); - if (((descriptor->numBytes)) > 1) { - byte1 = fetchByteofObject(bytecodePC + 1, methodObj); - if (((descriptor->numBytes)) > 2) { - byte2 = fetchByteofObject(bytecodePC + 2, methodObj); - if (((descriptor->numBytes)) > 3) { - byte3 = fetchByteofObject(bytecodePC + 3, methodObj); - if (((descriptor->numBytes)) > 4) { - notYetImplemented(); - } - } - } - } + loadSubsequentBytesForDescriptorat(descriptor, bytecodePC); nextOpcodeIndex = opcodeIndex; result = (deadCode ? ((((descriptor->isMapped)) @@ -10397,7 +10389,16 @@ realCEEnterCogCodePopReceiverArg1Arg0Regs(); } +static void +evaluateat(BytecodeDescriptor *descriptor, sqInt pc) +{ + byte0 = fetchByteofObject(pc, methodObj); + assert(descriptor == (generatorAt(bytecodeSetOffset + byte0))); + loadSubsequentBytesForDescriptorat(descriptor, pc); + ((descriptor->generator))(); +} + /* 224 11100000 aaaaaaaa Extend A (Ext A = Ext A prev * 256 + Ext A) */ static sqInt @@ -15058,6 +15059,11 @@ ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg); } size = byte1 & 0x7F; + if (!popValues) { + if (tryCollapseTempVectorInitializationOfSize(size)) { + return 0; + } + } genNewArrayOfSizeinitialized(size, !popValues); if (popValues) { for (i = (size - 1); i >= 0; i += -1) { @@ -17703,7 +17709,24 @@ return 5; } +static void +loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc) +{ + if (((descriptor->numBytes)) > 1) { + byte1 = fetchByteofObject(pc + 1, methodObj); + if (((descriptor->numBytes)) > 2) { + byte2 = fetchByteofObject(pc + 2, methodObj); + if (((descriptor->numBytes)) > 3) { + byte3 = fetchByteofObject(pc + 3, methodObj); + if (((descriptor->numBytes)) > 4) { + notYetImplemented(); + } + } + } + } +} + /* Since it's an extraction from other methods. */ /* This needs to be digfferent from jumpTargetAddress because long jumps can be to absolute addresses and hence we can't assert that the jump target is @@ -21569,7 +21592,59 @@ return theString; } + +/* Try and collapse + push: (Array new: 1) + popIntoTemp: tempIndex + pushConstant: const or pushTemp: n + popIntoTemp: 0 inVectorAt: tempIndex + into + tempAt: tempIndex put: {const}. + One might think that we should look for a sequence of more than + one pushes and pops but this is extremely rare. */ + static sqInt +tryCollapseTempVectorInitializationOfSize(sqInt slots) +{ + BytecodeDescriptor *pushArrayDesc; + BytecodeDescriptor *pushValueDesc; + sqInt reg; + BytecodeDescriptor *storeArrayDesc; + BytecodeDescriptor *storeValueDesc; + + if (slots != 1) { + return 0; + } + pushArrayDesc = generatorAt(bytecodeSetOffset + (fetchByteofObject(bytecodePC, methodObj))); + assert(((pushArrayDesc->generator)) == genPushNewArrayBytecode); + storeArrayDesc = generatorAt(bytecodeSetOffset + (fetchByteofObject(bytecodePC + ((pushArrayDesc->numBytes)), methodObj))); + if (((storeArrayDesc->generator)) != genStoreAndPopTemporaryVariableBytecode) { + return 0; + } + pushValueDesc = generatorAt(bytecodeSetOffset + (fetchByteofObject((bytecodePC + ((pushArrayDesc->numBytes))) + ((storeArrayDesc->numBytes)), methodObj))); + if ((((pushValueDesc->generator)) != genPushLiteralConstantBytecode) + && ((((pushValueDesc->generator)) != genPushQuickIntegerConstantBytecode) + && (((pushValueDesc->generator)) != genPushTemporaryVariableBytecode))) { + return 0; + } + storeValueDesc = generatorAt(bytecodeSetOffset + (fetchByteofObject(((bytecodePC + ((pushArrayDesc->numBytes))) + ((storeArrayDesc->numBytes))) + ((pushValueDesc->numBytes)), methodObj))); + if (((storeValueDesc->generator)) != genStoreAndPopRemoteTempLongBytecode) { + return 0; + } + genNewArrayOfSizeinitialized(1, 0); + evaluateat(pushValueDesc, (bytecodePC + ((pushArrayDesc->numBytes))) + ((storeArrayDesc->numBytes))); + reg = ssStorePoptoPreferredReg(1, TempReg); + genStoreSourceRegslotIndexintoNewObjectInDestReg(reg, 0, ReceiverResultReg); + ssPushRegister(ReceiverResultReg); + evaluateat(storeArrayDesc, bytecodePC + ((pushArrayDesc->numBytes))); + + /* + pushArrayDesc numBytes this gets added by nextBytecodePCFor:at:exts:in: */ + + bytecodePC = ((bytecodePC + ((storeArrayDesc->numBytes))) + ((pushValueDesc->numBytes))) + ((storeValueDesc->numBytes)); + return 1; +} + +static sqInt twoByteInstructionSizeAt(AbstractInstruction * self_in_twoByteInstructionSizeAt, sqInt pc) { sqInt op; Modified: branches/Cog/nscogsrc/vm/cogit.h =================================================================== --- branches/Cog/nscogsrc/vm/cogit.h 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nscogsrc/vm/cogit.h 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 + CCodeGenerator VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ Modified: branches/Cog/nscogsrc/vm/cogmethod.h =================================================================== --- branches/Cog/nscogsrc/vm/cogmethod.h 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nscogsrc/vm/cogmethod.h 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 + CCodeGenerator VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ typedef struct { Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nscogsrc/vm/cointerp.c 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 from - CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -839,6 +839,7 @@ unsigned long positiveMachineIntegerValueOf(sqInt oop); static void possibleRootStoreIntovalue(sqInt oop, sqInt valueObj) NoDbgRegParms; static void postGCAction(sqInt gcModeArg) NoDbgRegParms; +static void preGCAction(sqInt gcModeArg) NoDbgRegParms; static sqInt prepareForwardingTableForBecomingwithtwoWay(sqInt array1, sqInt array2, sqInt twoWayFlag) NoDbgRegParms; sqInt primErrTable(void); usqInt primFailCodeAddress(void); @@ -1311,8 +1312,8 @@ _iss sqInt trueObj; _iss sqInt falseObj; _iss sqInt remapBufferCount; -_iss sqInt traceLogIndex; _iss sqInt bytesPerPage; +_iss sqInt traceLogIndex; _iss usqInt reserveStart; _iss char * stackLimit; _iss sqInt rootTableCount; @@ -1338,18 +1339,18 @@ _iss sqInt growHeadroom; _iss sqInt longRunningPrimitiveCheckMethod; _iss sqInt profileMethod; -_iss sqInt lastMethodCacheProbeWrite; _iss sqInt backwardJumpCount; +_iss sqInt lastMethodCacheProbeWrite; _iss sqInt lkupClass; _iss usqLong nextWakeupUsecs; _iss sqInt preemptionYields; _iss sqInt cogCompiledCodeCompactionCalledFor; -_iss sqInt gcMode; _iss sqInt highestRunnableProcessPriority; _iss usqLong longRunningPrimitiveStartUsecs; _iss usqLong longRunningPrimitiveStopUsecs; _iss usqLong statCheckForEvents; _iss sqInt statMarkCount; +_iss sqInt gcMode; _iss sqInt lastCoggableInterpretedBlockMethod; _iss sqInt lastUncoggableInterpretedBlockMethod; _iss sqInt lowSpaceThreshold; @@ -2059,7 +2060,7 @@ /* 574 */ (void (*)(void))0, /* 575 */ (void (*)(void))0, 0 }; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.741"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.746"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -4852,7 +4853,6 @@ GIV(framePointer) = localFP; ceEnterCogCodePopReceiverReg(); - null; goto l309; } localIP = pointerForOop(longAt(localFP + FoxIFSavedIP)); @@ -4870,7 +4870,7 @@ /* begin fetchNextBytecode */ currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector); - null; + /* return self */ l309: /* end baseFrameReturn */; goto l306; } @@ -22847,52 +22847,15 @@ void fullGC(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; - sqInt i1; sqInt limit; sqInt sz; - sqInt traceType; if (GIV(fullGCLock) > 0) { warning("aborting fullGC because fullGCLock > 0"); return; } runLeakCheckerForFullGC(1); - /* begin preGCAction: */ - if (GIV(stackPage) != 0) { - /* begin externalWriteBackHeadFramePointers */ - assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); - assert(GIV(stackPage) == (mostRecentlyUsedPage())); - /* begin setHeadFP:andSP:inPage: */ - assert(GIV(stackPointer) < GIV(framePointer)); - assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); - assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); - (GIV(stackPage)->headFP = GIV(framePointer)); - (GIV(stackPage)->headSP = GIV(stackPointer)); - assert(pageListIsWellFormed()); - } - - GIV(gcMode) = GCModeFull; - if (recordEventTrace()) { - traceType = (GCModeFull == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin recordTrace:thing:source: */ - GIV(traceLog)[GIV(traceLogIndex)] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; - } - if (recordPrimTrace()) { - traceType = (GCModeFull == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin fastLogPrim: */ - GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; - primTraceLogIndex(GIV(primTraceLogIndex) + 1); - } + preGCAction(GCModeFull); GIV(needGCFlag) = 0; GIV(gcStartUsecs) = ioUTCMicrosecondsNow(); GIV(statSweepCount) = (GIV(statMarkCount) = (GIV(statMkFwdCount) = (GIV(statCompMoveCount) = 0))); @@ -24193,11 +24156,8 @@ sqInt delta; sqInt growth; sqInt i; - sqInt i1; - sqInt i2; sqInt limit; sqInt survivorCount; - sqInt traceType; sqInt weDidGrow; if (GIV(rootTableOverflowed)) { @@ -24210,41 +24170,7 @@ return; } runLeakCheckerForFullGC(0); - /* begin preGCAction: */ - if (GIV(stackPage) != 0) { - /* begin externalWriteBackHeadFramePointers */ - assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); - assert(GIV(stackPage) == (mostRecentlyUsedPage())); - /* begin setHeadFP:andSP:inPage: */ - assert(GIV(stackPointer) < GIV(framePointer)); - assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); - assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); - (GIV(stackPage)->headFP = GIV(framePointer)); - (GIV(stackPage)->headSP = GIV(stackPointer)); - assert(pageListIsWellFormed()); - } - - GIV(gcMode) = GCModeIncr; - if (recordEventTrace()) { - traceType = (GCModeIncr == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin recordTrace:thing:source: */ - GIV(traceLog)[GIV(traceLogIndex)] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; - } - if (recordPrimTrace()) { - traceType = (GCModeIncr == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin fastLogPrim: */ - GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; - primTraceLogIndex(GIV(primTraceLogIndex) + 1); - } + preGCAction(GCModeIncr); GIV(needGCFlag) = 0; GIV(gcStartUsecs) = ioUTCMicrosecondsNow(); GIV(statSweepCount) = (GIV(statMarkCount) = (GIV(statMkFwdCount) = (GIV(statCompMoveCount) = 0))); @@ -30457,6 +30383,72 @@ } +/* Need to write back the frame pointers unless all pages are free (as in + snapshot) + */ +/* Need to write back the frame pointers unless all pages are free (as in + snapshot). Need to set gcMode var (to avoid passing the flag through a lot + of the updating code) */ + +static void +preGCAction(sqInt gcModeArg) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt i; + sqInt i1; + sqInt traceType; + + if (GIV(stackPage) != 0) { + /* begin externalWriteBackHeadFramePointers */ + assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); + assert(GIV(stackPage) == (mostRecentlyUsedPage())); + /* begin setHeadFP:andSP:inPage: */ + assert(GIV(stackPointer) < GIV(framePointer)); + assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); + assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); + (GIV(stackPage)->headFP = GIV(framePointer)); + (GIV(stackPage)->headSP = GIV(stackPointer)); + assert(pageListIsWellFormed()); + } + if ((gcModeArg == GCModeFull) + && (0)) { + /* begin flushMethodCache */ + for (i = 1; i <= MethodCacheSize; i += 1) { + GIV(methodCache)[i] = 0; + } + + /* this for primitiveExternalMethod */ + + GIV(lastMethodCacheProbeWrite) = 0; + /* begin flushAtCache */ + for (i1 = 1; i1 <= AtCacheTotalSize; i1 += 1) { + GIV(atCache)[i1] = 0; + } + unlinkAllSends(); + } + GIV(gcMode) = gcModeArg; + if (recordEventTrace()) { + traceType = (gcModeArg == GCModeFull + ? TraceFullGC + : TraceIncrementalGC); + /* begin recordTrace:thing:source: */ + GIV(traceLog)[GIV(traceLogIndex)] = traceType; + GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; + GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + } + if (recordPrimTrace()) { + traceType = (gcModeArg == GCModeFull + ? TraceFullGC + : TraceIncrementalGC); + /* begin fastLogPrim: */ + GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; + primTraceLogIndex(GIV(primTraceLogIndex) + 1); + } +} + + /* Ensure that there are enough forwarding blocks to accomodate this become, then prepare forwarding blocks for the pointer swap. Return true if successful. */ Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nscogsrc/vm/cointerp.h 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2014-06-02 01:11:49 UTC (rev 2938) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 from - CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -842,6 +842,7 @@ unsigned long positiveMachineIntegerValueOf(sqInt oop); static void possibleRootStoreIntovalue(sqInt oop, sqInt valueObj) NoDbgRegParms; static void postGCAction(sqInt gcModeArg) NoDbgRegParms; +static void preGCAction(sqInt gcModeArg) NoDbgRegParms; static sqInt prepareForwardingTableForBecomingwithtwoWay(sqInt array1, sqInt array2, sqInt twoWayFlag) NoDbgRegParms; sqInt primErrTable(void); usqInt primFailCodeAddress(void); @@ -1314,8 +1315,8 @@ _iss sqInt trueObj; _iss sqInt falseObj; _iss sqInt remapBufferCount; -_iss sqInt traceLogIndex; _iss sqInt bytesPerPage; +_iss sqInt traceLogIndex; _iss usqInt reserveStart; _iss char * stackLimit; _iss sqInt rootTableCount; @@ -1341,18 +1342,18 @@ _iss sqInt growHeadroom; _iss sqInt longRunningPrimitiveCheckMethod; _iss sqInt profileMethod; -_iss sqInt lastMethodCacheProbeWrite; _iss sqInt backwardJumpCount; +_iss sqInt lastMethodCacheProbeWrite; _iss sqInt lkupClass; _iss usqLong nextWakeupUsecs; _iss sqInt preemptionYields; _iss sqInt cogCompiledCodeCompactionCalledFor; -_iss sqInt gcMode; _iss sqInt highestRunnableProcessPriority; _iss usqLong longRunningPrimitiveStartUsecs; _iss usqLong longRunningPrimitiveStopUsecs; _iss usqLong statCheckForEvents; _iss sqInt statMarkCount; +_iss sqInt gcMode; _iss sqInt lastCoggableInterpretedBlockMethod; _iss sqInt lastUncoggableInterpretedBlockMethod; _iss sqInt lowSpaceThreshold; @@ -2062,7 +2063,7 @@ /* 574 */ (void (*)(void))0, /* 575 */ (void (*)(void))0, 0 }; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.741"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.746"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -4861,7 +4862,6 @@ GIV(framePointer) = localFP; ceEnterCogCodePopReceiverReg(); - null; goto l309; } localIP = pointerForOop(longAt(localFP + FoxIFSavedIP)); @@ -4879,7 +4879,7 @@ /* begin fetchNextBytecode */ currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector); - null; + /* return self */ l309: /* end baseFrameReturn */; goto l306; } @@ -22856,52 +22856,15 @@ void fullGC(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; - sqInt i1; sqInt limit; sqInt sz; - sqInt traceType; if (GIV(fullGCLock) > 0) { warning("aborting fullGC because fullGCLock > 0"); return; } runLeakCheckerForFullGC(1); - /* begin preGCAction: */ - if (GIV(stackPage) != 0) { - /* begin externalWriteBackHeadFramePointers */ - assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); - assert(GIV(stackPage) == (mostRecentlyUsedPage())); - /* begin setHeadFP:andSP:inPage: */ - assert(GIV(stackPointer) < GIV(framePointer)); - assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); - assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); - (GIV(stackPage)->headFP = GIV(framePointer)); - (GIV(stackPage)->headSP = GIV(stackPointer)); - assert(pageListIsWellFormed()); - } - - GIV(gcMode) = GCModeFull; - if (recordEventTrace()) { - traceType = (GCModeFull == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin recordTrace:thing:source: */ - GIV(traceLog)[GIV(traceLogIndex)] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; - } - if (recordPrimTrace()) { - traceType = (GCModeFull == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin fastLogPrim: */ - GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; - primTraceLogIndex(GIV(primTraceLogIndex) + 1); - } + preGCAction(GCModeFull); GIV(needGCFlag) = 0; GIV(gcStartUsecs) = ioUTCMicrosecondsNow(); GIV(statSweepCount) = (GIV(statMarkCount) = (GIV(statMkFwdCount) = (GIV(statCompMoveCount) = 0))); @@ -24202,11 +24165,8 @@ sqInt delta; sqInt growth; sqInt i; - sqInt i1; - sqInt i2; sqInt limit; sqInt survivorCount; - sqInt traceType; sqInt weDidGrow; if (GIV(rootTableOverflowed)) { @@ -24219,41 +24179,7 @@ return; } runLeakCheckerForFullGC(0); - /* begin preGCAction: */ - if (GIV(stackPage) != 0) { - /* begin externalWriteBackHeadFramePointers */ - assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); - assert(GIV(stackPage) == (mostRecentlyUsedPage())); - /* begin setHeadFP:andSP:inPage: */ - assert(GIV(stackPointer) < GIV(framePointer)); - assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); - assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); - (GIV(stackPage)->headFP = GIV(framePointer)); - (GIV(stackPage)->headSP = GIV(stackPointer)); - assert(pageListIsWellFormed()); - } - - GIV(gcMode) = GCModeIncr; - if (recordEventTrace()) { - traceType = (GCModeIncr == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin recordTrace:thing:source: */ - GIV(traceLog)[GIV(traceLogIndex)] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; - } - if (recordPrimTrace()) { - traceType = (GCModeIncr == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin fastLogPrim: */ - GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; - primTraceLogIndex(GIV(primTraceLogIndex) + 1); - } + preGCAction(GCModeIncr); GIV(needGCFlag) = 0; GIV(gcStartUsecs) = ioUTCMicrosecondsNow(); GIV(statSweepCount) = (GIV(statMarkCount) = (GIV(statMkFwdCount) = (GIV(statCompMoveCount) = 0))); @@ -30466,6 +30392,72 @@ } +/* Need to write back the frame pointers unless all pages are free (as in + snapshot) + */ +/* Need to write back the frame pointers unless all pages are free (as in + snapshot). Need to set gcMode var (to avoid passing the flag through a lot + of the updating code) */ + +static void +preGCAction(sqInt gcModeArg) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt i; + sqInt i1; + sqInt traceType; + + if (GIV(stackPage) != 0) { + /* begin externalWriteBackHeadFramePointers */ + assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); + assert(GIV(stackPage) == (mostRecentlyUsedPage())); + /* begin setHeadFP:andSP:inPage: */ + assert(GIV(stackPointer) < GIV(framePointer)); + assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); + assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); + (GIV(stackPage)->headFP = GIV(framePointer)); + (GIV(stackPage)->headSP = GIV(stackPointer)); + assert(pageListIsWellFormed()); + } + if ((gcModeArg == GCModeFull) + && (0)) { + /* begin flushMethodCache */ + for (i = 1; i <= MethodCacheSize; i += 1) { + GIV(methodCache)[i] = 0; + } + + /* this for primitiveExternalMethod */ + + GIV(lastMethodCacheProbeWrite) = 0; + /* begin flushAtCache */ + for (i1 = 1; i1 <= AtCacheTotalSize; i1 += 1) { + GIV(atCache)[i1] = 0; + } + unlinkAllSends(); + } + GIV(gcMode) = gcModeArg; + if (recordEventTrace()) { + traceType = (gcModeArg == GCModeFull + ? TraceFullGC + : TraceIncrementalGC); + /* begin recordTrace:thing:source: */ + GIV(traceLog)[GIV(traceLogIndex)] = traceType; + GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; + GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + } + if (recordPrimTrace()) { + traceType = (gcModeArg == GCModeFull + ? TraceFullGC + : TraceIncrementalGC); + /* begin fastLogPrim: */ + GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; + primTraceLogIndex(GIV(primTraceLogIndex) + 1); + } +} + + /* Ensure that there are enough forwarding blocks to accomodate this become, then prepare forwarding blocks for the pointer swap. Return true if successful. */ Modified: branches/Cog/nscogsrc/vm/interp.h =================================================================== --- branches/Cog/nscogsrc/vm/interp.h 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nscogsrc/vm/interp.h 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/nscogsrc/vm/vmCallback.h =================================================================== --- branches/Cog/nscogsrc/vm/vmCallback.h 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nscogsrc/vm/vmCallback.h 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ #define VM_CALLBACK_INC 1 Modified: branches/Cog/nsspursrc/vm/cogit.c =================================================================== --- branches/Cog/nsspursrc/vm/cogit.c 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nsspursrc/vm/cogit.c 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 + CCodeGenerator VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 + StackToRegisterMappingCogit VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -295,7 +295,7 @@ #define NSSendIsPCAnnotated 1 #define NumObjRefsInRuntime 2 #define NumSendTrampolines 4 -#define NumTrampolines 58 +#define NumTrampolines 60 #define OrCqR 93 #define OrCwR 100 #define OrRR 86 @@ -558,6 +558,7 @@ void enterCogCodePopReceiverAndClassRegs(void); void enterCogCodePopReceiverArg0Regs(void); void enterCogCodePopReceiverArg1Arg0Regs(void); +static void evaluateat(BytecodeDescriptor *descriptor, sqInt pc) NoDbgRegParms; static sqInt extABytecode(void); static sqInt extBBytecode(void); static sqInt extendedPushBytecode(void); @@ -928,6 +929,7 @@ static sqInt literalBeforeFollowingAddress(AbstractInstruction * self_in_literalBeforeFollowingAddress, sqInt followingAddress) NoDbgRegParms; static sqInt liveRegisters(void); static sqInt loadLiteralByteSize(AbstractInstruction * self_in_loadLiteralByteSize) NoDbgRegParms; +static void loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc) NoDbgRegParms; static sqInt log2BytesPerWord(void); static AbstractInstruction * longJumpTargetAddress(AbstractInstruction * self_in_longJumpTargetAddress) NoDbgRegParms; static AbstractInstruction * gMoveAwR(sqInt address, sqInt reg) NoDbgRegParms; @@ -1094,6 +1096,7 @@ static sqInt sib(AbstractInstruction * self_in_sib, sqInt scale, sqInt indexReg, sqInt baseReg) NoDbgRegParms; sqInt traceLinkedSendOffset(void); static char * trampolineNamenumArgs(char *routinePrefix, sqInt numArgs) NoDbgRegParms; +static sqInt tryCollapseTempVectorInitializationOfSize(sqInt slots) NoDbgRegParms; static sqInt twoByteInstructionSizeAt(AbstractInstruction * self_in_twoByteInstructionSizeAt, sqInt pc) NoDbgRegParms; static sqInt unimplementedPrimitive(void); static sqInt unknownBytecode(void); @@ -4109,18 +4112,7 @@ byte0 = (fetchByteofObject(bytecodePC, methodObj)) + bytecodeSetOffset; descriptor = generatorAt(byte0); - if (((descriptor->numBytes)) > 1) { - byte1 = fetchByteofObject(bytecodePC + 1, methodObj); - if (((descriptor->numBytes)) > 2) { - byte2 = fetchByteofObject(bytecodePC + 2, methodObj); - if (((descriptor->numBytes)) > 3) { - byte3 = fetchByteofObject(bytecodePC + 3, methodObj); - if (((descriptor->numBytes)) > 4) { - notYetImplemented(); - } - } - } - } + loadSubsequentBytesForDescriptorat(descriptor, bytecodePC); nextOpcodeIndex = opcodeIndex; result = (deadCode ? ((((descriptor->isMapped)) @@ -10331,7 +10323,16 @@ realCEEnterCogCodePopReceiverArg1Arg0Regs(); } +static void +evaluateat(BytecodeDescriptor *descriptor, sqInt pc) +{ + byte0 = fetchByteofObject(pc, methodObj); + assert(descriptor == (generatorAt(bytecodeSetOffset + byte0))); + loadSubsequentBytesForDescriptorat(descriptor, pc); + ((descriptor->generator))(); +} + /* 224 11100000 aaaaaaaa Extend A (Ext A = Ext A prev * 256 + Ext A) */ static sqInt @@ -16673,6 +16674,11 @@ ssAllocateCallRegand(SendNumArgsReg, ReceiverResultReg); } size = byte1 & 0x7F; + if (!popValues) { + if (tryCollapseTempVectorInitializationOfSize(size)) { + return 0; + } + } genNewArrayOfSizeinitialized(size, !popValues); if (popValues) { for (i = (size - 1); i >= 0; i += -1) { @@ -19408,6 +19414,23 @@ return 5; } +static void +loadSubsequentBytesForDescriptorat(BytecodeDescriptor *descriptor, sqInt pc) +{ + if (((descriptor->numBytes)) > 1) { + byte1 = fetchByteofObject(pc + 1, methodObj); + if (((descriptor->numBytes)) > 2) { + byte2 = fetchByteofObject(pc + 2, methodObj); + if (((descriptor->numBytes)) > 3) { + byte3 = fetchByteofObject(pc + 3, methodObj); + if (((descriptor->numBytes)) > 4) { + notYetImplemented(); + } + } + } + } +} + static sqInt log2BytesPerWord(void) { @@ -22934,7 +22957,59 @@ return theString; } + +/* Try and collapse + push: (Array new: 1) + popIntoTemp: tempIndex + pushConstant: const or pushTemp: n + popIntoTemp: 0 inVectorAt: tempIndex + into + tempAt: tempIndex put: {const}. + One might think that we should look for a sequence of more than + one pushes and pops but this is extremely rare. */ + static sqInt +tryCollapseTempVectorInitializationOfSize(sqInt slots) +{ + BytecodeDescriptor *pushArrayDesc; + BytecodeDescriptor *pushValueDesc; + sqInt reg; + BytecodeDescriptor *storeArrayDesc; + BytecodeDescriptor *storeValueDesc; + + if (slots != 1) { + return 0; + } + pushArrayDesc = generatorAt(bytecodeSetOffset + (fetchByteofObject(bytecodePC, methodObj))); + assert(((pushArrayDesc->generator)) == genPushNewArrayBytecode); + storeArrayDesc = generatorAt(bytecodeSetOffset + (fetchByteofObject(bytecodePC + ((pushArrayDesc->numBytes)), methodObj))); + if (((storeArrayDesc->generator)) != genStoreAndPopTemporaryVariableBytecode) { + return 0; + } + pushValueDesc = generatorAt(bytecodeSetOffset + (fetchByteofObject((bytecodePC + ((pushArrayDesc->numBytes))) + ((storeArrayDesc->numBytes)), methodObj))); + if ((((pushValueDesc->generator)) != genPushLiteralConstantBytecode) + && ((((pushValueDesc->generator)) != genPushQuickIntegerConstantBytecode) + && (((pushValueDesc->generator)) != genPushTemporaryVariableBytecode))) { + return 0; + } + storeValueDesc = generatorAt(bytecodeSetOffset + (fetchByteofObject(((bytecodePC + ((pushArrayDesc->numBytes))) + ((storeArrayDesc->numBytes))) + ((pushValueDesc->numBytes)), methodObj))); + if (((storeValueDesc->generator)) != genStoreAndPopRemoteTempLongBytecode) { + return 0; + } + genNewArrayOfSizeinitialized(1, 0); + evaluateat(pushValueDesc, (bytecodePC + ((pushArrayDesc->numBytes))) + ((storeArrayDesc->numBytes))); + reg = ssStorePoptoPreferredReg(1, TempReg); + genStoreSourceRegslotIndexintoNewObjectInDestReg(reg, 0, ReceiverResultReg); + ssPushRegister(ReceiverResultReg); + evaluateat(storeArrayDesc, bytecodePC + ((pushArrayDesc->numBytes))); + + /* + pushArrayDesc numBytes this gets added by nextBytecodePCFor:at:exts:in: */ + + bytecodePC = ((bytecodePC + ((storeArrayDesc->numBytes))) + ((pushValueDesc->numBytes))) + ((storeValueDesc->numBytes)); + return 1; +} + +static sqInt twoByteInstructionSizeAt(AbstractInstruction * self_in_twoByteInstructionSizeAt, sqInt pc) { sqInt op; Modified: branches/Cog/nsspursrc/vm/cogit.h =================================================================== --- branches/Cog/nsspursrc/vm/cogit.h 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nsspursrc/vm/cogit.h 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 + CCodeGenerator VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ Modified: branches/Cog/nsspursrc/vm/cogmethod.h =================================================================== --- branches/Cog/nsspursrc/vm/cogmethod.h 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nsspursrc/vm/cogmethod.h 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.745 uuid: 9ae88e74-1041-4ad2-be42-c2277e958b92 + CCodeGenerator VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ typedef struct { Modified: branches/Cog/nsspursrc/vm/cointerp.c =================================================================== --- branches/Cog/nsspursrc/vm/cointerp.c 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nsspursrc/vm/cointerp.c 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 from - CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -967,6 +967,7 @@ static void postBecomeOrCompactScanClassTable(sqInt effectsFlags) NoDbgRegParms; static void postGCAction(sqInt gcModeArg) NoDbgRegParms; static void postSnapshot(void); +static void preGCAction(sqInt gcModeArg) NoDbgRegParms; static void prepareForSnapshot(void); sqInt primErrTable(void); usqInt primFailCodeAddress(void); @@ -1476,8 +1477,8 @@ _iss sqInt falseObj; _iss sqInt needGCFlag; _iss sqInt totalFreeOldSpace; -_iss sqInt traceLogIndex; _iss sqInt bytesPerPage; +_iss sqInt traceLogIndex; _iss sqInt numSegments; _iss usqInt pastSpaceStart; _iss char * stackLimit; @@ -1485,9 +1486,9 @@ _iss usqInt scavengeThreshold; _iss usqInt freeListsMask; _iss sqInt rememberedSetSize; -_iss unsigned char primTraceLogIndex; _iss SpurContiguousObjStack unscannedEphemerons; _iss sqInt firstFreeChunk; +_iss unsigned char primTraceLogIndex; _iss StackPage * mostRecentlyUsedPage; _iss SpurNewSpaceSpace pastSpace; _iss sqInt numStackPages; @@ -1522,9 +1523,9 @@ _iss sqInt profileMethod; _iss sqInt classTableIndex; _iss sqInt ephemeronQueue; -_iss sqInt lastMethodCacheProbeWrite; _iss sqInt lkupClass; _iss sqInt backwardJumpCount; +_iss sqInt lastMethodCacheProbeWrite; _iss sqInt metaclassNumSlots; _iss usqLong nextWakeupUsecs; _iss sqInt preemptionYields; @@ -1534,7 +1535,6 @@ _iss usqLong longRunningPrimitiveStopUsecs; _iss sqInt numSegInfos; _iss usqLong statCheckForEvents; -_iss sqInt gcMode; _iss sqInt lastCoggableInterpretedBlockMethod; _iss sqInt lastUncoggableInterpretedBlockMethod; _iss usqInt lowSpaceThreshold; @@ -1543,6 +1543,7 @@ _iss sqInt cogCodeSize; _iss sqInt externalPrimitiveTableFirstFreeIndex; _iss sqInt flagInterpretedMethods; +_iss sqInt gcMode; _iss sqInt pendingFinalizationSignals; _iss usqLong statIOProcessEvents; _iss sqInt firstSegmentSize; @@ -2237,7 +2238,7 @@ /* 574 */ (void (*)(void))0, /* 575 */ (void (*)(void))0, 0 }; -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.741"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.746"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -5530,7 +5531,6 @@ GIV(framePointer) = localFP; ceEnterCogCodePopReceiverReg(); - null; goto l290; } localIP = pointerForOop(longAt(localFP + FoxIFSavedIP)); @@ -5548,7 +5548,7 @@ /* begin fetchNextBytecode */ currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector); - null; + /* return self */ l290: /* end baseFrameReturn */; goto l287; } @@ -29180,61 +29180,10 @@ usqLong fullGC(void) { DECL_MAYBE_SQ_GLOBAL_STRUCT - sqInt i; - sqInt i1; - sqInt traceType; - GIV(needGCFlag) = 0; GIV(gcStartUsecs) = ioUTCMicrosecondsNow(); GIV(statMarkCount) = 0; - /* begin preGCAction: */ - if (GIV(stackPage) != 0) { - /* begin externalWriteBackHeadFramePointers */ - assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); - assert(GIV(stackPage) == (mostRecentlyUsedPage())); - /* begin setHeadFP:andSP:inPage: */ - assert(GIV(stackPointer) < GIV(framePointer)); - assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); - assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); - (GIV(stackPage)->headFP = GIV(framePointer)); - (GIV(stackPage)->headSP = GIV(stackPointer)); - assert(pageListIsWellFormed()); - } - /* begin flushMethodCache */ - for (i = 1; i <= MethodCacheSize; i += 1) { - GIV(methodCache)[i] = 0; - } - - /* this for primitiveExternalMethod */ - - GIV(lastMethodCacheProbeWrite) = 0; - /* begin flushAtCache */ - for (i1 = 1; i1 <= AtCacheTotalSize; i1 += 1) { - GIV(atCache)[i1] = 0; - } - unlinkAllSends(); - - GIV(gcMode) = GCModeFull; - if (recordEventTrace()) { - traceType = (GCModeFull == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin recordTrace:thing:source: */ - GIV(traceLog)[GIV(traceLogIndex)] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; - } - if (recordPrimTrace()) { - traceType = (GCModeFull == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin fastLogPrim: */ - GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; - primTraceLogIndex(GIV(primTraceLogIndex) + 1); - } + preGCAction(GCModeFull); /* begin globalGarbageCollect */ null; assert(validObjStacks()); @@ -38542,6 +38491,72 @@ } +/* Need to write back the frame pointers unless all pages are free (as in + snapshot) + */ +/* Need to write back the frame pointers unless all pages are free (as in + snapshot). Need to set gcMode var (to avoid passing the flag through a lot + of the updating code) */ + +static void +preGCAction(sqInt gcModeArg) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt i; + sqInt i1; + sqInt traceType; + + if (GIV(stackPage) != 0) { + /* begin externalWriteBackHeadFramePointers */ + assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); + assert(GIV(stackPage) == (mostRecentlyUsedPage())); + /* begin setHeadFP:andSP:inPage: */ + assert(GIV(stackPointer) < GIV(framePointer)); + assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); + assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); + (GIV(stackPage)->headFP = GIV(framePointer)); + (GIV(stackPage)->headSP = GIV(stackPointer)); + assert(pageListIsWellFormed()); + } + if ((gcModeArg == GCModeFull) + && (1)) { + /* begin flushMethodCache */ + for (i = 1; i <= MethodCacheSize; i += 1) { + GIV(methodCache)[i] = 0; + } + + /* this for primitiveExternalMethod */ + + GIV(lastMethodCacheProbeWrite) = 0; + /* begin flushAtCache */ + for (i1 = 1; i1 <= AtCacheTotalSize; i1 += 1) { + GIV(atCache)[i1] = 0; + } + unlinkAllSends(); + } + GIV(gcMode) = gcModeArg; + if (recordEventTrace()) { + traceType = (gcModeArg == GCModeFull + ? TraceFullGC + : TraceIncrementalGC); + /* begin recordTrace:thing:source: */ + GIV(traceLog)[GIV(traceLogIndex)] = traceType; + GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; + GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + } + if (recordPrimTrace()) { + traceType = (gcModeArg == GCModeFull + ? TraceFullGC + : TraceIncrementalGC); + /* begin fastLogPrim: */ + GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; + primTraceLogIndex(GIV(primTraceLogIndex) + 1); + } +} + + /* shorten all segments by any trailing free space. */ static void @@ -62105,11 +62120,8 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt i; sqInt i1; - sqInt i11; - sqInt i2; sqInt probe; usqLong statSGCDeltaUsecs = 0; - sqInt traceType; assert(GIV(remapBufferCount) == 0); if (!(asserta(((((eden()).limit)) - GIV(freeStart)) > (interpreterAllocationReserveBytes())))) { @@ -62147,44 +62159,10 @@ /* begin runLeakCheckerForFullGC: */ runLeakCheckerForFullGCexcludeUnmarkedNewSpaceObjsclassIndicesShouldBeValid(0, 0, 1); /* return self */ - /* begin preGCAction: */ - if (GIV(stackPage) != 0) { - /* begin externalWriteBackHeadFramePointers */ - assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); - assert(GIV(stackPage) == (mostRecentlyUsedPage())); - /* begin setHeadFP:andSP:inPage: */ - assert(GIV(stackPointer) < GIV(framePointer)); - assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); - assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) - && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); - (GIV(stackPage)->headFP = GIV(framePointer)); - (GIV(stackPage)->headSP = GIV(stackPointer)); - assert(pageListIsWellFormed()); - } - - GIV(gcMode) = GCModeScavenge; - if (recordEventTrace()) { - traceType = (GCModeScavenge == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin recordTrace:thing:source: */ - GIV(traceLog)[GIV(traceLogIndex)] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 1] = traceType; - GIV(traceLog)[GIV(traceLogIndex) + 2] = 0; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; - } - if (recordPrimTrace()) { - traceType = (GCModeScavenge == GCModeFull - ? TraceFullGC - : TraceIncrementalGC); - /* begin fastLogPrim: */ - GIV(primTraceLog)[GIV(primTraceLogIndex)] = traceType; - primTraceLogIndex(GIV(primTraceLogIndex) + 1); - } + preGCAction(GCModeScavenge); /* begin flushMethodCacheFrom:to: */ probe = 0; - for (i2 = 1; i2 <= MethodCacheEntries; i2 += 1) { + for (i = 1; i <= MethodCacheEntries; i += 1) { if (!((GIV(methodCache)[probe + MethodCacheSelector]) == 0)) { if (((((((usqInt) (GIV(methodCache)[probe + MethodCacheSelector]))) >= (((usqInt) GIV(newSpaceStart)))) && ((((usqInt) (GIV(methodCache)[probe + MethodCacheSelector]))) < (((usqInt) GIV(newSpaceLimit))))) @@ -62198,8 +62176,8 @@ probe += MethodCacheEntrySize; } /* begin flushAtCache */ - for (i11 = 1; i11 <= AtCacheTotalSize; i11 += 1) { - GIV(atCache)[i11] = 0; + for (i1 = 1; i1 <= AtCacheTotalSize; i1 += 1) { + GIV(atCache)[i1] = 0; } GIV(needGCFlag) = 0; GIV(gcStartUsecs) = ioUTCMicrosecondsNow(); Modified: branches/Cog/nsspursrc/vm/cointerp.h =================================================================== --- branches/Cog/nsspursrc/vm/cointerp.h 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nsspursrc/vm/cointerp.h 2014-06-02 01:11:49 UTC (rev 2938) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ Modified: branches/Cog/nsspursrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nsspursrc/vm/gcc3x-cointerp.c 2014-06-01 19:43:14 UTC (rev 2937) +++ branches/Cog/nsspursrc/vm/gcc3x-cointerp.c 2014-06-02 01:11:49 UTC (rev 2938) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 from - CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 + CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.741 uuid: f73b1214-56e1-4dde-a466-bad10d979d17 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -970,6 +970,7 @@ static void postBecomeOrCompactScanClassTable(sqInt effectsFlags) NoDbgRegParms; static void postGCAction(sqInt gcModeArg) NoDbgRegParms; static void postSnapshot(void); +static void preGCAction(sqInt gcModeArg) NoDbgRegParms; static void prepareForSnapshot(void); sqInt primErrTable(void); usqInt primFailCodeAddress(void); @@ -1479,8 +1480,8 @@ _iss sqInt falseObj; _iss sqInt needGCFlag; _iss sqInt totalFreeOldSpace; -_iss sqInt traceLogIndex; _iss sqInt bytesPerPage; +_iss sqInt traceLogIndex; _iss sqInt numSegments; _iss usqInt pastSpaceStart; _iss char * stackLimit; @@ -1488,9 +1489,9 @@ _iss usqInt scavengeThreshold; _iss usqInt freeListsMask; _iss sqInt rememberedSetSize; -_iss unsigned char primTraceLogIndex; _iss SpurContiguousObjStack unscannedEphemerons; _iss sqInt firstFreeChunk; +_iss unsigned char primTraceLogIndex; _iss StackPage * mostRecentlyUsedPage; _iss SpurNewSpaceSpace pastSpace; _iss sqInt numStackPages; @@ -1525,9 +1526,9 @@ _iss sqInt profileMethod; _iss sqInt classTableIndex; _iss sqInt ephemeronQueue; -_iss sqInt lastMethodCacheProbeWrite; _iss sqInt lkupClass; _iss sqInt backwardJumpCount; +_iss sqInt lastMethodCacheProbeWrite; _iss sqInt metaclassNumSlots; _iss usqLong nextWakeupUsecs; _iss sqInt preemptionYields; @@ -1537,7 +1538,6 @@ _iss usqLong longRunningPrimitiveStopUsecs; _iss sqInt numSegInfos; _iss usqLong statCheckForEvents; -_iss sqInt gcMode; _iss sqInt lastCoggableInterpretedBlockMethod; _iss sqInt lastUncoggableInterpretedBlockMethod; _iss usqInt lowSpaceThreshold; @@ -1546,6 +1546,7 @@ _iss sqInt cogCodeSize; _iss sqInt externalPrimitiveTableFirstFreeIndex; _iss sqInt flagInterpretedMethods; +_iss sqInt gcMode; _iss sqInt pendingFinalizationSignals; _iss usqLong statIOProcessEvents; _iss sqInt firstSegmentSize; @@ -2240,7 +2241,7 @@ /* 574 */ (void (*)(void))0, @@ Diff output truncated at 50000 characters. @@ |
Free forum by Nabble | Edit this page |