Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.2359
Browse files Browse the repository at this point in the history
Cogits:
Fix regression introduced in VMMaker.oscog-eem.2333 or thereabouts when improving comoilation breakpoint.  maybeSelectorOfMethod can answer nil so a guard is needed.

Fix ceSend:aboveClassBinding:to:numArgs:, which forgot to indirect through the binding before sending ceSend:above:to:numArgs:.

Sista Cogit:
This commit:
- extends the Sista instruction set (new conditional jumps on mutability, age, backjump without interrupt points, new inlined arithmetics, inlined allocation up to 65k supported, possibleRoot, etc.) both in the interpreter and the JIT
- all the interpreter version are now filled with many assertions, so it is now possible to compile a StackVM with SistaVM option and debug easily the optimized code using the assertions.
- refactors a bit all inline primitives (Since now there is many)
- reworked a bit the bytecode set so all bytecodes except traps, mappedInlinedPrimitive and callPrimitive are normal Smalltalk bytecodes while the 3 bytecodes mentioned are different in the Sista VM. That way it is easier to know what to implement to support the full image without having to implement the whole sista extensions.

Decreases by 1 the number of instructions for byte reads on constants.

Plugins:
Fix several (ancient) issues with the MiscPrimitivePlugin primitives, identified by Levente.
Try and make all failures supply an error code.

Tidy up FilePlugin error checking and use of symbols for declaring variable types in:
- #fileValueOf:
- #pointerFrom:
- #primitiveConnectToFile
- #primitiveConnectToFileDescriptor

Restored SerialPlugin's *byName* primitives on non-PharoVM VMs.
  • Loading branch information
eliotmiranda committed Mar 16, 2018
1 parent 937ea4d commit 1f0a7da
Show file tree
Hide file tree
Showing 80 changed files with 70,900 additions and 62,109 deletions.
2 changes: 1 addition & 1 deletion nsspur64src/vm/cogit.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-eem.2347 uuid: 062614a7-e3da-4b30-997a-9568911b9ff5
CCodeGenerator VMMaker.oscog-eem.2359 uuid: b3273e3e-dd9d-4819-a928-7034e1cf412c
*/


Expand Down
1,144 changes: 588 additions & 556 deletions nsspur64src/vm/cogitX64SysV.c

Large diffs are not rendered by default.

1,144 changes: 588 additions & 556 deletions nsspur64src/vm/cogitX64WIN64.c

Large diffs are not rendered by default.

179 changes: 91 additions & 88 deletions nsspur64src/vm/cointerp.c
@@ -1,9 +1,9 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2347 uuid: 062614a7-e3da-4b30-997a-9568911b9ff5
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2359 uuid: b3273e3e-dd9d-4819-a928-7034e1cf412c
from
CoInterpreter VMMaker.oscog-eem.2347 uuid: 062614a7-e3da-4b30-997a-9568911b9ff5
CoInterpreter VMMaker.oscog-eem.2359 uuid: b3273e3e-dd9d-4819-a928-7034e1cf412c
*/
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2347 uuid: 062614a7-e3da-4b30-997a-9568911b9ff5 " __DATE__ ;
static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.2359 uuid: b3273e3e-dd9d-4819-a928-7034e1cf412c " __DATE__ ;
char *__interpBuildInfo = __buildInfo;


Expand Down Expand Up @@ -1131,6 +1131,7 @@ static void NoDbgRegParms initializeObjectMemory(sqInt bytesToShift);
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);
extern sqInt instSpecOfClassFormat(sqInt classFormat);
static sqInt NoDbgRegParms instSpecOfClass(sqInt classPointer);
static sqInt NoDbgRegParms isAnyPointerFormat(sqInt format);
Expand Down Expand Up @@ -2586,7 +2587,7 @@ static signed char primitiveAccessorDepthTable[MaxPrimitiveIndex + 2 /* 577 */]
};
sqInt checkedPluginName;
char expensiveAsserts = 0;
const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2347";
const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.2359";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;

