Skip to content

Commit

Permalink
Newspeak source as per VMMaker.oscog-mt.3184 [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
marceltaeumel committed May 11, 2022
1 parent 6ad01bc commit 95dbe9d
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 1,620 deletions.
272 changes: 26 additions & 246 deletions src/spur32.cog.newspeak/cointerp.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-mt.3179 uuid: c6fbcb07-2a19-ed4f-8b40-9c119a70882a
CCodeGeneratorGlobalStructure VMMaker.oscog-mt.3184 uuid: 57b61827-3f1a-ab45-966e-7c5caaef28d7
from
CoInterpreter VMMaker.oscog-mt.3179 uuid: c6fbcb07-2a19-ed4f-8b40-9c119a70882a
CoInterpreter VMMaker.oscog-mt.3184 uuid: 57b61827-3f1a-ab45-966e-7c5caaef28d7
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-mt.3179 uuid: c6fbcb07-2a19-ed4f-8b40-9c119a70882a " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-mt.3184 uuid: 57b61827-3f1a-ab45-966e-7c5caaef28d7 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -601,7 +601,6 @@ static sqInt NoDbgRegParms returnToExecutivepostContextSwitch(sqInt inInterprete
static sqInt NoDbgRegParms returntoExecutive(sqInt returnValue, sqInt inInterpreter);
static sqInt NoDbgRegParms roomToPushNArgs(sqInt n);
EXPORT(sqInt) sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext);
EXPORT(sqInt) sendInvokeCallbackStackRegistersJmpbuf(sqInt thunkPtr, sqInt stackPtr, sqInt regsPtr, sqInt jmpBufPtr);
static sqInt NoDbgRegParms shortPrintFrame(char *theFP);
extern sqInt signed32BitIntegerFor(sqInt integerValue);
extern int signed32BitValueOf(sqInt oop);
Expand Down Expand Up @@ -1310,6 +1309,7 @@ static usqInt NoDbgRegParms startOfObject(sqInt objOop);
EXPORT(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);
extern sqInt storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer);
extern sqInt storePointerofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer);
extern sqInt stringForCString(const char *aCString);
Expand Down Expand Up @@ -1769,8 +1769,8 @@ _iss sqInt argumentCount;
_iss sqLong nextProfileTick;
_iss sqInt primTraceLog[256];
_iss usqInt method;
_iss sqInt nilObj;
_iss FILE * transcript;
_iss sqInt nilObj;
_iss StackPage * stackPage;
_iss usqInt oldSpaceStart;
_iss sqInt bytecodeSetSelector;
Expand Down Expand Up @@ -2007,7 +2007,7 @@ static signed short primitiveMetadataTable[MaxPrimitiveIndex + 2 /* 581 */] = {
/*78*/ 0, 0,
/*80*/ -256,-256,-256, 4, 4, 0, 0x100, 0, 0x200,-256,-256, 0, 0, 0, 0x100,-256,-256,
/*97*/ -256, 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,
Expand Down Expand Up @@ -2674,8 +2674,9 @@ sqInt sendWheelEvents;
sqInt suppressHeartbeatFlag;
sqInt debugCallbackInvokes;
sqInt debugCallbackReturns;
sqInt cannotDeferDisplayUpdates;
sqInt checkedPluginName;
const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-mt.3179";
const char *interpreterVersion = "Newspeak Virtual Machine [ Open Smalltalk, Spur] CoInterpreterPrimitives_VMMaker.oscog-mt.3184";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
char expensiveAsserts = 0;
int (*showSurfaceFn)(sqIntptr_t, int, int, int, int);
Expand Down Expand Up @@ -24386,240 +24387,6 @@ sendInvokeCallbackContext(VMCallbackContext *vmCallbackContext)
return 1;
}


/* Send the 4 argument callback message
invokeCallback:stack:registers:jmpbuf: to Alien class with the supplied
args. The arguments are raw C addresses
and are converted to integer objects on the way. */
/* Override to log and check stack alignment. Since this is an implicit send
we need to
log it explicitly. The return side is done via a primitive so that gets
logged normally. */

