[Vm-dev] [commit][3385] CogVM source as per VMMaker.oscog-eem.1369
commits at squeakvm.org
commits at squeakvm.org
Sat Jun 20 19:52:46 UTC 2015
Revision: 3385
Author: eliot
Date: 2015-06-20 12:52:45 -0700 (Sat, 20 Jun 2015)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1369
Add explicit read barriers to primitives which access an argument as the
receiver (i.e. the mirror primitives). Don't check if the actual receiver is
used. Simplify failure where appropriate cuz the primitives will be retried.
Modified Paths:
--------------
branches/Cog/nsspursrc/vm/cogit.h
branches/Cog/nsspursrc/vm/cointerp.c
branches/Cog/nsspursrc/vm/cointerp.h
branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
branches/Cog/nsspurstack64src/vm/gcc3x-interp.c
branches/Cog/nsspurstack64src/vm/interp.c
branches/Cog/nsspurstacksrc/vm/gcc3x-interp.c
branches/Cog/nsspurstacksrc/vm/interp.c
branches/Cog/spursistasrc/vm/cogit.h
branches/Cog/spursistasrc/vm/cointerp.c
branches/Cog/spursistasrc/vm/cointerp.h
branches/Cog/spursistasrc/vm/gcc3x-cointerp.c
branches/Cog/spursrc/vm/cogit.h
branches/Cog/spursrc/vm/cointerp.c
branches/Cog/spursrc/vm/cointerp.h
branches/Cog/spursrc/vm/gcc3x-cointerp.c
branches/Cog/spurstack64src/vm/gcc3x-interp.c
branches/Cog/spurstack64src/vm/interp.c
branches/Cog/spurstacksrc/vm/gcc3x-interp.c
branches/Cog/spurstacksrc/vm/interp.c
branches/Cog/src/vm/cogit.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/stacksrc/vm/gcc3x-interp.c
branches/Cog/stacksrc/vm/interp.c
Property Changed:
----------------
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nsspursrc/vm/cogit.h
===================================================================
--- branches/Cog/nsspursrc/vm/cogit.h 2015-06-20 03:36:45 UTC (rev 3384)
+++ branches/Cog/nsspursrc/vm/cogit.h 2015-06-20 19:52:45 UTC (rev 3385)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGenerator VMMaker.oscog-eem.1367 uuid: 5d5685bb-29fe-4d36-8ff2-df498dd8cc47
+ CCodeGenerator VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753
*/
Modified: branches/Cog/nsspursrc/vm/cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.c 2015-06-20 03:36:45 UTC (rev 3384)
+++ branches/Cog/nsspursrc/vm/cointerp.c 2015-06-20 19:52:45 UTC (rev 3385)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1367 uuid: 5d5685bb-29fe-4d36-8ff2-df498dd8cc47
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753
from
- CoInterpreter VMMaker.oscog-eem.1367 uuid: 5d5685bb-29fe-4d36-8ff2-df498dd8cc47
+ CoInterpreter VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1367 uuid: 5d5685bb-29fe-4d36-8ff2-df498dd8cc47 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -1554,8 +1554,8 @@
_iss sqInt nilObj;
_iss usqInt freeStart;
_iss sqInt specialObjectsOop;
-_iss sqInt bytecodeSetSelector;
_iss sqInt argumentCount;
+_iss sqInt bytecodeSetSelector;
_iss usqInt instructionPointer;
_iss usqInt newMethod;
_iss sqInt markStack;
@@ -2376,7 +2376,7 @@
/*560*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
};
char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1367";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1369";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;
@@ -18113,7 +18113,7 @@
static sqInt
checkForAndFollowForwardedPrimitiveState(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
- sqInt accessorDepth;
+ signed char accessorDepth;
sqInt firstBytecode;
sqInt found;
sqInt found1;
@@ -30225,35 +30225,15 @@
sqInt arg;
sqInt err;
sqInt i;
- sqInt oop;
- sqInt oop1;
sqInt rcvr;
- /* begin stackObjectValue: */
- oop = longAt(GIV(stackPointer) + (0 * BytesPerWord));
- if ((oop & 3) != 0) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- arg = null;
- goto l1;
- }
- arg = oop;
-l1: /* end stackObjectValue: */;
- /* begin stackObjectValue: */
- oop1 = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if ((oop1 & 3) != 0) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- rcvr = null;
- goto l2;
- }
- rcvr = oop1;
-l2: /* end stackObjectValue: */;
- if (GIV(primFailCode)) {
+ arg = longAt(GIV(stackPointer));
+ rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ if (((arg & 3) != 0)
+ || ((GIV(argumentCount) > 1)
+ && (((rcvr & 3) != 0)
+ || (!(objCouldBeClassObj(rcvr)))))) {
+ (GIV(primFailCode) = PrimErrBadArgument);
return;
}
err = changeClassOfto(arg, rcvr);
@@ -30288,6 +30268,15 @@
sqInt result;
char *sp;
+
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || ((((longAt(GIV(stackPointer))) & 3) == 0)
+ && (objCouldBeClassObj(longAt(GIV(stackPointer))))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
result = allInstancesOf(longAt(GIV(stackPointer)));
if ((result & 1)) {
/* begin growToAccomodateContainerWithNumSlots: */
@@ -30554,15 +30543,14 @@
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ index = longAt(GIV(stackPointer));
if ((rcvr & 3) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer));
- if (!((index & 1))) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 1)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -30762,19 +30750,18 @@
usqInt valueToStore1;
/* begin commonAtPut: */
- value = longAt(GIV(stackPointer));
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
- if (!((rcvr & 3) == 0)) {
+ index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ value = longAt(GIV(stackPointer));
+ if ((rcvr & 3) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if (!((index & 1))) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 2)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -31262,6 +31249,14 @@
sqInt hashOrError;
char *sp;
+ if (GIV(argumentCount) > 0) {
+ if (!((((longAt(GIV(stackPointer))) & 3) == 0)
+ && (objCouldBeClassObj(longAt(GIV(stackPointer)))))) {
+ (GIV(primFailCode) = PrimErrBadArgument);
+ return;
+ }
+ }
+
assert((isNonImmediate(stackTop()))
&& (addressCouldBeClassObj(stackTop())));
/* begin ensureBehaviorHash: */
@@ -32006,18 +32001,22 @@
sqInt tagBits;
instance = longAt(GIV(stackPointer));
- if (GIV(argumentCount) > 0) {
- instance = (((instance & 3) == 0)
- && (((longAt(instance)) & 0x3FFFFF) == 8)
- ? noInlineFollowForwarded(instance)
- : instance);
+ if ((GIV(argumentCount) > 0)
+ && (((instance & 3) == 0)
+ && (((longAt(instance)) & 0x3FFFFF) == 8))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
}
- /* begin pop:thenPush: */
- oop = (((tagBits = instance & 3)) != 0
- ? longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (tagBits << (shiftForWord())))
- : fetchClassOfNonImm(instance));
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop);
- GIV(stackPointer) = sp;
+ else {
+ /* begin pop:thenPush: */
+ oop = (((tagBits = instance & 3)) != 0
+ ? longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (tagBits << (shiftForWord())))
+ : fetchClassOfNonImm(instance));
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop);
+ GIV(stackPointer) = sp;
+ }
}
@@ -32047,7 +32046,7 @@
usqInt newObj;
usqInt numBytes;
sqInt numSlots;
- sqInt s;
+ usqInt s;
char *sp;
sqInt sz;
@@ -32096,7 +32095,7 @@
GIV(needGCFlag) = 1;
forceInterruptCheck();
}
- s = ((usqInt) (allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, formatField, ClassByteStringCompactIndex)));
+ s = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, formatField, ClassByteStringCompactIndex);
goto l1;
}
if (numSlots >= 0xFF) {
@@ -36094,42 +36093,25 @@
primitiveIdentical(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt otherObject;
- sqInt referent;
- sqInt referent1;
char *sp;
sqInt thisObject;
otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord));
thisObject = longAt(GIV(stackPointer));
- if (((otherObject & 3) == 0)
- && (((longAt(otherObject)) & 0x3FFFFF) == 8)) {
- assert(GIV(argumentCount) > 1);
- /* begin followForwarded: */
- assert(isUnambiguouslyForwarder(thisObject));
- referent = longAt((thisObject + BaseHeaderSize) + (0 << (shiftForWord())));
- while (((referent & 3) == 0)
- && (((longAt(referent)) & 0x3FFFFF) == 8)) {
- referent = longAt((referent + BaseHeaderSize) + (0 << (shiftForWord())));
- }
- otherObject = referent;
+ if ((((otherObject & 3) == 0)
+ && (((longAt(otherObject)) & 0x3FFFFF) == 8))
+ || ((GIV(argumentCount) > 1)
+ && (((thisObject & 3) == 0)
+ && (((longAt(thisObject)) & 0x3FFFFF) == 8)))) {
+ GIV(primFailCode) = PrimErrBadArgument;
}
- assert(!(isOopForwarded(otherObject)));
- if (((thisObject & 3) == 0)
- && (((longAt(thisObject)) & 0x3FFFFF) == 8)) {
- /* begin followForwarded: */
- assert(isUnambiguouslyForwarder(thisObject));
- referent1 = longAt((thisObject + BaseHeaderSize) + (0 << (shiftForWord())));
- while (((referent1 & 3) == 0)
- && (((longAt(referent1)) & 0x3FFFFF) == 8)) {
- referent1 = longAt((referent1 + BaseHeaderSize) + (0 << (shiftForWord())));
- }
- thisObject = referent1;
+ else {
+ /* begin pop:thenPushBool: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject == otherObject
+ ? GIV(trueObj)
+ : GIV(falseObj)));
+ GIV(stackPointer) = sp;
}
- /* begin pop:thenPushBool: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject == otherObject
- ? GIV(trueObj)
- : GIV(falseObj)));
- GIV(stackPointer) = sp;
}
/* InterpreterPrimitives>>#primitiveIdentityHash */
@@ -36142,7 +36124,9 @@
sqInt thisReceiver;
thisReceiver = longAt(GIV(stackPointer));
- if ((thisReceiver & 3) != 0) {
+ if (((thisReceiver & 3) != 0)
+ || ((GIV(argumentCount) > 0)
+ && (isObjectForwarded(thisReceiver)))) {
/* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
@@ -37782,6 +37766,14 @@
spaceOkay = 0;
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || (objCouldBeClassObj(longAt(GIV(stackPointer)))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
+
/* Allocate a new fixed-size instance. Fail if the allocation would leave
less than lowSpaceThreshold bytes free. This *will not* cause a GC :-) */
@@ -38731,8 +38723,17 @@
sqInt tagBits2;
sqInt top;
- lookupClass = longAt(GIV(stackPointer));
rcvr = longAt(GIV(stackPointer) + (3 * BytesPerWord));
+ lookupClass = longAt(GIV(stackPointer));
+ if ((GIV(argumentCount) > 3)
+ && (((rcvr & 3) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ return;
+ }
if (((tagBits = rcvr & 3)) != 0) {
currentClass = longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (tagBits << (shiftForWord())));
}
@@ -40742,6 +40743,15 @@
char *sp;
class = longAt(GIV(stackPointer));
+
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || (((class & 3) == 0)
+ && (objCouldBeClassObj(class))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
instance = initialInstanceOf(class);
if (instance == null) {
/* begin primitiveFail */
@@ -40951,15 +40961,14 @@
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ index = longAt(GIV(stackPointer));
if ((rcvr & 3) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer));
- if (!((index & 1))) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 1)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -41168,19 +41177,18 @@
usqInt valueToStore1;
/* begin commonAtPut: */
- value = longAt(GIV(stackPointer));
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
- if (!((rcvr & 3) == 0)) {
+ index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ value = longAt(GIV(stackPointer));
+ if ((rcvr & 3) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if (!((index & 1))) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 2)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -45971,7 +45979,7 @@
sqInt ptr2;
sqInt slotBytes;
usqInt smallObj;
- sqInt start;
+ usqInt start;
classIndex = (long32At(aClass + 4)) & 0x3FFFFF;
if (classIndex == 0) {
@@ -60232,7 +60240,7 @@
usqInt prevFree;
usqInt prevFreeChunk;
usqInt prevPrevFree;
- sqInt prevPrevFreeChunk;
+ usqInt prevPrevFreeChunk;
sqInt slotBytes;
sqInt slotBytes1;
usqInt there;
@@ -65106,7 +65114,7 @@
static sqInt
readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
- usqInt bridge;
+ sqInt bridge;
usqInt bridgehead;
usqInt bridgeSpan;
sqInt bytesRead;
@@ -77659,7 +77667,13 @@
newCopy = cloneContext(rcvr);
}
else {
- newCopy = clone(rcvr);
+ if ((GIV(argumentCount) == 0)
+ || (!(isObjectForwarded(rcvr)))) {
+ newCopy = clone(rcvr);
+ }
+ else {
+ newCopy = 0;
+ }
}
if (newCopy == 0) {
(GIV(primFailCode) = PrimErrNoMemory);
@@ -79114,6 +79128,7 @@
sqInt methodHeader;
sqInt primBits;
sqInt primitiveIndex;
+ sqInt rcvr;
char *sp;
methodArgument = longAt(GIV(stackPointer));
@@ -79146,14 +79161,17 @@
if (GIV(argumentCount) > 2) {
/* CompiledMethod class>>receiver:withArguments:executeMethod:
- SqueakObjectPrimitives class >> receiver:withArguments:apply:
+ SqueakObjectPrimitives class>>receiver:withArguments:apply:
VMMirror>>ifFail:object:with:executeMethod: et al */
- if (GIV(argumentCount) > 4) {
+ rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
+ if ((GIV(argumentCount) > 4)
+ || (((rcvr & 3) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8))) {
(GIV(primFailCode) = PrimErrUnsupported);
return;
}
- longAtput(GIV(stackPointer) + (GIV(argumentCount) * BytesPerWord), longAt(GIV(stackPointer) + (2 * BytesPerWord)));
+ longAtput(GIV(stackPointer) + (GIV(argumentCount) * BytesPerWord), rcvr);
}
/* begin pop: */
GIV(stackPointer) += GIV(argumentCount) * BytesPerWord;
@@ -79713,7 +79731,6 @@
sqInt fmt;
sqLong hdr;
sqInt index;
- sqInt integerPointer;
sqInt integerValue;
sqInt newLargeInteger;
usqInt newObj;
@@ -79726,27 +79743,16 @@
sqInt totalLength;
sqInt value;
- /* begin stackIntegerValue: */
- integerPointer = longAt(GIV(stackPointer) + (0 * BytesPerWord));
- /* begin checkedIntegerValueOf: */
- if ((integerPointer & 1)) {
- index = (integerPointer >> 1);
- goto l2;
- }
- else {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- index = 0;
- goto l2;
- }
-l2: /* end stackIntegerValue: */;
+ index = longAt(GIV(stackPointer));
rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if (GIV(primFailCode)) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 1)
+ && (((rcvr & 3) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8)))) {
(GIV(primFailCode) = PrimErrBadArgument);
return;
}
+ index = (index >> 1);
hdr = long64At(rcvr);
fmt = (((unsigned sqLong)hdr) >> 24) & 0x1F;
/* begin lengthOf:format: */
@@ -79784,16 +79790,16 @@
if ((fmt >= 9)
|| (fmt == 2)) {
fixedFields = 0;
- goto l3;
+ goto l2;
}
if (fmt < 2) {
fixedFields = totalLength;
- goto l3;
+ goto l2;
}
class = fetchClassOfNonImm(rcvr);
/* begin fixedFieldsOfClassFormat: */
fixedFields = (((longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << (shiftForWord())))) >> 1)) & ((1 << 16) - 1);
-l3: /* end fixedFieldsOf:format:length: */;
+l2: /* end fixedFieldsOf:format:length: */;
if (!((index >= 1)
&& (index <= fixedFields))) {
(GIV(primFailCode) = PrimErrBadIndex);
@@ -79807,11 +79813,11 @@
/* begin subscript:with:format: */
if (fmt <= 5) {
value = longAt((rcvr + BaseHeaderSize) + ((index - 1) << (shiftForWord())));
- goto l5;
+ goto l4;
}
if (fmt >= 16) {
value = (((byteAt((rcvr + BaseHeaderSize) + (index - 1))) << 1) | 1);
- goto l5;
+ goto l4;
}
/* begin positive32BitIntegerFor: */
integerValue = long32At((rcvr + BaseHeaderSize) + ((index - 1) << 2));
@@ -79820,7 +79826,7 @@
if ((integerValue >= 0)
&& ((integerValue ^ (integerValue << 1)) >= 0)) {
value = ((integerValue << 1) | 1);
- goto l5;
+ goto l4;
}
/* begin eeInstantiateSmallClassIndex:format:numSlots: */
objFormat = 16 + ((8 - 4) & (BytesPerWord - 1));
@@ -79843,13 +79849,13 @@
if ((GIV(freeStart) + numBytes) > (((eden()).limit))) {
error("no room in eden for allocateSmallNewSpaceSlots:format:classIndex:");
newLargeInteger = 0;
- goto l4;
+ goto l3;
}
}
long64Atput(newObj, (((((usqLong) 1)) << 56) + (objFormat << 24)) + ClassLargePositiveIntegerCompactIndex);
GIV(freeStart) += numBytes;
newLargeInteger = newObj;
- l4: /* end allocateSmallNewSpaceSlots:format:classIndex: */;
+ l3: /* end allocateSmallNewSpaceSlots:format:classIndex: */;
# if VMBIGENDIAN
byteAtput((newLargeInteger + BaseHeaderSize) + 3, (((usqInt) integerValue) >> 24) & 0xFF);
@@ -79863,9 +79869,9 @@
# endif /* VMBIGENDIAN */
value = newLargeInteger;
- goto l5;
+ goto l4;
- l5: /* end subscript:with:format: */;
+ l4: /* end subscript:with:format: */;
}
/* begin pop:thenPush: */
longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
@@ -79881,7 +79887,6 @@
sqInt fmt;
sqLong hdr;
sqInt index;
- sqInt integerPointer;
sqInt newValue;
usqInt numSlots;
usqInt numSlots1;
@@ -79891,27 +79896,16 @@
usqInt valueToStore;
newValue = longAt(GIV(stackPointer));
- /* begin stackIntegerValue: */
- integerPointer = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- /* begin checkedIntegerValueOf: */
- if ((integerPointer & 1)) {
- index = (integerPointer >> 1);
- goto l2;
- }
- else {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- index = 0;
- goto l2;
- }
-l2: /* end stackIntegerValue: */;
+ index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
- if (GIV(primFailCode)) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 2)
+ && (((rcvr & 3) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8)))) {
(GIV(primFailCode) = PrimErrBadArgument);
return;
}
+ index = (index >> 1);
hdr = long64At(rcvr);
fmt = (((unsigned sqLong)hdr) >> 24) & 0x1F;
/* begin lengthOf:format: */
@@ -79949,16 +79943,16 @@
if ((fmt >= 9)
|| (fmt == 2)) {
fixedFields = 0;
- goto l3;
+ goto l2;
}
if (fmt < 2) {
fixedFields = totalLength;
- goto l3;
+ goto l2;
}
class = fetchClassOfNonImm(rcvr);
/* begin fixedFieldsOfClassFormat: */
fixedFields = (((longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << (shiftForWord())))) >> 1)) & ((1 << 16) - 1);
-l3: /* end fixedFieldsOf:format:length: */;
+l2: /* end fixedFieldsOf:format:length: */;
if (!((index >= 1)
&& (index <= fixedFields))) {
(GIV(primFailCode) = PrimErrBadIndex);
Modified: branches/Cog/nsspursrc/vm/cointerp.h
===================================================================
--- branches/Cog/nsspursrc/vm/cointerp.h 2015-06-20 03:36:45 UTC (rev 3384)
+++ branches/Cog/nsspursrc/vm/cointerp.h 2015-06-20 19:52:45 UTC (rev 3385)
@@ -1,5 +1,5 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1367 uuid: 5d5685bb-29fe-4d36-8ff2-df498dd8cc47
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753
*/
Modified: branches/Cog/nsspursrc/vm/gcc3x-cointerp.c
===================================================================
--- branches/Cog/nsspursrc/vm/gcc3x-cointerp.c 2015-06-20 03:36:45 UTC (rev 3384)
+++ branches/Cog/nsspursrc/vm/gcc3x-cointerp.c 2015-06-20 19:52:45 UTC (rev 3385)
@@ -2,11 +2,11 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1367 uuid: 5d5685bb-29fe-4d36-8ff2-df498dd8cc47
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753
from
- CoInterpreter VMMaker.oscog-eem.1367 uuid: 5d5685bb-29fe-4d36-8ff2-df498dd8cc47
+ CoInterpreter VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1367 uuid: 5d5685bb-29fe-4d36-8ff2-df498dd8cc47 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -1557,8 +1557,8 @@
_iss sqInt nilObj;
_iss usqInt freeStart;
_iss sqInt specialObjectsOop;
-_iss sqInt bytecodeSetSelector;
_iss sqInt argumentCount;
+_iss sqInt bytecodeSetSelector;
_iss usqInt instructionPointer;
_iss usqInt newMethod;
_iss sqInt markStack;
@@ -2379,7 +2379,7 @@
/*560*/ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0,-1,-1
};
char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1367";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.1369";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;
@@ -18122,7 +18122,7 @@
static sqInt
checkForAndFollowForwardedPrimitiveState(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
- sqInt accessorDepth;
+ signed char accessorDepth;
sqInt firstBytecode;
sqInt found;
sqInt found1;
@@ -30234,35 +30234,15 @@
sqInt arg;
sqInt err;
sqInt i;
- sqInt oop;
- sqInt oop1;
sqInt rcvr;
- /* begin stackObjectValue: */
- oop = longAt(GIV(stackPointer) + (0 * BytesPerWord));
- if ((oop & 3) != 0) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- arg = null;
- goto l1;
- }
- arg = oop;
-l1: /* end stackObjectValue: */;
- /* begin stackObjectValue: */
- oop1 = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if ((oop1 & 3) != 0) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- rcvr = null;
- goto l2;
- }
- rcvr = oop1;
-l2: /* end stackObjectValue: */;
- if (GIV(primFailCode)) {
+ arg = longAt(GIV(stackPointer));
+ rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ if (((arg & 3) != 0)
+ || ((GIV(argumentCount) > 1)
+ && (((rcvr & 3) != 0)
+ || (!(objCouldBeClassObj(rcvr)))))) {
+ (GIV(primFailCode) = PrimErrBadArgument);
return;
}
err = changeClassOfto(arg, rcvr);
@@ -30297,6 +30277,15 @@
sqInt result;
char *sp;
+
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || ((((longAt(GIV(stackPointer))) & 3) == 0)
+ && (objCouldBeClassObj(longAt(GIV(stackPointer))))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
result = allInstancesOf(longAt(GIV(stackPointer)));
if ((result & 1)) {
/* begin growToAccomodateContainerWithNumSlots: */
@@ -30563,15 +30552,14 @@
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ index = longAt(GIV(stackPointer));
if ((rcvr & 3) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer));
- if (!((index & 1))) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 1)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -30771,19 +30759,18 @@
usqInt valueToStore1;
/* begin commonAtPut: */
- value = longAt(GIV(stackPointer));
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
- if (!((rcvr & 3) == 0)) {
+ index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ value = longAt(GIV(stackPointer));
+ if ((rcvr & 3) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if (!((index & 1))) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 2)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -31271,6 +31258,14 @@
sqInt hashOrError;
char *sp;
+ if (GIV(argumentCount) > 0) {
+ if (!((((longAt(GIV(stackPointer))) & 3) == 0)
+ && (objCouldBeClassObj(longAt(GIV(stackPointer)))))) {
+ (GIV(primFailCode) = PrimErrBadArgument);
+ return;
+ }
+ }
+
assert((isNonImmediate(stackTop()))
&& (addressCouldBeClassObj(stackTop())));
/* begin ensureBehaviorHash: */
@@ -32015,18 +32010,22 @@
sqInt tagBits;
instance = longAt(GIV(stackPointer));
- if (GIV(argumentCount) > 0) {
- instance = (((instance & 3) == 0)
- && (((longAt(instance)) & 0x3FFFFF) == 8)
- ? noInlineFollowForwarded(instance)
- : instance);
+ if ((GIV(argumentCount) > 0)
+ && (((instance & 3) == 0)
+ && (((longAt(instance)) & 0x3FFFFF) == 8))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
}
- /* begin pop:thenPush: */
- oop = (((tagBits = instance & 3)) != 0
- ? longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (tagBits << (shiftForWord())))
- : fetchClassOfNonImm(instance));
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop);
- GIV(stackPointer) = sp;
+ else {
+ /* begin pop:thenPush: */
+ oop = (((tagBits = instance & 3)) != 0
+ ? longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (tagBits << (shiftForWord())))
+ : fetchClassOfNonImm(instance));
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop);
+ GIV(stackPointer) = sp;
+ }
}
@@ -32056,7 +32055,7 @@
usqInt newObj;
usqInt numBytes;
sqInt numSlots;
- sqInt s;
+ usqInt s;
char *sp;
sqInt sz;
@@ -32105,7 +32104,7 @@
GIV(needGCFlag) = 1;
forceInterruptCheck();
}
- s = ((usqInt) (allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, formatField, ClassByteStringCompactIndex)));
+ s = allocateSlotsInOldSpacebytesformatclassIndex(numSlots, numBytes, formatField, ClassByteStringCompactIndex);
goto l1;
}
if (numSlots >= 0xFF) {
@@ -36103,42 +36102,25 @@
primitiveIdentical(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt otherObject;
- sqInt referent;
- sqInt referent1;
char *sp;
sqInt thisObject;
otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord));
thisObject = longAt(GIV(stackPointer));
- if (((otherObject & 3) == 0)
- && (((longAt(otherObject)) & 0x3FFFFF) == 8)) {
- assert(GIV(argumentCount) > 1);
- /* begin followForwarded: */
- assert(isUnambiguouslyForwarder(thisObject));
- referent = longAt((thisObject + BaseHeaderSize) + (0 << (shiftForWord())));
- while (((referent & 3) == 0)
- && (((longAt(referent)) & 0x3FFFFF) == 8)) {
- referent = longAt((referent + BaseHeaderSize) + (0 << (shiftForWord())));
- }
- otherObject = referent;
+ if ((((otherObject & 3) == 0)
+ && (((longAt(otherObject)) & 0x3FFFFF) == 8))
+ || ((GIV(argumentCount) > 1)
+ && (((thisObject & 3) == 0)
+ && (((longAt(thisObject)) & 0x3FFFFF) == 8)))) {
+ GIV(primFailCode) = PrimErrBadArgument;
}
- assert(!(isOopForwarded(otherObject)));
- if (((thisObject & 3) == 0)
- && (((longAt(thisObject)) & 0x3FFFFF) == 8)) {
- /* begin followForwarded: */
- assert(isUnambiguouslyForwarder(thisObject));
- referent1 = longAt((thisObject + BaseHeaderSize) + (0 << (shiftForWord())));
- while (((referent1 & 3) == 0)
- && (((longAt(referent1)) & 0x3FFFFF) == 8)) {
- referent1 = longAt((referent1 + BaseHeaderSize) + (0 << (shiftForWord())));
- }
- thisObject = referent1;
+ else {
+ /* begin pop:thenPushBool: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject == otherObject
+ ? GIV(trueObj)
+ : GIV(falseObj)));
+ GIV(stackPointer) = sp;
}
- /* begin pop:thenPushBool: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject == otherObject
- ? GIV(trueObj)
- : GIV(falseObj)));
- GIV(stackPointer) = sp;
}
/* InterpreterPrimitives>>#primitiveIdentityHash */
@@ -36151,7 +36133,9 @@
sqInt thisReceiver;
thisReceiver = longAt(GIV(stackPointer));
- if ((thisReceiver & 3) != 0) {
+ if (((thisReceiver & 3) != 0)
+ || ((GIV(argumentCount) > 0)
+ && (isObjectForwarded(thisReceiver)))) {
/* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
@@ -37791,6 +37775,14 @@
spaceOkay = 0;
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || (objCouldBeClassObj(longAt(GIV(stackPointer)))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
+
/* Allocate a new fixed-size instance. Fail if the allocation would leave
less than lowSpaceThreshold bytes free. This *will not* cause a GC :-) */
@@ -38740,8 +38732,17 @@
sqInt tagBits2;
sqInt top;
- lookupClass = longAt(GIV(stackPointer));
rcvr = longAt(GIV(stackPointer) + (3 * BytesPerWord));
+ lookupClass = longAt(GIV(stackPointer));
+ if ((GIV(argumentCount) > 3)
+ && (((rcvr & 3) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ return;
+ }
if (((tagBits = rcvr & 3)) != 0) {
currentClass = longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (tagBits << (shiftForWord())));
}
@@ -40751,6 +40752,15 @@
char *sp;
class = longAt(GIV(stackPointer));
+
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || (((class & 3) == 0)
+ && (objCouldBeClassObj(class))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
instance = initialInstanceOf(class);
if (instance == null) {
/* begin primitiveFail */
@@ -40960,15 +40970,14 @@
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ index = longAt(GIV(stackPointer));
if ((rcvr & 3) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer));
- if (!((index & 1))) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 1)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -41177,19 +41186,18 @@
usqInt valueToStore1;
/* begin commonAtPut: */
- value = longAt(GIV(stackPointer));
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
- if (!((rcvr & 3) == 0)) {
+ index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ value = longAt(GIV(stackPointer));
+ if ((rcvr & 3) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if (!((index & 1))) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 2)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -45980,7 +45988,7 @@
sqInt ptr2;
sqInt slotBytes;
usqInt smallObj;
- sqInt start;
+ usqInt start;
classIndex = (long32At(aClass + 4)) & 0x3FFFFF;
if (classIndex == 0) {
@@ -60241,7 +60249,7 @@
usqInt prevFree;
usqInt prevFreeChunk;
usqInt prevPrevFree;
- sqInt prevPrevFreeChunk;
+ usqInt prevPrevFreeChunk;
sqInt slotBytes;
sqInt slotBytes1;
usqInt there;
@@ -65115,7 +65123,7 @@
static sqInt
readHeapFromImageFiledataBytes(sqImageFile f, sqInt numBytes)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
- usqInt bridge;
+ sqInt bridge;
usqInt bridgehead;
usqInt bridgeSpan;
sqInt bytesRead;
@@ -77668,7 +77676,13 @@
newCopy = cloneContext(rcvr);
}
else {
- newCopy = clone(rcvr);
+ if ((GIV(argumentCount) == 0)
+ || (!(isObjectForwarded(rcvr)))) {
+ newCopy = clone(rcvr);
+ }
+ else {
+ newCopy = 0;
+ }
}
if (newCopy == 0) {
(GIV(primFailCode) = PrimErrNoMemory);
@@ -79123,6 +79137,7 @@
sqInt methodHeader;
sqInt primBits;
sqInt primitiveIndex;
+ sqInt rcvr;
char *sp;
methodArgument = longAt(GIV(stackPointer));
@@ -79155,14 +79170,17 @@
if (GIV(argumentCount) > 2) {
/* CompiledMethod class>>receiver:withArguments:executeMethod:
- SqueakObjectPrimitives class >> receiver:withArguments:apply:
+ SqueakObjectPrimitives class>>receiver:withArguments:apply:
VMMirror>>ifFail:object:with:executeMethod: et al */
- if (GIV(argumentCount) > 4) {
+ rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
+ if ((GIV(argumentCount) > 4)
+ || (((rcvr & 3) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8))) {
(GIV(primFailCode) = PrimErrUnsupported);
return;
}
- longAtput(GIV(stackPointer) + (GIV(argumentCount) * BytesPerWord), longAt(GIV(stackPointer) + (2 * BytesPerWord)));
+ longAtput(GIV(stackPointer) + (GIV(argumentCount) * BytesPerWord), rcvr);
}
/* begin pop: */
GIV(stackPointer) += GIV(argumentCount) * BytesPerWord;
@@ -79722,7 +79740,6 @@
sqInt fmt;
sqLong hdr;
sqInt index;
- sqInt integerPointer;
sqInt integerValue;
sqInt newLargeInteger;
usqInt newObj;
@@ -79735,27 +79752,16 @@
sqInt totalLength;
sqInt value;
- /* begin stackIntegerValue: */
- integerPointer = longAt(GIV(stackPointer) + (0 * BytesPerWord));
- /* begin checkedIntegerValueOf: */
- if ((integerPointer & 1)) {
- index = (integerPointer >> 1);
- goto l2;
- }
- else {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- index = 0;
- goto l2;
- }
-l2: /* end stackIntegerValue: */;
+ index = longAt(GIV(stackPointer));
rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if (GIV(primFailCode)) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 1)
+ && (((rcvr & 3) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8)))) {
(GIV(primFailCode) = PrimErrBadArgument);
return;
}
+ index = (index >> 1);
hdr = long64At(rcvr);
fmt = (((unsigned sqLong)hdr) >> 24) & 0x1F;
/* begin lengthOf:format: */
@@ -79793,16 +79799,16 @@
if ((fmt >= 9)
|| (fmt == 2)) {
fixedFields = 0;
- goto l3;
+ goto l2;
}
if (fmt < 2) {
fixedFields = totalLength;
- goto l3;
+ goto l2;
}
class = fetchClassOfNonImm(rcvr);
/* begin fixedFieldsOfClassFormat: */
fixedFields = (((longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << (shiftForWord())))) >> 1)) & ((1 << 16) - 1);
-l3: /* end fixedFieldsOf:format:length: */;
+l2: /* end fixedFieldsOf:format:length: */;
if (!((index >= 1)
&& (index <= fixedFields))) {
(GIV(primFailCode) = PrimErrBadIndex);
@@ -79816,11 +79822,11 @@
/* begin subscript:with:format: */
if (fmt <= 5) {
value = longAt((rcvr + BaseHeaderSize) + ((index - 1) << (shiftForWord())));
- goto l5;
+ goto l4;
}
if (fmt >= 16) {
value = (((byteAt((rcvr + BaseHeaderSize) + (index - 1))) << 1) | 1);
- goto l5;
+ goto l4;
}
/* begin positive32BitIntegerFor: */
integerValue = long32At((rcvr + BaseHeaderSize) + ((index - 1) << 2));
@@ -79829,7 +79835,7 @@
if ((integerValue >= 0)
&& ((integerValue ^ (integerValue << 1)) >= 0)) {
value = ((integerValue << 1) | 1);
- goto l5;
+ goto l4;
}
/* begin eeInstantiateSmallClassIndex:format:numSlots: */
objFormat = 16 + ((8 - 4) & (BytesPerWord - 1));
@@ -79852,13 +79858,13 @@
if ((GIV(freeStart) + numBytes) > (((eden()).limit))) {
error("no room in eden for allocateSmallNewSpaceSlots:format:classIndex:");
newLargeInteger = 0;
- goto l4;
+ goto l3;
}
}
long64Atput(newObj, (((((usqLong) 1)) << 56) + (objFormat << 24)) + ClassLargePositiveIntegerCompactIndex);
GIV(freeStart) += numBytes;
newLargeInteger = newObj;
- l4: /* end allocateSmallNewSpaceSlots:format:classIndex: */;
+ l3: /* end allocateSmallNewSpaceSlots:format:classIndex: */;
# if VMBIGENDIAN
byteAtput((newLargeInteger + BaseHeaderSize) + 3, (((usqInt) integerValue) >> 24) & 0xFF);
@@ -79872,9 +79878,9 @@
# endif /* VMBIGENDIAN */
value = newLargeInteger;
- goto l5;
+ goto l4;
- l5: /* end subscript:with:format: */;
+ l4: /* end subscript:with:format: */;
}
/* begin pop:thenPush: */
longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value);
@@ -79890,7 +79896,6 @@
sqInt fmt;
sqLong hdr;
sqInt index;
- sqInt integerPointer;
sqInt newValue;
usqInt numSlots;
usqInt numSlots1;
@@ -79900,27 +79905,16 @@
usqInt valueToStore;
newValue = longAt(GIV(stackPointer));
- /* begin stackIntegerValue: */
- integerPointer = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- /* begin checkedIntegerValueOf: */
- if ((integerPointer & 1)) {
- index = (integerPointer >> 1);
- goto l2;
- }
- else {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- index = 0;
- goto l2;
- }
-l2: /* end stackIntegerValue: */;
+ index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
- if (GIV(primFailCode)) {
+ if (((index & 1) == 0)
+ || ((GIV(argumentCount) > 2)
+ && (((rcvr & 3) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8)))) {
(GIV(primFailCode) = PrimErrBadArgument);
return;
}
+ index = (index >> 1);
hdr = long64At(rcvr);
fmt = (((unsigned sqLong)hdr) >> 24) & 0x1F;
/* begin lengthOf:format: */
@@ -79958,16 +79952,16 @@
if ((fmt >= 9)
|| (fmt == 2)) {
fixedFields = 0;
- goto l3;
+ goto l2;
}
if (fmt < 2) {
fixedFields = totalLength;
- goto l3;
+ goto l2;
}
class = fetchClassOfNonImm(rcvr);
/* begin fixedFieldsOfClassFormat: */
fixedFields = (((longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << (shiftForWord())))) >> 1)) & ((1 << 16) - 1);
-l3: /* end fixedFieldsOf:format:length: */;
+l2: /* end fixedFieldsOf:format:length: */;
if (!((index >= 1)
&& (index <= fixedFields))) {
(GIV(primFailCode) = PrimErrBadIndex);
Modified: branches/Cog/nsspurstack64src/vm/gcc3x-interp.c
===================================================================
--- branches/Cog/nsspurstack64src/vm/gcc3x-interp.c 2015-06-20 03:36:45 UTC (rev 3384)
+++ branches/Cog/nsspurstack64src/vm/gcc3x-interp.c 2015-06-20 19:52:45 UTC (rev 3385)
@@ -2,11 +2,11 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1359 uuid: 0e62a222-6136-430f-9bc2-8e7cee245076
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753
from
- StackInterpreter VMMaker.oscog-eem.1359 uuid: 0e62a222-6136-430f-9bc2-8e7cee245076
+ StackInterpreter VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753
*/
-static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.1359 uuid: 0e62a222-6136-430f-9bc2-8e7cee245076 " __DATE__ ;
+static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.1369 uuid: 46477ec0-5610-4000-b7b6-4d32e240b753 " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -358,7 +358,6 @@
#endif
extern sqInt interpret(void);
-static unsigned long asUnsigned(sqInt anInteger) NoDbgRegParms;
extern char * cStringOrNullFor(sqInt oop);
extern sqInt failed(void);
static sqInt isNegativeIntegerValueOf(sqInt oop) NoDbgRegParms;
@@ -1291,7 +1290,7 @@
static sqInt stackPageHeadroom(void);
static sqInt stackPointerForMaybeMarriedContext(sqInt aContext) NoDbgRegParms;
static sqInt stackPointerIndexForFrame(char *theFP) NoDbgRegParms;
-extern unsigned long stackPositiveMachineIntegerValue(sqInt offset);
+extern usqInt stackPositiveMachineIntegerValue(sqInt offset);
extern long stackSignedMachineIntegerValue(sqInt offset);
extern sqInt stackTop(void);
extern sqInt stackValue(sqInt offset);
@@ -1374,9 +1373,9 @@
_iss sqInt nilObj;
_iss StackPage * stackPage;
_iss char * framePointer;
+_iss sqInt argumentCount;
_iss sqInt bytecodeSetSelector;
_iss sqInt specialObjectsOop;
-_iss sqInt argumentCount;
_iss usqInt freeStart;
_iss sqInt markStack;
_iss sqInt messageSelector;
@@ -2147,7 +2146,7 @@
/* 575 */ (void (*)(void))0,
0 };
char expensiveAsserts = 0;
-const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.1359";
+const char *interpreterVersion = "Newspeak Virtual Machine StackInterpreterPrimitives_VMMaker.oscog-eem.1369";
volatile int sendTrace;
sqInt suppressHeartbeatFlag;
@@ -15042,14 +15041,7 @@
return null;
}
- /* InterpreterPrimitives>>#asUnsigned: */
-static unsigned long
-asUnsigned(sqInt anInteger)
-{
- return ((unsigned long)anInteger);
-}
-
/* Answer either a malloced string with the null-terminated contents of oop
if oop is a string,
or the null pointer if oop is nil, or fail. It is the client's
@@ -15649,35 +15641,15 @@
sqInt arg;
sqInt err;
sqInt i;
- sqInt oop;
- sqInt oop1;
sqInt rcvr;
- /* begin stackObjectValue: */
- oop = longAt(GIV(stackPointer) + (0 * BytesPerWord));
- if ((oop & 7) != 0) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- arg = null;
- goto l1;
- }
- arg = oop;
-l1: /* end stackObjectValue: */;
- /* begin stackObjectValue: */
- oop1 = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if ((oop1 & 7) != 0) {
- /* begin primitiveFail */
- if (!GIV(primFailCode)) {
- GIV(primFailCode) = 1;
- }
- rcvr = null;
- goto l2;
- }
- rcvr = oop1;
-l2: /* end stackObjectValue: */;
- if (GIV(primFailCode)) {
+ arg = longAt(GIV(stackPointer));
+ rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ if (((arg & 7) != 0)
+ || ((GIV(argumentCount) > 1)
+ && (((rcvr & 7) != 0)
+ || (!(objCouldBeClassObj(rcvr)))))) {
+ (GIV(primFailCode) = PrimErrBadArgument);
return;
}
err = changeClassOfto(arg, rcvr);
@@ -15712,6 +15684,15 @@
sqInt result;
char *sp;
+
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || ((((longAt(GIV(stackPointer))) & 7) == 0)
+ && (objCouldBeClassObj(longAt(GIV(stackPointer))))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
result = allInstancesOf(longAt(GIV(stackPointer)));
if ((((result) & 7) == 1)) {
/* begin growToAccomodateContainerWithNumSlots: */
@@ -15952,15 +15933,14 @@
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ index = longAt(GIV(stackPointer));
if ((rcvr & 7) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer));
- if (!((((index) & 7) == 1))) {
+ if (((index & 7) != 1)
+ || ((GIV(argumentCount) > 1)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -16113,19 +16093,18 @@
usqInt valueToStore1;
/* begin commonAtPut: */
- value = longAt(GIV(stackPointer));
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
- if (!((rcvr & 7) == 0)) {
+ index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ value = longAt(GIV(stackPointer));
+ if ((rcvr & 7) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if (!((((index) & 7) == 1))) {
+ if (((index & 7) != 1)
+ || ((GIV(argumentCount) > 2)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -16613,6 +16592,14 @@
sqInt hashOrError;
char *sp;
+ if (GIV(argumentCount) > 0) {
+ if (!((((longAt(GIV(stackPointer))) & 7) == 0)
+ && (objCouldBeClassObj(longAt(GIV(stackPointer)))))) {
+ (GIV(primFailCode) = PrimErrBadArgument);
+ return;
+ }
+ }
+
assert((isNonImmediate(stackTop()))
&& (addressCouldBeClassObj(stackTop())));
/* begin ensureBehaviorHash: */
@@ -17132,18 +17119,22 @@
sqInt tagBits;
instance = longAt(GIV(stackPointer));
- if (GIV(argumentCount) > 0) {
- instance = (((instance & 7) == 0)
- && (((longAt(instance)) & 0x3FFFFF) == 8)
- ? noInlineFollowForwarded(instance)
- : instance);
+ if ((GIV(argumentCount) > 0)
+ && (((instance & 7) == 0)
+ && (((longAt(instance)) & 0x3FFFFF) == 8))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
}
- /* begin pop:thenPush: */
- oop = (((tagBits = instance & 7)) != 0
- ? longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (((long)tagBits) << (shiftForWord())))
- : fetchClassOfNonImm(instance));
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop);
- GIV(stackPointer) = sp;
+ else {
+ /* begin pop:thenPush: */
+ oop = (((tagBits = instance & 7)) != 0
+ ? longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (((long)tagBits) << (shiftForWord())))
+ : fetchClassOfNonImm(instance));
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), oop);
+ GIV(stackPointer) = sp;
+ }
}
@@ -21016,42 +21007,25 @@
primitiveIdentical(void)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt otherObject;
- sqInt referent;
- sqInt referent1;
char *sp;
sqInt thisObject;
otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord));
thisObject = longAt(GIV(stackPointer));
- if (((otherObject & 7) == 0)
- && (((longAt(otherObject)) & 0x3FFFFF) == 8)) {
- assert(GIV(argumentCount) > 1);
- /* begin followForwarded: */
- assert(isUnambiguouslyForwarder(thisObject));
- referent = longAt((thisObject + BaseHeaderSize) + (0LL << (shiftForWord())));
- while (((referent & 7) == 0)
- && (((longAt(referent)) & 0x3FFFFF) == 8)) {
- referent = longAt((referent + BaseHeaderSize) + (0LL << (shiftForWord())));
- }
- otherObject = referent;
+ if ((((otherObject & 7) == 0)
+ && (((longAt(otherObject)) & 0x3FFFFF) == 8))
+ || ((GIV(argumentCount) > 1)
+ && (((thisObject & 7) == 0)
+ && (((longAt(thisObject)) & 0x3FFFFF) == 8)))) {
+ GIV(primFailCode) = PrimErrBadArgument;
}
- assert(!(isOopForwarded(otherObject)));
- if (((thisObject & 7) == 0)
- && (((longAt(thisObject)) & 0x3FFFFF) == 8)) {
- /* begin followForwarded: */
- assert(isUnambiguouslyForwarder(thisObject));
- referent1 = longAt((thisObject + BaseHeaderSize) + (0LL << (shiftForWord())));
- while (((referent1 & 7) == 0)
- && (((longAt(referent1)) & 0x3FFFFF) == 8)) {
- referent1 = longAt((referent1 + BaseHeaderSize) + (0LL << (shiftForWord())));
- }
- thisObject = referent1;
+ else {
+ /* begin pop:thenPushBool: */
+ longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject == otherObject
+ ? GIV(trueObj)
+ : GIV(falseObj)));
+ GIV(stackPointer) = sp;
}
- /* begin pop:thenPushBool: */
- longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject == otherObject
- ? GIV(trueObj)
- : GIV(falseObj)));
- GIV(stackPointer) = sp;
}
/* InterpreterPrimitives>>#primitiveIdentityHash */
@@ -21064,7 +21038,9 @@
sqInt thisReceiver;
thisReceiver = longAt(GIV(stackPointer));
- if ((thisReceiver & 7) != 0) {
+ if (((thisReceiver & 7) != 0)
+ || ((GIV(argumentCount) > 0)
+ && (isObjectForwarded(thisReceiver)))) {
/* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
@@ -22777,6 +22753,14 @@
spaceOkay = 0;
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || (objCouldBeClassObj(longAt(GIV(stackPointer)))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
+
/* Allocate a new fixed-size instance. Fail if the allocation would leave
less than lowSpaceThreshold bytes free. This *will not* cause a GC :-) */
@@ -23920,8 +23904,17 @@
nArgs = 0;
savedFramePointer = 0;
savedStackPointer = 0;
- lookupClass = longAt(GIV(stackPointer));
rcvr = longAt(GIV(stackPointer) + (3 * BytesPerWord));
+ lookupClass = longAt(GIV(stackPointer));
+ if ((GIV(argumentCount) > 3)
+ && (((rcvr & 7) == 0)
+ && (((longAt(rcvr)) & 0x3FFFFF) == 8))) {
+ /* begin primitiveFail */
+ if (!GIV(primFailCode)) {
+ GIV(primFailCode) = 1;
+ }
+ return;
+ }
if (((tagBits = rcvr & 7)) != 0) {
currentClass = longAt((GIV(classTableFirstPage) + BaseHeaderSize) + (((long)tagBits) << (shiftForWord())));
}
@@ -27239,6 +27232,15 @@
char *sp;
class = longAt(GIV(stackPointer));
+
+ /* For the mirror prims check that the class obj is actually a valid class. */
+
+ if (!((GIV(argumentCount) < 1)
+ || (((class & 7) == 0)
+ && (objCouldBeClassObj(class))))) {
+ GIV(primFailCode) = PrimErrBadArgument;
+ }
+
instance = initialInstanceOf(class);
if (instance == null) {
/* begin primitiveFail */
@@ -27422,15 +27424,14 @@
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ index = longAt(GIV(stackPointer));
if ((rcvr & 7) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer));
- if (!((((index) & 7) == 1))) {
+ if (((index & 7) != 1)
+ || ((GIV(argumentCount) > 1)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -27592,19 +27593,18 @@
usqInt valueToStore1;
/* begin commonAtPut: */
- value = longAt(GIV(stackPointer));
/* begin initPrimCall */
GIV(primFailCode) = 0;
rcvr = longAt(GIV(stackPointer) + (2 * BytesPerWord));
- if (!((rcvr & 7) == 0)) {
+ index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ value = longAt(GIV(stackPointer));
+ if ((rcvr & 7) != 0) {
GIV(primFailCode) = PrimErrInappropriate;
goto l1;
}
-
- /* No need to test for large positive integers here. No object has 1g elements */
-
- index = longAt(GIV(stackPointer) + (1 * BytesPerWord));
- if (!((((index) & 7) == 1))) {
+ if (((index & 7) != 1)
+ || ((GIV(argumentCount) > 2)
+ && (isObjectForwarded(rcvr)))) {
GIV(primFailCode) = PrimErrBadArgument;
goto l1;
}
@@ -69257,7 +69257,7 @@
/* In the StackInterpreter stacks grow down. */
/* StackInterpreter>>#stackPositiveMachineIntegerValue: */
-unsigned long
+usqInt
stackPositiveMachineIntegerValue(sqInt offset)
{ DECL_MAYBE_SQ_GLOBAL_STRUCT
sqInt bs;
@@ -69276,16 +69276,16 @@
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
- return null;
+ return ((unsigned long) null);
}
- return value;
+ return ((unsigned long) value);
}
if ((integerPointer & 7) != 0) {
/* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
- return 0;
+ return ((unsigned long) 0);
}
/* begin isClassOfNonImm:equalTo:compactClassIndex: */
assert(!(isImmediate(integerPointer)));
@@ -69299,7 +69299,7 @@
if (!GIV(primFailCode)) {
@@ Diff output truncated at 50000 characters. @@
More information about the Vm-dev
mailing list