Author: eliot Date: 2011-07-13 12:10:17 -0700 (Wed, 13 Jul 2011) New Revision: 2457 Modified: branches/Cog/nscogsrc/plugins/IA32ABI/IA32ABI.c branches/Cog/nscogsrc/vm/cogit.c branches/Cog/nscogsrc/vm/cogit.h 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/nscogsrc/vm/vmCallback.h branches/Cog/nssrc/plugins/FilePlugin/FilePlugin.c branches/Cog/nssrc/plugins/IA32ABI/IA32ABI.c branches/Cog/nssrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c branches/Cog/nssrc/vm/gcc3x-interp.c branches/Cog/nssrc/vm/interp.c branches/Cog/nssrc/vm/interp.h branches/Cog/nssrc/vm/vmCallback.h branches/Cog/src/plugins/IA32ABI/IA32ABI.c branches/Cog/src/vm/cogit.c branches/Cog/src/vm/cogit.h branches/Cog/src/vm/cogmethod.h branches/Cog/src/vm/cointerp.c branches/Cog/src/vm/cointerp.h branches/Cog/src/vm/gcc3x-cointerp.c branches/Cog/src/vm/interp.h branches/Cog/src/vm/vmCallback.h branches/Cog/stacksrc/vm/gcc3x-interp.c branches/Cog/stacksrc/vm/interp.c branches/Cog/stacksrc/vm/interp.h branches/Cog/stacksrc/vm/vmCallback.h Log: CogVM source as per VMMaker.oscog-eem.99. Add null pointer checks to Alien accessing prims. Fix assert compile of src/vm/cogit.c. Cosmetics in ifdefs. Modified: branches/Cog/nscogsrc/plugins/IA32ABI/IA32ABI.c =================================================================== --- branches/Cog/nscogsrc/plugins/IA32ABI/IA32ABI.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nscogsrc/plugins/IA32ABI/IA32ABI.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator * VMMaker.oscog-eem.96 uuid: b9686449-0418-4b93-b40f-40049e108776 + VMPluginCodeGenerator VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - NewsqueakIA32ABIPlugin * VMMaker.oscog-eem.96 uuid: b9686449-0418-4b93-b40f-40049e108776 + NewsqueakIA32ABIPlugin VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "NewsqueakIA32ABIPlugin * VMMaker.oscog-eem.96 uuid: b9686449-0418-4b93-b40f-40049e108776 " __DATE__ ; +static char __buildInfo[] = "NewsqueakIA32ABIPlugin VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; @@ -134,9 +134,9 @@ struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "IA32ABI * VMMaker.oscog-eem.96 (i)" + "IA32ABI VMMaker.oscog-eem.99 (i)" #else - "IA32ABI * VMMaker.oscog-eem.96 (e)" + "IA32ABI VMMaker.oscog-eem.99 (e)" #endif ; @@ -445,19 +445,19 @@ mac = interpreterProxy->methodArgumentCount(); -# if (STACKVM) +# if STACKVM errCode = callIA32DoubleReturn(interpreterProxy->getStackPointer() + mac - 2, /* arg vec */ 1 - mac /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# else /* (STACKVM) */ +# else /* STACKVM */ errCode = callIA32DoubleReturn(interpreterProxy->getStackPointer() - mac + 2, /* arg vec */ mac - 1 /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# endif /* (STACKVM) */ +# endif /* STACKVM */ if (errCode != 0) { return interpreterProxy->primitiveFailFor(errCode); @@ -487,19 +487,19 @@ mac = interpreterProxy->methodArgumentCount(); -# if (STACKVM) +# if STACKVM errCode = callIA32FloatReturn(interpreterProxy->getStackPointer() + mac - 2, /* arg vec */ 1 - mac /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# else /* (STACKVM) */ +# else /* STACKVM */ errCode = callIA32FloatReturn(interpreterProxy->getStackPointer() - mac + 2, /* arg vec */ mac - 1 /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# endif /* (STACKVM) */ +# endif /* STACKVM */ if (errCode != 0) { return interpreterProxy->primitiveFailFor(errCode); @@ -529,19 +529,19 @@ mac = interpreterProxy->methodArgumentCount(); -# if (STACKVM) +# if STACKVM errCode = callIA32IntegralReturn(interpreterProxy->getStackPointer() + mac - 2, /* arg vec */ 1 - mac /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# else /* (STACKVM) */ +# else /* STACKVM */ errCode = callIA32IntegralReturn(interpreterProxy->getStackPointer() - mac + 2, /* arg vec */ mac - 1 /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# endif /* (STACKVM) */ +# endif /* STACKVM */ if (errCode != 0) { return interpreterProxy->primitiveFailFor(errCode); @@ -588,6 +588,7 @@ sqInt dataSize; double floatValue; sqInt rcvr; + sqInt startAddr; byteOffset = (interpreterProxy->stackPositiveMachineIntegerValue(0)) - 1; rcvr = interpreterProxy->stackObjectValue(1); @@ -598,9 +599,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)(&floatValue))[0] = ((long *)addr)[0]; ((long *)(&floatValue))[1] = ((long *)addr)[1]; interpreterProxy->pop(2); return interpreterProxy->pushFloat(floatValue); @@ -621,6 +625,7 @@ sqInt dataSize; double floatValue; sqInt rcvr; + sqInt startAddr; sqInt valueOop; valueOop = interpreterProxy->stackValue(0); @@ -642,9 +647,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((int*)addr)[0] = ((int*)(&floatValue))[0]; ((int*)addr)[1] = ((int*)(&floatValue))[1]; interpreterProxy->methodReturnValue(valueOop); @@ -669,6 +677,7 @@ sqInt dataSize; float floatValue; sqInt rcvr; + sqInt startAddr; byteOffset = (interpreterProxy->stackPositiveMachineIntegerValue(0)) - 1; rcvr = interpreterProxy->stackObjectValue(1); @@ -679,9 +688,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)(&floatValue))[0] = ((long *)addr)[0]; interpreterProxy->pop(2); return interpreterProxy->pushFloat(floatValue); @@ -702,6 +714,7 @@ sqInt dataSize; float floatValue; sqInt rcvr; + sqInt startAddr; sqInt valueOop; valueOop = interpreterProxy->stackValue(0); @@ -723,9 +736,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)addr)[0] = ((long *)(&floatValue))[0]; interpreterProxy->methodReturnValue(valueOop); } @@ -915,6 +931,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; signed char value; sqInt valueOop; @@ -927,9 +944,12 @@ || (((((usqInt)byteOffset)) + 1) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = byteAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -949,6 +969,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -968,9 +989,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; byteAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -989,6 +1013,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1001,9 +1026,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = longAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1023,6 +1051,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1040,9 +1069,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; longAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1063,6 +1095,7 @@ sqInt rcvr; long long signedlonglongvalue; long long *signedlonglongvaluePtr; + sqInt startAddr; sqInt valueOop; signedlonglongvaluePtr = 0; @@ -1076,9 +1109,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; signedlonglongvaluePtr = ((long long*) addr); signedlonglongvalue = *signedlonglongvaluePtr; valueOop = interpreterProxy->signed64BitIntegerFor(signedlonglongvalue); @@ -1101,6 +1137,7 @@ sqInt rcvr; long long signedlonglongvalue; long long *signedlonglongvaluePtr; + sqInt startAddr; sqInt valueOop; signedlonglongvaluePtr = 0; @@ -1120,9 +1157,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; signedlonglongvaluePtr = ((long long*) addr); *signedlonglongvaluePtr = signedlonglongvalue; return interpreterProxy->methodReturnValue(valueOop); @@ -1142,6 +1182,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; short value; sqInt valueOop; @@ -1154,9 +1195,12 @@ || (((((usqInt)byteOffset)) + 2) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = shortAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1176,6 +1220,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1195,9 +1240,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; shortAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1356,6 +1404,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned char value; sqInt valueOop; @@ -1368,9 +1417,12 @@ || (((((usqInt)byteOffset)) + 1) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = byteAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1390,6 +1442,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1408,9 +1461,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; byteAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1429,6 +1485,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1441,9 +1498,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = longAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1463,6 +1523,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1480,9 +1541,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; longAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1501,6 +1565,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned long long unsignedlonglongvalue; unsigned long long *unsignedlonglongvaluePtr; sqInt valueOop; @@ -1516,9 +1581,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; unsignedlonglongvaluePtr = ((unsigned long long*) addr); unsignedlonglongvalue = *unsignedlonglongvaluePtr; valueOop = interpreterProxy->positive64BitIntegerFor(unsignedlonglongvalue); @@ -1540,6 +1608,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned long long unsignedlonglongvalue; unsigned long long *unsignedlonglongvaluePtr; sqInt valueOop; @@ -1561,9 +1630,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; unsignedlonglongvaluePtr = ((unsigned long long*) addr); *unsignedlonglongvaluePtr = unsignedlonglongvalue; return interpreterProxy->methodReturnValue(valueOop); @@ -1583,6 +1655,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned short value; sqInt valueOop; @@ -1595,9 +1668,12 @@ || (((((usqInt)byteOffset)) + 2) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = shortAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1617,6 +1693,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1635,9 +1712,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; shortAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } Modified: branches/Cog/nscogsrc/vm/cogit.c =================================================================== --- branches/Cog/nscogsrc/vm/cogit.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nscogsrc/vm/cogit.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.96 uuid: b9686449-0418-4b93-b40f-40049e108776 + CCodeGenerator * VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 from - SimpleStackBasedCogit VMMaker.oscog-eem.96 uuid: b9686449-0418-4b93-b40f-40049e108776 + SimpleStackBasedCogit * VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 */ -static char __buildInfo[] = "SimpleStackBasedCogit VMMaker.oscog-eem.96 uuid: b9686449-0418-4b93-b40f-40049e108776 " __DATE__ ; +static char __buildInfo[] = "SimpleStackBasedCogit * VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -515,6 +515,7 @@ static sqInt findMcpcBcpcMatchingMcpc(char *mcpc, sqInt bcpc, void *targetMcpc); CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static usqInt findMinAndMaxMethodsPCaround(sqInt blockEntryPC, sqInt mcpc); +static CogMethod * findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop); static sqInt frameOffsetOfTemporary(sqInt index); static void freeMethod(CogMethod *cogMethod); static void freeOlderMethodsForCompaction(void); @@ -2882,14 +2883,23 @@ assert((!(methodHasCogMethod(aMethodObj))) || ((methodClassAssociationOf(aMethodObj)) == (nilObject()))); - - /* coInterpreter stringOf: aSelectorOop */ - - methodObj = aMethodObj; compilationBreakpoint(aSelectorOop, lengthOf(aSelectorOop)); if (aMethodObj == breakMethod) { haltmsg("Compilation of breakMethod"); } + +# if NewspeakVM + cogMethod = findPreviouslyCompiledVersionOfwith(aMethodObj, aSelectorOop); + if (cogMethod == null) { + null; + } + else { + return cogMethod; + } + +# endif /* NewspeakVM */ + + methodObj = aMethodObj; cogMethod = compileCogMethod(aSelectorOop); if ((((((sqInt)cogMethod)) >= MaxNegativeErrorCode) && ((((sqInt)cogMethod)) <= -1))) { if ((((sqInt)cogMethod)) == InsufficientCodeSpace) { @@ -6974,6 +6984,26 @@ return 0; } +static CogMethod * +findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) +{ + CogMethod *cogMethod; + + if ((methodHasCogMethod(aMethodObj)) + && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { + cogMethod = ((CogMethod *) baseAddress); + while (cogMethod < (limitZony())) { + if ((((cogMethod->cmType)) == CMMethod) + && ((((cogMethod->selector)) == aSelectorOop) + && (((cogMethod->methodObject)) == aMethodObj))) { + return cogMethod; + } + cogMethod = methodAfter(cogMethod); + } + } + return null; +} + static sqInt frameOffsetOfTemporary(sqInt index) { Modified: branches/Cog/nscogsrc/vm/cogit.h =================================================================== --- branches/Cog/nscogsrc/vm/cogit.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nscogsrc/vm/cogit.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.96 uuid: b9686449-0418-4b93-b40f-40049e108776 + CCodeGenerator * VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 */ Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nscogsrc/vm/cointerp.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - CoInterpreter VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CoInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -1883,7 +1883,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.98"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.99"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -9785,13 +9785,13 @@ byteSwapped(sqInt w) { -# if (BytesPerWord == 4) +# if BytesPerWord == 4 return ((((((usqInt) w >> 24)) & Byte0Mask) + ((((usqInt) w >> 8)) & Byte1Mask)) + ((((usqInt) w << 8)) & Byte2Mask)) + ((((usqInt) w << 24)) & Byte3Mask); -# else /* (BytesPerWord == 4) */ +# else /* BytesPerWord == 4 */ return ((((((((((usqInt) w << 0)) & Byte0Mask) + ((((usqInt) w << 0)) & Byte1Mask)) + ((((usqInt) w >> 24)) & Byte2Mask)) + ((((usqInt) w >> 8)) & Byte3Mask)) + ((((usqInt) w << 8)) & Byte4Mask)) + ((((usqInt) w << 24)) & Byte5Mask)) + ((((usqInt) w << 0)) & Byte6Mask)) + ((((usqInt) w << 0)) & Byte7Mask); -# endif /* (BytesPerWord == 4) */ +# endif /* BytesPerWord == 4 */ } @@ -40729,7 +40729,7 @@ longAtput((sp8 = GIV(stackPointer) - BytesPerWord), longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassAlien << ShiftForWord))); GIV(stackPointer) = sp8; -# if (BytesPerWord == 8) +# if BytesPerWord == 8 if ((argumentCountOf(GIV(newMethod))) == 4) { /* begin push: */ object = positive64BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -40749,7 +40749,7 @@ longAtput((sp3 = GIV(stackPointer) - BytesPerWord), object3); GIV(stackPointer) = sp3; -# else /* (BytesPerWord == 8) */ +# else /* BytesPerWord == 8 */ if ((argumentCountOf(GIV(newMethod))) == 4) { /* begin push: */ object4 = positive32BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -40769,7 +40769,7 @@ longAtput((sp7 = GIV(stackPointer) - BytesPerWord), object7); GIV(stackPointer) = sp7; -# endif /* (BytesPerWord == 8) */ +# endif /* BytesPerWord == 8 */ /* begin ifAppropriateCompileToNativeCode:selector: */ methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)); Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nscogsrc/vm/cointerp.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - CoInterpreter VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CoInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -1886,7 +1886,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.98"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.99"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -9789,13 +9789,13 @@ byteSwapped(sqInt w) { -# if (BytesPerWord == 4) +# if BytesPerWord == 4 return ((((((usqInt) w >> 24)) & Byte0Mask) + ((((usqInt) w >> 8)) & Byte1Mask)) + ((((usqInt) w << 8)) & Byte2Mask)) + ((((usqInt) w << 24)) & Byte3Mask); -# else /* (BytesPerWord == 4) */ +# else /* BytesPerWord == 4 */ return ((((((((((usqInt) w << 0)) & Byte0Mask) + ((((usqInt) w << 0)) & Byte1Mask)) + ((((usqInt) w >> 24)) & Byte2Mask)) + ((((usqInt) w >> 8)) & Byte3Mask)) + ((((usqInt) w << 8)) & Byte4Mask)) + ((((usqInt) w << 24)) & Byte5Mask)) + ((((usqInt) w << 0)) & Byte6Mask)) + ((((usqInt) w << 0)) & Byte7Mask); -# endif /* (BytesPerWord == 4) */ +# endif /* BytesPerWord == 4 */ } @@ -40733,7 +40733,7 @@ longAtput((sp8 = GIV(stackPointer) - BytesPerWord), longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassAlien << ShiftForWord))); GIV(stackPointer) = sp8; -# if (BytesPerWord == 8) +# if BytesPerWord == 8 if ((argumentCountOf(GIV(newMethod))) == 4) { /* begin push: */ object = positive64BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -40753,7 +40753,7 @@ longAtput((sp3 = GIV(stackPointer) - BytesPerWord), object3); GIV(stackPointer) = sp3; -# else /* (BytesPerWord == 8) */ +# else /* BytesPerWord == 8 */ if ((argumentCountOf(GIV(newMethod))) == 4) { /* begin push: */ object4 = positive32BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -40773,7 +40773,7 @@ longAtput((sp7 = GIV(stackPointer) - BytesPerWord), object7); GIV(stackPointer) = sp7; -# endif /* (BytesPerWord == 8) */ +# endif /* BytesPerWord == 8 */ /* begin ifAppropriateCompileToNativeCode:selector: */ methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)); Modified: branches/Cog/nscogsrc/vm/interp.h =================================================================== --- branches/Cog/nscogsrc/vm/interp.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nscogsrc/vm/interp.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/nscogsrc/vm/vmCallback.h =================================================================== --- branches/Cog/nscogsrc/vm/vmCallback.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nscogsrc/vm/vmCallback.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ #define VM_CALLBACK_INC 1 Modified: branches/Cog/nssrc/plugins/FilePlugin/FilePlugin.c =================================================================== --- branches/Cog/nssrc/plugins/FilePlugin/FilePlugin.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nssrc/plugins/FilePlugin/FilePlugin.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.68 uuid: 1fd12e1a-c0b3-4d41-91bb-26f029240bfe + VMPluginCodeGenerator VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - FilePlugin VMMaker.oscog-eem.68 uuid: 1fd12e1a-c0b3-4d41-91bb-26f029240bfe + FilePlugin VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.68 uuid: 1fd12e1a-c0b3-4d41-91bb-26f029240bfe " __DATE__ ; +static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; @@ -38,6 +38,7 @@ /*** Constants ***/ +#define COGMTVM 0 #define DirBadPath 2 #define DirNoMoreEntries 1 #define PrimErrBadArgument 3 @@ -96,9 +97,9 @@ struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "FilePlugin VMMaker.oscog-eem.68 (i)" + "FilePlugin VMMaker.oscog-eem.99 (i)" #else - "FilePlugin VMMaker.oscog-eem.68 (e)" + "FilePlugin VMMaker.oscog-eem.99 (e)" #endif ; static void * sCCPfn; @@ -129,10 +130,10 @@ sqInt fileOop; sqInt okToOpen; - fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ if (!((interpreterProxy->isBytes(fileOop)) - && ((interpreterProxy->byteSizeOf(fileOop)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(fileOop)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -173,7 +174,7 @@ fileValueOf(sqInt objectPointer) { if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); return null; } @@ -284,7 +285,7 @@ moduleUnloaded(char *aModuleName) { if ((strcmp(aModuleName, "SecurityPlugin")) == 0) { - sCCPfn = sCDPfn = sCGFTfn = sCLPfn = sCSFTfn = sDFAfn = sCDFfn = sCOFfn = sCRFfn = sHFAfn = 0; + sCCPfn = (sCDPfn = (sCGFTfn = (sCLPfn = (sCSFTfn = (sDFAfn = (sCDFfn = (sCOFfn = (sCRFfn = (sHFAfn = 0))))))))); } } @@ -601,7 +602,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(0); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -626,7 +627,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(0); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -680,7 +681,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(0); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -705,7 +706,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(0); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -762,7 +763,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(3); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -774,8 +775,8 @@ return interpreterProxy->primitiveFailFor(PrimErrBadArgument); } elementSize = (interpreterProxy->isWords(array) - ? 4 - : 1); + ? (4) + : (1)); if (!((startIndex >= 1) && (((startIndex + count) - 1) <= (interpreterProxy->slotSizeOf(array))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); @@ -846,7 +847,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(1); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -871,7 +872,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(0); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -907,6 +908,7 @@ return interpreterProxy->primitiveFailFor(PrimErrUnsupported); } } + ; validMask = sqFileStdioHandlesInto((&fileRecords)); if (validMask == 0) { return interpreterProxy->primitiveFailFor(PrimErrUnsupported); @@ -918,13 +920,13 @@ interpreterProxy->pushRemappableOop(result); for (index = 0; index <= 2; index += 1) { if ((validMask & (1 << index)) != 0) { - result = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + result = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); if (result == null) { interpreterProxy->popRemappableOop(); return interpreterProxy->primitiveFailFor(PrimErrNoMemory); } interpreterProxy->storePointerofObjectwithValue(index, interpreterProxy->topRemappableOop(), result); - memcpy(interpreterProxy->firstIndexableField(result), (&(fileRecords[index])), fileRecordSize()); + memcpy(interpreterProxy->firstIndexableField(result), (&(fileRecords[index])), sizeof(SQFile)); } } @@ -960,7 +962,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(1); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; @@ -993,7 +995,7 @@ /* begin fileValueOf: */ objectPointer = interpreterProxy->stackValue(3); if (!((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize())))) { + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); file = null; goto l1; Modified: branches/Cog/nssrc/plugins/IA32ABI/IA32ABI.c =================================================================== --- branches/Cog/nssrc/plugins/IA32ABI/IA32ABI.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nssrc/plugins/IA32ABI/IA32ABI.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator * VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb + VMPluginCodeGenerator VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - NewsqueakIA32ABIPlugin * VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb + NewsqueakIA32ABIPlugin VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "NewsqueakIA32ABIPlugin * VMMaker.oscog-eem.78 uuid: 412444c6-36dc-48be-b5cd-a6ebc4ade0bb " __DATE__ ; +static char __buildInfo[] = "NewsqueakIA32ABIPlugin VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; @@ -134,9 +134,9 @@ struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "IA32ABI * VMMaker.oscog-eem.78 (i)" + "IA32ABI VMMaker.oscog-eem.99 (i)" #else - "IA32ABI * VMMaker.oscog-eem.78 (e)" + "IA32ABI VMMaker.oscog-eem.99 (e)" #endif ; @@ -291,8 +291,8 @@ if (interpreterProxy->includesBehaviorThatOf(interpreterProxy->fetchClassOf(array), interpreterProxy->classAlien())) { totalLength = longAt(array + BaseHeaderSize); dest = (((totalLength > 0 - ? (array + BaseHeaderSize) + BytesPerOop - : longAt((array + BaseHeaderSize) + BytesPerOop))) + start) - 1; + ? ((array + BaseHeaderSize) + BytesPerOop) + : (longAt((array + BaseHeaderSize) + BytesPerOop)))) + start) - 1; if (totalLength == 0) { /* no bounds checks for zero-sized (pointer) Aliens */ @@ -309,7 +309,7 @@ } if (!((start >= 1) && (((start - 1) <= stop) - && (stop <= totalLength)))) { + && (stop <= totalLength)))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } if ((repl & 1)) { @@ -329,8 +329,8 @@ if (interpreterProxy->includesBehaviorThatOf(interpreterProxy->fetchClassOf(repl), interpreterProxy->classAlien())) { totalLength = longAt(repl + BaseHeaderSize); src = (((totalLength > 0 - ? (repl + BaseHeaderSize) + BytesPerOop - : longAt((repl + BaseHeaderSize) + BytesPerOop))) + replStart) - 1; + ? ((repl + BaseHeaderSize) + BytesPerOop) + : (longAt((repl + BaseHeaderSize) + BytesPerOop)))) + replStart) - 1; if (totalLength == 0) { /* no bounds checks for zero-sized (pointer) Aliens */ @@ -416,7 +416,7 @@ addr = ptr[1]; if ((sizeField >= 0) || ((addr == 0) - || (interpreterProxy->isInMemory(addr)))) { + || (interpreterProxy->isInMemory(addr)))) { return interpreterProxy->primitiveFailFor(PrimErrInappropriate); } free((void *)addr); @@ -588,6 +588,7 @@ sqInt dataSize; double floatValue; sqInt rcvr; + sqInt startAddr; byteOffset = (interpreterProxy->stackPositiveMachineIntegerValue(0)) - 1; rcvr = interpreterProxy->stackObjectValue(1); @@ -598,9 +599,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)(&floatValue))[0] = ((long *)addr)[0]; ((long *)(&floatValue))[1] = ((long *)addr)[1]; interpreterProxy->pop(2); return interpreterProxy->pushFloat(floatValue); @@ -621,6 +625,7 @@ sqInt dataSize; double floatValue; sqInt rcvr; + sqInt startAddr; sqInt valueOop; valueOop = interpreterProxy->stackValue(0); @@ -642,9 +647,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((int*)addr)[0] = ((int*)(&floatValue))[0]; ((int*)addr)[1] = ((int*)(&floatValue))[1]; interpreterProxy->methodReturnValue(valueOop); @@ -669,6 +677,7 @@ sqInt dataSize; float floatValue; sqInt rcvr; + sqInt startAddr; byteOffset = (interpreterProxy->stackPositiveMachineIntegerValue(0)) - 1; rcvr = interpreterProxy->stackObjectValue(1); @@ -679,9 +688,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)(&floatValue))[0] = ((long *)addr)[0]; interpreterProxy->pop(2); return interpreterProxy->pushFloat(floatValue); @@ -702,6 +714,7 @@ sqInt dataSize; float floatValue; sqInt rcvr; + sqInt startAddr; sqInt valueOop; valueOop = interpreterProxy->stackValue(0); @@ -723,9 +736,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)addr)[0] = ((long *)(&floatValue))[0]; interpreterProxy->methodReturnValue(valueOop); } @@ -787,7 +803,7 @@ libraryProxy = interpreterProxy->stackValue(1); if (!((interpreterProxy->includesBehaviorThatOf(interpreterProxy->fetchClassOf(libraryProxy), interpreterProxy->classAlien())) && ((((interpreterProxy->byteSizeOf(libraryProxy)) >= 2) * BytesPerOop) - && (interpreterProxy->isBytes(functionName))))) { + && (interpreterProxy->isBytes(functionName))))) { return interpreterProxy->primitiveFailFor(PrimErrBadArgument); } address = interpreterProxy->ioLoadSymbolOfLengthFromModule(((sqInt) (interpreterProxy->firstIndexableField(functionName))), interpreterProxy->byteSizeOf(functionName), longAt((libraryProxy + BaseHeaderSize) + BytesPerOop)); @@ -895,11 +911,10 @@ } } vmCallbackReturnValue = ((VMCallbackReturnValue *) (startOfData(interpreterProxy->stackValue(mac)))); - if (!(interpreterProxy->reestablishContextPriorToCallback(interpreterProxy->stackValue(1)))) { + memcpy((&((vmCallbackContext->rvs))), (&((vmCallbackReturnValue->crvrvs))), sizeof((vmCallbackContext->rvs))); + if (!(interpreterProxy->returnAsThroughCallbackContext((((((vmCallbackReturnValue->type)) + 1) << 1) | 1), vmCallbackContext, interpreterProxy->stackValue(1)))) { return interpreterProxy->primitiveFailFor(PrimErrBadArgument); } - memcpy((&((vmCallbackContext->rvs))), (&((vmCallbackReturnValue->crvrvs))), sizeof((vmCallbackContext->rvs))); - longjmp((vmCallbackContext->trampoline), ((vmCallbackReturnValue->type)) + 1); } @@ -916,6 +931,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; signed char value; sqInt valueOop; @@ -928,9 +944,12 @@ || (((((usqInt)byteOffset)) + 1) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = byteAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -950,6 +969,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -959,7 +979,7 @@ value = interpreterProxy->signed32BitValueOf(valueOop); if ((interpreterProxy->failed()) || ((value < -128) - || (value > 127))) { + || (value > 127))) { return interpreterProxy->primitiveFailFor(PrimErrBadArgument); } if (!((((dataSize = longAt(rcvr + BaseHeaderSize))) == 0) @@ -969,9 +989,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; byteAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -990,6 +1013,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1002,9 +1026,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = longAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1024,6 +1051,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1041,9 +1069,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; longAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1064,6 +1095,7 @@ sqInt rcvr; long long signedlonglongvalue; long long *signedlonglongvaluePtr; + sqInt startAddr; sqInt valueOop; signedlonglongvaluePtr = 0; @@ -1077,9 +1109,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; signedlonglongvaluePtr = ((long long*) addr); signedlonglongvalue = *signedlonglongvaluePtr; valueOop = interpreterProxy->signed64BitIntegerFor(signedlonglongvalue); @@ -1102,6 +1137,7 @@ sqInt rcvr; long long signedlonglongvalue; long long *signedlonglongvaluePtr; + sqInt startAddr; sqInt valueOop; signedlonglongvaluePtr = 0; @@ -1121,9 +1157,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; signedlonglongvaluePtr = ((long long*) addr); *signedlonglongvaluePtr = signedlonglongvalue; return interpreterProxy->methodReturnValue(valueOop); @@ -1143,6 +1182,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; short value; sqInt valueOop; @@ -1155,9 +1195,12 @@ || (((((usqInt)byteOffset)) + 2) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = shortAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1177,6 +1220,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1186,7 +1230,7 @@ value = interpreterProxy->signed32BitValueOf(valueOop); if ((interpreterProxy->failed()) || ((value < -32768) - || (value > 32767))) { + || (value > 32767))) { return interpreterProxy->primitiveFailFor(PrimErrBadArgument); } if (!((((dataSize = longAt(rcvr + BaseHeaderSize))) == 0) @@ -1196,9 +1240,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; shortAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1279,8 +1326,8 @@ } limit = longAt(rcvr + BaseHeaderSize); ptr = ((char *) (((limit > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset)); + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset)); if (limit == 0) { index = strlen(ptr); } @@ -1288,7 +1335,7 @@ limit = abs(limit); index = 0; while ((index < limit) - && ((ptr[index]) != 0)) { + && ((ptr[index]) != 0)) { index += 1; } } @@ -1322,8 +1369,8 @@ return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; ptr = ((char *) (longAt(addr))); return interpreterProxy->methodReturnValue(interpreterProxy->positive32BitIntegerFor(strlen(ptr))); } @@ -1357,6 +1404,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned char value; sqInt valueOop; @@ -1369,9 +1417,12 @@ || (((((usqInt)byteOffset)) + 1) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = byteAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1391,6 +1442,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1409,9 +1461,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; byteAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1430,6 +1485,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1442,9 +1498,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = longAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1464,6 +1523,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1481,9 +1541,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; longAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1502,6 +1565,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned long long unsignedlonglongvalue; unsigned long long *unsignedlonglongvaluePtr; sqInt valueOop; @@ -1517,9 +1581,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; unsignedlonglongvaluePtr = ((unsigned long long*) addr); unsignedlonglongvalue = *unsignedlonglongvaluePtr; valueOop = interpreterProxy->positive64BitIntegerFor(unsignedlonglongvalue); @@ -1541,6 +1608,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned long long unsignedlonglongvalue; unsigned long long *unsignedlonglongvaluePtr; sqInt valueOop; @@ -1562,9 +1630,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; unsignedlonglongvaluePtr = ((unsigned long long*) addr); *unsignedlonglongvaluePtr = unsignedlonglongvalue; return interpreterProxy->methodReturnValue(valueOop); @@ -1584,6 +1655,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned short value; sqInt valueOop; @@ -1596,9 +1668,12 @@ || (((((usqInt)byteOffset)) + 2) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = shortAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1618,6 +1693,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1636,9 +1712,12 @@ if (interpreterProxy->internalIsImmutable(rcvr)) { return interpreterProxy->primitiveFailFor(PrimErrNoModification); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop))) + byteOffset; + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; shortAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1760,11 +1839,8 @@ sqInt ok; interpreterProxy = anInterpreter; - ok = interpreterProxy->majorVersion() == VM_PROXY_MAJOR; - if (ok == 0) { - return 0; - } - ok = interpreterProxy->minorVersion() >= VM_PROXY_MINOR; + ok = ((interpreterProxy->majorVersion()) == 1) + && ((interpreterProxy->minorVersion()) >= 12); return ok; } @@ -1799,8 +1875,8 @@ startOfData(sqInt rcvr) { return ((longAt(rcvr + BaseHeaderSize)) > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop)); + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))); } @@ -1814,8 +1890,8 @@ startOfDatawithSize(sqInt rcvr, sqInt sizeField) { return (sizeField > 0 - ? (rcvr + BaseHeaderSize) + BytesPerOop - : longAt((rcvr + BaseHeaderSize) + BytesPerOop)); + ? ((rcvr + BaseHeaderSize) + BytesPerOop) + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))); } Modified: branches/Cog/nssrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c =================================================================== --- branches/Cog/nssrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nssrc/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.68 uuid: 1fd12e1a-c0b3-4d41-91bb-26f029240bfe + VMPluginCodeGenerator VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - Win32OSProcessPlugin * VMConstruction-Plugins-OSProcessPlugin-eem.28 uuid: 9dd4e012-1f25-4946-9b7b-feb93153e08a + Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.31 uuid: b7c551ed-5e67-4774-9285-3f4a291fccb9 */ -static char __buildInfo[] = "Win32OSProcessPlugin * VMConstruction-Plugins-OSProcessPlugin-eem.28 uuid: 9dd4e012-1f25-4946-9b7b-feb93153e08a " __DATE__ ; +static char __buildInfo[] = "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.31 uuid: b7c551ed-5e67-4774-9285-3f4a291fccb9 " __DATE__ ; @@ -14,7 +14,7 @@ #include <time.h> #include <sys/types.h> /* D T Lewis - Win32OSProcessPlugin.c translated from class - Win32OSProcessPlugin of OSProcessPlugin version 4.3.2 */ + Win32OSProcessPlugin of OSProcessPlugin version 4.3.3 Cog */ #include <windows.h> #include <process.h> @@ -158,9 +158,9 @@ struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "Win32OSProcessPlugin * VMConstruction-Plugins-OSProcessPlugin-eem.28 (i)" + "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.31 (i)" #else - "Win32OSProcessPlugin * VMConstruction-Plugins-OSProcessPlugin-eem.28 (e)" + "Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.31 (e)" #endif ; static int osprocessSandboxSecurity; @@ -262,7 +262,7 @@ } -/* Answer the size of a SQFile data structure in bytes. */ +/* Return the size of a Smalltalk file record in bytes. */ static sqInt fileRecordSize(void) @@ -372,7 +372,7 @@ SQFile *sqFile; if (!((interpreterProxy->isBytes(anSQFileRecord)) - && ((interpreterProxy->stSizeOf(anSQFileRecord)) == (fileRecordSize())))) { + && ((interpreterProxy->stSizeOf(anSQFileRecord)) == (sizeof(SQFile))))) { interpreterProxy->primitiveFail(); return null; } @@ -456,7 +456,7 @@ sqFileBytes = interpreterProxy->arrayValueOf(objectPointer); idx = 0; - while (idx < (fileRecordSize())) { + while (idx < (sizeof(SQFile))) { if ((sqFileBytes[idx]) != 0) { return 1; } @@ -494,7 +494,7 @@ isSQFileObject(sqInt objectPointer) { return (((interpreterProxy->isBytes(objectPointer)) - && ((interpreterProxy->byteSizeOf(objectPointer)) == (fileRecordSize()))) + && ((interpreterProxy->byteSizeOf(objectPointer)) == (sizeof(SQFile)))) && ((interpreterProxy->getThisSessionID()) == (sessionIdentifierFromSqFile(interpreterProxy->arrayValueOf(objectPointer))))) && (isNonNullSQFile(objectPointer)); } @@ -558,7 +558,7 @@ static sqInt newSQFileByteArray(void) { - return interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + return interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); } @@ -827,7 +827,7 @@ if (!(createPipeForReaderwriter(readerIOStreamPtr, writerIOStreamPtr))) { return interpreterProxy->primitiveFail(); } - writer = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + writer = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ writerPtr = interpreterProxy->arrayValueOf(writer); writerPtr->file = writerIOStream; @@ -835,7 +835,7 @@ writerPtr->writable = 1; writerPtr->lastOp = 0; interpreterProxy->pushRemappableOop(writer); - reader = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + reader = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ readerPtr = interpreterProxy->arrayValueOf(reader); readerPtr->file = readerIOStream; @@ -889,7 +889,7 @@ if (!(createPipeForReaderwriter(readerIOStreamPtr, writerIOStreamPtr))) { return interpreterProxy->primitiveFail(); } - writer = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + writer = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ writerPtr = interpreterProxy->arrayValueOf(writer); writerPtr->file = writerIOStream; @@ -897,7 +897,7 @@ writerPtr->writable = 1; writerPtr->lastOp = 0; interpreterProxy->pushRemappableOop(writer); - reader = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + reader = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ readerPtr = interpreterProxy->arrayValueOf(reader); readerPtr->file = readerIOStream; @@ -1192,7 +1192,7 @@ thisSession = sessionIdentifierFrom(interpreterProxy->stackObjectValue(0)); invalid = INVALID_HANDLE_VALUE; result = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classArray(), 2); - fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ file = interpreterProxy->arrayValueOf(fileOop); handle = GetStdHandle(STD_ERROR_HANDLE); @@ -1235,7 +1235,7 @@ thisSession = sessionIdentifierFrom(interpreterProxy->stackObjectValue(0)); invalid = INVALID_HANDLE_VALUE; result = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classArray(), 2); - fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ file = interpreterProxy->arrayValueOf(fileOop); handle = GetStdHandle(STD_INPUT_HANDLE); @@ -1278,7 +1278,7 @@ thisSession = sessionIdentifierFrom(interpreterProxy->stackObjectValue(0)); invalid = INVALID_HANDLE_VALUE; result = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classArray(), 2); - fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ file = interpreterProxy->arrayValueOf(fileOop); handle = GetStdHandle(STD_OUTPUT_HANDLE); @@ -1398,7 +1398,7 @@ if (!(makePipeForReaderwriter(readerIOStreamPtr, writerIOStreamPtr))) { return interpreterProxy->primitiveFail(); } - writer = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + writer = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ writerPtr = interpreterProxy->arrayValueOf(writer); writerPtr->file = writerIOStream; @@ -1406,7 +1406,7 @@ writerPtr->writable = 1; writerPtr->lastOp = 0; interpreterProxy->pushRemappableOop(writer); - reader = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + reader = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ readerPtr = interpreterProxy->arrayValueOf(reader); readerPtr->file = readerIOStream; @@ -1460,7 +1460,7 @@ if (!(makePipeForReaderwriter(readerIOStreamPtr, writerIOStreamPtr))) { return interpreterProxy->primitiveFail(); } - writer = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + writer = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ writerPtr = interpreterProxy->arrayValueOf(writer); writerPtr->file = writerIOStream; @@ -1468,7 +1468,7 @@ writerPtr->writable = 1; writerPtr->lastOp = 0; interpreterProxy->pushRemappableOop(writer); - reader = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); + reader = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), sizeof(SQFile)); /* begin fileValueOf: */ readerPtr = interpreterProxy->arrayValueOf(reader); readerPtr->file = readerIOStream; @@ -1573,7 +1573,7 @@ sqFileOop = interpreterProxy->stackValue(0); if (!((((interpreterProxy->isBytes(sqFileOop)) - && ((interpreterProxy->byteSizeOf(sqFileOop)) == (fileRecordSize()))) + && ((interpreterProxy->byteSizeOf(sqFileOop)) == (sizeof(SQFile)))) && ((interpreterProxy->getThisSessionID()) == (sessionIdentifierFromSqFile(interpreterProxy->arrayValueOf(sqFileOop))))) && (isNonNullSQFile(sqFileOop)))) { return interpreterProxy->primitiveFail(); @@ -1600,7 +1600,7 @@ sqFileOop = interpreterProxy->stackValue(0); if (!((((interpreterProxy->isBytes(sqFileOop)) - && ((interpreterProxy->byteSizeOf(sqFileOop)) == (fileRecordSize()))) + && ((interpreterProxy->byteSizeOf(sqFileOop)) == (sizeof(SQFile)))) && ((interpreterProxy->getThisSessionID()) == (sessionIdentifierFromSqFile(interpreterProxy->arrayValueOf(sqFileOop))))) && (isNonNullSQFile(sqFileOop)))) { return interpreterProxy->primitiveFail(); @@ -1627,7 +1627,7 @@ sqFileOop = interpreterProxy->stackValue(0); if (!((((interpreterProxy->isBytes(sqFileOop)) - && ((interpreterProxy->byteSizeOf(sqFileOop)) == (fileRecordSize()))) + && ((interpreterProxy->byteSizeOf(sqFileOop)) == (sizeof(SQFile)))) && ((interpreterProxy->getThisSessionID()) == (sessionIdentifierFromSqFile(interpreterProxy->arrayValueOf(sqFileOop))))) && (isNonNullSQFile(sqFileOop)))) { return interpreterProxy->primitiveFail(); @@ -2200,7 +2200,7 @@ static char * versionString(void) { - static char version[]= "4.3.2"; + static char version[]= "4.3.3 Cog"; return version; } Modified: branches/Cog/nssrc/vm/gcc3x-interp.c =================================================================== --- branches/Cog/nssrc/vm/gcc3x-interp.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nssrc/vm/gcc3x-interp.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - NewspeakInterpreter VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + NewspeakInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "NewspeakInterpreter VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 " __DATE__ ; +static char __buildInfo[] = "NewspeakInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -1467,7 +1467,7 @@ 0 }; char * breakSelector; sqInt breakSelectorLength = -1; -const char *interpreterVersion = "Newspeak Virtual Machine NewspeakInterpreter_VMMaker.oscog-eem.92"; +const char *interpreterVersion = "Newspeak Virtual Machine NewspeakInterpreter_VMMaker.oscog-eem.99"; volatile int sendTrace; @@ -8323,13 +8323,13 @@ byteSwapped(sqInt w) { -# if (BytesPerWord == 4) +# if BytesPerWord == 4 return ((((((usqInt) w >> 24)) & Byte0Mask) + ((((usqInt) w >> 8)) & Byte1Mask)) + ((((usqInt) w << 8)) & Byte2Mask)) + ((((usqInt) w << 24)) & Byte3Mask); -# else /* (BytesPerWord == 4) */ +# else /* BytesPerWord == 4 */ return ((((((((((usqInt) w << 0)) & Byte0Mask) + ((((usqInt) w << 0)) & Byte1Mask)) + ((((usqInt) w >> 24)) & Byte2Mask)) + ((((usqInt) w >> 8)) & Byte3Mask)) + ((((usqInt) w << 8)) & Byte4Mask)) + ((((usqInt) w << 24)) & Byte5Mask)) + ((((usqInt) w << 0)) & Byte6Mask)) + ((((usqInt) w << 0)) & Byte7Mask); -# endif /* (BytesPerWord == 4) */ +# endif /* BytesPerWord == 4 */ } @@ -29308,7 +29308,7 @@ relativeSP = GIV(stackPointer) - GIV(activeContext); GIV(stackPointer) = (GIV(activeContext) + BaseHeaderSize) + (ReceiverIndex * BytesPerWord); -# if (BytesPerWord == 8) +# if BytesPerWord == 8 if (((((usqInt) (longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >> 25) & 15) == 4) { /* begin push: */ object = positive64BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -29328,7 +29328,7 @@ longAtput((sp3 = GIV(stackPointer) + BytesPerWord), object3); GIV(stackPointer) = sp3; -# else /* (BytesPerWord == 8) */ +# else /* BytesPerWord == 8 */ if (((((usqInt) (longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >> 25) & 15) == 4) { /* begin push: */ object4 = positive32BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -29348,7 +29348,7 @@ longAtput((sp7 = GIV(stackPointer) + BytesPerWord), object7); GIV(stackPointer) = sp7; -# endif /* (BytesPerWord == 8) */ +# endif /* BytesPerWord == 8 */ GIV(stackPointer) = GIV(activeContext) + relativeSP; assert(validInstructionPointerinMethod(GIV(instructionPointer), GIV(method))); Modified: branches/Cog/nssrc/vm/interp.c =================================================================== --- branches/Cog/nssrc/vm/interp.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nssrc/vm/interp.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - NewspeakInterpreter VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + NewspeakInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "NewspeakInterpreter VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 " __DATE__ ; +static char __buildInfo[] = "NewspeakInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -1464,7 +1464,7 @@ 0 }; char * breakSelector; sqInt breakSelectorLength = -1; -const char *interpreterVersion = "Newspeak Virtual Machine NewspeakInterpreter_VMMaker.oscog-eem.92"; +const char *interpreterVersion = "Newspeak Virtual Machine NewspeakInterpreter_VMMaker.oscog-eem.99"; volatile int sendTrace; @@ -8319,13 +8319,13 @@ byteSwapped(sqInt w) { -# if (BytesPerWord == 4) +# if BytesPerWord == 4 return ((((((usqInt) w >> 24)) & Byte0Mask) + ((((usqInt) w >> 8)) & Byte1Mask)) + ((((usqInt) w << 8)) & Byte2Mask)) + ((((usqInt) w << 24)) & Byte3Mask); -# else /* (BytesPerWord == 4) */ +# else /* BytesPerWord == 4 */ return ((((((((((usqInt) w << 0)) & Byte0Mask) + ((((usqInt) w << 0)) & Byte1Mask)) + ((((usqInt) w >> 24)) & Byte2Mask)) + ((((usqInt) w >> 8)) & Byte3Mask)) + ((((usqInt) w << 8)) & Byte4Mask)) + ((((usqInt) w << 24)) & Byte5Mask)) + ((((usqInt) w << 0)) & Byte6Mask)) + ((((usqInt) w << 0)) & Byte7Mask); -# endif /* (BytesPerWord == 4) */ +# endif /* BytesPerWord == 4 */ } @@ -29304,7 +29304,7 @@ relativeSP = GIV(stackPointer) - GIV(activeContext); GIV(stackPointer) = (GIV(activeContext) + BaseHeaderSize) + (ReceiverIndex * BytesPerWord); -# if (BytesPerWord == 8) +# if BytesPerWord == 8 if (((((usqInt) (longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >> 25) & 15) == 4) { /* begin push: */ object = positive64BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -29324,7 +29324,7 @@ longAtput((sp3 = GIV(stackPointer) + BytesPerWord), object3); GIV(stackPointer) = sp3; -# else /* (BytesPerWord == 8) */ +# else /* BytesPerWord == 8 */ if (((((usqInt) (longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >> 25) & 15) == 4) { /* begin push: */ object4 = positive32BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -29344,7 +29344,7 @@ longAtput((sp7 = GIV(stackPointer) + BytesPerWord), object7); GIV(stackPointer) = sp7; -# endif /* (BytesPerWord == 8) */ +# endif /* BytesPerWord == 8 */ GIV(stackPointer) = GIV(activeContext) + relativeSP; assert(validInstructionPointerinMethod(GIV(instructionPointer), GIV(method))); Modified: branches/Cog/nssrc/vm/interp.h =================================================================== --- branches/Cog/nssrc/vm/interp.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nssrc/vm/interp.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/nssrc/vm/vmCallback.h =================================================================== --- branches/Cog/nssrc/vm/vmCallback.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/nssrc/vm/vmCallback.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ #define VM_CALLBACK_INC 1 Modified: branches/Cog/src/plugins/IA32ABI/IA32ABI.c =================================================================== --- branches/Cog/src/plugins/IA32ABI/IA32ABI.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/plugins/IA32ABI/IA32ABI.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + VMPluginCodeGenerator VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - IA32ABIPlugin VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + IA32ABIPlugin VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "IA32ABIPlugin VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 " __DATE__ ; +static char __buildInfo[] = "IA32ABIPlugin VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; @@ -132,9 +132,9 @@ struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "IA32ABI VMMaker.oscog-eem.98 (i)" + "IA32ABI VMMaker.oscog-eem.99 (i)" #else - "IA32ABI VMMaker.oscog-eem.98 (e)" + "IA32ABI VMMaker.oscog-eem.99 (e)" #endif ; @@ -479,19 +479,19 @@ mac = interpreterProxy->methodArgumentCount(); -# if (STACKVM) +# if STACKVM errCode = callIA32FloatReturn(interpreterProxy->getStackPointer() + mac - 2, /* arg vec */ 1 - mac /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# else /* (STACKVM) */ +# else /* STACKVM */ errCode = callIA32FloatReturn(interpreterProxy->getStackPointer() - mac + 2, /* arg vec */ mac - 1 /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# endif /* (STACKVM) */ +# endif /* STACKVM */ if (errCode != 0) { return interpreterProxy->primitiveFailFor(errCode); @@ -521,19 +521,19 @@ mac = interpreterProxy->methodArgumentCount(); -# if (STACKVM) +# if STACKVM errCode = callIA32IntegralReturn(interpreterProxy->getStackPointer() + mac - 2, /* arg vec */ 1 - mac /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# else /* (STACKVM) */ +# else /* STACKVM */ errCode = callIA32IntegralReturn(interpreterProxy->getStackPointer() - mac + 2, /* arg vec */ mac - 1 /* nargs */, mac /* funcOffset*/, mac - 1 /* resultOffset */); -# endif /* (STACKVM) */ +# endif /* STACKVM */ if (errCode != 0) { return interpreterProxy->primitiveFailFor(errCode); @@ -580,6 +580,7 @@ sqInt dataSize; double floatValue; sqInt rcvr; + sqInt startAddr; byteOffset = (interpreterProxy->stackPositiveMachineIntegerValue(0)) - 1; rcvr = interpreterProxy->stackObjectValue(1); @@ -590,9 +591,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)(&floatValue))[0] = ((long *)addr)[0]; ((long *)(&floatValue))[1] = ((long *)addr)[1]; interpreterProxy->pop(2); return interpreterProxy->pushFloat(floatValue); @@ -613,6 +617,7 @@ sqInt dataSize; double floatValue; sqInt rcvr; + sqInt startAddr; sqInt valueOop; valueOop = interpreterProxy->stackValue(0); @@ -631,9 +636,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((int*)addr)[0] = ((int*)(&floatValue))[0]; ((int*)addr)[1] = ((int*)(&floatValue))[1]; interpreterProxy->methodReturnValue(valueOop); @@ -652,6 +660,7 @@ sqInt dataSize; float floatValue; sqInt rcvr; + sqInt startAddr; byteOffset = (interpreterProxy->stackPositiveMachineIntegerValue(0)) - 1; rcvr = interpreterProxy->stackObjectValue(1); @@ -662,9 +671,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)(&floatValue))[0] = ((long *)addr)[0]; interpreterProxy->pop(2); return interpreterProxy->pushFloat(floatValue); @@ -685,6 +697,7 @@ sqInt dataSize; float floatValue; sqInt rcvr; + sqInt startAddr; sqInt valueOop; valueOop = interpreterProxy->stackValue(0); @@ -703,9 +716,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; ((long *)addr)[0] = ((long *)(&floatValue))[0]; interpreterProxy->methodReturnValue(valueOop); } @@ -895,6 +911,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; signed char value; sqInt valueOop; @@ -907,9 +924,12 @@ || (((((usqInt)byteOffset)) + 1) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = byteAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -929,6 +949,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -945,9 +966,12 @@ || (((((usqInt)byteOffset)) + 1) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; byteAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -966,6 +990,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -978,9 +1003,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = longAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1000,6 +1028,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1014,9 +1043,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; longAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1037,6 +1069,7 @@ sqInt rcvr; long long signedlonglongvalue; long long *signedlonglongvaluePtr; + sqInt startAddr; sqInt valueOop; signedlonglongvaluePtr = 0; @@ -1050,9 +1083,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; signedlonglongvaluePtr = ((long long*) addr); signedlonglongvalue = *signedlonglongvaluePtr; valueOop = interpreterProxy->signed64BitIntegerFor(signedlonglongvalue); @@ -1075,6 +1111,7 @@ sqInt rcvr; long long signedlonglongvalue; long long *signedlonglongvaluePtr; + sqInt startAddr; sqInt valueOop; signedlonglongvaluePtr = 0; @@ -1091,9 +1128,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; signedlonglongvaluePtr = ((long long*) addr); *signedlonglongvaluePtr = signedlonglongvalue; return interpreterProxy->methodReturnValue(valueOop); @@ -1113,6 +1153,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; short value; sqInt valueOop; @@ -1125,9 +1166,12 @@ || (((((usqInt)byteOffset)) + 2) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = shortAt(addr); valueOop = interpreterProxy->signed32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1147,6 +1191,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1163,9 +1208,12 @@ || (((((usqInt)byteOffset)) + 2) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; shortAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1321,6 +1369,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned char value; sqInt valueOop; @@ -1333,9 +1382,12 @@ || (((((usqInt)byteOffset)) + 1) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = byteAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1355,6 +1407,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1370,9 +1423,12 @@ || (((((usqInt)byteOffset)) + 1) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; byteAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1391,6 +1447,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1403,9 +1460,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = longAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1425,6 +1485,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1439,9 +1500,12 @@ || (((((usqInt)byteOffset)) + 4) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; longAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } @@ -1460,6 +1524,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned long long unsignedlonglongvalue; unsigned long long *unsignedlonglongvaluePtr; sqInt valueOop; @@ -1475,9 +1540,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; unsignedlonglongvaluePtr = ((unsigned long long*) addr); unsignedlonglongvalue = *unsignedlonglongvaluePtr; valueOop = interpreterProxy->positive64BitIntegerFor(unsignedlonglongvalue); @@ -1499,6 +1567,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned long long unsignedlonglongvalue; unsigned long long *unsignedlonglongvaluePtr; sqInt valueOop; @@ -1517,9 +1586,12 @@ || (((((usqInt)byteOffset)) + 8) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; unsignedlonglongvaluePtr = ((unsigned long long*) addr); *unsignedlonglongvaluePtr = unsignedlonglongvalue; return interpreterProxy->methodReturnValue(valueOop); @@ -1539,6 +1611,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; unsigned short value; sqInt valueOop; @@ -1551,9 +1624,12 @@ || (((((usqInt)byteOffset)) + 2) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; value = shortAt(addr); valueOop = interpreterProxy->positive32BitIntegerFor(value); return interpreterProxy->methodReturnValue(valueOop); @@ -1573,6 +1649,7 @@ sqInt byteOffset; sqInt dataSize; sqInt rcvr; + sqInt startAddr; sqInt value; sqInt valueOop; @@ -1588,9 +1665,12 @@ || (((((usqInt)byteOffset)) + 2) <= (abs(dataSize))))) { return interpreterProxy->primitiveFailFor(PrimErrBadIndex); } - addr = (((longAt(rcvr + BaseHeaderSize)) > 0 + if (((startAddr = ((longAt(rcvr + BaseHeaderSize)) > 0 ? ((rcvr + BaseHeaderSize) + BytesPerOop) - : (longAt((rcvr + BaseHeaderSize) + BytesPerOop)))) + byteOffset; + : (longAt((rcvr + BaseHeaderSize) + BytesPerOop))))) == 0) { + return interpreterProxy->primitiveFailFor(PrimErrBadReceiver); + } + addr = startAddr + byteOffset; shortAtput(addr, value); return interpreterProxy->methodReturnValue(valueOop); } Modified: branches/Cog/src/vm/cogit.c =================================================================== --- branches/Cog/src/vm/cogit.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/vm/cogit.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + CCodeGenerator VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - StackToRegisterMappingCogit VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + StackToRegisterMappingCogit VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -545,6 +545,7 @@ static sqInt findMcpcBcpcMatchingMcpc(char *mcpc, sqInt bcpc, void *targetMcpc); CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod); static usqInt findMinAndMaxMethodsPCaround(sqInt blockEntryPC, sqInt mcpc); +static CogMethod * findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop); static sqInt frameOffsetOfTemporary(sqInt index); static void freeMethod(CogMethod *cogMethod); static void freeOlderMethodsForCompaction(void); @@ -3005,14 +3006,23 @@ assert((!(methodHasCogMethod(aMethodObj))) || ((methodClassAssociationOf(aMethodObj)) == (nilObject()))); - - /* coInterpreter stringOf: aSelectorOop */ - - methodObj = aMethodObj; compilationBreakpoint(aSelectorOop, lengthOf(aSelectorOop)); if (aMethodObj == breakMethod) { haltmsg("Compilation of breakMethod"); } + +# if NewspeakVM + cogMethod = findPreviouslyCompiledVersionOfwith(aMethodObj, aSelectorOop); + if (cogMethod == null) { + null; + } + else { + return cogMethod; + } + +# endif /* NewspeakVM */ + + methodObj = aMethodObj; cogMethod = compileCogMethod(aSelectorOop); if ((((((sqInt)cogMethod)) >= MaxNegativeErrorCode) && ((((sqInt)cogMethod)) <= -1))) { if ((((sqInt)cogMethod)) == InsufficientCodeSpace) { @@ -7312,6 +7322,26 @@ return 0; } +static CogMethod * +findPreviouslyCompiledVersionOfwith(sqInt aMethodObj, sqInt aSelectorOop) +{ + CogMethod *cogMethod; + + if ((methodHasCogMethod(aMethodObj)) + && ((methodClassAssociationOf(aMethodObj)) == (nilObject()))) { + cogMethod = ((CogMethod *) baseAddress); + while (cogMethod < (limitZony())) { + if ((((cogMethod->cmType)) == CMMethod) + && ((((cogMethod->selector)) == aSelectorOop) + && (((cogMethod->methodObject)) == aMethodObj))) { + return cogMethod; + } + cogMethod = methodAfter(cogMethod); + } + } + return null; +} + static sqInt frameOffsetOfTemporary(sqInt index) { @@ -12335,7 +12365,7 @@ (optStatus.isReceiverResultRegLive = 1); (optStatus.ssEntry = (&simSelf)); assert((methodOrBlockNumTemps == methodOrBlockNumArgs) - || (isQuick(primitiveIndex))); + || (isQuickPrimitiveIndex(primitiveIndex))); assert((numRegArgs()) <= 2); if (((methodOrBlockNumArgs >= 1) && (methodOrBlockNumArgs <= (numRegArgs())))) { desc = simStackAt(0); Modified: branches/Cog/src/vm/cogit.h =================================================================== --- branches/Cog/src/vm/cogit.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/vm/cogit.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + CCodeGenerator VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ Modified: branches/Cog/src/vm/cogmethod.h =================================================================== --- branches/Cog/src/vm/cogmethod.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/vm/cogmethod.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.92 uuid: 8e895f7e-f712-4117-8e8a-cbc8ebf37b00 + CCodeGenerator VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ typedef struct { Modified: branches/Cog/src/vm/cointerp.c =================================================================== --- branches/Cog/src/vm/cointerp.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/vm/cointerp.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - CoInterpreter VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CoInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -1875,7 +1875,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.98]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.99]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -9546,13 +9546,13 @@ byteSwapped(sqInt w) { -# if (BytesPerWord == 4) +# if BytesPerWord == 4 return ((((((usqInt) w >> 24)) & Byte0Mask) + ((((usqInt) w >> 8)) & Byte1Mask)) + ((((usqInt) w << 8)) & Byte2Mask)) + ((((usqInt) w << 24)) & Byte3Mask); -# else /* (BytesPerWord == 4) */ +# else /* BytesPerWord == 4 */ return ((((((((((usqInt) w << 0)) & Byte0Mask) + ((((usqInt) w << 0)) & Byte1Mask)) + ((((usqInt) w >> 24)) & Byte2Mask)) + ((((usqInt) w >> 8)) & Byte3Mask)) + ((((usqInt) w << 8)) & Byte4Mask)) + ((((usqInt) w << 24)) & Byte5Mask)) + ((((usqInt) w << 0)) & Byte6Mask)) + ((((usqInt) w << 0)) & Byte7Mask); -# endif /* (BytesPerWord == 4) */ +# endif /* BytesPerWord == 4 */ } @@ -40062,7 +40062,7 @@ longAtput((sp8 = GIV(stackPointer) - BytesPerWord), longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassAlien << ShiftForWord))); GIV(stackPointer) = sp8; -# if (BytesPerWord == 8) +# if BytesPerWord == 8 if ((argumentCountOf(GIV(newMethod))) == 4) { /* begin push: */ object = positive64BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -40082,7 +40082,7 @@ longAtput((sp3 = GIV(stackPointer) - BytesPerWord), object3); GIV(stackPointer) = sp3; -# else /* (BytesPerWord == 8) */ +# else /* BytesPerWord == 8 */ if ((argumentCountOf(GIV(newMethod))) == 4) { /* begin push: */ object4 = positive32BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -40102,7 +40102,7 @@ longAtput((sp7 = GIV(stackPointer) - BytesPerWord), object7); GIV(stackPointer) = sp7; -# endif /* (BytesPerWord == 8) */ +# endif /* BytesPerWord == 8 */ /* begin ifAppropriateCompileToNativeCode:selector: */ methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)); Modified: branches/Cog/src/vm/cointerp.h =================================================================== --- branches/Cog/src/vm/cointerp.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/vm/cointerp.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ Modified: branches/Cog/src/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/src/vm/gcc3x-cointerp.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/vm/gcc3x-cointerp.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - CoInterpreter VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CoInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -1878,7 +1878,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.98]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.99]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -9550,13 +9550,13 @@ byteSwapped(sqInt w) { -# if (BytesPerWord == 4) +# if BytesPerWord == 4 return ((((((usqInt) w >> 24)) & Byte0Mask) + ((((usqInt) w >> 8)) & Byte1Mask)) + ((((usqInt) w << 8)) & Byte2Mask)) + ((((usqInt) w << 24)) & Byte3Mask); -# else /* (BytesPerWord == 4) */ +# else /* BytesPerWord == 4 */ return ((((((((((usqInt) w << 0)) & Byte0Mask) + ((((usqInt) w << 0)) & Byte1Mask)) + ((((usqInt) w >> 24)) & Byte2Mask)) + ((((usqInt) w >> 8)) & Byte3Mask)) + ((((usqInt) w << 8)) & Byte4Mask)) + ((((usqInt) w << 24)) & Byte5Mask)) + ((((usqInt) w << 0)) & Byte6Mask)) + ((((usqInt) w << 0)) & Byte7Mask); -# endif /* (BytesPerWord == 4) */ +# endif /* BytesPerWord == 4 */ } @@ -40066,7 +40066,7 @@ longAtput((sp8 = GIV(stackPointer) - BytesPerWord), longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassAlien << ShiftForWord))); GIV(stackPointer) = sp8; -# if (BytesPerWord == 8) +# if BytesPerWord == 8 if ((argumentCountOf(GIV(newMethod))) == 4) { /* begin push: */ object = positive64BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -40086,7 +40086,7 @@ longAtput((sp3 = GIV(stackPointer) - BytesPerWord), object3); GIV(stackPointer) = sp3; -# else /* (BytesPerWord == 8) */ +# else /* BytesPerWord == 8 */ if ((argumentCountOf(GIV(newMethod))) == 4) { /* begin push: */ object4 = positive32BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -40106,7 +40106,7 @@ longAtput((sp7 = GIV(stackPointer) - BytesPerWord), object7); GIV(stackPointer) = sp7; -# endif /* (BytesPerWord == 8) */ +# endif /* BytesPerWord == 8 */ /* begin ifAppropriateCompileToNativeCode:selector: */ methodHeader = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)); Modified: branches/Cog/src/vm/interp.h =================================================================== --- branches/Cog/src/vm/interp.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/vm/interp.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/src/vm/vmCallback.h =================================================================== --- branches/Cog/src/vm/vmCallback.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/src/vm/vmCallback.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.98 uuid: 120a176d-c5ad-4b31-829d-2236efbb9278 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ #define VM_CALLBACK_INC 1 Modified: branches/Cog/stacksrc/vm/gcc3x-interp.c =================================================================== --- branches/Cog/stacksrc/vm/gcc3x-interp.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/stacksrc/vm/gcc3x-interp.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.93 uuid: a811c33a-a695-452b-9090-e0984e33c100 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - StackInterpreter VMMaker.oscog-eem.93 uuid: a811c33a-a695-452b-9090-e0984e33c100 + StackInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.93 uuid: a811c33a-a695-452b-9090-e0984e33c100 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -216,7 +216,7 @@ #define MethodIndex 3 #define MillisecondClockMask 0x1FFFFFFF #define MyListIndex 3 -#define NewspeakVM 0 +#define NewspeakVM 1 #define NextLinkIndex 0 #define NilObject 0 #define PrimErrBadArgument 3 @@ -954,8 +954,8 @@ _iss usqInt youngStart; _iss sqInt messageSelector; _iss usqInt newMethod; +_iss usqInt instructionPointer; _iss usqInt endOfMemory; -_iss usqInt instructionPointer; _iss sqInt rootTableCount; _iss sqInt trueObj; _iss sqInt falseObj; @@ -1672,7 +1672,7 @@ 0 }; char * breakSelector; sqInt breakSelectorLength = -1; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.93]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.99]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -8477,13 +8477,13 @@ byteSwapped(sqInt w) { -# if (BytesPerWord == 4) +# if BytesPerWord == 4 return ((((((usqInt) w >> 24)) & Byte0Mask) + ((((usqInt) w >> 8)) & Byte1Mask)) + ((((usqInt) w << 8)) & Byte2Mask)) + ((((usqInt) w << 24)) & Byte3Mask); -# else /* (BytesPerWord == 4) */ +# else /* BytesPerWord == 4 */ return ((((((((((usqInt) w << 0)) & Byte0Mask) + ((((usqInt) w << 0)) & Byte1Mask)) + ((((usqInt) w >> 24)) & Byte2Mask)) + ((((usqInt) w >> 8)) & Byte3Mask)) + ((((usqInt) w << 8)) & Byte4Mask)) + ((((usqInt) w << 24)) & Byte5Mask)) + ((((usqInt) w << 0)) & Byte6Mask)) + ((((usqInt) w << 0)) & Byte7Mask); -# endif /* (BytesPerWord == 4) */ +# endif /* BytesPerWord == 4 */ } @@ -32815,11 +32815,7 @@ printFloat(dbgFloatValueOf(oop)); goto l2; } - /* begin fetchClassOf: */ - if ((oop & 1)) { - classOop = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); - goto l1; - } + /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(oop))) >> 12) & 31)) == 0) { classOop = (longAt(oop - BaseHeaderSize)) & AllButTypeMask; goto l1; @@ -32828,7 +32824,14 @@ classOop = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); goto l1; } -l1: /* end fetchClassOf: */; +l1: /* end fetchClassOfNonInt: */; + if (!(((classOop & 3) == 0) + && (((((usqInt)classOop)) >= memory) + && (((((usqInt)classOop)) < GIV(freeStart)) + && (((longAt(classOop)) & TypeMask) != HeaderTypeGC))))) { + print("a ??"); + goto l2; + } if ((sizeBitsOf(classOop)) == GIV(metaclassSizeBytes)) { printNameOfClasscount(oop, 5); goto l2; @@ -33816,6 +33819,7 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; sqInt index; + char *sp; char *theFP; StackPage *thePage; sqInt top; @@ -33830,6 +33834,21 @@ if (!(isLiveContext(calloutContext))) { return 0; } + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); + GIV(stackPointer) = sp; + /* begin externalWriteBackHeadFramePointers */ + assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); + assert(GIV(stackPage) == (mostRecentlyUsedPage())); + /* begin setHeadFP:andSP:inPage: */ + assert(GIV(stackPointer) < GIV(framePointer)); + assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); + assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); + (GIV(stackPage)->headFP = GIV(framePointer)); + (GIV(stackPage)->headSP = GIV(stackPointer)); + assert(pageListIsWellFormed()); if (((longAt((callbackContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1) == 0) { /* begin markContextAsDead: */ assert(isContext(callbackContext)); @@ -34081,6 +34100,7 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutMethodContext; sqInt index; + char *sp; char *theFP; StackPage *thePage; sqInt top; @@ -34095,6 +34115,21 @@ if (!(isLiveContext(calloutMethodContext))) { return 0; } + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); + GIV(stackPointer) = sp; + /* begin externalWriteBackHeadFramePointers */ + assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); + assert(GIV(stackPage) == (mostRecentlyUsedPage())); + /* begin setHeadFP:andSP:inPage: */ + assert(GIV(stackPointer) < GIV(framePointer)); + assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); + assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); + (GIV(stackPage)->headFP = GIV(framePointer)); + (GIV(stackPage)->headSP = GIV(stackPointer)); + assert(pageListIsWellFormed()); if (((longAt((callbackMethodContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1) == 0) { /* begin markContextAsDead: */ assert(isContext(callbackMethodContext)); @@ -34377,7 +34412,7 @@ longAtput((sp8 = GIV(stackPointer) - BytesPerWord), object8); GIV(stackPointer) = sp8; -# if (BytesPerWord == 8) +# if BytesPerWord == 8 if (((((usqInt) (longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >> 25) & 15) == 4) { /* begin push: */ object = positive64BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -34397,7 +34432,7 @@ longAtput((sp3 = GIV(stackPointer) - BytesPerWord), object3); GIV(stackPointer) = sp3; -# else /* (BytesPerWord == 8) */ +# else /* BytesPerWord == 8 */ if (((((usqInt) (longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >> 25) & 15) == 4) { /* begin push: */ object4 = positive32BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -34417,7 +34452,7 @@ longAtput((sp7 = GIV(stackPointer) - BytesPerWord), object7); GIV(stackPointer) = sp7; -# endif /* (BytesPerWord == 8) */ +# endif /* BytesPerWord == 8 */ /* begin ifAppropriateCompileToNativeCode:selector: */ /* begin justActivateNewMethod */ Modified: branches/Cog/stacksrc/vm/interp.c =================================================================== --- branches/Cog/stacksrc/vm/interp.c 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/stacksrc/vm/interp.c 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.93 uuid: a811c33a-a695-452b-9090-e0984e33c100 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 from - StackInterpreter VMMaker.oscog-eem.93 uuid: a811c33a-a695-452b-9090-e0984e33c100 + StackInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ -static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.93 uuid: a811c33a-a695-452b-9090-e0984e33c100 " __DATE__ ; +static char __buildInfo[] = "StackInterpreter VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -213,7 +213,7 @@ #define MethodIndex 3 #define MillisecondClockMask 0x1FFFFFFF #define MyListIndex 3 -#define NewspeakVM 0 +#define NewspeakVM 1 #define NextLinkIndex 0 #define NilObject 0 #define PrimErrBadArgument 3 @@ -951,8 +951,8 @@ _iss usqInt youngStart; _iss sqInt messageSelector; _iss usqInt newMethod; +_iss usqInt instructionPointer; _iss usqInt endOfMemory; -_iss usqInt instructionPointer; _iss sqInt rootTableCount; _iss sqInt trueObj; _iss sqInt falseObj; @@ -1669,7 +1669,7 @@ 0 }; char * breakSelector; sqInt breakSelectorLength = -1; -const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.93]"; +const char *interpreterVersion = "Croquet Closure Stack VM [StackInterpreter VMMaker.oscog-eem.99]"; volatile int sendTrace; sqInt suppressHeartbeatFlag; @@ -8473,13 +8473,13 @@ byteSwapped(sqInt w) { -# if (BytesPerWord == 4) +# if BytesPerWord == 4 return ((((((usqInt) w >> 24)) & Byte0Mask) + ((((usqInt) w >> 8)) & Byte1Mask)) + ((((usqInt) w << 8)) & Byte2Mask)) + ((((usqInt) w << 24)) & Byte3Mask); -# else /* (BytesPerWord == 4) */ +# else /* BytesPerWord == 4 */ return ((((((((((usqInt) w << 0)) & Byte0Mask) + ((((usqInt) w << 0)) & Byte1Mask)) + ((((usqInt) w >> 24)) & Byte2Mask)) + ((((usqInt) w >> 8)) & Byte3Mask)) + ((((usqInt) w << 8)) & Byte4Mask)) + ((((usqInt) w << 24)) & Byte5Mask)) + ((((usqInt) w << 0)) & Byte6Mask)) + ((((usqInt) w << 0)) & Byte7Mask); -# endif /* (BytesPerWord == 4) */ +# endif /* BytesPerWord == 4 */ } @@ -32811,11 +32811,7 @@ printFloat(dbgFloatValueOf(oop)); goto l2; } - /* begin fetchClassOf: */ - if ((oop & 1)) { - classOop = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); - goto l1; - } + /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(oop))) >> 12) & 31)) == 0) { classOop = (longAt(oop - BaseHeaderSize)) & AllButTypeMask; goto l1; @@ -32824,7 +32820,14 @@ classOop = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); goto l1; } -l1: /* end fetchClassOf: */; +l1: /* end fetchClassOfNonInt: */; + if (!(((classOop & 3) == 0) + && (((((usqInt)classOop)) >= memory) + && (((((usqInt)classOop)) < GIV(freeStart)) + && (((longAt(classOop)) & TypeMask) != HeaderTypeGC))))) { + print("a ??"); + goto l2; + } if ((sizeBitsOf(classOop)) == GIV(metaclassSizeBytes)) { printNameOfClasscount(oop, 5); goto l2; @@ -33812,6 +33815,7 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutContext; sqInt index; + char *sp; char *theFP; StackPage *thePage; sqInt top; @@ -33826,6 +33830,21 @@ if (!(isLiveContext(calloutContext))) { return 0; } + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); + GIV(stackPointer) = sp; + /* begin externalWriteBackHeadFramePointers */ + assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); + assert(GIV(stackPage) == (mostRecentlyUsedPage())); + /* begin setHeadFP:andSP:inPage: */ + assert(GIV(stackPointer) < GIV(framePointer)); + assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); + assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); + (GIV(stackPage)->headFP = GIV(framePointer)); + (GIV(stackPage)->headSP = GIV(stackPointer)); + assert(pageListIsWellFormed()); if (((longAt((callbackContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1) == 0) { /* begin markContextAsDead: */ assert(isContext(callbackContext)); @@ -34077,6 +34096,7 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt calloutMethodContext; sqInt index; + char *sp; char *theFP; StackPage *thePage; sqInt top; @@ -34091,6 +34111,21 @@ if (!(isLiveContext(calloutMethodContext))) { return 0; } + /* begin push: */ + longAtput((sp = GIV(stackPointer) - BytesPerWord), GIV(instructionPointer)); + GIV(stackPointer) = sp; + /* begin externalWriteBackHeadFramePointers */ + assert((GIV(framePointer) - GIV(stackPointer)) < LargeContextSize); + assert(GIV(stackPage) == (mostRecentlyUsedPage())); + /* begin setHeadFP:andSP:inPage: */ + assert(GIV(stackPointer) < GIV(framePointer)); + assert((GIV(stackPointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(stackPointer) > (((GIV(stackPage)->realStackLimit)) - LargeContextSize))); + assert((GIV(framePointer) < ((GIV(stackPage)->baseAddress))) + && (GIV(framePointer) > (((GIV(stackPage)->realStackLimit)) - (((sqInt) LargeContextSize >> 1))))); + (GIV(stackPage)->headFP = GIV(framePointer)); + (GIV(stackPage)->headSP = GIV(stackPointer)); + assert(pageListIsWellFormed()); if (((longAt((callbackMethodContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1) == 0) { /* begin markContextAsDead: */ assert(isContext(callbackMethodContext)); @@ -34373,7 +34408,7 @@ longAtput((sp8 = GIV(stackPointer) - BytesPerWord), object8); GIV(stackPointer) = sp8; -# if (BytesPerWord == 8) +# if BytesPerWord == 8 if (((((usqInt) (longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >> 25) & 15) == 4) { /* begin push: */ object = positive64BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -34393,7 +34428,7 @@ longAtput((sp3 = GIV(stackPointer) - BytesPerWord), object3); GIV(stackPointer) = sp3; -# else /* (BytesPerWord == 8) */ +# else /* BytesPerWord == 8 */ if (((((usqInt) (longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >> 25) & 15) == 4) { /* begin push: */ object4 = positive32BitIntegerFor(((usqInt)((vmCallbackContext->thunkp)))); @@ -34413,7 +34448,7 @@ longAtput((sp7 = GIV(stackPointer) - BytesPerWord), object7); GIV(stackPointer) = sp7; -# endif /* (BytesPerWord == 8) */ +# endif /* BytesPerWord == 8 */ /* begin ifAppropriateCompileToNativeCode:selector: */ /* begin justActivateNewMethod */ Modified: branches/Cog/stacksrc/vm/interp.h =================================================================== --- branches/Cog/stacksrc/vm/interp.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/stacksrc/vm/interp.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.93 uuid: a811c33a-a695-452b-9090-e0984e33c100 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/stacksrc/vm/vmCallback.h =================================================================== --- branches/Cog/stacksrc/vm/vmCallback.h 2011-07-12 22:52:15 UTC (rev 2456) +++ branches/Cog/stacksrc/vm/vmCallback.h 2011-07-13 19:10:17 UTC (rev 2457) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.93 uuid: a811c33a-a695-452b-9090-e0984e33c100 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.99 uuid: 3a15adab-a4d3-49c1-82a1-6ed02b158658 */ #define VM_CALLBACK_INC 1 |
Free forum by Nabble | Edit this page |