/* CoInterpreter>>#sendInvokeCallback:Stack:Registers:Jmpbuf: */
EXPORT(sqInt)
sendInvokeCallbackStackRegistersJmpbuf(sqInt thunkPtr, sqInt stackPtr, sqInt regsPtr, sqInt jmpBufPtr)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
usqInt aMethodObj;
sqInt aMethodSelectorOrImmediate;
sqInt classTag;
CogMethod *cogMethod;
CogMethod *cogMethod1;
sqInt i;
usqInt initialIP;
sqInt methodHeader;
sqInt methodHeader1;
sqInt numArgs;
sqInt numTemps;
sqInt obj;
sqInt object;
sqInt object1;
sqInt object2;
sqInt object3;
sqInt object4;
sqInt object5;
sqInt rcvr;
sqInt selector;
char *sp;
char *sp1;
char *sp10;
char *sp11;
char *sp2;
char *sp21;
char *sp3;
char *sp31;
char *sp4;
char *sp41;
char *sp5;
char *sp6;
char *sp7;
char *sp8;
char *sp9;

assertCStackWellAligned();
if (recordPrimTrace()) {
/* begin fastLogPrim: */
aMethodSelectorOrImmediate = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(SelectorInvokeCallback) << (shiftForWord())))));
GIV(primTraceLog)[GIV(primTraceLogIndex)] = aMethodSelectorOrImmediate;
primTraceLogIndex(GIV(primTraceLogIndex) + 1);
}
/* begin fetchClassTagOfNonImm: */
obj = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassAlien) << (shiftForWord())))));
/* begin classIndexOf: */
classTag = (longAt(obj)) & (classIndexMask());
/* begin fetchPointer:ofObject: */
GIV(messageSelector) = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(SelectorInvokeCallback) << (shiftForWord())))));
GIV(argumentCount) = 4;
if (!(lookupInMethodCacheSelclassTag(GIV(messageSelector), classTag))) {
if ((lookupOrdinaryNoMNUEtcInClass(classAtIndex(classTag))) != 0) {
return 0;
}
}
if (!(((argumentCountOfMethodHeader(methodHeaderOf(GIV(newMethod)))) == 4)
&& (primitiveFunctionPointer == 0))) {
return 0;
}
/* begin push: */
object = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (((int)((usqInt)(ClassAlien) << (shiftForWord())))));
longAtput((sp = GIV(stackPointer) - BytesPerWord), object);
GIV(stackPointer) = sp;
/* begin push: */
object1 = positiveMachineIntegerFor(thunkPtr);
longAtput((sp1 = GIV(stackPointer) - BytesPerWord), object1);
GIV(stackPointer) = sp1;
/* begin push: */
object2 = positiveMachineIntegerFor(stackPtr);
longAtput((sp2 = GIV(stackPointer) - BytesPerWord), object2);
GIV(stackPointer) = sp2;
/* begin push: */
object3 = positiveMachineIntegerFor(regsPtr);
longAtput((sp3 = GIV(stackPointer) - BytesPerWord), object3);
GIV(stackPointer) = sp3;
/* begin push: */
object4 = positiveMachineIntegerFor(jmpBufPtr);
longAtput((sp4 = GIV(stackPointer) - BytesPerWord), object4);
GIV(stackPointer) = sp4;
/* begin ifAppropriateCompileToNativeCode:selector: */
aMethodObj = GIV(newMethod);
selector = GIV(messageSelector);
/* begin fetchPointer:ofObject: */
methodHeader1 = longAt((aMethodObj + BaseHeaderSize) + (((int)((usqInt)(HeaderIndex) << (shiftForWord())))));
if ((assert(((methodHeader1 & 1))
|| (((((usqInt)methodHeader1)) < (startOfMemory()))
&& ((((usqInt)methodHeader1)) >= (minCogMethodAddress())))),
(methodHeader1 & 1) == 0)) {

/* makeBaseFrame: can create cog methods with nil selectors. */
cogMethod1 = ((CogMethod *) methodHeader1);
if (((cogMethod1->selector)) == GIV(nilObj)) {
setSelectorOfto(cogMethod1, selector);
}
}
else {
if (((assert((methodHeader1 & 1)),
((methodHeader1 >> 1)) & AlternateHeaderNumLiteralsMask)) <= maxLiteralCountForCompile) {
cogselector(aMethodObj, selector);
}
else {
maybeFlagMethodAsInterpreted(aMethodObj);
}
}
/* begin justActivateNewMethod: */
methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (((int)((usqInt)(HeaderIndex) << (shiftForWord())))));
cogMethod = null;
if ((assert(((methodHeader & 1))
|| (((((usqInt)methodHeader)) < (startOfMemory()))
&& ((((usqInt)methodHeader)) >= (minCogMethodAddress())))),
(methodHeader & 1) == 0)) {
cogMethod = ((CogMethod *) methodHeader);
methodHeader = (cogMethod->methodHeader);
}
numTemps = (((usqInt)(methodHeader)) >> MethodHeaderTempCountShift) & 0x3F;
numArgs = (((usqInt)(methodHeader)) >> MethodHeaderArgCountShift) & 15;

