11/* Automatically generated by
2- CCodeGenerator VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
2+ CCodeGenerator VMMaker.oscog-eem.2970 uuid: 18899133-c885-4672-8722-9faceaa8bd85
33 from
4- StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181
4+ StackToRegisterMappingCogit VMMaker.oscog-eem.2970 uuid: 18899133-c885-4672-8722-9faceaa8bd85
55 */
6- static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2969 uuid: e47dec6d-965d-4dc1-ad51-ad192f9f6181 " __DATE__ ;
6+ static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.2970 uuid: 18899133-c885-4672-8722-9faceaa8bd85 " __DATE__ ;
77char *__cogitBuildInfo = __buildInfo;
88
99
@@ -1423,9 +1423,9 @@ static sqInt expectedFPAlignment;
14231423static sqInt expectedSPAlignment;
14241424static sqInt extA;
14251425static sqInt extB;
1426- static sqInt externalPrimCallOffsets[MaxNumArgs + 1 ];
1427- static sqInt externalPrimJumpOffsets[MaxNumArgs + 1 ];
1428- static sqInt externalSetPrimOffsets[MaxNumArgs + 1 ];
1426+ static sqInt externalPrimCallOffsets[MaxNumArgs + MaxNumArgs + 2 ];
1427+ static sqInt externalPrimJumpOffsets[MaxNumArgs + MaxNumArgs + 2 ];
1428+ static sqInt externalSetPrimOffsets[MaxNumArgs + MaxNumArgs + 2 ];
14291429static sqInt firstCPICCaseOffset;
14301430static sqInt firstOpcodeIndex;
14311431static sqInt firstSend;
@@ -25469,7 +25469,7 @@ compileInterpreterPrimitiveflags(void (*primitiveRoutine)(void), sqInt flags)
2546925469 /* begin Label */
2547025470 continuePostSampleNonPrim = genoperandoperand(Label, (labelCounter += 1), bytecodePC);
2547125471 }
25472- if (recordPrimTrace( )) {
25472+ if (recordPrimTraceForMethod(methodObj )) {
2547325473 genFastPrimTraceUsingand(ClassReg, SendNumArgsReg);
2547425474 }
2547525475 /* begin checkQuickConstant:forInstruction: */
@@ -27552,29 +27552,42 @@ primitiveGeneratorOrNil(void)
2755227552 return null;
2755327553}
2755427554
27555+
27556+ /* Remember the offsets in an external primitive method where the function
27557+ address is assigned
27558+ to primitiveFunctionPointer (Spur) and where the external function is
27559+ either called or jumped to.
27560+ This allows the machine code to be unlinked when a plugin is unloaded,
27561+ etc.
27562+ */
27563+
2755527564 /* SimpleStackBasedCogit>>#recordCallOffsetIn: */
2755627565void
2755727566recordCallOffsetIn(CogMethod *cogMethod)
2755827567{
27568+ usqInt index;
2755927569 sqInt offset;
2756027570 sqInt *offsetTable;
2756127571
2756227572 offset = ((primSetFunctionLabel->address)) - (((sqInt)cogMethod));
27563- if ((externalSetPrimOffsets[(cogMethod->cmNumArgs)]) == null) {
27564- externalSetPrimOffsets[(cogMethod->cmNumArgs)] = offset;
27573+ index = (recordPrimTraceForMethod((cogMethod->methodObject))
27574+ ? (((cogMethod->cmNumArgs)) + MaxNumArgs) + 1
27575+ : (cogMethod->cmNumArgs));
27576+ if ((externalSetPrimOffsets[index]) == null) {
27577+ externalSetPrimOffsets[index] = offset;
2756527578 }
2756627579 else {
27567- assert((externalSetPrimOffsets[(cogMethod->cmNumArgs) ]) == offset);
27580+ assert((externalSetPrimOffsets[index ]) == offset);
2756827581 }
2756927582 offsetTable = (isJump(primInvokeInstruction)
2757027583 ? externalPrimJumpOffsets
2757127584 : externalPrimCallOffsets);
2757227585 offset = (((primInvokeInstruction->address)) + ((primInvokeInstruction->machineCodeSize))) - (((sqInt)cogMethod));
27573- if ((offsetTable[(cogMethod->cmNumArgs) ]) == null) {
27574- offsetTable[(cogMethod->cmNumArgs) ] = offset;
27586+ if ((offsetTable[index ]) == null) {
27587+ offsetTable[index ] = offset;
2757527588 }
2757627589 else {
27577- assert((offsetTable[(cogMethod->cmNumArgs) ]) == offset);
27590+ assert((offsetTable[index ]) == offset);
2757827591 }
2757927592}
2758027593
@@ -27592,20 +27605,24 @@ rewritePrimInvocationInto(CogMethod *cogMethod, void (*primFunctionPointer)(void
2759227605 usqInt address;
2759327606 sqInt extent;
2759427607 sqInt flags;
27608+ usqInt index;
2759527609 sqInt primIndex;
2759627610
2759727611 assert(((cogMethod->cmType)) == CMMethod);
27612+ index = (recordPrimTraceForMethod((cogMethod->methodObject))
27613+ ? (((cogMethod->cmNumArgs)) + MaxNumArgs) + 1
27614+ : (cogMethod->cmNumArgs));
2759827615 primIndex = primitiveIndexOfMethodheader((cogMethod->methodObject), (cogMethod->methodHeader));
2759927616 flags = primitivePropertyFlags(primIndex);
2760027617 if (flags & PrimCallNeedsPrimitiveFunction) {
27601- storeLiteralbeforeFollowingAddress(backEnd, ((usqInt)primFunctionPointer), (((usqInt)cogMethod)) + (externalSetPrimOffsets[(cogMethod->cmNumArgs) ]));
27618+ storeLiteralbeforeFollowingAddress(backEnd, ((usqInt)primFunctionPointer), (((usqInt)cogMethod)) + (externalSetPrimOffsets[index ]));
2760227619 }
2760327620 if (flags & PrimCallMayEndureCodeCompaction) {
27604- address = (((usqInt)cogMethod)) + (externalPrimJumpOffsets[(cogMethod->cmNumArgs) ]);
27621+ address = (((usqInt)cogMethod)) + (externalPrimJumpOffsets[index ]);
2760527622 extent = rewriteJumpFullAttarget(backEnd, address, ((usqInt)primFunctionPointer));
2760627623 }
2760727624 else {
27608- address = (((usqInt)cogMethod)) + (externalPrimCallOffsets[(cogMethod->cmNumArgs) ]);
27625+ address = (((usqInt)cogMethod)) + (externalPrimCallOffsets[index ]);
2760927626 extent = rewriteCallFullAttarget(backEnd, address, ((usqInt)primFunctionPointer));
2761027627 }
2761127628 if (extent > 0) {
@@ -27796,7 +27813,7 @@ voidCogCompiledCode(void)
2779627813 sqInt i;
2779727814
2779827815 clearCogCompiledCode();
27799- for (i = 0; i <= MaxNumArgs; i += 1) {
27816+ for (i = 0; i <= (( MaxNumArgs + MaxNumArgs) + 1) ; i += 1) {
2780027817 externalPrimJumpOffsets[i] = null;
2780127818 externalPrimCallOffsets[i] = null;
2780227819 externalSetPrimOffsets[i] = null;
0 commit comments