Revision: 3026 Author: eliot Date: 2014-07-02 15:44:11 -0700 (Wed, 02 Jul 2014) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.794
Fix the shift for divide issues in the LargeIntegersPlugin. Add code to generateDivide:on:indent: to spit out checking asserts if required.
Change the SmartSyntaxPluginCodeGenerator to generate code that ifdefs out the remapOop:in: rigmarole on Spur.
Fix inline cache for Characters in Spur.
Update mksistaarchives for new build structure on Mac (only).
Modified Paths: -------------- branches/Cog/nsspursrc/vm/cogit.c branches/Cog/nsspursrc/vm/cogit.h branches/Cog/nsspursrc/vm/cogmethod.h branches/Cog/scripts/mksistaarchives branches/Cog/spursistasrc/vm/cogit.c branches/Cog/spursistasrc/vm/cogit.h branches/Cog/spursistasrc/vm/cogmethod.h branches/Cog/spursrc/vm/cogit.c branches/Cog/spursrc/vm/cogit.h branches/Cog/spursrc/vm/cogmethod.h branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c
Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nsspursrc/vm/cogit.c =================================================================== --- branches/Cog/nsspursrc/vm/cogit.c 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/nsspursrc/vm/cogit.c 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 from - StackToRegisterMappingCogit VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + StackToRegisterMappingCogit VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -18457,7 +18457,7 @@ movl 0(%edx), rDest andl $0x3fffff, rDest Lcmp: - But we expect most SMallInteger arithmetic to be performwd in-line and so + But we expect most SmallInteger arithmetic to be performed in-line and so prefer the version that is faster for non-immediates (because it branches for immediates only). */ @@ -18834,13 +18834,9 @@ static sqInt inlineCacheTagForInstance(sqInt oop) { - if (isImmediate(oop)) { - if ((oop & 1)) { - return ((0 << 1) | 1); - } - return oop & (tagMask()); - } - return classIndexOf(oop); + return (isImmediate(oop) + ? oop & 1 + : classIndexOf(oop)); }
Modified: branches/Cog/nsspursrc/vm/cogit.h =================================================================== --- branches/Cog/nsspursrc/vm/cogit.h 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/nsspursrc/vm/cogit.h 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */
Modified: branches/Cog/nsspursrc/vm/cogmethod.h =================================================================== --- branches/Cog/nsspursrc/vm/cogmethod.h 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/nsspursrc/vm/cogmethod.h 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */
typedef struct {
Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h ___________________________________________________________________ Modified: checkindate - Tue Jul 1 20:11:53 PDT 2014 + Wed Jul 2 15:43:04 PDT 2014
Modified: branches/Cog/scripts/mksistaarchives =================================================================== --- branches/Cog/scripts/mksistaarchives 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/scripts/mksistaarchives 2014-07-02 22:44:11 UTC (rev 3026) @@ -5,7 +5,8 @@ " cd `dirname $0`/../products NSB=newspeak.sista.spur -SQB=squeak.sista.spur +SQCB=squeak.sista.v3 +SQSB=squeak.sista.spur if [ $# = 0 ]; then CL=1 CM=1 @@ -44,6 +45,8 @@ TAG=`date +%g.%U.`$REV echo REV=$REV TAG=$TAG if [ -n "$CL" ]; then + echo not yet implemented 1>&2 + exit 1 for archive in sistaspurlinuxht; do rm -rf $archive-$TAG.tgz echo $archive '=>' $archive-$TAG.tgz @@ -52,6 +55,8 @@ done fi if [ -n "$NL" ]; then + echo not yet implemented 1>&2 + exit 1 set -- nssistaspurlinuxht for archive in nsvmspurlinuxht; do rm -rf $archive-$TAG.tgz @@ -63,22 +68,39 @@ fi if [ -n "$CM" ]; then set -- Fast.app + for app in Sista.app; do + test -d $app || mkdir $app + if [ -d ../build.macos32x86/$SQCB/$1 ]; then + rm -rf $app/* $app-$TAG.tgz + echo build.macos32x86/$SQCB/$1 '=>' $app '=>' $app-$TAG.tgz + (cd ../build.macos32x86/$SQCB/$1 >/dev/null;tar cf - *) \ + | (cd $app;tar xf -) + tar czf $app-$TAG.tgz $app + EXES="$EXES $app/Contents/MacOS/Squeak" + else + echo build.macos32x86/$SQCB/$1 is missing + fi + shift + done + set -- Fast.app for app in SistaSpur.app; do test -d $app || mkdir $app - if [ -d ../build.macos32x86/$SQB/$1 ]; then + if [ -d ../build.macos32x86/$SQSB/$1 ]; then rm -rf $app/* $app-$TAG.tgz - echo build.macos32x86/$SQB/$1 '=>' $app '=>' $app-$TAG.tgz - (cd ../build.macos32x86/$SQB/$1 >/dev/null;tar cf - *) \ + echo build.macos32x86/$SQSB/$1 '=>' $app '=>' $app-$TAG.tgz + (cd ../build.macos32x86/$SQSB/$1 >/dev/null;tar cf - *) \ | (cd $app;tar xf -) tar czf $app-$TAG.tgz $app EXES="$EXES $app/Contents/MacOS/Squeak" else - echo build.macos32x86/$SQB/$1 is missing + echo build.macos32x86/$SQSB/$1 is missing fi shift done fi if [ -n "$NM" ]; then + echo not yet implemented 1>&2 + exit 1 set -- Fast.app for app in Newspeak\ Spur\ Virtual\ Machine.app; do test -d $app || mkdir $app @@ -96,25 +118,29 @@ done fi if [ -n "$CW" ]; then + echo not yet implemented 1>&2 + exit 1 set -- build/vm for dir in sistaspurwin; do test -d $dir || mkdir $dir - if [ -d ../build.win32x86/$SQB/$1 ]; then + if [ -d ../build.win32x86/$SQSB/$1 ]; then rm -rf $dir/* $dir-$TAG.zip - echo build.win32x86/$SQB/$1 '=>' $dir '=>' $dir-$TAG.zip - (cd ../build.win32x86/$SQB/$1 >/dev/null; \ + echo build.win32x86/$SQSB/$1 '=>' $dir '=>' $dir-$TAG.zip + (cd ../build.win32x86/$SQSB/$1 >/dev/null; \ tar cf - Squeak.exe Squeak.map Squeak.exe.manifest \ SqueakConsole.exe SqueakConsole.map *.dll) \ | (cd $dir;tar xf -) zip -qr $dir-$TAG.zip $dir EXES="$EXES $dir/Squeak.exe $dir/SqueakConsole.exe" else - echo build.win32x86/$SQB/$1 is missing + echo build.win32x86/$SQSB/$1 is missing fi shift done fi if [ -n "$NW" ]; then + echo not yet implemented 1>&2 + exit 1 set -- build/vm for dir in nsvmspurwin; do test -d $dir || mkdir $dir
Modified: branches/Cog/spursistasrc/vm/cogit.c =================================================================== --- branches/Cog/spursistasrc/vm/cogit.c 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/spursistasrc/vm/cogit.c 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.792 uuid: 9d8d23c8-c855-48a6-8bdd-402765c01a99 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 from - SistaStackToRegisterMappingCogit VMMaker.oscog-eem.792 uuid: 9d8d23c8-c855-48a6-8bdd-402765c01a99 + SistaStackToRegisterMappingCogit VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */ -static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.792 uuid: 9d8d23c8-c855-48a6-8bdd-402765c01a99 " __DATE__ ; +static char __buildInfo[] = "SistaStackToRegisterMappingCogit VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -16895,7 +16895,7 @@ movl 0(%edx), rDest andl $0x3fffff, rDest Lcmp: - But we expect most SMallInteger arithmetic to be performwd in-line and so + But we expect most SmallInteger arithmetic to be performed in-line and so prefer the version that is faster for non-immediates (because it branches for immediates only). */ @@ -17288,13 +17288,9 @@ static sqInt inlineCacheTagForInstance(sqInt oop) { - if (isImmediate(oop)) { - if ((oop & 1)) { - return ((0 << 1) | 1); - } - return oop & (tagMask()); - } - return classIndexOf(oop); + return (isImmediate(oop) + ? oop & 1 + : classIndexOf(oop)); }
Modified: branches/Cog/spursistasrc/vm/cogit.h =================================================================== --- branches/Cog/spursistasrc/vm/cogit.h 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/spursistasrc/vm/cogit.h 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.792 uuid: 9d8d23c8-c855-48a6-8bdd-402765c01a99 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */
Modified: branches/Cog/spursistasrc/vm/cogmethod.h =================================================================== --- branches/Cog/spursistasrc/vm/cogmethod.h 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/spursistasrc/vm/cogmethod.h 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.792 uuid: 9d8d23c8-c855-48a6-8bdd-402765c01a99 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */
typedef struct {
Modified: branches/Cog/spursrc/vm/cogit.c =================================================================== --- branches/Cog/spursrc/vm/cogit.c 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/spursrc/vm/cogit.c 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 from - StackToRegisterMappingCogit VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + StackToRegisterMappingCogit VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 " __DATE__ ; char *__cogitBuildInfo = __buildInfo;
@@ -16805,7 +16805,7 @@ movl 0(%edx), rDest andl $0x3fffff, rDest Lcmp: - But we expect most SMallInteger arithmetic to be performwd in-line and so + But we expect most SmallInteger arithmetic to be performed in-line and so prefer the version that is faster for non-immediates (because it branches for immediates only). */ @@ -17175,13 +17175,9 @@ static sqInt inlineCacheTagForInstance(sqInt oop) { - if (isImmediate(oop)) { - if ((oop & 1)) { - return ((0 << 1) | 1); - } - return oop & (tagMask()); - } - return classIndexOf(oop); + return (isImmediate(oop) + ? oop & 1 + : classIndexOf(oop)); }
Modified: branches/Cog/spursrc/vm/cogit.h =================================================================== --- branches/Cog/spursrc/vm/cogit.h 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/spursrc/vm/cogit.h 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */
Modified: branches/Cog/spursrc/vm/cogmethod.h =================================================================== --- branches/Cog/spursrc/vm/cogmethod.h 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/spursrc/vm/cogmethod.h 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + CCodeGenerator VMMaker.oscog-eem.793 uuid: aa676593-2c7b-4ad7-92a5-9d1e27cb7377 */
typedef struct {
Modified: branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c =================================================================== --- branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c 2014-07-02 03:12:22 UTC (rev 3025) +++ branches/Cog/src/plugins/LargeIntegers/LargeIntegers.c 2014-07-02 22:44:11 UTC (rev 3026) @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.794 uuid: 7fd23b24-d4aa-4291-996a-760b99e0d7e2 from - LargeIntegersPlugin VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 + LargeIntegersPlugin VMMaker.oscog-eem.794 uuid: 7fd23b24-d4aa-4291-996a-760b99e0d7e2 */ -static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.790 uuid: 1c0587fb-44ad-43f6-8bfd-2a0f91e21a59 " __DATE__ ; +static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.794 uuid: 7fd23b24-d4aa-4291-996a-760b99e0d7e2 " __DATE__ ;
@@ -53,14 +53,14 @@ static int cBytesReplacefromtowithstartingAt(unsigned char * pTo, sqInt start, sqInt stop, unsigned char * pFrom, sqInt repStart); static sqInt cCopyIntValtoBytes(sqInt val, sqInt bytes); static sqInt cCoreBytesRshiftCountnfbytesfromlentolen(sqInt count, sqInt n, sqInt f, sqInt b, unsigned char * pFrom, sqInt fromLen, unsigned char * pTo, sqInt toLen); -static sqInt cCoreDigitDivDivlenremlenquolen(unsigned char * pDiv, sqInt divLen, unsigned char * pRem, sqInt remLen, unsigned char * pQuo, sqInt quoLen); +static sqInt cCoreDigitDivDivlenremlenquolen(unsigned char *pDiv, sqInt divLen, unsigned char *pRem, sqInt remLen, unsigned char *pQuo, sqInt quoLen); static unsigned char cDigitAddlenwithleninto(unsigned char * pByteShort, sqInt shortLen, unsigned char * pByteLong, sqInt longLen, unsigned char * pByteRes); static sqInt cDigitComparewithlen(unsigned char * pFirst, unsigned char * pSecond, sqInt len); static sqInt cDigitLengthOfCSI(sqInt csi); static unsigned char cDigitMultiplylenwithleninto(unsigned char * pByteShort, sqInt shortLen, unsigned char * pByteLong, sqInt longLen, unsigned char * pByteRes); static sqInt cDigitOfCSIat(sqInt csi, sqInt ix); -static sqInt cDigitSublenwithleninto(unsigned char * pByteSmall, sqInt smallLen, unsigned char * pByteLarge, sqInt largeLen, unsigned char * pByteRes); -static sqInt cdigitMontgomerylentimeslenmodulolenmInvModBinto(unsigned char * pBytesFirst, sqInt firstLen, unsigned char * pBytesSecond, sqInt secondLen, unsigned char * pBytesThird, sqInt thirdLen, sqInt mInv, unsigned char * pBytesRes); +static sqInt cDigitSublenwithleninto(unsigned char *pByteSmall, sqInt smallLen, unsigned char *pByteLarge, sqInt largeLen, unsigned char *pByteRes); +static sqInt cdigitMontgomerylentimeslenmodulolenmInvModBinto(unsigned char *pBytesFirst, sqInt firstLen, unsigned char *pBytesSecond, sqInt secondLen, unsigned char *pBytesThird, sqInt thirdLen, sqInt mInv, unsigned char *pBytesRes); static sqInt cHighBit(sqInt uint); static sqInt createLargeFromSmallInteger(sqInt anOop); static sqInt digitAddLargewith(sqInt firstInteger, sqInt secondInteger); @@ -172,9 +172,9 @@ struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "LargeIntegers v1.5 VMMaker.oscog-eem.790 (i)" + "LargeIntegers v1.5 VMMaker.oscog-eem.794 (i)" #else - "LargeIntegers v1.5 VMMaker.oscog-eem.790 (e)" + "LargeIntegers v1.5 VMMaker.oscog-eem.794 (e)" #endif ; static const int orOpIndex = 1; @@ -300,9 +300,16 @@ sqInt newBytes; sqInt oldLen;
- pushRemappableOop(aBytesObject); + +#if SPURVM newBytes = instantiateClassindexableSize(fetchClassOf(aBytesObject), newLen); - aBytesObject = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(aBytesObject); + newBytes = instantiateClassindexableSize(fetchClassOf(aBytesObject), newLen); + aBytesObject = popRemappableOop() +#endif /* SPURVM */ +; oldLen = slotSizeOf(aBytesObject); if (oldLen < newLen) { copyLen = oldLen; @@ -342,9 +349,16 @@ return integerObjectOf(0); } newLen = ((highBit + shiftCount) + 7) / 8; - pushRemappableOop(aBytesOop); + +#if SPURVM newBytes = instantiateClassindexableSize(fetchClassOf(aBytesOop), newLen); - aBytesOop = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(aBytesOop); + newBytes = instantiateClassindexableSize(fetchClassOf(aBytesOop), newLen); + aBytesOop = popRemappableOop() +#endif /* SPURVM */ +; /* begin cBytesLshift:from:len:to:len: */ pFrom = firstIndexableField(aBytesOop); pTo = firstIndexableField(newBytes); @@ -452,9 +466,16 @@ } oldLen = slotSizeOf(aBytesOop); newLen = i - b; - pushRemappableOop(aBytesOop); + +#if SPURVM newBytes = instantiateClassindexableSize(fetchClassOf(aBytesOop), newLen); - aBytesOop = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(aBytesOop); + newBytes = instantiateClassindexableSize(fetchClassOf(aBytesOop), newLen); + aBytesOop = popRemappableOop() +#endif /* SPURVM */ +; /* begin cCoreBytesRshiftCount:n:f:bytes:from:len:to:len: */ pFrom = firstIndexableField(aBytesOop); pTo = firstIndexableField(newBytes); @@ -683,7 +704,7 @@ }
static sqInt -cCoreDigitDivDivlenremlenquolen(unsigned char * pDiv, sqInt divLen, unsigned char * pRem, sqInt remLen, unsigned char * pQuo, sqInt quoLen) +cCoreDigitDivDivlenremlenquolen(unsigned char *pDiv, sqInt divLen, unsigned char *pRem, sqInt remLen, unsigned char *pQuo, sqInt quoLen) { sqInt a; sqInt cond; @@ -709,12 +730,9 @@ dl = divLen - 1; ql = quoLen; dh = pDiv[dl - 1]; - if (dl == 1) { - dnh = 0; - } - else { - dnh = pDiv[dl - 2]; - } + dnh = (dl == 1 + ? 0 + : pDiv[dl - 2]); for (k = 1; k <= ql; k += 1) {
/* maintain quo*arg+rem=self */ @@ -783,13 +801,9 @@ a = 0; for (i = 1; i <= divLen; i += 1) { hi = (pDiv[i - 1]) * (((usqInt) q >> 8)); - - /* pRem at: l - 1 put: lo - (lo // 256 * 256). */ - /* sign-tolerant form of (lo bitAnd: 255) -> obsolete... */ - lo = (a + (pRem[l - 1])) - ((pDiv[i - 1]) * (q & 0xFF)); - pRem[l - 1] = (lo & 0xFF); - a = (lo / 256) - hi; + pRem[l - 1] = lo; + a = (((signed)lo >> 8)) - hi; l += 1; } if (a < 0) { @@ -801,7 +815,7 @@ a = 0; for (i = 1; i <= divLen; i += 1) { a = ((((usqInt) a >> 8)) + (pRem[l - 1])) + (pDiv[i - 1]); - pRem[l - 1] = (a & 0xFF); + pRem[l - 1] = a; l += 1; } } @@ -947,7 +961,7 @@ }
static sqInt -cDigitSublenwithleninto(unsigned char * pByteSmall, sqInt smallLen, unsigned char * pByteLarge, sqInt largeLen, unsigned char * pByteRes) +cDigitSublenwithleninto(unsigned char *pByteSmall, sqInt smallLen, unsigned char *pByteLarge, sqInt largeLen, unsigned char *pByteRes) { sqInt i; sqInt z; @@ -958,27 +972,27 @@ z = 0; for (i = 0; i < smallLen; i += 1) { z = (z + (pByteLarge[i])) - (pByteSmall[i]); - pByteRes[i] = (z - ((z / 256) * 256)); + pByteRes[i] = z; z = ((signed)z >> 8); } for (i = smallLen; i < largeLen; i += 1) { z += pByteLarge[i]; - pByteRes[i] = (z - ((z / 256) * 256)); + pByteRes[i] = z; z = ((signed)z >> 8); } }
static sqInt -cdigitMontgomerylentimeslenmodulolenmInvModBinto(unsigned char * pBytesFirst, sqInt firstLen, unsigned char * pBytesSecond, sqInt secondLen, unsigned char * pBytesThird, sqInt thirdLen, sqInt mInv, unsigned char * pBytesRes) +cdigitMontgomerylentimeslenmodulolenmInvModBinto(unsigned char *pBytesFirst, sqInt firstLen, unsigned char *pBytesSecond, sqInt secondLen, unsigned char *pBytesThird, sqInt thirdLen, sqInt mInv, unsigned char *pBytesRes) { - usqInt accum; + usqInt accum; sqInt i; sqInt k; - unsigned char lastByte; + unsigned char lastByte; sqInt limit1; sqInt limit2; sqInt limit3; - unsigned char u; + unsigned char u;
limit1 = firstLen - 1; limit2 = secondLen - 1; @@ -1020,8 +1034,8 @@ accum = 0; for (i = 0; i <= limit3; i += 1) { accum = (accum + (pBytesRes[i])) - (pBytesThird[i]); - pBytesRes[i] = (accum - ((accum / 256) * 256)); - accum = accum / 256; + pBytesRes[i] = accum; + accum = ((signed)accum >> 8); } } } @@ -1146,11 +1160,18 @@ longInt = firstInteger; longLen = firstLen; } - pushRemappableOop(shortInt); + +#if SPURVM + sum = instantiateClassindexableSize(resClass, longLen); + +#else /* SPURVM */ +pushRemappableOop(shortInt); pushRemappableOop(longInt); sum = instantiateClassindexableSize(resClass, longLen); longInt = popRemappableOop(); - shortInt = popRemappableOop(); + shortInt = popRemappableOop() +#endif /* SPURVM */ +; /* begin cDigitAdd:len:with:len:into: */ pByteShort = firstIndexableField(shortInt); pByteLong = firstIndexableField(longInt); @@ -1171,9 +1192,16 @@
/* sum := sum growby: 1. */
- pushRemappableOop(sum); + +#if SPURVM newSum = instantiateClassindexableSize(resClass, longLen + 1); - sum = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(sum); + newSum = instantiateClassindexableSize(resClass, longLen + 1); + sum = popRemappableOop() +#endif /* SPURVM */ +; cBytesCopyFromtolen(firstIndexableField(sum), firstIndexableField(newSum), longLen);
/* C index! */ @@ -1210,9 +1238,16 @@ if ((integerValueOf(firstInteger)) < 0) { return primitiveFail(); } - pushRemappableOop(secondInteger); + +#if SPURVM firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstLarge = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { if ((fetchClassOf(firstInteger)) == (classLargeNegativeInteger())) { @@ -1224,9 +1259,16 @@ if ((integerValueOf(secondInteger)) < 0) { return primitiveFail(); } - pushRemappableOop(firstLarge); + +#if SPURVM secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); + secondLarge = createLargeFromSmallInteger(secondInteger); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { if ((fetchClassOf(secondInteger)) == (classLargeNegativeInteger())) { @@ -1248,11 +1290,18 @@ longLen = firstLen; longLarge = firstLarge; } - pushRemappableOop(shortLarge); + +#if SPURVM + result = instantiateClassindexableSize(classLargePositiveInteger(), longLen); + +#else /* SPURVM */ +pushRemappableOop(shortLarge); pushRemappableOop(longLarge); result = instantiateClassindexableSize(classLargePositiveInteger(), longLen); longLarge = popRemappableOop(); - shortLarge = popRemappableOop(); + shortLarge = popRemappableOop() +#endif /* SPURVM */ +; /* begin cByteOp:short:len:long:len:into: */ pByteShort = firstIndexableField(shortLarge); pByteLong = firstIndexableField(longLarge); @@ -1346,10 +1395,10 @@ sqInt l1; sqInt lo; sqInt mul; - unsigned char * pDiv; + unsigned char *pDiv; unsigned char *pointer; - unsigned char * pQuo; - unsigned char * pRem; + unsigned char *pQuo; + unsigned char *pRem; sqInt q; sqInt ql; sqInt quo; @@ -1373,29 +1422,61 @@ } l = (firstLen - secondLen) + 1; if (l <= 0) { - pushRemappableOop(firstInteger); + +#if SPURVM result = instantiateClassindexableSize(classArray(), 2); - firstInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstInteger); + result = instantiateClassindexableSize(classArray(), 2); + firstInteger = popRemappableOop() +#endif /* SPURVM */ +; stObjectatput(result,1,(integerObjectOf(0))); stObjectatput(result,2,firstInteger); return result; } d = 8 - (cHighBit(((pointer = firstIndexableField(secondInteger)))[secondLen - 1])); - pushRemappableOop(firstInteger); + +#if SPURVM div = bytesLshift(secondInteger, d); div = bytesOrIntgrowTo(div, (digitLength(div)) + 1); - firstInteger = popRemappableOop(); - pushRemappableOop(div); + +#else /* SPURVM */ +pushRemappableOop(firstInteger); + div = bytesLshift(secondInteger, d); + div = bytesOrIntgrowTo(div, (digitLength(div)) + 1); + firstInteger = popRemappableOop() +#endif /* SPURVM */ +; + +#if SPURVM rem = bytesLshift(firstInteger, d); if ((digitLength(rem)) == firstLen) { rem = bytesOrIntgrowTo(rem, firstLen + 1); } - div = popRemappableOop(); - pushRemappableOop(div); + +#else /* SPURVM */ +pushRemappableOop(div); + rem = bytesLshift(firstInteger, d); + if ((digitLength(rem)) == firstLen) { + rem = bytesOrIntgrowTo(rem, firstLen + 1); + } + div = popRemappableOop() +#endif /* SPURVM */ +; + +#if SPURVM + quo = instantiateClassindexableSize(resultClass, l); + +#else /* SPURVM */ +pushRemappableOop(div); pushRemappableOop(rem); quo = instantiateClassindexableSize(resultClass, l); rem = popRemappableOop(); - div = popRemappableOop(); + div = popRemappableOop() +#endif /* SPURVM */ +; /* begin cCoreDigitDivDiv:len:rem:len:quo:len: */ pDiv = firstIndexableField(div); /* begin digitLength: */ @@ -1484,12 +1565,9 @@ dl = divLen - 1; ql = quoLen; dh = pDiv[dl - 1]; - if (dl == 1) { - dnh = 0; - } - else { - dnh = pDiv[dl - 2]; - } + dnh = (dl == 1 + ? 0 + : pDiv[dl - 2]); for (k = 1; k <= ql; k += 1) {
/* maintain quo*arg+rem=self */ @@ -1558,13 +1636,9 @@ a = 0; for (i = 1; i <= divLen; i += 1) { hi = (pDiv[i - 1]) * (((usqInt) q >> 8)); - - /* pRem at: l - 1 put: lo - (lo // 256 * 256). */ - /* sign-tolerant form of (lo bitAnd: 255) -> obsolete... */ - lo = (a + (pRem[l1 - 1])) - ((pDiv[i - 1]) * (q & 0xFF)); - pRem[l1 - 1] = (lo & 0xFF); - a = (lo / 256) - hi; + pRem[l1 - 1] = lo; + a = (((signed)lo >> 8)) - hi; l1 += 1; } if (a < 0) { @@ -1576,20 +1650,34 @@ a = 0; for (i = 1; i <= divLen; i += 1) { a = ((((usqInt) a >> 8)) + (pRem[l1 - 1])) + (pDiv[i - 1]); - pRem[l1 - 1] = (a & 0xFF); + pRem[l1 - 1] = a; l1 += 1; } } pQuo[quoLen - k] = q; } - pushRemappableOop(quo); + +#if SPURVM rem = bytesRshiftbyteslookfirst(rem, d, 0, (digitLength(div)) - 1); - quo = popRemappableOop(); - pushRemappableOop(quo); + +#else /* SPURVM */ +pushRemappableOop(quo); + rem = bytesRshiftbyteslookfirst(rem, d, 0, (digitLength(div)) - 1); + quo = popRemappableOop() +#endif /* SPURVM */ +; + +#if SPURVM + result = instantiateClassindexableSize(classArray(), 2); + +#else /* SPURVM */ +pushRemappableOop(quo); pushRemappableOop(rem); result = instantiateClassindexableSize(classArray(), 2); rem = popRemappableOop(); - quo = popRemappableOop(); + quo = popRemappableOop() +#endif /* SPURVM */ +; stObjectatput(result,1,quo); stObjectatput(result,2,rem); return result; @@ -1622,22 +1710,22 @@ static sqInt digitMontgomerytimesmodulomInvModB(sqInt firstLarge, sqInt secondLarge, sqInt thirdLarge, sqInt mInv) { - usqInt accum; + usqInt accum; sqInt firstLen; sqInt i; sqInt k; - unsigned char lastByte; + unsigned char lastByte; sqInt limit1; sqInt limit2; sqInt limit3; - unsigned char * pBytesFirst; - unsigned char * pBytesRes; - unsigned char * pBytesSecond; - unsigned char * pBytesThird; + unsigned char *pBytesFirst; + unsigned char *pBytesRes; + unsigned char *pBytesSecond; + unsigned char *pBytesThird; sqInt prod; sqInt secondLen; sqInt thirdLen; - unsigned char u; + unsigned char u;
firstLen = slotSizeOf(firstLarge); secondLen = slotSizeOf(secondLarge); @@ -1652,13 +1740,20 @@ && (mInv <= 0xFF))) { return primitiveFail(); } - pushRemappableOop(firstLarge); + +#if SPURVM + prod = instantiateClassindexableSize(classLargePositiveInteger(), thirdLen); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); pushRemappableOop(secondLarge); pushRemappableOop(thirdLarge); prod = instantiateClassindexableSize(classLargePositiveInteger(), thirdLen); thirdLarge = popRemappableOop(); secondLarge = popRemappableOop(); - firstLarge = popRemappableOop(); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; /* begin cdigitMontgomery:len:times:len:modulo:len:mInvModB:into: */ pBytesFirst = firstIndexableField(firstLarge); pBytesSecond = firstIndexableField(secondLarge); @@ -1704,8 +1799,8 @@ accum = 0; for (i = 0; i <= limit3; i += 1) { accum = (accum + (pBytesRes[i])) - (pBytesThird[i]); - pBytesRes[i] = (accum - ((accum / 256) * 256)); - accum = accum / 256; + pBytesRes[i] = accum; + accum = ((signed)accum >> 8); } } return normalizePositive(prod); @@ -1757,11 +1852,18 @@ else { resultClass = classLargePositiveInteger(); } - pushRemappableOop(shortInt); + +#if SPURVM + prod = instantiateClassindexableSize(resultClass, longLen + shortLen); + +#else /* SPURVM */ +pushRemappableOop(shortInt); pushRemappableOop(longInt); prod = instantiateClassindexableSize(resultClass, longLen + shortLen); longInt = popRemappableOop(); - shortInt = popRemappableOop(); + shortInt = popRemappableOop() +#endif /* SPURVM */ +; /* begin cDigitMultiply:len:with:len:into: */ pByteShort = firstIndexableField(shortInt); pByteLong = firstIndexableField(longInt); @@ -1854,9 +1956,9 @@ sqInt larger; sqInt largerLen; sqInt neg; - unsigned char * pByteLarge; - unsigned char * pByteRes; - unsigned char * pByteSmall; + unsigned char *pByteLarge; + unsigned char *pByteRes; + unsigned char *pByteSmall; sqInt res; sqInt resLen; sqInt secondLen; @@ -1891,13 +1993,22 @@ neg = firstNeg; } resLen = largerLen; - pushRemappableOop(smaller); + +#if SPURVM + res = instantiateClassindexableSize((neg + ? classLargeNegativeInteger() + : classLargePositiveInteger()), resLen); + +#else /* SPURVM */ +pushRemappableOop(smaller); pushRemappableOop(larger); res = instantiateClassindexableSize((neg ? classLargeNegativeInteger() : classLargePositiveInteger()), resLen); larger = popRemappableOop(); - smaller = popRemappableOop(); + smaller = popRemappableOop() +#endif /* SPURVM */ +; /* begin cDigitSub:len:with:len:into: */ pByteSmall = firstIndexableField(smaller); pByteLarge = firstIndexableField(larger); @@ -1908,12 +2019,12 @@ z = 0; for (i = 0; i < smallerLen; i += 1) { z = (z + (pByteLarge[i])) - (pByteSmall[i]); - pByteRes[i] = (z - ((z / 256) * 256)); + pByteRes[i] = z; z = ((signed)z >> 8); } for (i = smallerLen; i < largerLen; i += 1) { z += pByteLarge[i]; - pByteRes[i] = (z - ((z / 256) * 256)); + pByteRes[i] = z; z = ((signed)z >> 8); } return (neg @@ -2322,9 +2433,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(secondInteger); + +#if SPURVM firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstLarge = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstLarge = firstInteger; @@ -2333,9 +2451,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(firstLarge); + +#if SPURVM secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); + secondLarge = createLargeFromSmallInteger(secondInteger); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { secondLarge = secondInteger; @@ -2369,9 +2494,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(secondInteger); + +#if SPURVM firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstLarge = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstLarge = firstInteger; @@ -2380,9 +2512,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(firstLarge); + +#if SPURVM secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); + secondLarge = createLargeFromSmallInteger(secondInteger); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { secondLarge = secondInteger; @@ -2842,9 +2981,16 @@
/* convert to LargeInteger */
- pushRemappableOop(secondInteger); + +#if SPURVM firstAsLargeInteger = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstAsLargeInteger = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstAsLargeInteger = firstInteger; @@ -2857,9 +3003,16 @@ primitiveFail(); return null; } - pushRemappableOop(firstAsLargeInteger); + +#if SPURVM secondAsLargeInteger = createLargeFromSmallInteger(secondInteger); - firstAsLargeInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstAsLargeInteger); + secondAsLargeInteger = createLargeFromSmallInteger(secondInteger); + firstAsLargeInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { secondAsLargeInteger = secondInteger; @@ -2899,9 +3052,16 @@
/* convert to LargeInteger */
- pushRemappableOop(secondInteger); + +#if SPURVM firstAsLargeInteger = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstAsLargeInteger = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstAsLargeInteger = firstInteger; @@ -2914,9 +3074,16 @@ primitiveFail(); return null; } - pushRemappableOop(firstAsLargeInteger); + +#if SPURVM secondAsLargeInteger = createLargeFromSmallInteger(secondInteger); - firstAsLargeInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstAsLargeInteger); + secondAsLargeInteger = createLargeFromSmallInteger(secondInteger); + firstAsLargeInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { secondAsLargeInteger = secondInteger; @@ -2952,9 +3119,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(secondInteger); + +#if SPURVM firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstLarge = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstLarge = firstInteger; @@ -2963,9 +3137,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(firstLarge); + +#if SPURVM secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); + secondLarge = createLargeFromSmallInteger(secondInteger); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { secondLarge = secondInteger; @@ -3001,9 +3182,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(secondInteger); + +#if SPURVM firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstLarge = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstLarge = firstInteger; @@ -3012,9 +3200,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(firstLarge); + +#if SPURVM secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); + secondLarge = createLargeFromSmallInteger(secondInteger); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { secondLarge = secondInteger; @@ -3048,9 +3243,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(secondInteger); + +#if SPURVM firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstLarge = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstLarge = firstInteger; @@ -3059,9 +3261,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(firstLarge); + +#if SPURVM secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); + secondLarge = createLargeFromSmallInteger(secondInteger); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { secondLarge = secondInteger; @@ -3095,9 +3304,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(secondInteger); + +#if SPURVM firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(secondInteger); + firstLarge = createLargeFromSmallInteger(firstInteger); + secondInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstLarge = firstInteger; @@ -3106,9 +3322,16 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(firstLarge); + +#if SPURVM secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop(); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); + secondLarge = createLargeFromSmallInteger(secondInteger); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { secondLarge = secondInteger; @@ -3149,20 +3372,20 @@ EXPORT(sqInt) primMontgomeryTimesModulo(void) { - usqInt accum; + usqInt accum; sqInt firstInteger; sqInt firstLarge; sqInt firstLen; sqInt i; sqInt k; - unsigned char lastByte; + unsigned char lastByte; sqInt limit1; sqInt limit2; sqInt limit3; - unsigned char * pBytesFirst; - unsigned char * pBytesRes; - unsigned char * pBytesSecond; - unsigned char * pBytesThird; + unsigned char *pBytesFirst; + unsigned char *pBytesRes; + unsigned char *pBytesSecond; + unsigned char *pBytesThird; sqInt prod; sqInt secondLarge; sqInt secondLen; @@ -3171,7 +3394,7 @@ sqInt thirdLarge; sqInt thirdLen; sqInt thirdModuloInteger; - unsigned char u; + unsigned char u; sqInt _return_value;
success(isKindOf(stackValue(2), "Integer")); @@ -3189,11 +3412,18 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(secondOperandInteger); + +#if SPURVM + firstLarge = createLargeFromSmallInteger(firstInteger); + +#else /* SPURVM */ +pushRemappableOop(secondOperandInteger); pushRemappableOop(thirdModuloInteger); firstLarge = createLargeFromSmallInteger(firstInteger); thirdModuloInteger = popRemappableOop(); - secondOperandInteger = popRemappableOop(); + secondOperandInteger = popRemappableOop() +#endif /* SPURVM */ +; } else { firstLarge = firstInteger; @@ -3202,11 +3432,18 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(firstLarge); + +#if SPURVM + secondLarge = createLargeFromSmallInteger(secondOperandInteger); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); pushRemappableOop(thirdModuloInteger); secondLarge = createLargeFromSmallInteger(secondOperandInteger); thirdModuloInteger = popRemappableOop(); - firstLarge = popRemappableOop(); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { secondLarge = secondOperandInteger; @@ -3215,11 +3452,18 @@
/* convert it to a not normalized LargeInteger */
- pushRemappableOop(firstLarge); + +#if SPURVM + thirdLarge = createLargeFromSmallInteger(thirdModuloInteger); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); pushRemappableOop(secondLarge); thirdLarge = createLargeFromSmallInteger(thirdModuloInteger); secondLarge = popRemappableOop(); - firstLarge = popRemappableOop(); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; } else { thirdLarge = thirdModuloInteger; @@ -3241,13 +3485,20 @@ _return_value = primitiveFail(); goto l1; } - pushRemappableOop(firstLarge); + +#if SPURVM + prod = instantiateClassindexableSize(classLargePositiveInteger(), thirdLen); + +#else /* SPURVM */ +pushRemappableOop(firstLarge); pushRemappableOop(secondLarge); pushRemappableOop(thirdLarge); prod = instantiateClassindexableSize(classLargePositiveInteger(), thirdLen); thirdLarge = popRemappableOop(); secondLarge = popRemappableOop(); - firstLarge = popRemappableOop(); + firstLarge = popRemappableOop() +#endif /* SPURVM */ +; /* begin cdigitMontgomery:len:times:len:modulo:len:mInvModB:into: */ pBytesFirst = firstIndexableField(firstLarge); pBytesSecond = firstIndexableField(secondLarge); @@ -3293,8 +3544,8 @@ accum = 0; for (i = 0; i <= limit3; i += 1) { accum = (accum + (pBytesRes[i])) - (pBytesThird[i]); - pBytesRes[i] = (accum - ((accum / 256) * 256)); - accum = accum / 256; + pBytesRes[i] = accum; + accum = ((signed)accum >> 8); } } _return_value = normalizePositive(prod);
vm-dev@lists.squeakfoundation.org