/* could new rcvr be set at point of send? */
rcvr = longAt(GIV(stackPointer) + (numArgs * BytesPerWord));
assert(!(isOopForwarded(rcvr)));
if ((cogMethod != null)
&& (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory())))) {
if (GIV(instructionPointer) >= (startOfMemory())) {
/* begin iframeSavedIP:put: */
assert(!(isMachineCodeFrame(GIV(framePointer))));
longAtput(GIV(framePointer) + FoxIFSavedIP, GIV(instructionPointer));
}
GIV(instructionPointer) = ceReturnToInterpreterPC();
}
/* begin push: */
longAtput((sp7 = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer));
GIV(stackPointer) = sp7;
/* begin push: */
longAtput((sp8 = GIV(stackPointer) - BytesPerWord), GIV(framePointer));
GIV(stackPointer) = sp8;
GIV(framePointer) = GIV(stackPointer);
initialIP = (GIV(newMethod) + ((LiteralStart + ((assert((methodHeader & 1)),
((methodHeader >> 1)) & AlternateHeaderNumLiteralsMask))) * BytesPerOop)) + BaseHeaderSize;
if (cogMethod == null) {
/* begin push: */
longAtput((sp10 = GIV(stackPointer) - BytesPerWord), GIV(newMethod));
GIV(stackPointer) = sp10;
/* begin setMethod:methodHeader: */
GIV(method) = GIV(newMethod);
assert(isOopCompiledMethod(GIV(method)));
assert((methodHeaderOf(GIV(method))) == methodHeader);
# if MULTIPLEBYTECODESETS
GIV(bytecodeSetSelector) = ((((int) methodHeader)) < 0
? 0x100
: 0);
# else
assert(!((headerIndicatesAlternateBytecodeSet(methodHeader))));
# endif
/* begin push: */
longAtput((sp11 = GIV(stackPointer) - BytesPerWord), GIV(nilObj));
GIV(stackPointer) = sp11;
/* begin push: */
object5 = (VMBIGENDIAN
? ((1 + (((sqInt)((usqInt)(numArgs) << ((BytesPerWord * 8) - 8))))) + (0)) + (0)
: ((1 + (((sqInt)((usqInt)(numArgs) << 8)))) + (0)) + (0));
longAtput((sp21 = GIV(stackPointer) - BytesPerWord), object5);
GIV(stackPointer) = sp21;
/* begin push: */
longAtput((sp31 = GIV(stackPointer) - BytesPerWord), 0);
GIV(stackPointer) = sp31;
GIV(instructionPointer) = initialIP - 1;
}
else {
/* begin push: */
longAtput((sp41 = GIV(stackPointer) - BytesPerWord), ((usqInt)cogMethod));
GIV(stackPointer) = sp41;
/* begin push: */
longAtput((sp5 = GIV(stackPointer) - BytesPerWord), GIV(nilObj));
GIV(stackPointer) = sp5;
GIV(instructionPointer) = (((usqInt)cogMethod)) + ((cogMethod->stackCheckOffset));
}
/* begin push: */
longAtput((sp9 = GIV(stackPointer) - BytesPerWord), rcvr);
GIV(stackPointer) = sp9;
for (i = (numArgs + 1); i <= numTemps; i += 1) {
/* begin push: */
longAtput((sp6 = GIV(stackPointer) - BytesPerWord), GIV(nilObj));
GIV(stackPointer) = sp6;
}
if ((/* begin alternateHeaderHasPrimitiveFlag: */
((methodHeader & AlternateHeaderHasPrimFlag) != 0))) {

/* Skip the CallPrimitive bytecode, if it's there, and store the error code if the method starts
with a long store temp. Strictly no need to skip the store because it's effectively a noop. */
if (!cogMethod) {
GIV(instructionPointer) += 3;
}
if (GIV(primFailCode) != 0) {
reapAndResetErrorCodeToheader(GIV(stackPointer), methodHeader);
}
}
if (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < (startOfMemory()))) {
maybeFlagMethodAsInterpreted(GIV(newMethod));
}
/* begin checkForStackOverflow */
assert((GIV(framePointer) - GIV(stackPointer)) < (LargeContextSlots * BytesPerOop));
assert(GIV(stackPage) == (mostRecentlyUsedPage()));
assert(!((isFree(GIV(stackPage)))));
/* begin setHeadFP:andSP:inPage: */
assert(GIV(stackPointer) < GIV(framePointer));
assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress)))
&& (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - (LargeContextSlots * BytesPerOop))));
assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress)))
&& (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - ((LargeContextSlots * BytesPerOop) / 2))));
(GIV(stackPage)->headFP = GIV(framePointer));
(GIV(stackPage)->headSP = GIV(stackPointer));
assert(pageListIsWellFormed());
if (GIV(stackPointer) < ((GIV(stackPage)->realStackLimit))) {
handleStackOverflow();
}
/* begin enterSmalltalkExecutiveFromCallback */
enterSmalltalkExecutive();
return 1;
}

