diff --git a/src/plugins/DESPlugin/DESPlugin.c b/src/plugins/DESPlugin/DESPlugin.c index 167fd426e9..b419a5afd4 100644 --- a/src/plugins/DESPlugin/DESPlugin.c +++ b/src/plugins/DESPlugin/DESPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc + VMPluginCodeGenerator VMMaker.oscog-eem.3119 uuid: c0b40a55-50ca-4dd9-8b6f-d355a6dd5e1f from - DESPlugin * CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d + DESPlugin CryptographyPlugins-eem.27 uuid: 63bc0f04-a4d3-4347-84fc-20b64ea64093 */ -static char __buildInfo[] = "DESPlugin * CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d " __DATE__ ; +static char __buildInfo[] = "DESPlugin CryptographyPlugins-eem.27 uuid: 63bc0f04-a4d3-4347-84fc-20b64ea64093 " __DATE__ ; #include "config.h" @@ -58,30 +58,40 @@ static unsigned short byteBit[8] = { #if !defined(SQUEAK_BUILTIN_PLUGIN) static void * (*firstIndexableField)(sqInt oop); +#if !defined(integerValueOf) +static sqInt (*integerValueOf)(sqInt oop); +#endif static sqInt (*isBytes)(sqInt oop); +#if !defined(isIntegerObject) +static sqInt (*isIntegerObject)(sqInt objectPointer); +#endif static sqInt (*isWords)(sqInt oop); static sqInt (*methodArgumentCount)(void); static sqInt (*methodReturnBool)(sqInt boolean); -static sqInt (*pop)(sqInt nItems); +static sqInt (*methodReturnReceiver)(void); static sqInt (*primitiveFailFor)(sqInt reasonCode); static sqInt (*stSizeOf)(sqInt oop); -static sqInt (*stackIntegerValue)(sqInt offset); static sqInt (*stackValue)(sqInt offset); #else /* !defined(SQUEAK_BUILTIN_PLUGIN) */ extern void * firstIndexableField(sqInt oop); +#if !defined(integerValueOf) +extern sqInt integerValueOf(sqInt oop); +#endif extern sqInt isBytes(sqInt oop); +#if !defined(isIntegerObject) +extern sqInt isIntegerObject(sqInt objectPointer); +#endif extern sqInt isWords(sqInt oop); extern sqInt methodArgumentCount(void); extern sqInt methodReturnBool(sqInt boolean); -extern sqInt pop(sqInt nItems); +extern sqInt methodReturnReceiver(void); extern sqInt primitiveFailFor(sqInt reasonCode); extern sqInt stSizeOf(sqInt oop); -extern sqInt stackIntegerValue(sqInt offset); extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "DESPlugin * CryptographyPlugins-eem.23 " INT_EXT; +static const char *moduleName = "DESPlugin CryptographyPlugins-eem.27 " INT_EXT; static unsigned char pc1[56] = { 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, @@ -376,18 +386,17 @@ primitiveDESCookKey(void) return primitiveFailFor(PrimErrBadNumArgs); } rawOop = stackValue(2); - if (!((isBytes(rawOop)) - && ((stSizeOf(rawOop)) == 8))) { - return primitiveFailFor(PrimErrBadArgument); - } - encode = stackIntegerValue(1); + encode = stackValue(1); cookedOop = stackValue(0); - if (!((isWords(cookedOop)) - && ((stSizeOf(cookedOop)) == 32))) { + if (!((isBytes(rawOop)) + && (((stSizeOf(rawOop)) == 8) + && ((isIntegerObject(encode)) + && ((isWords(cookedOop)) + && ((stSizeOf(cookedOop)) == 32)))))) { return primitiveFailFor(PrimErrBadArgument); } - processKeymodeto(firstIndexableField(rawOop), encode != 0, firstIndexableField(cookedOop)); - pop(3); + processKeymodeto(firstIndexableField(rawOop), (integerValueOf(encode)) != 0, firstIndexableField(cookedOop)); + methodReturnReceiver(); return 0; } @@ -425,13 +434,11 @@ primitiveDESTransform(void) return primitiveFailFor(PrimErrBadNumArgs); } dataOop = stackValue(1); - if (!((isBytes(dataOop)) - && ((stSizeOf(dataOop)) == 8))) { - return primitiveFailFor(PrimErrBadArgument); - } cookedOop = stackValue(0); - if (!((isWords(cookedOop)) - && ((stSizeOf(cookedOop)) == 32))) { + if (!((isBytes(dataOop)) + && (((stSizeOf(dataOop)) == 8) + && ((isWords(cookedOop)) + && ((stSizeOf(cookedOop)) == 32))))) { return primitiveFailFor(PrimErrBadArgument); } data = firstIndexableField(dataOop); @@ -517,7 +524,7 @@ primitiveDESTransform(void) data[5] = ((((usqInt)((work[1]))) >> 16) & 0xFF); data[6] = ((((usqInt)((work[1]))) >> 8) & 0xFF); data[7] = ((work[1]) & 0xFF); - pop(2); + methodReturnReceiver(); return 0; } @@ -631,14 +638,19 @@ setInterpreter(struct VirtualMachine *anInterpreter) #if !defined(SQUEAK_BUILTIN_PLUGIN) firstIndexableField = interpreterProxy->firstIndexableField; +#if !defined(integerValueOf) + integerValueOf = interpreterProxy->integerValueOf; +#endif isBytes = interpreterProxy->isBytes; +#if !defined(isIntegerObject) + isIntegerObject = interpreterProxy->isIntegerObject; +#endif isWords = interpreterProxy->isWords; methodArgumentCount = interpreterProxy->methodArgumentCount; methodReturnBool = interpreterProxy->methodReturnBool; - pop = interpreterProxy->pop; + methodReturnReceiver = interpreterProxy->methodReturnReceiver; primitiveFailFor = interpreterProxy->primitiveFailFor; stSizeOf = interpreterProxy->stSizeOf; - stackIntegerValue = interpreterProxy->stackIntegerValue; stackValue = interpreterProxy->stackValue; #endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */ } @@ -666,7 +678,7 @@ unscrunchto(unsigned int *wordPtr, unsigned char *bytePtr) static char _m[] = "DESPlugin"; void* DESPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDESCookKey\000\001\001", (void*)primitiveDESCookKey}, + {(void*)_m, "primitiveDESCookKey\000\001\003", (void*)primitiveDESCookKey}, {(void*)_m, "primitiveDESPluginAvailable\000\377\001", (void*)primitiveDESPluginAvailable}, {(void*)_m, "primitiveDESTransform\000\001\001", (void*)primitiveDESTransform}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, @@ -676,7 +688,7 @@ void* DESPlugin_exports[][3] = { #else // ifdef SQ_BUILTIN_PLUGIN #if SPURVM -EXPORT(signed short) primitiveDESCookKeyMetadata = 0x101; +EXPORT(signed short) primitiveDESCookKeyMetadata = 259; EXPORT(signed short) primitiveDESPluginAvailableMetadata = -255; EXPORT(signed short) primitiveDESTransformMetadata = 0x101; #endif // SPURVM diff --git a/src/plugins/DSAPrims/DSAPrims.c b/src/plugins/DSAPrims/DSAPrims.c index dd1e749467..1cf16968f4 100644 --- a/src/plugins/DSAPrims/DSAPrims.c +++ b/src/plugins/DSAPrims/DSAPrims.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc + VMPluginCodeGenerator VMMaker.oscog-eem.3119 uuid: c0b40a55-50ca-4dd9-8b6f-d355a6dd5e1f from - DSAPlugin * CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d + DSAPlugin CryptographyPlugins-eem.27 uuid: 63bc0f04-a4d3-4347-84fc-20b64ea64093 */ -static char __buildInfo[] = "DSAPlugin * CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d " __DATE__ ; +static char __buildInfo[] = "DSAPlugin CryptographyPlugins-eem.27 uuid: 63bc0f04-a4d3-4347-84fc-20b64ea64093 " __DATE__ ; #include "config.h" @@ -67,9 +67,9 @@ static sqInt (*isBytes)(sqInt oop); static sqInt (*isWords)(sqInt oop); static sqInt (*methodArgumentCount)(void); static sqInt (*methodReturnBool)(sqInt boolean); -static sqInt (*pop)(sqInt nItems); +static sqInt (*methodReturnInteger)(sqInt integer); +static sqInt (*methodReturnReceiver)(void); static sqInt (*primitiveFailFor)(sqInt reasonCode); -static sqInt (*pushInteger)(sqInt integerValue); static sqInt (*stSizeOf)(sqInt oop); static sqInt (*stackValue)(sqInt offset); #else /* !defined(SQUEAK_BUILTIN_PLUGIN) */ @@ -80,15 +80,15 @@ extern sqInt isBytes(sqInt oop); extern sqInt isWords(sqInt oop); extern sqInt methodArgumentCount(void); extern sqInt methodReturnBool(sqInt boolean); -extern sqInt pop(sqInt nItems); +extern sqInt methodReturnInteger(sqInt integer); +extern sqInt methodReturnReceiver(void); extern sqInt primitiveFailFor(sqInt reasonCode); -extern sqInt pushInteger(sqInt integerValue); extern sqInt stSizeOf(sqInt oop); extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "DSAPrims * CryptographyPlugins-eem.23 " INT_EXT; +static const char *moduleName = "DSAPrims CryptographyPlugins-eem.27 " INT_EXT; static sqInt remainderDigitCount; @@ -398,7 +398,7 @@ primitiveBigDivide(void) } dsaQuotient[digitShift + 1] = q; } - pop(3); + methodReturnReceiver(); return 0; } @@ -466,7 +466,7 @@ primitiveBigMultiply(void) prodPtr[k] = carry; } } - pop(3); + methodReturnReceiver(); return 0; } @@ -514,7 +514,7 @@ primitiveExpandBlock(void) v = ((unsigned int) ((((usqInt)((((unsigned int) v))) << 1)) | (((usqInt)((((unsigned int) v)))) >> (0x1F)))); wordPtr[i] = v; } - pop(2); + methodReturnReceiver(); return 0; } @@ -598,7 +598,7 @@ primitiveHashBlock(void) statePtr[2] = ((statePtr[2]) + c); statePtr[3] = ((statePtr[3]) + d); statePtr[4] = ((statePtr[4]) + e); - pop(2); + methodReturnReceiver(); return 0; } @@ -638,8 +638,7 @@ primitiveHighestNonZeroDigitIndex(void) while ((i > 0) && ((bigIntPtr[(i -= 1)]) == 0)) { } - pop(1); - pushInteger(i + 1); + methodReturnInteger(i + 1); return 0; } @@ -668,9 +667,9 @@ setInterpreter(struct VirtualMachine *anInterpreter) isWords = interpreterProxy->isWords; methodArgumentCount = interpreterProxy->methodArgumentCount; methodReturnBool = interpreterProxy->methodReturnBool; - pop = interpreterProxy->pop; + methodReturnInteger = interpreterProxy->methodReturnInteger; + methodReturnReceiver = interpreterProxy->methodReturnReceiver; primitiveFailFor = interpreterProxy->primitiveFailFor; - pushInteger = interpreterProxy->pushInteger; stSizeOf = interpreterProxy->stSizeOf; stackValue = interpreterProxy->stackValue; #endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */ diff --git a/src/plugins/MD5Plugin/MD5Plugin.c b/src/plugins/MD5Plugin/MD5Plugin.c index 486a8fec74..4445a000f0 100644 --- a/src/plugins/MD5Plugin/MD5Plugin.c +++ b/src/plugins/MD5Plugin/MD5Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.3090 uuid: 3e2b8343-01bb-4169-ba4c-aecf82b4dcfc + VMPluginCodeGenerator VMMaker.oscog-eem.3119 uuid: c0b40a55-50ca-4dd9-8b6f-d355a6dd5e1f from - MD5Plugin * CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d + MD5Plugin CryptographyPlugins-eem.27 uuid: 63bc0f04-a4d3-4347-84fc-20b64ea64093 */ -static char __buildInfo[] = "MD5Plugin * CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d " __DATE__ ; +static char __buildInfo[] = "MD5Plugin CryptographyPlugins-eem.27 uuid: 63bc0f04-a4d3-4347-84fc-20b64ea64093 " __DATE__ ; #include "config.h" @@ -60,7 +60,7 @@ static sqInt (*methodReturnBool)(sqInt boolean); static sqInt (*methodReturnReceiver)(void); static sqInt (*primitiveFailFor)(sqInt reasonCode); static sqInt (*stSizeOf)(sqInt oop); -static sqInt (*stackObjectValue)(sqInt offset); +static sqInt (*stackValue)(sqInt offset); #else /* !defined(SQUEAK_BUILTIN_PLUGIN) */ extern void * firstIndexableField(sqInt oop); extern sqInt isBytes(sqInt oop); @@ -69,11 +69,11 @@ extern sqInt methodReturnBool(sqInt boolean); extern sqInt methodReturnReceiver(void); extern sqInt primitiveFailFor(sqInt reasonCode); extern sqInt stSizeOf(sqInt oop); -extern sqInt stackObjectValue(sqInt offset); +extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "MD5Plugin * CryptographyPlugins-eem.23 " INT_EXT; +static const char *moduleName = "MD5Plugin CryptographyPlugins-eem.27 " INT_EXT; @@ -100,7 +100,7 @@ primitiveDecodeState(void) if (!((methodArgumentCount()) == 1)) { return primitiveFailFor(PrimErrBadNumArgs); } - bytesOop = stackObjectValue(0); + bytesOop = stackValue(0); if (!((isBytes(bytesOop)) && ((stSizeOf(bytesOop)) == 16))) { return primitiveFailFor(PrimErrBadArgument); @@ -126,7 +126,7 @@ primitiveInitializeState(void) if (!((methodArgumentCount()) == 1)) { return primitiveFailFor(PrimErrBadNumArgs); } - bytesOop = stackObjectValue(0); + bytesOop = stackValue(0); if (!((isBytes(bytesOop)) && ((stSizeOf(bytesOop)) == 16))) { return primitiveFailFor(PrimErrBadArgument); @@ -166,14 +166,12 @@ primitiveProcessBufferWithState(void) if (!((methodArgumentCount()) == 2)) { return primitiveFailFor(PrimErrBadNumArgs); } - bufferOop = stackObjectValue(1); + bufferOop = stackValue(1); + stateOop = stackValue(0); if (!((isBytes(bufferOop)) - && ((stSizeOf(bufferOop)) == 64))) { - return primitiveFailFor(PrimErrBadArgument); - } - stateOop = stackObjectValue(0); - if (!((isBytes(stateOop)) - && ((stSizeOf(stateOop)) == 16))) { + && (((stSizeOf(bufferOop)) == 64) + && ((isBytes(stateOop)) + && ((stSizeOf(stateOop)) == 16))))) { return primitiveFailFor(PrimErrBadArgument); } /* begin md5ProcessBuffer:withState: */ @@ -350,7 +348,7 @@ setInterpreter(struct VirtualMachine *anInterpreter) methodReturnReceiver = interpreterProxy->methodReturnReceiver; primitiveFailFor = interpreterProxy->primitiveFailFor; stSizeOf = interpreterProxy->stSizeOf; - stackObjectValue = interpreterProxy->stackObjectValue; + stackValue = interpreterProxy->stackValue; #endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */ } return ok; diff --git a/src/plugins/SHA2Plugin/SHA2Plugin.c b/src/plugins/SHA2Plugin/SHA2Plugin.c index 92432f2a0e..c21217ac2f 100644 --- a/src/plugins/SHA2Plugin/SHA2Plugin.c +++ b/src/plugins/SHA2Plugin/SHA2Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by VMPluginCodeGenerator VMMaker.oscog-eem.3119 uuid: c0b40a55-50ca-4dd9-8b6f-d355a6dd5e1f from - SHA2Plugin CryptographyPlugins-eem.24 uuid: 7463960c-3baf-413e-b010-ec19e90522b3 + SHA2Plugin CryptographyPlugins-eem.27 uuid: 63bc0f04-a4d3-4347-84fc-20b64ea64093 */ -static char __buildInfo[] = "SHA2Plugin CryptographyPlugins-eem.24 uuid: 7463960c-3baf-413e-b010-ec19e90522b3 " __DATE__ ; +static char __buildInfo[] = "SHA2Plugin CryptographyPlugins-eem.27 uuid: 63bc0f04-a4d3-4347-84fc-20b64ea64093 " __DATE__ ; #include "config.h" @@ -57,32 +57,34 @@ EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); static sqInt (*byteSizeOf)(sqInt oop); static void * (*firstIndexableField)(sqInt oop); static sqInt (*isBytes)(sqInt oop); +static sqInt (*isLong64s)(sqInt oop); static sqInt (*isWords)(sqInt oop); -static sqInt (*isWordsOrBytes)(sqInt oop); static sqInt (*methodArgumentCount)(void); static sqInt (*methodReturnBool)(sqInt boolean); static sqInt (*methodReturnReceiver)(void); static sqInt (*primitiveFailFor)(sqInt reasonCode); static sqInt (*stSizeOf)(sqInt oop); -static sqInt (*stackObjectValue)(sqInt offset); static sqInt (*stackValue)(sqInt offset); #else /* !defined(SQUEAK_BUILTIN_PLUGIN) */ extern sqInt byteSizeOf(sqInt oop); extern void * firstIndexableField(sqInt oop); extern sqInt isBytes(sqInt oop); +#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 17) +extern sqInt isLong64s(sqInt oop); +#else +# define isLong64s(oop) 0 +#endif extern sqInt isWords(sqInt oop); -extern sqInt isWordsOrBytes(sqInt oop); extern sqInt methodArgumentCount(void); extern sqInt methodReturnBool(sqInt boolean); extern sqInt methodReturnReceiver(void); extern sqInt primitiveFailFor(sqInt reasonCode); extern sqInt stSizeOf(sqInt oop); -extern sqInt stackObjectValue(sqInt offset); extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SHA2Plugin CryptographyPlugins-eem.24 " INT_EXT; +static const char *moduleName = "SHA2Plugin CryptographyPlugins-eem.27 " INT_EXT; static const unsigned int sha256k[] = { /*0*/ 1116352408, 1899447441, 3049323471U, 3921009573U, 961987163, 0x59F111F1, 2453635748U, /*7*/ 2870763221U, 0xD807AA98U, 310598401, 607225278, 1426881987, 1925078388, 2162078206U, @@ -137,43 +139,36 @@ EXPORT(sqInt) primitiveCopyDoubleWordsIntoBytesBigEndian(void) { sqInt byteCount; - unsigned char *bytes; sqInt bytesOop; sqInt doubleWordCount; - unsigned long long *doubleWords; sqInt doubleWordsOop; sqInt i; + unsigned long long *source; + unsigned long long *target; if (!((methodArgumentCount()) == 2)) { return primitiveFailFor(PrimErrBadNumArgs); } - - /* TODO: there's no easy way to check whether doubleWordsOop is a DoubleWord object, so be creative here */ - doubleWordsOop = stackObjectValue(1); - if (!(isWordsOrBytes(doubleWordsOop))) { + doubleWordsOop = stackValue(1); + bytesOop = stackValue(0); + if (!((isLong64s(doubleWordsOop)) + && (isBytes(bytesOop)))) { return primitiveFailFor(PrimErrBadArgument); } doubleWordCount = stSizeOf(doubleWordsOop); - if (!((byteSizeOf(doubleWordsOop)) == (doubleWordCount * 8))) { - return primitiveFailFor(PrimErrBadArgument); - } - bytesOop = stackObjectValue(0); - if (!(isBytes(bytesOop))) { - return primitiveFailFor(PrimErrBadArgument); - } byteCount = stSizeOf(bytesOop); if (!((doubleWordCount * 8) == byteCount)) { return primitiveFailFor(PrimErrBadArgument); } - doubleWords = firstIndexableField(doubleWordsOop); - bytes = firstIndexableField(bytesOop); /* begin copyDoubleWords:into:count: */ + source = firstIndexableField(doubleWordsOop); + target = firstIndexableField(bytesOop); if (VMBIGENDIAN) { - memcpy(((unsigned long *) (((unsigned long long*) bytes))), ((unsigned long *) doubleWords), doubleWordCount * 8); + memcpy(target, source, doubleWordCount * 8); } else { for (i = 0; i < doubleWordCount; i += 1) { - (((unsigned long *) (((unsigned long long*) bytes))))[i] = (SQ_SWAP_8_BYTES(((((unsigned long *) doubleWords))[i]))); + target[i] = (SQ_SWAP_8_BYTES((source[i]))); } } methodReturnReceiver(); @@ -188,22 +183,20 @@ EXPORT(sqInt) primitiveCopyWordsIntoBytesBigEndian(void) { sqInt byteCount; - unsigned char *bytes; sqInt bytesOop; sqInt i; + unsigned int *source; + unsigned int *target; sqInt wordCount; - unsigned int *words; sqInt wordsOop; if (!((methodArgumentCount()) == 2)) { return primitiveFailFor(PrimErrBadNumArgs); } - wordsOop = stackObjectValue(1); - if (!(isWords(wordsOop))) { - return primitiveFailFor(PrimErrBadArgument); - } - bytesOop = stackObjectValue(0); - if (!(isBytes(bytesOop))) { + wordsOop = stackValue(1); + bytesOop = stackValue(0); + if (!((isWords(wordsOop)) + && (isBytes(bytesOop)))) { return primitiveFailFor(PrimErrBadArgument); } wordCount = stSizeOf(wordsOop); @@ -211,15 +204,15 @@ primitiveCopyWordsIntoBytesBigEndian(void) if (!((wordCount * 4) == byteCount)) { return primitiveFailFor(PrimErrBadArgument); } - words = firstIndexableField(wordsOop); - bytes = firstIndexableField(bytesOop); /* begin copyWords:into:count: */ + source = firstIndexableField(wordsOop); + target = firstIndexableField(bytesOop); if (VMBIGENDIAN) { - memcpy(((unsigned int *) bytes), words, wordCount * 4); + memcpy(target, source, wordCount * 4); } else { for (i = 0; i < wordCount; i += 1) { - (((unsigned int *) bytes))[i] = (SQ_SWAP_4_BYTES((words[i]))); + target[i] = (SQ_SWAP_4_BYTES((source[i]))); } } methodReturnReceiver(); @@ -274,9 +267,9 @@ primitiveSHA256ProcessBufferUpdatingHash(void) && ((stSizeOf(hashOop)) == 8))))) { return primitiveFailFor(PrimErrBadArgument); } + /* begin sha256ProcessBuffer:updatingHash: */ buffer = firstIndexableField(bufferOop); hash = firstIndexableField(hashOop); - /* begin sha256ProcessBuffer:updatingHash: */ /* begin sha256CopyAndExpandBuffer:into: */ if (VMBIGENDIAN) { memcpy(w, ((unsigned int*) buffer), 64); @@ -363,29 +356,24 @@ primitiveSHA512ProcessBufferUpdatingHash(void) if (!((methodArgumentCount()) == 2)) { return primitiveFailFor(PrimErrBadNumArgs); } - bufferOop = stackObjectValue(1); + bufferOop = stackValue(1); + hashOop = stackValue(0); if (!((isBytes(bufferOop)) - && ((stSizeOf(bufferOop)) == 128))) { - return primitiveFailFor(PrimErrBadArgument); - } - - /* TODO: there's no easy way to check whether doubleWordsOop is a DoubleWord object, so be creative here */ - hashOop = stackObjectValue(0); - if (!((isWordsOrBytes(hashOop)) - && (((stSizeOf(hashOop)) == 8) - && ((byteSizeOf(hashOop)) == 64)))) { + && (((stSizeOf(bufferOop)) == 128) + && ((isLong64s(hashOop)) + && ((stSizeOf(hashOop)) == 8))))) { return primitiveFailFor(PrimErrBadArgument); } + /* begin sha512ProcessBuffer:updatingHash: */ buffer = firstIndexableField(bufferOop); hash = firstIndexableField(hashOop); - /* begin sha512ProcessBuffer:updatingHash: */ /* begin sha512CopyAndExpandBuffer:into: */ if (VMBIGENDIAN) { - memcpy(((unsigned long *) w), ((unsigned long *) (((unsigned long long*) buffer))), 128); + memcpy(w, ((unsigned long long*) buffer), 128); } else { for (i1 = 0; i1 < 16; i1 += 1) { - (((unsigned long *) w))[i1] = (SQ_SWAP_8_BYTES(((((unsigned long *) (((unsigned long long*) buffer))))[i1]))); + w[i1] = (SQ_SWAP_8_BYTES(((((unsigned long long*) buffer))[i1]))); } } for (i2 = 16; i2 <= 79; i2 += 1) { @@ -454,14 +442,19 @@ setInterpreter(struct VirtualMachine *anInterpreter) byteSizeOf = interpreterProxy->byteSizeOf; firstIndexableField = interpreterProxy->firstIndexableField; isBytes = interpreterProxy->isBytes; +#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 17) + isLong64s = interpreterProxy->isLong64s; +#else +#if !defined(isLong64s) + isLong64s = 0; +#endif +#endif isWords = interpreterProxy->isWords; - isWordsOrBytes = interpreterProxy->isWordsOrBytes; methodArgumentCount = interpreterProxy->methodArgumentCount; methodReturnBool = interpreterProxy->methodReturnBool; methodReturnReceiver = interpreterProxy->methodReturnReceiver; primitiveFailFor = interpreterProxy->primitiveFailFor; stSizeOf = interpreterProxy->stSizeOf; - stackObjectValue = interpreterProxy->stackObjectValue; stackValue = interpreterProxy->stackValue; #endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */ } @@ -478,7 +471,7 @@ void* SHA2Plugin_exports[][3] = { {(void*)_m, "primitiveCopyWordsIntoBytesBigEndian\000\001\001", (void*)primitiveCopyWordsIntoBytesBigEndian}, {(void*)_m, "primitiveIsPluginAvailable\000\377\001", (void*)primitiveIsPluginAvailable}, {(void*)_m, "primitiveSHA256ProcessBufferUpdatingHash\000\001\003", (void*)primitiveSHA256ProcessBufferUpdatingHash}, - {(void*)_m, "primitiveSHA512ProcessBufferUpdatingHash\000\001\001", (void*)primitiveSHA512ProcessBufferUpdatingHash}, + {(void*)_m, "primitiveSHA512ProcessBufferUpdatingHash\000\001\003", (void*)primitiveSHA512ProcessBufferUpdatingHash}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; @@ -490,7 +483,7 @@ EXPORT(signed short) primitiveCopyDoubleWordsIntoBytesBigEndianMetadata = 0x101; EXPORT(signed short) primitiveCopyWordsIntoBytesBigEndianMetadata = 0x101; EXPORT(signed short) primitiveIsPluginAvailableMetadata = -255; EXPORT(signed short) primitiveSHA256ProcessBufferUpdatingHashMetadata = 259; -EXPORT(signed short) primitiveSHA512ProcessBufferUpdatingHashMetadata = 0x101; +EXPORT(signed short) primitiveSHA512ProcessBufferUpdatingHashMetadata = 259; #endif // SPURVM #endif // ifdef SQ_BUILTIN_PLUGIN