Revision: 2720 Author: eliot Date: 2013-04-12 15:16:14 -0700 (Fri, 12 Apr 2013) Log Message: ----------- CogVM source as per VMMaker.oscog-eem.285.
Eliminate some excessive use of push/popRemappableOop[:] in the SocketPlugin.
Modified Paths: -------------- branches/Cog/nscogsrc/plugins/SocketPlugin/SocketPlugin.c branches/Cog/src/plugins/SocketPlugin/SocketPlugin.c
Property Changed: ---------------- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Modified: branches/Cog/nscogsrc/plugins/SocketPlugin/SocketPlugin.c =================================================================== --- branches/Cog/nscogsrc/plugins/SocketPlugin/SocketPlugin.c 2013-04-12 19:00:52 UTC (rev 2719) +++ branches/Cog/nscogsrc/plugins/SocketPlugin/SocketPlugin.c 2013-04-12 22:16:14 UTC (rev 2720) @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.285 uuid: cb7737d2-7959-4494-ba87-9be6e6f1226b from - SocketPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 + SocketPlugin VMMaker.oscog-eem.285 uuid: cb7737d2-7959-4494-ba87-9be6e6f1226b */ -static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ; +static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.285 uuid: cb7737d2-7959-4494-ba87-9be6e6f1226b " __DATE__ ;
@@ -181,9 +181,9 @@ struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "SocketPlugin VMMaker.oscog-eem.235 (i)" + "SocketPlugin VMMaker.oscog-eem.285 (i)" #else - "SocketPlugin VMMaker.oscog-eem.235 (e)" + "SocketPlugin VMMaker.oscog-eem.285 (e)" #endif ; static void * sCCLOPfn; @@ -1388,13 +1388,10 @@ return null; } returnedValue = 0; - errorCode = sqSocketGetOptionsoptionNameStartoptionNameSizereturnedValue(s, optionNameStart, optionNameSize, &returnedValue); - pushRemappableOop(integerObjectOf(returnedValue)); - pushRemappableOop(integerObjectOf(errorCode)); - pushRemappableOop(instantiateClassindexableSize(classArray(), 2)); - results = popRemappableOop(); - storePointerofObjectwithValue(0, results, popRemappableOop()); - storePointerofObjectwithValue(1, results, popRemappableOop()); + errorCode = sqSocketGetOptionsoptionNameStartoptionNameSizereturnedValue(s, optionNameStart, optionNameSize, (&returnedValue)); + results = instantiateClassindexableSize(classArray(), 2); + storePointerofObjectwithValue(0, results, integerObjectOf(errorCode)); + storePointerofObjectwithValue(1, results, integerObjectOf(returnedValue)); if (failed()) { return null; } @@ -1787,9 +1784,9 @@ sqInt array; char *arrayBase; char *bufStart; - sqInt byteSize; sqInt bytesReceived; sqInt count; + sqInt elementSize; sqInt moreFlag; sqInt port; sqInt results; @@ -1812,10 +1809,10 @@ : ((SocketPtr) (firstIndexableField(socket)))); success(isWordsOrBytes(array)); if (isWords(array)) { - byteSize = 4; + elementSize = 4; } else { - byteSize = 1; + elementSize = 1; } success((startIndex >= 1) && ((count >= 0) @@ -1825,29 +1822,23 @@ /* Note: adjust bufStart for zero-origin indexing */
arrayBase = ((char *) (firstIndexableField(array))); + bufStart = arrayBase + ((startIndex - 1) * elementSize); + address = 0; + port = 0; + moreFlag = 0;
/* allocate storage for results, remapping newly allocated oops in case GC happens during allocation */
- bufStart = arrayBase + ((startIndex - 1) * byteSize); - address = 0; - port = 0; - moreFlag = 0; - bytesReceived = sqSocketReceiveUDPDataBufCountaddressportmoreFlag(s, bufStart, count * byteSize, &address, &port, &moreFlag); - pushRemappableOop(integerObjectOf(port)); + bytesReceived = sqSocketReceiveUDPDataBufCountaddressportmoreFlag(s, bufStart, count * elementSize, (&address), (&port), (&moreFlag)); pushRemappableOop(intToNetAddress(address)); - pushRemappableOop(integerObjectOf((bytesReceived / byteSize))); - pushRemappableOop(instantiateClassindexableSize(classArray(), 4)); - results = popRemappableOop(); - storePointerofObjectwithValue(0, results, popRemappableOop()); + results = instantiateClassindexableSize(classArray(), 4); + storePointerofObjectwithValue(0, results, integerObjectOf((bytesReceived / elementSize))); storePointerofObjectwithValue(1, results, popRemappableOop()); - storePointerofObjectwithValue(2, results, popRemappableOop()); - if (moreFlag) { - storePointerofObjectwithValue(3, results, trueObject()); - } - else { - storePointerofObjectwithValue(3, results, falseObject()); - } + storePointerofObjectwithValue(2, results, integerObjectOf(port)); + storePointerofObjectwithValue(3, results, (moreFlag + ? trueObject() + : falseObject())); } if (failed()) { return null; @@ -2123,6 +2114,15 @@ return null; }
+ +/* THIS BADLY NEEDS TO BE REWRITTEN TO TAKE Booleans AND Integers AS WELL AS + (OR INSTEAD OF) Strings. + It is only used with booleans and integers and parsing these back out of + strings in + + sqSocketSetOptions:optionNameStart:optionNameSize:optionValueStart:optionValueSize:returnedValue: + is STUPID. */ + EXPORT(sqInt) primitiveSocketSetOptions(void) { @@ -2160,13 +2160,10 @@ return null; } returnedValue = 0; - errorCode = sqSocketSetOptionsoptionNameStartoptionNameSizeoptionValueStartoptionValueSizereturnedValue(s, optionNameStart, optionNameSize, optionValueStart, optionValueSize, &returnedValue); - pushRemappableOop(integerObjectOf(returnedValue)); - pushRemappableOop(integerObjectOf(errorCode)); - pushRemappableOop(instantiateClassindexableSize(classArray(), 2)); - results = popRemappableOop(); - storePointerofObjectwithValue(0, results, popRemappableOop()); - storePointerofObjectwithValue(1, results, popRemappableOop()); + errorCode = sqSocketSetOptionsoptionNameStartoptionNameSizeoptionValueStartoptionValueSizereturnedValue(s, optionNameStart, optionNameSize, optionValueStart, optionValueSize, (&returnedValue)); + results = instantiateClassindexableSize(classArray(), 2); + storePointerofObjectwithValue(0, results, integerObjectOf(errorCode)); + storePointerofObjectwithValue(1, results, integerObjectOf(returnedValue)); if (failed()) { return null; }
Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h ___________________________________________________________________ Modified: checkindate - Fri Apr 12 11:56:58 PDT 2013 + Fri Apr 12 15:15:32 PDT 2013
Modified: branches/Cog/src/plugins/SocketPlugin/SocketPlugin.c =================================================================== --- branches/Cog/src/plugins/SocketPlugin/SocketPlugin.c 2013-04-12 19:00:52 UTC (rev 2719) +++ branches/Cog/src/plugins/SocketPlugin/SocketPlugin.c 2013-04-12 22:16:14 UTC (rev 2720) @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.285 uuid: cb7737d2-7959-4494-ba87-9be6e6f1226b from - SocketPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 + SocketPlugin VMMaker.oscog-eem.285 uuid: cb7737d2-7959-4494-ba87-9be6e6f1226b */ -static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.235 uuid: 954df856-3f83-498c-9735-6cd3777ba9c7 " __DATE__ ; +static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.285 uuid: cb7737d2-7959-4494-ba87-9be6e6f1226b " __DATE__ ;
@@ -181,9 +181,9 @@ struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "SocketPlugin VMMaker.oscog-eem.235 (i)" + "SocketPlugin VMMaker.oscog-eem.285 (i)" #else - "SocketPlugin VMMaker.oscog-eem.235 (e)" + "SocketPlugin VMMaker.oscog-eem.285 (e)" #endif ; static void * sCCLOPfn; @@ -1388,13 +1388,10 @@ return null; } returnedValue = 0; - errorCode = sqSocketGetOptionsoptionNameStartoptionNameSizereturnedValue(s, optionNameStart, optionNameSize, &returnedValue); - pushRemappableOop(integerObjectOf(returnedValue)); - pushRemappableOop(integerObjectOf(errorCode)); - pushRemappableOop(instantiateClassindexableSize(classArray(), 2)); - results = popRemappableOop(); - storePointerofObjectwithValue(0, results, popRemappableOop()); - storePointerofObjectwithValue(1, results, popRemappableOop()); + errorCode = sqSocketGetOptionsoptionNameStartoptionNameSizereturnedValue(s, optionNameStart, optionNameSize, (&returnedValue)); + results = instantiateClassindexableSize(classArray(), 2); + storePointerofObjectwithValue(0, results, integerObjectOf(errorCode)); + storePointerofObjectwithValue(1, results, integerObjectOf(returnedValue)); if (failed()) { return null; } @@ -1787,9 +1784,9 @@ sqInt array; char *arrayBase; char *bufStart; - sqInt byteSize; sqInt bytesReceived; sqInt count; + sqInt elementSize; sqInt moreFlag; sqInt port; sqInt results; @@ -1812,10 +1809,10 @@ : ((SocketPtr) (firstIndexableField(socket)))); success(isWordsOrBytes(array)); if (isWords(array)) { - byteSize = 4; + elementSize = 4; } else { - byteSize = 1; + elementSize = 1; } success((startIndex >= 1) && ((count >= 0) @@ -1825,29 +1822,23 @@ /* Note: adjust bufStart for zero-origin indexing */
arrayBase = ((char *) (firstIndexableField(array))); + bufStart = arrayBase + ((startIndex - 1) * elementSize); + address = 0; + port = 0; + moreFlag = 0;
/* allocate storage for results, remapping newly allocated oops in case GC happens during allocation */
- bufStart = arrayBase + ((startIndex - 1) * byteSize); - address = 0; - port = 0; - moreFlag = 0; - bytesReceived = sqSocketReceiveUDPDataBufCountaddressportmoreFlag(s, bufStart, count * byteSize, &address, &port, &moreFlag); - pushRemappableOop(integerObjectOf(port)); + bytesReceived = sqSocketReceiveUDPDataBufCountaddressportmoreFlag(s, bufStart, count * elementSize, (&address), (&port), (&moreFlag)); pushRemappableOop(intToNetAddress(address)); - pushRemappableOop(integerObjectOf((bytesReceived / byteSize))); - pushRemappableOop(instantiateClassindexableSize(classArray(), 4)); - results = popRemappableOop(); - storePointerofObjectwithValue(0, results, popRemappableOop()); + results = instantiateClassindexableSize(classArray(), 4); + storePointerofObjectwithValue(0, results, integerObjectOf((bytesReceived / elementSize))); storePointerofObjectwithValue(1, results, popRemappableOop()); - storePointerofObjectwithValue(2, results, popRemappableOop()); - if (moreFlag) { - storePointerofObjectwithValue(3, results, trueObject()); - } - else { - storePointerofObjectwithValue(3, results, falseObject()); - } + storePointerofObjectwithValue(2, results, integerObjectOf(port)); + storePointerofObjectwithValue(3, results, (moreFlag + ? trueObject() + : falseObject())); } if (failed()) { return null; @@ -2123,6 +2114,15 @@ return null; }
+ +/* THIS BADLY NEEDS TO BE REWRITTEN TO TAKE Booleans AND Integers AS WELL AS + (OR INSTEAD OF) Strings. + It is only used with booleans and integers and parsing these back out of + strings in + + sqSocketSetOptions:optionNameStart:optionNameSize:optionValueStart:optionValueSize:returnedValue: + is STUPID. */ + EXPORT(sqInt) primitiveSocketSetOptions(void) { @@ -2160,13 +2160,10 @@ return null; } returnedValue = 0; - errorCode = sqSocketSetOptionsoptionNameStartoptionNameSizeoptionValueStartoptionValueSizereturnedValue(s, optionNameStart, optionNameSize, optionValueStart, optionValueSize, &returnedValue); - pushRemappableOop(integerObjectOf(returnedValue)); - pushRemappableOop(integerObjectOf(errorCode)); - pushRemappableOop(instantiateClassindexableSize(classArray(), 2)); - results = popRemappableOop(); - storePointerofObjectwithValue(0, results, popRemappableOop()); - storePointerofObjectwithValue(1, results, popRemappableOop()); + errorCode = sqSocketSetOptionsoptionNameStartoptionNameSizeoptionValueStartoptionValueSizereturnedValue(s, optionNameStart, optionNameSize, optionValueStart, optionValueSize, (&returnedValue)); + results = instantiateClassindexableSize(classArray(), 2); + storePointerofObjectwithValue(0, results, integerObjectOf(errorCode)); + storePointerofObjectwithValue(1, results, integerObjectOf(returnedValue)); if (failed()) { return null; }
vm-dev@lists.squeakfoundation.org