/* CoInterpreter>>#shortPrintFrame: */
static sqInt NoDbgRegParms
shortPrintFrame(char *theFP)
Expand Down Expand Up @@ -35329,7 +35096,7 @@ primitiveInvokeObjectAsMethod(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt i;
sqInt lookupClassTag;
sqInt runArgs;
usqInt runArgs;
sqInt runReceiver;
char *sp;
char *sp1;
Expand Down Expand Up @@ -59500,6 +59267,13 @@ storeImageSegmentIntooutPointersroots(sqInt segmentWordArrayArg, sqInt outPointe
return returnrestoringObjectsInsavedFirstFieldsandsavedHashes(PrimNoErr, arrayOfObjects, savedFirstFields, outPointerArray, savedOutHashes);
}

/* SpurMemoryManager>>#storeLong32:ofObject:withValue: */
sqInt
storeLong32ofObjectwithValue(sqInt fieldIndex, sqInt obj, sqInt valueWord)
{
return long32Atput((obj + BaseHeaderSize) + (((sqInt)((usqInt)(fieldIndex) << 2))), valueWord);
}

/* SpurMemoryManager>>#storePointerUnchecked:ofObject:withValue: */
sqInt
storePointerUncheckedofObjectwithValue(sqInt fieldIndex, sqInt objOop, sqInt valuePointer)
Expand Down Expand Up @@ -62092,7 +61866,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: */
Expand Down Expand Up @@ -62122,7 +61896,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)) {
Expand Down Expand Up @@ -62673,7 +62447,7 @@ prepareForSnapshot(void)
sqInt limit;
sqInt newEndOfMemory;
sqInt next;
usqInt node;
sqInt node;
SpurSegmentInfo *seg;
sqInt smallChild;
sqInt treeNode;
Expand Down Expand Up @@ -78444,6 +78218,13 @@ primitiveDeferDisplayUpdates(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt flag;

if (cannotDeferDisplayUpdates) {
/* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
return;
}
/* begin stackTop */
flag = longAt(GIV(stackPointer));
if (flag == GIV(trueObj)) {
Expand Down Expand Up @@ -82295,7 +82076,6 @@ void* vm_exports[][3] = {
{(void*)_m, "returnAsThroughCallbackContext", (void*)returnAsThroughCallbackContext},
{(void*)_m, "segmentContainingObj", (void*)segmentContainingObj},
{(void*)_m, "sendInvokeCallbackContext", (void*)sendInvokeCallbackContext},
{(void*)_m, "sendInvokeCallbackStackRegistersJmpbuf", (void*)sendInvokeCallbackStackRegistersJmpbuf},
{(void*)_m, "setBreakMNUSelector", (void*)setBreakMNUSelector},
{(void*)_m, "setBreakSelector", (void*)setBreakSelector},
{(void*)_m, "setInterruptCheckChain", (void*)setInterruptCheckChain},
Expand Down
4 changes: 3 additions & 1 deletion src/spur32.cog.newspeak/cointerp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-mt.3175 uuid: c104df7c-e900-5145-9ec3-3164112c3841
CCodeGeneratorGlobalStructure VMMaker.oscog-mt.3184 uuid: 57b61827-3f1a-ab45-966e-7c5caaef28d7
*/


Expand Down Expand Up @@ -264,6 +264,7 @@ 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 stringForCString(const char *aCString);
extern void tenuringIncrementalGC(void);
Expand Down Expand Up @@ -335,6 +336,7 @@ extern sqInt ultimateLiteralOf(sqInt aMethodOop);
extern sqInt breakLookupClassTag;
extern char * breakSelector;
extern sqInt breakSelectorLength ;
extern sqInt cannotDeferDisplayUpdates;
extern sqInt checkedPluginName;
extern sqInt checkForLeaks;
extern sqInt debugCallbackInvokes;
Expand Down
Loading

0 comments on commit 95dbe9d

Please sign in to comment.