Expand Down Expand Up @@ -35545,18 +35546,7 @@ primitiveMultiplyLargeIntegers(void)
static void
primitiveNew(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt classFormat;
sqInt classIndex;
sqInt classObj1;
sqInt err;
sqInt hash;
sqInt instSpec;
sqInt newObj;
usqInt newObj1;
usqInt numBytes;
sqInt numSlots;
sqInt obj;
usqInt p;
sqInt reasonCode;
char *sp;

Expand All @@ -35571,79 +35561,7 @@ primitiveNew(void)

/* Allocate a new fixed-size instance. Fail if the allocation would leave
less than lowSpaceThreshold bytes free. This *will not* cause a GC :-) */
/* begin instantiateClass: */
classObj1 = longAt(GIV(stackPointer));
classFormat = ((longAt((classObj1 + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3);
instSpec = (((usqInt) classFormat) >> (fixedFieldsFieldWidth())) & (formatMask());
if (!((instSpec <= 1 /* nonIndexablePointerFormat */)
|| (instSpec == 5 /* ephemeronFormat */))) {
obj = null;
goto l8;
}
assert(addressCouldBeClassObj(classObj1));
classIndex = (((hash = (long32At(classObj1 + 4)) & (identityHashHalfWordMask()))) != 0
? hash
: (objCouldBeClassObj(classObj1)
? (((err = enterIntoClassTable(classObj1))) != 0
? -err
: (long32At(classObj1 + 4)) & (identityHashHalfWordMask()))
: -PrimErrBadReceiver));
if (classIndex < 0) {
/* begin primitiveFailFor: */
GIV(primFailCode) = -classIndex;
obj = null;
goto l8;
}
/* begin fixedFieldsOfClassFormat: */
numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1);
/* begin allocateSlots:format:classIndex: */
if (numSlots >= (numSlotsMask())) {
if ((((usqInt) numSlots) >> 56) > 0) {
newObj = null;
goto l4;
}
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 l4;
}
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;
l4: /* end allocateSlots:format: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, GIV(nilObj));
}
}
obj = newObj;
l8: /* end instantiateClass: */;
obj = instantiateClass(longAt(GIV(stackPointer)));
if (obj == null) {
/* begin primitiveFailFor: */
reasonCode = (isFixedSizePointerFormat(instSpecOfClass(longAt(GIV(stackPointer))))
Expand Down Expand Up @@ -51251,6 +51169,91 @@ instanceSizeOf(sqInt classObj)
return (((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3)) & ((1U << (fixedFieldsFieldWidth())) - 1);
}

/* SpurMemoryManager>>#instantiateClass: */
static sqInt NoDbgRegParms
instantiateClass(sqInt classObj)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt classFormat;
sqInt classIndex;
sqInt err;
sqInt hash;
sqInt instSpec;
sqInt newObj;
usqInt newObj1;
usqInt numBytes;
sqInt numSlots;
usqInt p;

classFormat = ((longAt((classObj + BaseHeaderSize) + (((sqInt)((usqInt)(InstanceSpecificationIndex) << (shiftForWord())))))) >> 3);
instSpec = (((usqInt) classFormat) >> (fixedFieldsFieldWidth())) & (formatMask());
if (!((instSpec <= 1 /* nonIndexablePointerFormat */)
|| (instSpec == 5 /* ephemeronFormat */))) {
return null;
}
assert(addressCouldBeClassObj(classObj));
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;
}
/* begin fixedFieldsOfClassFormat: */
numSlots = classFormat & ((1U << (fixedFieldsFieldWidth())) - 1);
/* begin allocateSlots:format:classIndex: */
if (numSlots >= (numSlotsMask())) {
if ((((usqInt) numSlots) >> 56) > 0) {
newObj = null;
goto l4;
}
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 l4;
}
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;
l4: /* end allocateSlots:format: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, GIV(nilObj));
}
}
return newObj;
}

/* SpurMemoryManager>>#instSpecOfClassFormat: */
sqInt
instSpecOfClassFormat(sqInt classFormat)
Expand Down
2 changes: 1 addition & 1 deletion nsspur64src/vm/cointerp.h
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2347 uuid: 062614a7-e3da-4b30-997a-9568911b9ff5
CCodeGeneratorGlobalStructure VMMaker.oscog-eem.2359 uuid: b3273e3e-dd9d-4819-a928-7034e1cf412c
*/


Expand Down

0 comments on commit 1f0a7da

Please sign in to comment.