[Vm-dev] [commit][3138] CogVM source as per VMMaker.oscog-eem.948
commits at squeakvm.org
commits at squeakvm.org
Fri Nov 21 02:57:25 UTC 2014
Revision: 3138
Author: eliot
Date: 2014-11-20 18:57:22 -0800 (Thu, 20 Nov 2014)
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.948
Spur:
Fix regression in primitiveNewWithArg from VMMaker.oscog-eem.859 which caused
basicNew: on fixed classes to raise OutOfMemory instead of the relevant error.
Have checkForAndFollowForwardedPrimitiveState follow other referencesin the
frame if a forwarder is found on the stack.
All:
Add a first cut at the primitiveSlotAt[Put] primitives.
Reimplement primitiveBitShift for 64-bits.
Define areIntegers:and: for 64-bit Spur, and move it into the ObjectMemory
hierarchies.
Add maxSmallInteger and minSmallInteger and matching manifest constants.
Use these in LargeIntegersPlugin and Matrix2x3Plugin.
Use numBytesOf: instead of lengthOf: in the 64-bit integer conversion routines.
Reorder cases in Spur's numBytesOf: to put common case first.
Modified Paths:
--------------
branches/Cog/nscogsrc/plugins/AioPlugin/AioPlugin.c
branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
branches/Cog/nscogsrc/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c
branches/Cog/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
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/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/nsspurstacksrc/vm/gcc3x-interp.c
branches/Cog/nsspurstacksrc/vm/interp.c
branches/Cog/nsspurstacksrc/vm/interp.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/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/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/spurstacksrc/vm/gcc3x-interp.c
branches/Cog/spurstacksrc/vm/interp.c
branches/Cog/spurstacksrc/vm/interp.h
branches/Cog/src/plugins/AioPlugin/AioPlugin.c
branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c
branches/Cog/src/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c
branches/Cog/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
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/stacksrc/vm/gcc3x-interp.c
branches/Cog/stacksrc/vm/interp.c
branches/Cog/stacksrc/vm/interp.h
Property Changed:
----------------
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogsrc/plugins/AioPlugin/AioPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/AioPlugin/AioPlugin.c 2014-11-16 01:45:07 UTC (rev 3137)
+++ branches/Cog/nscogsrc/plugins/AioPlugin/AioPlugin.c 2014-11-21 02:57:22 UTC (rev 3138)
@@ -1,9 +1,9 @@
/* Automatically generated by
- VMPluginCodeGenerator VMMaker.oscog-eem.702 uuid: 2f753471-9a18-4f13-aaef-58ffb0702465
+ VMPluginCodeGenerator VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca
from
- UnixAioPlugin VMConstruction-Plugins-AioPlugin-eem.15 uuid: 0029df1c-3720-4b61-8579-4851417d24a7
+ UnixAioPlugin VMConstruction-Plugins-AioPlugin-eem.16 uuid: 88d89f3d-80f8-4dbc-977a-78df02bbe8be
*/
-static char __buildInfo[] = "UnixAioPlugin VMConstruction-Plugins-AioPlugin-eem.15 uuid: 0029df1c-3720-4b61-8579-4851417d24a7 " __DATE__ ;
+static char __buildInfo[] = "UnixAioPlugin VMConstruction-Plugins-AioPlugin-eem.16 uuid: 88d89f3d-80f8-4dbc-977a-78df02bbe8be " __DATE__ ;
@@ -123,9 +123,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "AioPlugin VMConstruction-Plugins-AioPlugin-eem.15 (i)"
+ "AioPlugin VMConstruction-Plugins-AioPlugin-eem.16 (i)"
#else
- "AioPlugin VMConstruction-Plugins-AioPlugin-eem.15 (e)"
+ "AioPlugin VMConstruction-Plugins-AioPlugin-eem.16 (e)"
#endif
;
@@ -161,7 +161,7 @@
fileDescriptorFrom(sqInt aSQFileByteArray)
{
if (!((((isBytes(aSQFileByteArray))
- && ((byteSizeOf(aSQFileByteArray)) == (fileRecordSize())))
+ && ((byteSizeOf(aSQFileByteArray)) == (sizeof(SQFile))))
&& ((getThisSessionID()) == (sessionIdentifierFromSqFile(arrayValueOf(aSQFileByteArray)))))
&& (isNonNullSQFile(aSQFileByteArray)))) {
return -1;
@@ -255,7 +255,7 @@
sqFileBytes = arrayValueOf(objectPointer);
idx = 0;
- while (idx < (fileRecordSize())) {
+ while (idx < (sizeof(SQFile))) {
if ((sqFileBytes[idx]) != 0) {
return 1;
}
@@ -293,7 +293,7 @@
isSQFileObject(sqInt objectPointer)
{
return (((isBytes(objectPointer))
- && ((byteSizeOf(objectPointer)) == (fileRecordSize())))
+ && ((byteSizeOf(objectPointer)) == (sizeof(SQFile))))
&& ((getThisSessionID()) == (sessionIdentifierFromSqFile(arrayValueOf(objectPointer)))))
&& (isNonNullSQFile(objectPointer));
}
@@ -517,14 +517,14 @@
sqFileOop = stackValue(0);
if (!((((isBytes(sqFileOop))
- && ((byteSizeOf(sqFileOop)) == (fileRecordSize())))
+ && ((byteSizeOf(sqFileOop)) == (sizeof(SQFile))))
&& ((getThisSessionID()) == (sessionIdentifierFromSqFile(arrayValueOf(sqFileOop)))))
&& (isNonNullSQFile(sqFileOop)))) {
return primitiveFail();
}
/* begin fileDescriptorFrom: */
if (!((((isBytes(sqFileOop))
- && ((byteSizeOf(sqFileOop)) == (fileRecordSize())))
+ && ((byteSizeOf(sqFileOop)) == (sizeof(SQFile))))
&& ((getThisSessionID()) == (sessionIdentifierFromSqFile(arrayValueOf(sqFileOop)))))
&& (isNonNullSQFile(sqFileOop)))) {
fileNo = -1;
Modified: branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c
===================================================================
--- branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c 2014-11-16 01:45:07 UTC (rev 3137)
+++ branches/Cog/nscogsrc/plugins/LargeIntegers/LargeIntegers.c 2014-11-21 02:57:22 UTC (rev 3138)
@@ -1,9 +1,9 @@
/* Automatically generated by
- SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.796 uuid: 037e61a6-d81c-42e5-bbcb-62adbd938f38
+ SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca
from
- LargeIntegersPlugin VMMaker.oscog-eem.796 uuid: 037e61a6-d81c-42e5-bbcb-62adbd938f38
+ LargeIntegersPlugin VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca
*/
-static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.796 uuid: 037e61a6-d81c-42e5-bbcb-62adbd938f38 " __DATE__ ;
+static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca " __DATE__ ;
@@ -175,9 +175,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "LargeIntegers v1.5 VMMaker.oscog-eem.796 (i)"
+ "LargeIntegers v1.5 VMMaker.oscog-eem.948 (i)"
#else
- "LargeIntegers v1.5 VMMaker.oscog-eem.796 (e)"
+ "LargeIntegers v1.5 VMMaker.oscog-eem.948 (e)"
#endif
;
static const int orOpIndex = 1;
@@ -876,25 +876,69 @@
}
-/* Answer the number of indexable fields of a CSmallInteger. This value is
- the same as the largest legal subscript. */
+/* Answer the number of bytes required to represent the value of a
+ CSmallInteger.
+ */
static sqInt
cDigitLengthOfCSI(sqInt csi)
{
- if ((csi < 256)
- && (csi > -256)) {
+ if (csi >= 0) {
+ if (csi < 256) {
+ return 1;
+ }
+ if (csi < 65536) {
+ return 2;
+ }
+ if (csi < 0x1000000) {
+ return 3;
+ }
+ if (BytesPerOop == 4) {
+ return 4;
+ }
+ else {
+ if (csi < 0x100000000ULL) {
+ return 4;
+ }
+ if (csi < 0x10000000000ULL) {
+ return 5;
+ }
+ if (csi < 0x1000000000000ULL) {
+ return 6;
+ }
+ if (csi < 0x100000000000000ULL) {
+ return 7;
+ }
+ return 8;
+ }
+ }
+ if (csi > -256) {
return 1;
}
- if ((csi < 65536)
- && (csi > -65536)) {
+ if (csi > -65536) {
return 2;
}
- if ((csi < 0x1000000)
- && (csi > -16777216)) {
+ if (csi > -16777216) {
return 3;
}
- return 4;
+ if (BytesPerOop == 4) {
+ return 4;
+ }
+ else {
+ if (csi > -4294967296) {
+ return 4;
+ }
+ if (csi > -1099511627776) {
+ return 5;
+ }
+ if (csi > -281474976710656) {
+ return 6;
+ }
+ if (csi > -72057594037927936) {
+ return 7;
+ }
+ return 8;
+ }
}
static unsigned char
@@ -950,17 +994,14 @@
{
if (ix < 1) {
primitiveFail();
+ return 0;
}
- if (ix > 4) {
+ if (ix > BytesPerOop) {
return 0;
}
- if (csi < 0) {
- ;
- return (((usqInt) (0 - csi)) >> ((ix - 1) * 8)) & 0xFF;
- }
- else {
- return (((usqInt) csi) >> ((ix - 1) * 8)) & 0xFF;
- }
+ return (((usqInt) ((csi < 0
+ ? 0 - csi
+ : csi))) >> ((ix - 1) * 8)) & 0xFF;
}
static sqInt
@@ -1085,6 +1126,7 @@
static sqInt
createLargeFromSmallInteger(sqInt anOop)
{
+ sqInt byte;
sqInt class;
sqInt ix;
unsigned char * pByte;
@@ -1099,28 +1141,25 @@
else {
class = classLargePositiveInteger();
}
- /* begin cDigitLengthOfCSI: */
- if ((val < 256)
- && (val > -256)) {
- size = 1;
- goto l1;
- }
- if ((val < 65536)
- && (val > -65536)) {
- size = 2;
- goto l1;
- }
- if ((val < 0x1000000)
- && (val > -16777216)) {
- size = 3;
- goto l1;
- }
- size = 4;
-l1: /* end cDigitLengthOfCSI: */;
+ size = cDigitLengthOfCSI(val);
res = instantiateClassindexableSize(class, size);
pByte = firstIndexableField(res);
for (ix = 1; ix <= size; ix += 1) {
- pByte[ix - 1] = (cDigitOfCSIat(val, ix));
+ /* begin cDigitOfCSI:at: */
+ if (ix < 1) {
+ primitiveFail();
+ byte = 0;
+ goto l1;
+ }
+ if (ix > BytesPerOop) {
+ byte = 0;
+ goto l1;
+ }
+ byte = (((usqInt) ((val < 0
+ ? 0 - val
+ : val))) >> ((ix - 1) * 8)) & 0xFF;
+ l1: /* end cDigitOfCSI:at: */;
+ pByte[ix - 1] = byte;
}
return res;
}
@@ -1484,23 +1523,7 @@
pDiv = firstIndexableField(div);
/* begin digitLength: */
if (isIntegerObject(div)) {
- /* begin cDigitLengthOfCSI: */
- if (((integerValueOf(div)) < 256)
- && ((integerValueOf(div)) > -256)) {
- divLen = 1;
- goto l1;
- }
- if (((integerValueOf(div)) < 65536)
- && ((integerValueOf(div)) > -65536)) {
- divLen = 2;
- goto l1;
- }
- if (((integerValueOf(div)) < 0x1000000)
- && ((integerValueOf(div)) > -16777216)) {
- divLen = 3;
- goto l1;
- }
- divLen = 4;
+ divLen = cDigitLengthOfCSI(integerValueOf(div));
goto l1;
}
else {
@@ -1511,23 +1534,7 @@
pRem = firstIndexableField(rem);
/* begin digitLength: */
if (isIntegerObject(rem)) {
- /* begin cDigitLengthOfCSI: */
- if (((integerValueOf(rem)) < 256)
- && ((integerValueOf(rem)) > -256)) {
- remLen = 1;
- goto l2;
- }
- if (((integerValueOf(rem)) < 65536)
- && ((integerValueOf(rem)) > -65536)) {
- remLen = 2;
- goto l2;
- }
- if (((integerValueOf(rem)) < 0x1000000)
- && ((integerValueOf(rem)) > -16777216)) {
- remLen = 3;
- goto l2;
- }
- remLen = 4;
+ remLen = cDigitLengthOfCSI(integerValueOf(rem));
goto l2;
}
else {
@@ -1538,23 +1545,7 @@
pQuo = firstIndexableField(quo);
/* begin digitLength: */
if (isIntegerObject(quo)) {
- /* begin cDigitLengthOfCSI: */
- if (((integerValueOf(quo)) < 256)
- && ((integerValueOf(quo)) > -256)) {
- quoLen = 1;
- goto l3;
- }
- if (((integerValueOf(quo)) < 65536)
- && ((integerValueOf(quo)) > -65536)) {
- quoLen = 2;
- goto l3;
- }
- if (((integerValueOf(quo)) < 0x1000000)
- && ((integerValueOf(quo)) > -16777216)) {
- quoLen = 3;
- goto l3;
- }
- quoLen = 4;
+ quoLen = cDigitLengthOfCSI(integerValueOf(quo));
goto l3;
}
else {
@@ -1690,20 +1681,7 @@
digitLength(sqInt oop)
{
if (isIntegerObject(oop)) {
- /* begin cDigitLengthOfCSI: */
- if (((integerValueOf(oop)) < 256)
- && ((integerValueOf(oop)) > -256)) {
- return 1;
- }
- if (((integerValueOf(oop)) < 65536)
- && ((integerValueOf(oop)) > -65536)) {
- return 2;
- }
- if (((integerValueOf(oop)) < 0x1000000)
- && ((integerValueOf(oop)) > -16777216)) {
- return 3;
- }
- return 4;
+ return cDigitLengthOfCSI(integerValueOf(oop));
}
else {
return slotSizeOf(oop);
@@ -1934,7 +1912,17 @@
unsigned char *pointer;
if (isIntegerObject(oop)) {
- return cDigitOfCSIat(integerValueOf(oop), ix);
+ /* begin cDigitOfCSI:at: */
+ if (ix < 1) {
+ primitiveFail();
+ return 0;
+ }
+ if (ix > BytesPerOop) {
+ return 0;
+ }
+ return (((usqInt) (((integerValueOf(oop)) < 0
+ ? 0 - (integerValueOf(oop))
+ : integerValueOf(oop)))) >> ((ix - 1) * 8)) & 0xFF;
}
else {
/* begin digitOfBytes:at: */
@@ -2110,23 +2098,7 @@
}
/* begin digitLength: */
if (isIntegerObject(anInteger)) {
- /* begin cDigitLengthOfCSI: */
- if (((integerValueOf(anInteger)) < 256)
- && ((integerValueOf(anInteger)) > -256)) {
- len = 1;
- goto l1;
- }
- if (((integerValueOf(anInteger)) < 65536)
- && ((integerValueOf(anInteger)) > -65536)) {
- len = 2;
- goto l1;
- }
- if (((integerValueOf(anInteger)) < 0x1000000)
- && ((integerValueOf(anInteger)) > -16777216)) {
- len = 3;
- goto l1;
- }
- len = 4;
+ len = cDigitLengthOfCSI(integerValueOf(anInteger));
goto l1;
}
else {
@@ -2143,7 +2115,7 @@
/* maximal digitLength of aSmallInteger */
- sLen = 4;
+ sLen = BytesPerOop;
if (len > sLen) {
return 1;
}
@@ -2155,7 +2127,7 @@
/* SmallInteger maxVal */
/* all bytes of maxVal but the highest one are just FF's */
- maxVal = 0x3FFFFFFF;
+ maxVal = MaxSmallInteger;
return (((pointer1 = firstIndexableField(anInteger)))[sLen - 1]) > (cDigitOfCSIat(maxVal, sLen));
}
else {
@@ -2163,7 +2135,7 @@
/* SmallInteger minVal */
/* all bytes of minVal but the highest one are just 00's */
- minVal = -1073741824;
+ minVal = MinSmallInteger;
if ((((pointer2 = firstIndexableField(anInteger)))[sLen - 1]) < (cDigitOfCSIat(minVal, sLen))) {
return 0;
}
@@ -2221,7 +2193,7 @@
/* SmallInteger minVal */
- minVal = -1073741824;
+ minVal = MinSmallInteger;
if ((len < sLen)
|| ((digitOfBytesat(aLargeNegativeInteger, sLen)) < (cDigitOfCSIat(minVal, sLen)))) {
@@ -2292,9 +2264,9 @@
/* SmallInteger maxVal digitLength. */
- sLen = 4;
+ sLen = BytesPerOop;
if ((len <= sLen)
- && ((digitOfBytesat(aLargePositiveInteger, sLen)) <= (cDigitOfCSIat(0x3FFFFFFF, sLen)))) {
+ && ((digitOfBytesat(aLargePositiveInteger, sLen)) <= (cDigitOfCSIat(MaxSmallInteger, sLen)))) {
/* If so, return its SmallInt value */
Modified: branches/Cog/nscogsrc/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c 2014-11-16 01:45:07 UTC (rev 3137)
+++ branches/Cog/nscogsrc/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c 2014-11-21 02:57:22 UTC (rev 3138)
@@ -1,9 +1,9 @@
/* Automatically generated by
- VMPluginCodeGenerator VMMaker.oscog-eem.580 uuid: 751b08d4-d92e-440a-b3f6-cb2c76f52514
+ VMPluginCodeGenerator VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca
from
- Matrix2x3Plugin VMMaker.oscog-eem.580 uuid: 751b08d4-d92e-440a-b3f6-cb2c76f52514
+ Matrix2x3Plugin VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca
*/
-static char __buildInfo[] = "Matrix2x3Plugin VMMaker.oscog-eem.580 uuid: 751b08d4-d92e-440a-b3f6-cb2c76f52514 " __DATE__ ;
+static char __buildInfo[] = "Matrix2x3Plugin VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca " __DATE__ ;
@@ -117,9 +117,9 @@
static double m23ResultY;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "Matrix2x3Plugin VMMaker.oscog-eem.580 (i)"
+ "Matrix2x3Plugin VMMaker.oscog-eem.948 (i)"
#else
- "Matrix2x3Plugin VMMaker.oscog-eem.580 (e)"
+ "Matrix2x3Plugin VMMaker.oscog-eem.948 (e)"
#endif
;
@@ -282,8 +282,8 @@
static sqInt
okayIntValue(sqInt value)
{
- return (value >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF )));
+ return (value >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) )));
}
EXPORT(sqInt)
@@ -394,13 +394,13 @@
/* begin roundAndStoreResultPoint: */
m23ResultX += 0.5;
m23ResultY += 0.5;
- if (!((m23ResultX >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((m23ResultX >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
primitiveFail();
goto l2;
}
- if (!((m23ResultY >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((m23ResultY >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
primitiveFail();
goto l2;
}
@@ -588,13 +588,13 @@
/* begin roundAndStoreResultPoint: */
m23ResultX += 0.5;
m23ResultY += 0.5;
- if (!((m23ResultX >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((m23ResultX >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
primitiveFail();
goto l2;
}
- if (!((m23ResultY >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((m23ResultY >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
primitiveFail();
goto l2;
}
@@ -712,12 +712,12 @@
{
m23ResultX += 0.5;
m23ResultY += 0.5;
- if (!((m23ResultX >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((m23ResultX >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
return primitiveFail();
}
- if (!((m23ResultY >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((m23ResultY >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
return primitiveFail();
}
popthenPush(nItemsToPop, makePointwithxValueyValue(((sqInt)m23ResultX), ((sqInt)m23ResultY)));
@@ -738,23 +738,23 @@
sqInt rectOop;
minX = x0 + 0.5;
- if (!((minX >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((minX >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
return primitiveFail();
}
maxX = x1 + 0.5;
- if (!((maxX >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((maxX >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
return primitiveFail();
}
minY = y0 + 0.5;
- if (!((minY >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((minY >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
return primitiveFail();
}
maxY = y1 + 0.5;
- if (!((maxY >= (((double) -1073741824 )))
- && (m23ResultX <= (((double) 0x3FFFFFFF ))))) {
+ if (!((maxY >= (((double) (MinSmallInteger) )))
+ && (m23ResultX <= (((double) (MaxSmallInteger) ))))) {
return primitiveFail();
}
pushRemappableOop(dstOop);
Modified: branches/Cog/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c 2014-11-16 01:45:07 UTC (rev 3137)
+++ branches/Cog/nscogsrc/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c 2014-11-21 02:57:22 UTC (rev 3138)
@@ -1,9 +1,9 @@
/* Automatically generated by
- VMPluginCodeGenerator VMMaker.oscog-eem.706 uuid: 6eba60e7-a131-4353-870a-b34e8230b701
+ VMPluginCodeGenerator VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca
from
- UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.48 uuid: 65e92aef-c30a-4a73-8966-e3d7da6ec7b6
+ UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 uuid: dbbde2e2-9103-4ba8-96a9-33c29e7ee7e4
*/
-static char __buildInfo[] = "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.48 uuid: 65e92aef-c30a-4a73-8966-e3d7da6ec7b6 " __DATE__ ;
+static char __buildInfo[] = "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 uuid: dbbde2e2-9103-4ba8-96a9-33c29e7ee7e4 " __DATE__ ;
/* D T Lewis - UnixOSProcessPlugin.c translated from class
UnixOSProcessPlugin of OSProcessPlugin version 4.3.3 Cog */
@@ -318,9 +318,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.48 (i)"
+ "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 (i)"
#else
- "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.48 (e)"
+ "UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.49 (e)"
#endif
;
static void *originalSigHandlers[NSIG];
@@ -1271,7 +1271,7 @@
# endif /* defined(SA_DISABLE) */
- SigStackSize = ((((1024 * (sizeof(void *))) * 16) < (MINSIGSTKSZ)) ? (MINSIGSTKSZ) : ((1024 * (sizeof(void *))) * 16));
+ SigStackSize = ((((1024 * (sizeof(void *))) * 16) < MINSIGSTKSZ) ? MINSIGSTKSZ : ((1024 * (sizeof(void *))) * 16));
if (null == (sigstack.ss_size = SigStackSize, sigstack.ss_sp = malloc(SigStackSize))) {
msg("sigstack malloc failed");
useSignalStack = 0;
Modified: branches/Cog/nscogsrc/vm/cointerp.c
===================================================================
--- branches/Cog/nscogsrc/vm/cointerp.c 2014-11-16 01:45:07 UTC (rev 3137)
+++ branches/Cog/nscogsrc/vm/cointerp.c 2014-11-21 02:57:22 UTC (rev 3138)
@@ -1,9 +1,9 @@
/* Automatically generated by
- CCodeGeneratorGlobalStructure VMMaker.oscog-eem.933 uuid: 5a37067c-b76b-4ada-9399-1de11632acd8
+ CCodeGeneratorGlobalStructure VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca
from
- CoInterpreter VMMaker.oscog-eem.933 uuid: 5a37067c-b76b-4ada-9399-1de11632acd8
+ CoInterpreter VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca
*/
-static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.933 uuid: 5a37067c-b76b-4ada-9399-1de11632acd8 " __DATE__ ;
+static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca " __DATE__ ;
char *__interpBuildInfo = __buildInfo;
@@ -101,6 +101,7 @@
#define AllButMarkBitAndTypeMask 0x7FFFFFFC
#define AllButRootBit 0xBFFFFFFFUL
#define AllButTypeMask 0xFFFFFFFCUL
+#define AlternateHeaderHasPrimFlag 0x20000
#define AltLongStoreBytecode 234
#define AtCacheFixedFields 4
#define AtCacheFmt 3
@@ -259,6 +260,8 @@
#define MethodCacheSelector 1
#define MethodCacheSize 4096
#define MethodDictionaryIndex 1
+#define MethodHeaderArgCountShift 25
+#define MethodHeaderTempCountShift 19
#define MethodIndex 3
#define MFMethodFlagHasContextFlag 1
#define MFMethodFlagIsBlockFlag 2
@@ -320,7 +323,6 @@
#define Size4Bit 0
#define SizeMask 0xFC
#define SmallContextSlots 22
-#define SmallIntegerShift 1
#define SpecialSelectors 23
#define StackPageReachedButUntraced 1
#define StackPageTraced 2
@@ -352,6 +354,7 @@
#define TrueObject 2
#define TypeMask 0x3
#define Upward 3
+#define V3PrimitiveBitsMask 0x200003FE
#define ValueIndex 1
#define WeakRootTableSize 2625
#define WordMask 0xFFFFFFFFUL
@@ -585,6 +588,7 @@
static sqInt pageListIsWellFormed(void);
static StackPage * stackPageAt(sqInt index) NoDbgRegParms;
static StackPage * stackPageFor(void *pointer) NoDbgRegParms;
+static unsigned long asUnsigned(sqInt anInteger) NoDbgRegParms;
char * cStringOrNullFor(sqInt oop);
sqInt failed(void);
static sqInt isNegativeIntegerValueOf(sqInt oop) NoDbgRegParms;
@@ -850,7 +854,7 @@
void printWronglySizedContexts(sqInt printContexts);
static void restoreHeadersFromtofromandtofrom(sqInt firstIn, sqInt lastIn, sqInt hdrBaseIn, sqInt firstOut, sqInt lastOut, sqInt hdrBaseOut) NoDbgRegParms;
static void runLeakCheckerForFullGC(sqInt fullGCFlag) NoDbgRegParms;
-static usqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
+static sqInt safeObjectAfter(sqInt oop) NoDbgRegParms;
static sqInt safePrintStringOf(sqInt oop) NoDbgRegParms;
static sqInt shortentoIndexableSize(sqInt obj, sqInt nSlots) NoDbgRegParms;
static sqInt sizeBitsOfSafe(sqInt oop) NoDbgRegParms;
@@ -1027,7 +1031,7 @@
static sqInt checkDeliveryOfLongRunningPrimitiveSignal(void);
sqInt checkedIntegerValueOf(sqInt intOop);
static sqInt checkForEventsMayContextSwitch(sqInt mayContextSwitch) NoDbgRegParms;
-static sqInt checkImageVersionFromstartingAt(sqImageFile f, squeakFileOffsetType imageOffset) NoDbgRegParms;
+static sqInt checkImageVersionFromstartingAt(sqImageFile f, squeakFileOffsetType imageOffset) NoDbgRegParms;
static sqInt checkInterpreterIntegrity(void);
static sqInt checkIsStillMarriedContextcurrentFP(sqInt aContext, char *currentFP) NoDbgRegParms;
sqInt checkOkayInterpreterObjects(sqInt writeBack);
@@ -1095,12 +1099,12 @@
sqInt getFullScreenFlag(void);
sqInt getInterruptKeycode(void);
sqInt getInterruptPending(void);
-static sqInt getLongFromFileswap(sqImageFile aFile, sqInt swapFlag) NoDbgRegParms;
usqLong getNextWakeupUsecs(void);
sqInt getSavedWindowSize(void);
static sqInt getShortFromFileswap(sqImageFile aFile, sqInt swapFlag) NoDbgRegParms;
sqInt * getStackPointer(void);
sqInt getThisSessionID(void);
+static sqInt getWord32FromFileswap(sqImageFile aFile, sqInt swapFlag) NoDbgRegParms;
static void handleStackOverflow(void);
static sqInt handleStackOverflowOrEventAllowContextSwitch(sqInt mayContextSwitch) NoDbgRegParms;
sqInt headerIndicatesAlternateBytecodeSet(sqInt methodHeader);
@@ -1214,9 +1218,10 @@
void pushFloat(double f);
sqInt pushInteger(sqInt integerValue);
void push(sqInt object);
-static void putLongtoFile(sqInt aWord, sqImageFile aFile) NoDbgRegParms;
-static void putShorttoFile(sqInt aShort, sqImageFile aFile) NoDbgRegParms;
+static void putLongtoFile(long aLong, sqImageFile aFile) NoDbgRegParms;
+static void putShorttoFile(short aShort, sqImageFile aFile) NoDbgRegParms;
static void putToSleepyieldingIf(sqInt aProcess, sqInt yieldImplicitly) NoDbgRegParms;
+static void putWord32toFile(int aWord32, sqImageFile aFile) NoDbgRegParms;
static sqInt quickFetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer) NoDbgRegParms;
sqInt readableFormat(sqInt imageVersion);
EXPORT(sqInt) reestablishContextPriorToCallback(sqInt callbackContext);
@@ -1301,6 +1306,8 @@
EXPORT(void) primitiveSetGCSemaphore(void);
static void primitiveSignalAtMilliseconds(void);
static void primitiveSignalAtUTCMicroseconds(void);
+static void primitiveSlotAt(void);
+static void primitiveSlotAtPut(void);
static void primitiveStoreStackp(void);
static void primitiveVMParameter(void);
EXPORT(void) primitiveVoidReceiver(void);
@@ -1682,8 +1689,8 @@
/* 170 */ primitiveAsCharacter,
/* 171 */ primitiveCharacterValue,
/* 172 */ (void (*)(void))0,
- /* 173 */ (void (*)(void))0,
- /* 174 */ (void (*)(void))0,
+ /* 173 */ primitiveSlotAt,
+ /* 174 */ primitiveSlotAtPut,
/* 175 */ primitiveBehaviorHash,
/* 176 */ primitiveMaxIdentityHash,
/* 177 */ primitiveAllInstances,
@@ -2086,7 +2093,7 @@
/* 574 */ (void (*)(void))0,
/* 575 */ (void (*)(void))0,
0 };
-const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.933";
+const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreterPrimitives_VMMaker.oscog-eem.948";
sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 40 */;
volatile int sendTrace;
@@ -4823,7 +4830,6 @@
GIV(framePointer) = localFP;
ceEnterCogCodePopReceiverReg();
- null;
goto l260;
}
localIP = pointerForOop(longAt(localFP + FoxIFSavedIP));
@@ -4841,7 +4847,7 @@
/* begin fetchNextBytecode */
currentBytecode = (byteAtPointer(++localIP)) + GIV(bytecodeSetSelector);
- null;
+ /* return self */
l260: /* end baseFrameReturn */;
goto l259;
}
@@ -5367,7 +5373,8 @@
/* begin internalActivateNewMethod */
methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << (shiftForWord())));
assert(!(isCogMethodReference(methodHeader)));
- numTemps = (((usqInt) methodHeader) >> 19) & 0x3F;
+ numTemps = (((usqInt) methodHeader) >> MethodHeaderTempCountShift) & 0x3F;
+ assert(GIV(argumentCount) == (argumentCountOfMethodHeader(methodHeader)));
/* could new rcvr be set at point of send? */
@@ -5392,8 +5399,8 @@
longAtPointerput((localSP -= BytesPerOop), GIV(nilObj));
/* begin internalPush: */
object = (VMBIGENDIAN
- ? ((1 + (((((usqInt) methodHeader) >> 25) & 15) << ((BytesPerWord * 8) - 8))) + (0)) + (0)
- : ((1 + (((((usqInt) methodHeader) >> 25) & 15) << 8)) + (0)) + (0));
+ ? ((1 + (((((usqInt) methodHeader) >> MethodHeaderArgCountShift) & 15) << ((BytesPerWord * 8) - 8))) + (0)) + (0)
+ : ((1 + (((((usqInt) methodHeader) >> MethodHeaderArgCountShift) & 15) << 8)) + (0)) + (0));
longAtPointerput((localSP -= BytesPerOop), object);
/* begin internalPush: */
longAtPointerput((localSP -= BytesPerOop), 0);
@@ -5405,8 +5412,8 @@
}
localIP = pointerForOop(((GIV(newMethod) + ((LiteralStart + (literalCountOfMethodHeader(methodHeader))) * BytesPerOop)) + BaseHeaderSize) - 1);
if (((((sqInt) methodHeader)) < 0
- ? methodHeader & (65536 << SmallIntegerShift)
- : (methodHeader & 536871934) != 0)) {
+ ? methodHeader & AlternateHeaderHasPrimFlag
+ : methodHeader & V3PrimitiveBitsMask)) {
/* 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. */
@@ -7924,14 +7931,9 @@
/* bytecodePrimBitShift */
{
sqInt integerArgument;
- sqInt integerPointer;
- usqInt integerReceiver;
- sqInt object;
+ sqLong integerReceiver;
sqInt shifted;
char *sp;
- sqInt top;
- sqInt top1;
- sqInt top2;
VM_LABEL(bytecodePrimBitShift);
/* begin initPrimCall */
@@ -7942,82 +7944,63 @@
GIV(stackPointer) = localSP;
GIV(framePointer) = localFP;
/* begin primitiveBitShift */
- /* begin popInteger */
- /* begin popStack */
- top2 = longAt(GIV(stackPointer));
- GIV(stackPointer) += BytesPerWord;
- integerPointer = top2;
- /* begin checkedIntegerValueOf: */
- if ((integerPointer & 1)) {
- integerArgument = (integerPointer >> 1);
- goto l88;
- }
- else {
+ integerArgument = longAt(GIV(stackPointer));
+ if (!((integerArgument & 1))) {
/* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
- integerArgument = 0;
+ null;
goto l88;
}
- l88: /* end popInteger */;
- /* begin popPos32BitInteger */
- /* begin popStack */
- top1 = longAt(GIV(stackPointer));
- GIV(stackPointer) += BytesPerWord;
- top = top1;
- integerReceiver = positive32BitValueOf(top);
+ integerReceiver = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ integerReceiver = positive32BitValueOf(integerReceiver);
+
if (!GIV(primFailCode)) {
- if (integerArgument >= 0) {
+ if (((integerArgument = (integerArgument >> 1))) >= 0) {
/* Left shift -- must fail if we lose bits beyond 32 */
- /* begin success: */
if (!(integerArgument <= 0x1F)) {
-
- /* Don't overwrite an error code that has already been set. */
-
+ /* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
+ null;
+ goto l88;
}
shifted = integerReceiver << integerArgument;
- /* begin success: */
if (!((((usqInt) shifted) >> integerArgument) == integerReceiver)) {
-
- /* Don't overwrite an error code that has already been set. */
-
+ /* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
+ null;
+ goto l88;
}
}
else {
/* Right shift -- OK to lose bits */
- /* begin success: */
- if (!(integerArgument >= -31)) {
-
- /* Don't overwrite an error code that has already been set. */
-
+ if (!(integerArgument >= (-0x1F))) {
+ /* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
+ null;
+ goto l88;
}
- shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
+ shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
}
- }
- if (!GIV(primFailCode)) {
- /* begin push: */
- object = positive32BitIntegerFor(shifted);
- longAtput((sp = GIV(stackPointer) - BytesPerWord), object);
+ shifted = ((shifted ^ (shifted << 1)) >= 0
+ ? ((shifted << 1) | 1)
+ : positive32BitIntegerFor(shifted));
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), shifted);
GIV(stackPointer) = sp;
}
- else {
- /* begin unPop: */
- GIV(stackPointer) -= 2 * BytesPerWord;
- }
+ l88: /* end primitiveBitShift */;
/* begin internalizeIPandSP */
assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
localIP = pointerForOop(GIV(instructionPointer));
@@ -10885,14 +10868,9 @@
/* bytecodePrimBitShift */
{
sqInt integerArgument;
- sqInt integerPointer;
- usqInt integerReceiver;
- sqInt object;
+ sqLong integerReceiver;
sqInt shifted;
char *sp;
- sqInt top;
- sqInt top1;
- sqInt top2;
VM_LABEL(bytecodePrimBitShift1);
/* begin initPrimCall */
@@ -10903,82 +10881,63 @@
GIV(stackPointer) = localSP;
GIV(framePointer) = localFP;
/* begin primitiveBitShift */
- /* begin popInteger */
- /* begin popStack */
- top2 = longAt(GIV(stackPointer));
- GIV(stackPointer) += BytesPerWord;
- integerPointer = top2;
- /* begin checkedIntegerValueOf: */
- if ((integerPointer & 1)) {
- integerArgument = (integerPointer >> 1);
- goto l203;
- }
- else {
+ integerArgument = longAt(GIV(stackPointer));
+ if (!((integerArgument & 1))) {
/* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
- integerArgument = 0;
+ null;
goto l203;
}
- l203: /* end popInteger */;
- /* begin popPos32BitInteger */
- /* begin popStack */
- top1 = longAt(GIV(stackPointer));
- GIV(stackPointer) += BytesPerWord;
- top = top1;
- integerReceiver = positive32BitValueOf(top);
+ integerReceiver = longAt(GIV(stackPointer) + (1 * BytesPerWord));
+ integerReceiver = positive32BitValueOf(integerReceiver);
+
if (!GIV(primFailCode)) {
- if (integerArgument >= 0) {
+ if (((integerArgument = (integerArgument >> 1))) >= 0) {
/* Left shift -- must fail if we lose bits beyond 32 */
- /* begin success: */
if (!(integerArgument <= 0x1F)) {
-
- /* Don't overwrite an error code that has already been set. */
-
+ /* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
+ null;
+ goto l203;
}
shifted = integerReceiver << integerArgument;
- /* begin success: */
if (!((((usqInt) shifted) >> integerArgument) == integerReceiver)) {
-
- /* Don't overwrite an error code that has already been set. */
-
+ /* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
+ null;
+ goto l203;
}
}
else {
/* Right shift -- OK to lose bits */
- /* begin success: */
- if (!(integerArgument >= -31)) {
-
- /* Don't overwrite an error code that has already been set. */
-
+ if (!(integerArgument >= (-0x1F))) {
+ /* begin primitiveFail */
if (!GIV(primFailCode)) {
GIV(primFailCode) = 1;
}
+ null;
+ goto l203;
}
- shifted = ((usqInt) integerReceiver) >> (0 - integerArgument);
+ shifted = ((unsigned sqLong)integerReceiver) >> (0 - integerArgument);
}
- }
- if (!GIV(primFailCode)) {
- /* begin push: */
- object = positive32BitIntegerFor(shifted);
- longAtput((sp = GIV(stackPointer) - BytesPerWord), object);
+ shifted = ((shifted ^ (shifted << 1)) >= 0
+ ? ((shifted << 1) | 1)
+ : positive32BitIntegerFor(shifted));
+ /* begin pop:thenPush: */
+ longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), shifted);
GIV(stackPointer) = sp;
}
- else {
- /* begin unPop: */
- GIV(stackPointer) -= 2 * BytesPerWord;
- }
+ l203: /* end primitiveBitShift */;
/* begin internalizeIPandSP */
assert(GIV(instructionPointer) != (ceReturnToInterpreterPC()));
localIP = pointerForOop(GIV(instructionPointer));
@@ -12999,8 +12958,8 @@
assert((((((CogMethod *) header2))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header2))->methodHeader)));
if ((((((sqInt) header)) < 0
- ? header & (65536 << SmallIntegerShift)
- : (header & 536871934) != 0))
+ ? header & AlternateHeaderHasPrimFlag
+ : header & V3PrimitiveBitsMask))
&& ((((sqInt)localIP)) == ((GIV(method) + ((LiteralStart + (literalCountOfMethodHeader(header))) * BytesPerOop)) + BaseHeaderSize))) {
localIP = (localIP + (((((sqInt) header)) < 0
? 3
@@ -13181,15 +13140,15 @@
/* begin push: */
longAtput((sp9 = GIV(stackPointer) - BytesPerWord), rcvr);
GIV(stackPointer) = sp9;
- numTemps = (((usqInt) methodHeader) >> 19) & 0x3F;
+ numTemps = (((usqInt) methodHeader) >> MethodHeaderTempCountShift) & 0x3F;
for (i = (((cogMethod->cmNumArgs)) + 1); i <= numTemps; i += 1) {
/* begin push: */
longAtput((sp2 = GIV(stackPointer) - BytesPerWord), GIV(nilObj));
GIV(stackPointer) = sp2;
}
if (((((sqInt) methodHeader)) < 0
- ? methodHeader & (65536 << SmallIntegerShift)
- : (methodHeader & 536871934) != 0)) {
+ ? methodHeader & AlternateHeaderHasPrimFlag
+ : methodHeader & V3PrimitiveBitsMask)) {
/* Store the error code if the method starts with a long store temp. No instructionPointer skip because we're heading for machine code. */
@@ -13263,8 +13222,8 @@
: (assert((((usqInt)header)) < (heapBase())),
assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header))->methodHeader)));
- numTemps = (((usqInt) methodHeader) >> 19) & 0x3F;
- numArgs = (((usqInt) methodHeader) >> 25) & 15;
+ numTemps = (((usqInt) methodHeader) >> MethodHeaderTempCountShift) & 0x3F;
+ numArgs = (((usqInt) methodHeader) >> MethodHeaderArgCountShift) & 15;
/* could new rcvr be set at point of send? */
@@ -13315,8 +13274,8 @@
}
GIV(instructionPointer) = ((GIV(newMethod) + ((LiteralStart + (literalCountOfMethodHeader(methodHeader))) * BytesPerOop)) + BaseHeaderSize) - 1;
if (((((sqInt) methodHeader)) < 0
- ? methodHeader & (65536 << SmallIntegerShift)
- : (methodHeader & 536871934) != 0)) {
+ ? methodHeader & AlternateHeaderHasPrimFlag
+ : methodHeader & V3PrimitiveBitsMask)) {
/* 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. */
@@ -13397,8 +13356,8 @@
assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header))->methodHeader)));
primitiveIndex = ((((sqInt) methodHeader)) < 0
- ? (methodHeader & (65536 << SmallIntegerShift)
- ? ((firstBytecode = (GIV(newMethod) + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
+ ? (methodHeader & AlternateHeaderHasPrimFlag
+ ? ((firstBytecode = (GIV(newMethod) + ((LiteralStart + (((methodHeader >> 1)) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
: 0)
: ((primBits = (methodHeader >> 1)),
@@ -13799,7 +13758,7 @@
: (assert((((usqInt)header1)) < (heapBase())),
assert((((((CogMethod *) header1))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header1))->methodHeader)));
- GIV(argumentCount) = (((usqInt) header) >> 25) & 15;
+ GIV(argumentCount) = (((usqInt) header) >> MethodHeaderArgCountShift) & 15;
assert(wasInMachineCode == (isMachineCodeFrame(GIV(framePointer))));
if (calledFromMachineCode) {
if ((((usqInt)GIV(instructionPointer))) >= (startOfMemory())) {
@@ -14367,8 +14326,8 @@
assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header))->methodHeader)));
primitiveIndex = ((((sqInt) methodHeader)) < 0
- ? (methodHeader & (65536 << SmallIntegerShift)
- ? ((firstBytecode = (aMethodObj + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
+ ? (methodHeader & AlternateHeaderHasPrimFlag
+ ? ((firstBytecode = (aMethodObj + ((LiteralStart + (((methodHeader >> 1)) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
: 0)
: ((primBits = (methodHeader >> 1)),
@@ -14439,8 +14398,8 @@
assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header))->methodHeader)));
primitiveIndex = ((((sqInt) methodHeader)) < 0
- ? (methodHeader & (65536 << SmallIntegerShift)
- ? ((firstBytecode = (aMethodObj + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
+ ? (methodHeader & AlternateHeaderHasPrimFlag
+ ? ((firstBytecode = (aMethodObj + ((LiteralStart + (((methodHeader >> 1)) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
: 0)
: ((primBits = (methodHeader >> 1)),
@@ -17217,11 +17176,11 @@
/* If this is a synthetic context its IP could be pointing at the CallPrimitive opcode. If so, skip it. */
- numArgs = (((usqInt) header) >> 25) & 15;
+ numArgs = (((usqInt) header) >> MethodHeaderArgCountShift) & 15;
if (((((sqInt) theIP)) > 0)
&& ((((((sqInt) header)) < 0
- ? header & (65536 << SmallIntegerShift)
- : (header & 536871934) != 0))
+ ? header & AlternateHeaderHasPrimFlag
+ : header & V3PrimitiveBitsMask))
&& (theIP == (1 + (lastPointerOf(theMethod)))))) {
theIP += ((((sqInt) header)) < 0
? 3
@@ -18416,8 +18375,8 @@
theMethod = (cogMethod->methodObject);
methodHeader = (cogMethod->methodHeader);
primitive = ((((sqInt) methodHeader)) < 0
- ? (methodHeader & (65536 << SmallIntegerShift)
- ? ((firstBytecode = (theMethod + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
+ ? (methodHeader & AlternateHeaderHasPrimFlag
+ ? ((firstBytecode = (theMethod + ((LiteralStart + (((methodHeader >> 1)) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
: 0)
: ((primBits = (methodHeader >> 1)),
@@ -18744,7 +18703,7 @@
numArgs = (cogMethod->cmNumArgs);
/* begin temporaryCountOfMethodHeader: */
header = (homeMethod->methodHeader);
- numTemps = (((usqInt) header) >> 19) & 0x3F;
+ numTemps = (((usqInt) header) >> MethodHeaderTempCountShift) & 0x3F;
}
else {
theMethod = ((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
@@ -18761,7 +18720,7 @@
: (assert((((usqInt)header2)) < (heapBase())),
assert((((((CogMethod *) header2))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header2))->methodHeader)));
- numTemps = (((usqInt) header1) >> 19) & 0x3F;
+ numTemps = (((usqInt) header1) >> MethodHeaderTempCountShift) & 0x3F;
}
if (((((usqInt)(longAt(theFP + FoxMethod)))) < (startOfMemory())
? ((longAt(theFP + FoxMethod)) & MFMethodFlagIsBlockFlag) != 0
@@ -19154,13 +19113,13 @@
sqInt classArrayClass;
sqInt classArrayObj;
size_t dataSize;
- sqInt firstSegSize;
+ long firstSegSize;
sqInt hdrCogCodeSize;
sqInt hdrEdenBytes;
sqInt hdrMaxExtSemTabSize;
sqInt hdrNumStackPages;
sqInt header;
- sqInt headerFlags;
+ long headerFlags;
sqInt headerSize;
squeakFileOffsetType headerStart;
usqInt heapSize;
@@ -19177,10 +19136,23 @@
sqInt memEnd;
sqInt memLimit;
usqInt minimumMemory;
- sqInt oldBaseAddr;
+ long oldBaseAddr;
sqInt oop;
sqInt swapBytes;
sqInt sz;
+ int w;
+ long w1;
+ long w10;
+ long w11;
+ long w12;
+ long w2;
+ long w3;
+ long w4;
+ int w5;
+ short w6;
+ int w7;
+ short w8;
+ short w9;
/* guess Metaclass instSize */
@@ -19194,18 +19166,53 @@
/* record header start position */
- headerStart = (sqImageFilePosition(f)) - BytesPerWord;
- headerSize = getLongFromFileswap(f, swapBytes);
- dataSize = getLongFromFileswap(f, swapBytes);
- oldBaseAddr = getLongFromFileswap(f, swapBytes);
+ headerStart = (sqImageFilePosition(f)) - 4;
+ /* begin getWord32FromFile:swap: */
+ w = 0;
+ sqImageFileRead((&w), sizeof(int), 1, f);
+ headerSize = (swapBytes
+ ? byteSwapped(w)
+ : w);
+ /* begin getLongFromFile:swap: */
+ w1 = 0;
+ sqImageFileRead((&w1), sizeof(long), 1, f);
+ dataSize = ((long) ((swapBytes
+ ? byteSwapped(w1)
+ : w1)));
+ /* begin getLongFromFile:swap: */
+ w2 = 0;
+ sqImageFileRead((&w2), sizeof(long), 1, f);
+ oldBaseAddr = (swapBytes
+ ? byteSwapped(w2)
+ : w2);
/* begin specialObjectsOop: */
- anObject = getLongFromFileswap(f, swapBytes);
+ /* begin getLongFromFile:swap: */
+ w11 = 0;
+ sqImageFileRead((&w11), sizeof(long), 1, f);
+ anObject = ((long) ((swapBytes
+ ? byteSwapped(w11)
+ : w11)));
GIV(specialObjectsOop) = anObject;
/* begin lastHash: */
- aValue = getLongFromFileswap(f, swapBytes);
+ /* begin getLongFromFile:swap: */
+ w12 = 0;
+ sqImageFileRead((&w12), sizeof(long), 1, f);
+ aValue = ((long) ((swapBytes
+ ? byteSwapped(w12)
+ : w12)));
lastHash = aValue;
- GIV(savedWindowSize) = getLongFromFileswap(f, swapBytes);
- headerFlags = getLongFromFileswap(f, swapBytes);
+ /* begin getLongFromFile:swap: */
+ w3 = 0;
+ sqImageFileRead((&w3), sizeof(long), 1, f);
+ GIV(savedWindowSize) = ((long) ((swapBytes
+ ? byteSwapped(w3)
+ : w3)));
+ /* begin getLongFromFile:swap: */
+ w4 = 0;
+ sqImageFileRead((&w4), sizeof(long), 1, f);
+ headerFlags = (swapBytes
+ ? byteSwapped(w4)
+ : w4);
/* begin setImageHeaderFlagsFrom: */
/* so as to preserve unrecognised flags. */
@@ -19219,19 +19226,18 @@
GIV(flagInterpretedMethods) = (headerFlags & 8) != 0;
GIV(preemptionYields) = (headerFlags & 16) == 0;
GIV(noThreadingOfGUIThread) = (headerFlags & 32) != 0;
-
- /* N.B. not used. */
-
- extraVMMemory = getLongFromFileswap(f, swapBytes);
-
- /* 4 stack pages is small. Should be able to run with as few as
- three. 4 should be comfortable but slow. 8 is a reasonable
- default. Can be changed via vmParameterAt: 43 put: n.
- Can be set as a preference (Info.plist, VM.ini, command line etc).
- If desiredNumStackPages is already non-zero then it has been
- set as a preference. Ignore (but preserve) the header's default. */
-
- hdrNumStackPages = getShortFromFileswap(f, swapBytes);
+ /* begin getWord32FromFile:swap: */
+ w5 = 0;
+ sqImageFileRead((&w5), sizeof(int), 1, f);
+ extraVMMemory = (swapBytes
+ ? byteSwapped(w5)
+ : w5);
+ /* begin getShortFromFile:swap: */
+ w6 = 0;
+ sqImageFileRead((&w6), sizeof(short), 1, f);
+ hdrNumStackPages = (swapBytes
+ ? byteSwapped(w6)
+ : w6);
GIV(numStackPages) = (desiredNumStackPages != 0
? desiredNumStackPages
: (hdrNumStackPages == 0
@@ -19247,7 +19253,12 @@
: (hdrCogCodeSize == 0
? defaultCogCodeSize()
: hdrCogCodeSize));
- hdrEdenBytes = getLongFromFileswap(f, swapBytes);
+ /* begin getWord32FromFile:swap: */
+ w7 = 0;
+ sqImageFileRead((&w7), sizeof(int), 1, f);
+ hdrEdenBytes = (swapBytes
+ ? byteSwapped(w7)
+ : w7);
/* begin edenBytes: */
aValue1 = (desiredEdenBytes != 0
? desiredEdenBytes
@@ -19256,14 +19267,29 @@
: hdrEdenBytes));
GIV(edenBytes) = aValue1;
desiredEdenBytes = hdrEdenBytes;
- hdrMaxExtSemTabSize = getShortFromFileswap(f, swapBytes);
+ /* begin getShortFromFile:swap: */
+ w8 = 0;
+ sqImageFileRead((&w8), sizeof(short), 1, f);
+ hdrMaxExtSemTabSize = (swapBytes
+ ? byteSwapped(w8)
+ : w8);
if (hdrMaxExtSemTabSize != 0) {
/* begin setMaxExtSemSizeTo: */
GIV(maxExtSemTabSizeSet) = 1;
ioSetMaxExtSemTableSize(hdrMaxExtSemTabSize);
}
- GIV(the2ndUnknownShort) = getShortFromFileswap(f, swapBytes);
- firstSegSize = getLongFromFileswap(f, swapBytes);
+ /* begin getShortFromFile:swap: */
+ w9 = 0;
+ sqImageFileRead((&w9), sizeof(short), 1, f);
+ GIV(the2ndUnknownShort) = (swapBytes
+ ? byteSwapped(w9)
+ : w9);
+ /* begin getLongFromFile:swap: */
+ w10 = 0;
+ sqImageFileRead((&w10), sizeof(long), 1, f);
+ firstSegSize = (swapBytes
+ ? byteSwapped(w10)
+ : w10);
/* begin firstSegmentSize: */
/* no need to include the stackZone; this is alloca'ed */
@@ -19805,8 +19831,8 @@
cogMethod1 = ((CogMethod *) methodHeader1);
methodHeader1 = (cogMethod1->methodHeader);
}
- numTemps = (((usqInt) methodHeader1) >> 19) & 0x3F;
- numArgs = (((usqInt) methodHeader1) >> 25) & 15;
+ numTemps = (((usqInt) methodHeader1) >> MethodHeaderTempCountShift) & 0x3F;
+ numArgs = (((usqInt) methodHeader1) >> MethodHeaderArgCountShift) & 15;
/* could new rcvr be set at point of send? */
@@ -19871,8 +19897,8 @@
GIV(stackPointer) = sp61;
}
if (((((sqInt) methodHeader1)) < 0
- ? methodHeader1 & (65536 << SmallIntegerShift)
- : (methodHeader1 & 536871934) != 0)) {
+ ? methodHeader1 & AlternateHeaderHasPrimFlag
+ : methodHeader1 & V3PrimitiveBitsMask)) {
/* 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. */
@@ -20040,8 +20066,8 @@
cogMethod1 = ((CogMethod *) methodHeader1);
methodHeader1 = (cogMethod1->methodHeader);
}
- numTemps = (((usqInt) methodHeader1) >> 19) & 0x3F;
- numArgs = (((usqInt) methodHeader1) >> 25) & 15;
+ numTemps = (((usqInt) methodHeader1) >> MethodHeaderTempCountShift) & 0x3F;
+ numArgs = (((usqInt) methodHeader1) >> MethodHeaderArgCountShift) & 15;
/* could new rcvr be set at point of send? */
@@ -20106,8 +20132,8 @@
GIV(stackPointer) = sp6;
}
if (((((sqInt) methodHeader1)) < 0
- ? methodHeader1 & (65536 << SmallIntegerShift)
- : (methodHeader1 & 536871934) != 0)) {
+ ? methodHeader1 & AlternateHeaderHasPrimFlag
+ : methodHeader1 & V3PrimitiveBitsMask)) {
/* 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. */
@@ -21206,8 +21232,8 @@
assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header))->methodHeader)));
primIdx = ((((sqInt) methodHeader)) < 0
- ? (methodHeader & (65536 << SmallIntegerShift)
- ? ((firstBytecode = (oldMethod + ((LiteralStart + ((((usqInt) methodHeader) >> 1) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
+ ? (methodHeader & AlternateHeaderHasPrimFlag
+ ? ((firstBytecode = (oldMethod + ((LiteralStart + (((methodHeader >> 1)) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
: 0)
: ((primBits = (methodHeader >> 1)),
@@ -22219,8 +22245,8 @@
assert((((((CogMethod *) header))->objectHeader)) == (nullHeaderForMachineCodeMethod())),
((((CogMethod *) header))->methodHeader)));
primIdx = ((((sqInt) methodHeader1)) < 0
- ? (methodHeader1 & (65536 << SmallIntegerShift)
- ? ((firstBytecode = (oldMethod + ((LiteralStart + ((((usqInt) methodHeader1) >> 1) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
+ ? (methodHeader1 & AlternateHeaderHasPrimFlag
+ ? ((firstBytecode = (oldMethod + ((LiteralStart + (((methodHeader1 >> 1)) & 0xFFFF)) * BytesPerOop)) + BaseHeaderSize),
(byteAt(firstBytecode + 1)) + ((byteAt(firstBytecode + 2)) << 8))
: 0)
: ((primBits = (methodHeader1 >> 1)),
@@ -22784,7 +22810,13 @@
return stackPageAtpages(index, GIV(pages));
}
+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
@@ -22944,8 +22976,8 @@
sqInt sz;
isSmall = (isNegative
- ? magnitude <= 0x40000000
- : magnitude < 0x40000000);
+ ? magnitude <= ((MaxSmallInteger) + 1)
+ : magnitude < ((MaxSmallInteger) + 1));
if (isSmall) {
smallVal = ((sqInt) magnitude);
if (isNegative) {
@@ -22993,13 +23025,10 @@
sqInt ccIndex1;
sqInt classOop;
sqInt classOop1;
- sqInt fmt;
- sqInt header;
sqInt i;
sqInt ok;
sqInt smallIntValue;
sqInt sz;
- sqInt sz1;
usqLong value;
if ((oop & 1)) {
@@ -23045,25 +23074,7 @@
return null;
}
}
- /* begin lengthOf: */
- header = longAt(oop);
- /* begin lengthOf:baseHeader:format: */
- fmt = (((usqInt) header) >> (instFormatFieldLSB())) & 15;
- if ((header & TypeMask) == HeaderTypeSizeAndClass) {
- sz1 = (longAt(oop - (BytesPerWord * 2))) & LongSizeMask;
- }
- else {
- sz1 = header & SizeMask;
- }
- sz1 -= header & Size4Bit;
- if (fmt <= 4) {
- sz = ((usqInt) (sz1 - BaseHeaderSize)) >> (shiftForWord());
- goto l3;
- }
- sz = (fmt < 8
- ? ((usqInt) (sz1 - BaseHeaderSize)) >> 2
- : (sz1 - BaseHeaderSize) - (fmt & 3));
-l3: /* end lengthOf:baseHeader:format: */;
+ sz = numBytesOf(oop);
if (sz > (sizeof(sqLong))) {
/* begin primitiveFail */
@@ Diff output truncated at 50000 characters. @@
More information about the Vm-dev
mailing list