Author: eliot Date: 2011-10-09 10:16:26 -0700 (Sun, 09 Oct 2011) New Revision: 2499 Modified: branches/Cog/macbuild/CoreMTVM.xcodeproj/project.pbxproj branches/Cog/macbuild/CoreVM.xcodeproj/project.pbxproj 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/platforms/Cross/vm/sqExternalSemaphores.c branches/Cog/platforms/Cross/vm/sqSCCSVersion.h branches/Cog/platforms/Mac OS/plugins/SoundPlugin/sqUnixSoundMacOSXJMM.c branches/Cog/platforms/Mac OS/vm/Developer/sqGnu.h branches/Cog/platforms/Mac OS/vm/sqMacNSPluginUILogic2.c branches/Cog/platforms/Mac OS/vm/sqMacUIEventsUniversal.c branches/Cog/platforms/Mac OS/vm/sqMacUnixCommandLineInterface.c branches/Cog/platforms/Mac OS/vm/sqPlatformSpecific.h branches/Cog/platforms/unix/vm/sqGnu.h branches/Cog/platforms/unix/vm/sqUnixMain.c branches/Cog/platforms/win32/vm/sqGnu.h branches/Cog/platforms/win32/vm/sqWin32Args.c branches/Cog/platforms/win32/vm/sqWin32Args.h branches/Cog/platforms/win32/vm/sqWin32Intel.c branches/Cog/platforms/win32/vm/sqWin32Service.c branches/Cog/platforms/win32/vm/sqWin32Window.c branches/Cog/src/vm/cointerp.c branches/Cog/src/vm/cointerp.h branches/Cog/src/vm/cointerpmt.c branches/Cog/src/vm/cointerpmt.h branches/Cog/src/vm/gcc3x-cointerp.c branches/Cog/src/vm/gcc3x-cointerpmt.c branches/Cog/src/vm/interp.h branches/Cog/src/vm/vmCallback.h Log: CogVM source as per VMMaker.oscog-eem.133. Tiny performance tweak to bytecodePrimMultiply. Added findStringBeginningWith: debugging facility. Fix yet another slip in Cogit>>lookup:for:methodAndErrorSelectorInto: for cannotInterpret: cases. Fixes Mariano's crash as of 2011/10/03. Add -numextsems command-line argument to set size of external semaphore table on start-up. Changes to allow compilation via clang 1.7 on Mac OS X. Assert & Debug VMs work. -O2 production VM crashes on start-up. Modified: branches/Cog/macbuild/CoreMTVM.xcodeproj/project.pbxproj =================================================================== --- branches/Cog/macbuild/CoreMTVM.xcodeproj/project.pbxproj 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/macbuild/CoreMTVM.xcodeproj/project.pbxproj 2011-10-09 17:16:26 UTC (rev 2499) @@ -258,17 +258,6 @@ DAFA08940AA64625008DF459 /* Croquet.icns in Resources */ = {isa = PBXBuildFile; fileRef = DAFA08930AA64625008DF459 /* Croquet.icns */; }; /* End PBXBuildFile section */ -/* Begin PBXBuildRule section */ - A23738BF107FC08B00AB4620 /* PBXBuildRule */ = { - isa = PBXBuildRule; - compilerSpec = com.apple.compilers.gcc.4_2; - fileType = sourcecode.c; - isEditable = 1; - outputFiles = ( - ); - }; -/* End PBXBuildRule section */ - /* Begin PBXFileReference section */ 0192233A00CCBFCBC0A80109 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; }; 05DD6BB000CCC66FC0A80109 /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; }; @@ -1736,9 +1725,6 @@ 941A3BFA09AA144000C9D25A /* Frameworks */, 941A3C0409AA144000C9D25A /* Rez */, ); - buildRules = ( - A23738BF107FC08B00AB4620 /* PBXBuildRule */, - ); comments = " @@ -2233,7 +2219,7 @@ SQUEAK_BUILTIN_PLUGIN, TARGET_API_MAC_CARBON, ); - GCC_VERSION = com.apple.compilers.gcc.4_2; + GCC_VERSION = 4.2; HEADER_SEARCH_PATHS = ( /Developer/Headers/FlatCarbon, $SRCROOT, Modified: branches/Cog/macbuild/CoreVM.xcodeproj/project.pbxproj =================================================================== --- branches/Cog/macbuild/CoreVM.xcodeproj/project.pbxproj 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/macbuild/CoreVM.xcodeproj/project.pbxproj 2011-10-09 17:16:26 UTC (rev 2499) @@ -258,17 +258,6 @@ DAFA08940AA64625008DF459 /* Croquet.icns in Resources */ = {isa = PBXBuildFile; fileRef = DAFA08930AA64625008DF459 /* Croquet.icns */; }; /* End PBXBuildFile section */ -/* Begin PBXBuildRule section */ - A23738BF107FC08B00AB4620 /* PBXBuildRule */ = { - isa = PBXBuildRule; - compilerSpec = com.apple.compilers.gcc.4_2; - fileType = sourcecode.c; - isEditable = 1; - outputFiles = ( - ); - }; -/* End PBXBuildRule section */ - /* Begin PBXFileReference section */ 0192233A00CCBFCBC0A80109 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; }; 05DD6BB000CCC66FC0A80109 /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; }; @@ -1736,9 +1725,6 @@ 941A3BFA09AA144000C9D25A /* Frameworks */, 941A3C0409AA144000C9D25A /* Rez */, ); - buildRules = ( - A23738BF107FC08B00AB4620 /* PBXBuildRule */, - ); comments = " @@ -2233,7 +2219,7 @@ SQUEAK_BUILTIN_PLUGIN, TARGET_API_MAC_CARBON, ); - GCC_VERSION = com.apple.compilers.gcc.4_2; + GCC_VERSION = 4.2; HEADER_SEARCH_PATHS = ( /Developer/Headers/FlatCarbon, $SRCROOT, Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/nscogsrc/vm/cointerp.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 from - CoInterpreter VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -511,6 +511,7 @@ static void findNewMethodInClass(sqInt class); sqInt findSelectorOfMethodforReceiver(sqInt meth, sqInt rcvr); static char * findSPOfon(char *theFP, StackPage *thePage); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void * firstFixedField(sqInt oop); void * firstIndexableField(sqInt oop); @@ -1894,7 +1895,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.131"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.133"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -7235,9 +7236,9 @@ rcvr = (rcvr >> 1); arg = (arg >> 1); result = rcvr * arg; - if (((arg == 0) - || ((result / arg) == rcvr)) - && ((result ^ (result << 1)) >= 0)) { + if ((arg == 0) + || (((result / arg) == rcvr) + && ((result ^ (result << 1)) >= 0))) { /* begin internalPop:thenPush: */ longAtPointerput((localSP += (2 - 1) * BytesPerWord), ((result << 1) | 1)); /* begin fetchNextBytecode */ @@ -16200,6 +16201,51 @@ } +/* Print the oops of all string-like things that start with the same + characters as aCString + */ + +void +findStringBeginningWith(char *aCString) +{ + sqInt cssz; + sqInt header; + sqInt obj; + sqInt sz; + + cssz = strlen(aCString); + obj = heapBase + (headerTypeBytes[(longAt(heapBase)) & TypeMask]); + while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) { + if (((longAt(obj)) & TypeMask) == HeaderTypeFree) { + sz = (longAt(obj)) & AllButTypeMask; + } + else { + if ((((((usqInt) (longAt(obj))) >> 8) & 15) >= 8) + && (((lengthOf(obj)) >= cssz) + && ((strncmp(aCString, pointerForOop(obj + BaseHeaderSize), cssz)) == 0))) { + printHex(obj); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printNum(lengthOf(obj)); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printOopShort(obj); + /* begin cr */ + printf("\n"); + } + /* begin sizeBitsOf: */ + header = longAt(obj); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(obj - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + } + obj = (obj + sz) + (headerTypeBytes[(longAt(obj + sz)) & TypeMask]); + } +} + + /* Print the oops of all string-like things that have the same characters as aCString */ Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/nscogsrc/vm/cointerp.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ @@ -68,6 +68,7 @@ sqInt failed(void); sqInt falseObject(void); sqInt fetchByteofObject(sqInt byteIndex, sqInt oop); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void flushExternalPrimitiveOf(sqInt methodObj); sqInt formatOfClass(sqInt classPointer); Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 from - CoInterpreter VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -514,6 +514,7 @@ static void findNewMethodInClass(sqInt class); sqInt findSelectorOfMethodforReceiver(sqInt meth, sqInt rcvr); static char * findSPOfon(char *theFP, StackPage *thePage); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void * firstFixedField(sqInt oop); void * firstIndexableField(sqInt oop); @@ -1897,7 +1898,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.131"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.133"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -7239,9 +7240,9 @@ rcvr = (rcvr >> 1); arg = (arg >> 1); result = rcvr * arg; - if (((arg == 0) - || ((result / arg) == rcvr)) - && ((result ^ (result << 1)) >= 0)) { + if ((arg == 0) + || (((result / arg) == rcvr) + && ((result ^ (result << 1)) >= 0))) { /* begin internalPop:thenPush: */ longAtPointerput((localSP += (2 - 1) * BytesPerWord), ((result << 1) | 1)); /* begin fetchNextBytecode */ @@ -16204,6 +16205,51 @@ } +/* Print the oops of all string-like things that start with the same + characters as aCString + */ + +void +findStringBeginningWith(char *aCString) +{ + sqInt cssz; + sqInt header; + sqInt obj; + sqInt sz; + + cssz = strlen(aCString); + obj = heapBase + (headerTypeBytes[(longAt(heapBase)) & TypeMask]); + while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) { + if (((longAt(obj)) & TypeMask) == HeaderTypeFree) { + sz = (longAt(obj)) & AllButTypeMask; + } + else { + if ((((((usqInt) (longAt(obj))) >> 8) & 15) >= 8) + && (((lengthOf(obj)) >= cssz) + && ((strncmp(aCString, pointerForOop(obj + BaseHeaderSize), cssz)) == 0))) { + printHex(obj); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printNum(lengthOf(obj)); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printOopShort(obj); + /* begin cr */ + printf("\n"); + } + /* begin sizeBitsOf: */ + header = longAt(obj); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(obj - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + } + obj = (obj + sz) + (headerTypeBytes[(longAt(obj + sz)) & TypeMask]); + } +} + + /* Print the oops of all string-like things that have the same characters as aCString */ Modified: branches/Cog/nscogsrc/vm/interp.h =================================================================== --- branches/Cog/nscogsrc/vm/interp.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/nscogsrc/vm/interp.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/nscogsrc/vm/vmCallback.h =================================================================== --- branches/Cog/nscogsrc/vm/vmCallback.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/nscogsrc/vm/vmCallback.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ #define VM_CALLBACK_INC 1 Modified: branches/Cog/platforms/Cross/vm/sqExternalSemaphores.c =================================================================== --- branches/Cog/platforms/Cross/vm/sqExternalSemaphores.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/Cross/vm/sqExternalSemaphores.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -98,12 +98,15 @@ ioSetMaxExtSemTableSize(int n) { #if COGMTVM - if (getVMOSThread()) /* initialization is a little different in MT. Hack around for now */ + /* initialization is a little different in MT. Hack around assert for now */ + if (getVMOSThread()) #endif - assert(ioOSThreadsEqual(ioCurrentOSThread(),getVMOSThread())); + if (numSignalRequests) + assert(ioOSThreadsEqual(ioCurrentOSThread(),getVMOSThread())); if (numSignalRequests < n) { extern sqInt highBit(sqInt); - int sz = 1 << highBit(n); + int sz = 1 << highBit(n-1); + assert(sz >= n); signalRequests = realloc(signalRequests, sz * sizeof(SignalRequest)); memset(signalRequests + numSignalRequests, 0, Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h ___________________________________________________________________ Modified: checkindate - Tue Oct 4 07:46:22 PDT 2011 + Sun Oct 9 10:12:20 PDT 2011 Modified: branches/Cog/platforms/Mac OS/plugins/SoundPlugin/sqUnixSoundMacOSXJMM.c =================================================================== --- branches/Cog/platforms/Mac OS/plugins/SoundPlugin/sqUnixSoundMacOSXJMM.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/Mac OS/plugins/SoundPlugin/sqUnixSoundMacOSXJMM.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -91,9 +91,10 @@ #if (DEBUG) - void dumpFormat(AudioStreamBasicDescription *fmt); // atend +void dumpFormat(AudioStreamBasicDescription *fmt); // atend - void dprintf(const char *fmt, ...) +void +dprintf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -102,17 +103,16 @@ } #else // !DEBUG - void dumpFormat(AudioStreamBasicDescription *fmt); - inline void dumpFormat(AudioStreamBasicDescription *fmt) { +inline_and_export void +dumpFormat(AudioStreamBasicDescription *fmt) { #pragma unused(fmt) } #define dprintf(ARGS, ...) // inline void dprintf(const char *fmt, ...) {} #endif // !DEBUG - void eprintf(const char *fmt, ...); - - void eprintf(const char *fmt, ...) +void +eprintf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -120,17 +120,17 @@ va_end(ap); } -sqInt min(sqInt i, sqInt j); -sqInt max(sqInt i, sqInt j); +/* N.B. static qualifier is important for clang which won't inline these two + * functions otherwise. + */ +static inline sqInt min(sqInt i, sqInt j) { return (i < j) ? i : j; } +static inline sqInt max(sqInt i, sqInt j) { return (i > j) ? i : j; } -inline sqInt min(sqInt i, sqInt j) { return (i < j) ? i : j; } -inline sqInt max(sqInt i, sqInt j) { return (i > j) ? i : j; } - // Apple error codes are really (rather contrived) 4-byte chars with // (almost) meaningful content. // - char *str4(UInt32 chars); - char *str4(UInt32 chars) +char * +str4(UInt32 chars) { static char str[5]; *(sqInt *)&str= chars; @@ -138,9 +138,8 @@ return str; } -sqInt checkError(OSStatus err, char *op, char *param); - - inline sqInt checkError(OSStatus err, char *op, char *param) +inline_and_export sqInt +checkError(OSStatus err, char *op, char *param) { if (kAudioHardwareNoError != noErr) { @@ -168,9 +167,8 @@ // allocate a new, empty buffer // -Buffer *Buffer_new(sqInt size); - -Buffer *Buffer_new(sqInt size) +Buffer * +Buffer_new(sqInt size) { Buffer *b= (Buffer *)malloc(sizeof(Buffer)); if (!b) @@ -189,9 +187,8 @@ // deallocate a buffer // -void Buffer_delete(Buffer *b); - -void Buffer_delete(Buffer *b) +void +Buffer_delete(Buffer *b) { assert(b && b->data); free(b->data); @@ -201,28 +198,19 @@ // answer how many bytes are available for reading // -inline sqInt Buffer_avail(Buffer *b); +inline_and_export sqInt +Buffer_avail(Buffer *b) { return b->avail; } -inline sqInt Buffer_avail(Buffer *b) -{ - return b->avail; -} - // answer how many bytes can be written // -inline sqInt Buffer_free(Buffer *b); +inline_and_export sqInt +Buffer_free(Buffer *b) { return b->size - Buffer_avail(b); } -inline sqInt Buffer_free(Buffer *b) -{ - return b->size - Buffer_avail(b); -} - // set outputs to address and size of zero (empty), one (contiguous) or two // (wrapped, fragmented) populated regions in the buffer // -inline sqInt Buffer_getOutputPointers(Buffer *b, char **p1, sqInt *n1, char **p2, sqInt *n2); - -inline sqInt Buffer_getOutputPointers(Buffer *b, char **p1, sqInt *n1, char **p2, sqInt *n2) +inline_and_export sqInt +Buffer_getOutputPointers(Buffer *b, char **p1, sqInt *n1, char **p2, sqInt *n2) { sqInt optr= b->optr; sqInt avail= Buffer_avail(b); @@ -250,9 +238,8 @@ // set the output to the current read position and answer the amount of // data at that location // -inline sqInt Buffer_getOutputPointer(Buffer *b, char **ptr); - -inline sqInt Buffer_getOutputPointer(Buffer *b, char **ptr) +inline sqInt +Buffer_getOutputPointer(Buffer *b, char **ptr) { sqInt optr= b->optr; sqInt avail= Buffer_avail(b); @@ -266,9 +253,8 @@ // set the output to the current write location and answer the number of // bytes that can be written to that location // -inline sqInt Buffer_getInputPointer(Buffer *b, char **ptr); - -inline sqInt Buffer_getInputPointer(Buffer *b, char **ptr) +inline sqInt +Buffer_getInputPointer(Buffer *b, char **ptr) { sqInt iptr= b->iptr; sqInt nfree= Buffer_free(b); @@ -281,9 +267,8 @@ // increment the output pointer over a contiguous section of buffer // -inline void Buffer_advanceOutputPointer(Buffer *b, sqInt size); - -inline void Buffer_advanceOutputPointer(Buffer *b, sqInt size) +inline_and_export void +Buffer_advanceOutputPointer(Buffer *b, sqInt size) { sqInt optr= b->optr; sqInt avail= b->avail; @@ -298,9 +283,8 @@ // advance the input pointer over a contiguous section of buffer // -inline void Buffer_advanceInputPointer(Buffer *b, sqInt size); - -inline void Buffer_advanceInputPointer(Buffer *b, sqInt size) +inline void +Buffer_advanceInputPointer(Buffer *b, sqInt size) { sqInt iptr= b->iptr; sqInt nfree= Buffer_free(b); @@ -316,9 +300,8 @@ // clear the given number of bytes at the input position and advance the // input pointer past them // -inline void Buffer_prefill(Buffer *b, sqInt bytes); - -inline void Buffer_prefill(Buffer *b, sqInt bytes) +inline void +Buffer_prefill(Buffer *b, sqInt bytes) { char *ptr; sqInt size= Buffer_getInputPointer(b, &ptr); @@ -330,9 +313,8 @@ // write at most nbytes from buf into the buffer, wrapping in the middle if // necessary. answer the actual number of bytes written. // -inline sqInt Buffer_write(Buffer *b, char *buf, sqInt nbytes); - -inline sqInt Buffer_write(Buffer *b, char *buf, sqInt nbytes) +inline_and_export sqInt +Buffer_write(Buffer *b, char *buf, sqInt nbytes) { sqInt iptr= b->iptr; sqInt bytesToCopy= min(nbytes, Buffer_free(b)); @@ -358,9 +340,8 @@ return bytesCopied; } -inline sqInt Buffer_writeRecheck(Buffer *b, char *buf, sqInt nbytes); - -inline sqInt Buffer_writeRecheck(Buffer *b, char *buf, sqInt nbytes) +inline_and_export sqInt +Buffer_writeRecheck(Buffer *b, char *buf, sqInt nbytes) { sqInt iptr= b->iptr; sqInt bytesToCopy= min(nbytes, Buffer_free(b)); @@ -392,9 +373,8 @@ // read at most nbytes from the buffer into buf, wrapping in the middle if // necessary. answer the actual number of bytes read. // -inline sqInt Buffer_read(Buffer *b, char *buf, sqInt nbytes); - -inline sqInt Buffer_read(Buffer *b, char *buf, sqInt nbytes) +inline sqInt +Buffer_read(Buffer *b, char *buf, sqInt nbytes) { sqInt optr= b->optr; sqInt bytesToCopy= min(nbytes, Buffer_avail(b)); @@ -1100,7 +1080,8 @@ #if (DEBUG) - void dumpFormat(AudioStreamBasicDescription *fmt) +void +dumpFormat(AudioStreamBasicDescription *fmt) { UInt32 flags= fmt->mFormatFlags; Modified: branches/Cog/platforms/Mac OS/vm/Developer/sqGnu.h =================================================================== --- branches/Cog/platforms/Mac OS/vm/Developer/sqGnu.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/Mac OS/vm/Developer/sqGnu.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -163,47 +163,49 @@ currentBytecode. Wins big on register-deficient architectures -- especially Intel. */ -#if defined(__mips__) +#if defined(__clang__) +/* clang can't compile specific register assignments */ +#elif defined(__mips__) # define IP_REG asm("$16") # define SP_REG asm("$17") # define CB_REG asm("$18") -#endif -#if defined(__sparc__) +#elif defined(__sparc__) # define IP_REG asm("%l0") # define SP_REG asm("%l1") # define CB_REG asm("%l2") -#endif -#if defined(__alpha__) +#elif defined(__alpha__) # define IP_REG asm("$9") # define SP_REG asm("$10") # define CB_REG asm("$11") -#endif -#if defined(__i386__) +#elif defined(__i386__) # define IP_REG asm("%esi") # define SP_REG asm("%edi") # define CB_REG asm("%ebx") -#endif -#if defined(__powerpc__) || defined(PPC) || defined(_POWER) || defined(_IBMR2) || defined(__ppc__) +#elif defined(__powerpc__) || defined(PPC) || defined(_POWER) || defined(_IBMR2) || defined(__ppc__) # define FOO_REG asm("13") # define JP_REG asm("14") # define IP_REG asm("15") # define SP_REG asm("16") # define CB_REG asm("17") -#endif -#if defined(__hppa__) +#elif defined(__hppa__) # define IP_REG asm("%r18") # define SP_REG asm("%r17") # define CB_REG asm("%r16") -#endif -#if defined(__mc68000__) +#elif defined(__mc68000__) # define IP_REG asm("a5") # define SP_REG asm("a4") # define CB_REG asm("d7") #endif -#if !defined(FOO_REG) -# define FOO_REG /* nada */ +#if !defined(CB_REG) +# define CB_REG /* nada */ #endif +#if !defined(IP_REG) +# define IP_REG /* nada */ +#endif +#if !defined(SP_REG) +# define SP_REG /* nada */ +#endif #if !defined(FP_REG) # define FP_REG /* nada */ #endif Modified: branches/Cog/platforms/Mac OS/vm/sqMacNSPluginUILogic2.c =================================================================== --- branches/Cog/platforms/Mac OS/vm/sqMacNSPluginUILogic2.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/Mac OS/vm/sqMacNSPluginUILogic2.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -144,17 +144,17 @@ return false; } -Boolean inline browserActiveAndDrawingContextOk() { +Boolean inline_and_export browserActiveAndDrawingContextOk() { return gSqueakBrowserSubProcess && SharedBrowserBitMapContextRef; } -Boolean inline browserActiveAndDrawingContextOkAndInFullScreenMode() { +Boolean inline_and_export browserActiveAndDrawingContextOkAndInFullScreenMode() { extern Boolean gSqueakBrowserWasHeadlessButMadeFullScreen; extern sqInt getFullScreenFlag(void); return browserActiveAndDrawingContextOk() && gSqueakBrowserWasHeadlessButMadeFullScreen && getFullScreenFlag(); } -Boolean inline browserActiveAndDrawingContextOkAndNOTInFullScreenMode() { +Boolean inline_and_export browserActiveAndDrawingContextOkAndNOTInFullScreenMode() { extern sqInt getFullScreenFlag(void); return browserActiveAndDrawingContextOk() && !getFullScreenFlag(); } Modified: branches/Cog/platforms/Mac OS/vm/sqMacUIEventsUniversal.c =================================================================== --- branches/Cog/platforms/Mac OS/vm/sqMacUIEventsUniversal.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/Mac OS/vm/sqMacUIEventsUniversal.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -1311,7 +1311,7 @@ * ioProcessEvents is disabled. If >= 0 inIOProcessEvents is incremented * to avoid reentrancy (i.e. for native GUIs). */ - if (inIOProcessEvents) return; + if (inIOProcessEvents) return 0; inIOProcessEvents += 1; aioPoll(0); Modified: branches/Cog/platforms/Mac OS/vm/sqMacUnixCommandLineInterface.c =================================================================== --- branches/Cog/platforms/Mac OS/vm/sqMacUnixCommandLineInterface.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/Mac OS/vm/sqMacUnixCommandLineInterface.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -181,6 +181,9 @@ extern sqInt desiredNumStackPages; desiredNumStackPages = atoi(argv[1]); return 2; } + else if (!strcmp(argv[0], "-numextsems")) { + ioSetMaxExtSemTableSize(atoi(argv[1])); + return 2; } else if (!strcmp(argv[0], "-noheartbeat")) { extern sqInt suppressHeartbeatFlag; suppressHeartbeatFlag = 1; Modified: branches/Cog/platforms/Mac OS/vm/sqPlatformSpecific.h =================================================================== --- branches/Cog/platforms/Mac OS/vm/sqPlatformSpecific.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/Mac OS/vm/sqPlatformSpecific.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -110,6 +110,16 @@ void CopyCStringToPascal(const char* src, Str255 dst); #endif +/* Macro for inlined functions. + As of 1.7, clang elides the original, even though global. + gcc & icc don't elide the original +*/ +#if defined(__clang__) +# define inline_and_export /* nada */ +#else +# define inline_and_export inline +#endif + /* undef the memory routines for our logic */ #undef sqGrowMemoryBy #undef sqShrinkMemoryBy Modified: branches/Cog/platforms/unix/vm/sqGnu.h =================================================================== --- branches/Cog/platforms/unix/vm/sqGnu.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/unix/vm/sqGnu.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -166,18 +166,15 @@ # define IP_REG __asm__("$16") # define SP_REG __asm__("$17") # define CB_REG __asm__("$18") -#endif -#if defined(__sparc__) +#elif defined(__sparc__) # define IP_REG __asm__("%l0") # define SP_REG __asm__("%l1") # define CB_REG __asm__("%l2") -#endif -#if defined(__alpha__) +#elif defined(__alpha__) # define IP_REG __asm__("$9") # define SP_REG __asm__("$10") # define CB_REG __asm__("$11") -#endif -#if defined(__i386__) +#elif defined(__i386__) # define IP_REG __asm__("%esi") # define SP_REG __asm__("%edi") # if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)) @@ -185,20 +182,17 @@ # else # define CB_REG /* avoid undue register pressure */ # endif -#endif -#if defined(__powerpc__) || defined(PPC) || defined(_POWER) || defined(_IBMR2) || defined(__ppc__) +#elif defined(__powerpc__) || defined(PPC) || defined(_POWER) || defined(_IBMR2) || defined(__ppc__) # define GP_REG __asm__("24") # define JP_REG __asm__("25") # define IP_REG __asm__("26") # define SP_REG __asm__("27") # define CB_REG __asm__("28") -#endif -#if defined(__hppa__) +#elif defined(__hppa__) # define IP_REG __asm__("%r18") # define SP_REG __asm__("%r17") # define CB_REG __asm__("%r16") -#endif -#if defined(__mc68000__) +#elif defined(__mc68000__) # define IP_REG __asm__("a5") # define SP_REG __asm__("a4") # define CB_REG __asm__("d7") @@ -219,9 +213,6 @@ #if !defined(GP_REG) # define GP_REG #endif -#if !defined(FOO_REG) -# define FOO_REG /* nada */ -#endif #if !defined(FP_REG) # define FP_REG /* nada */ #endif Modified: branches/Cog/platforms/unix/vm/sqUnixMain.c =================================================================== --- branches/Cog/platforms/unix/vm/sqUnixMain.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/unix/vm/sqUnixMain.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -1305,6 +1305,9 @@ extern sqInt desiredNumStackPages; desiredNumStackPages = atoi(argv[1]); return 2; } + else if (!strcmp(argv[0], "-numextsems")) { + ioSetMaxExtSemTableSize(atoi(argv[1])); + return 2; } else if (!strcmp(argv[0], "-noheartbeat")) { extern sqInt suppressHeartbeatFlag; suppressHeartbeatFlag = 1; Modified: branches/Cog/platforms/win32/vm/sqGnu.h =================================================================== --- branches/Cog/platforms/win32/vm/sqGnu.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/win32/vm/sqGnu.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -142,42 +142,42 @@ # define IP_REG asm("$16") # define SP_REG asm("$17") # define CB_REG asm("$18") -#endif -#if defined(__sparc__) +#elif defined(__sparc__) # define IP_REG asm("%l0") # define SP_REG asm("%l1") # define CB_REG asm("%l2") -#endif -#if defined(__alpha__) +#elif defined(__alpha__) # define IP_REG asm("$9") # define SP_REG asm("$10") # define CB_REG asm("$11") -#endif -#if defined(__i386__) +#elif defined(__i386__) # define IP_REG asm("%esi") # define SP_REG asm("%edi") # define CB_REG asm("%ebx") //# define JP_REG asm("%ebx") -#endif -#if defined(PPC) || defined(_POWER) || defined(_IBMR2) +#elif defined(PPC) || defined(_POWER) || defined(_IBMR2) # define IP_REG asm("26") # define SP_REG asm("27") # define CB_REG asm("28") -#endif -#if defined(__hppa__) +#elif defined(__hppa__) # define IP_REG asm("%r18") # define SP_REG asm("%r17") # define CB_REG asm("%r16") -#endif -#if defined(__mc68000__) +#elif defined(__mc68000__) # define IP_REG asm("a5") # define SP_REG asm("a4") # define CB_REG asm("d7") #endif -#if !defined(FOO_REG) -# define FOO_REG /* nada */ +#if !defined(CB_REG) +# define CB_REG /* nada */ #endif +#if !defined(IP_REG) +# define IP_REG /* nada */ +#endif +#if !defined(SP_REG) +# define SP_REG /* nada */ +#endif #if !defined(FP_REG) # define FP_REG /* nada */ #endif Modified: branches/Cog/platforms/win32/vm/sqWin32Args.c =================================================================== --- branches/Cog/platforms/win32/vm/sqWin32Args.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/win32/vm/sqWin32Args.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -166,6 +166,14 @@ break; } + case ARG_INT_FUNC: { + int dummy; + vmOptions[numOptionsVM++] = string; + string = parseSignedArg(string, &dummy); + ((void (*)(int))(arg->value))(dummy); + if(!string) return NULL; + break; + } case ARG_INT: vmOptions[numOptionsVM++] = string; *(char**) arg->value = string; Modified: branches/Cog/platforms/win32/vm/sqWin32Args.h =================================================================== --- branches/Cog/platforms/win32/vm/sqWin32Args.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/win32/vm/sqWin32Args.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -13,13 +13,14 @@ /* this goes separately so that we can insert the "hidden" name */ extern char imageName[]; -#define ARG_NONE 0 -#define ARG_FLAG 1 -#define ARG_STRING 2 -#define ARG_INT 3 -#define ARG_UINT 4 +#define ARG_NONE 0 +#define ARG_FLAG 1 +#define ARG_STRING 2 +#define ARG_INT 3 +#define ARG_UINT 4 #define ARG_STRING_FUNC 5 -#define ARG_NULL 6 +#define ARG_INT_FUNC 6 +#define ARG_NULL 7 typedef struct vmArg{ int type; Modified: branches/Cog/platforms/win32/vm/sqWin32Intel.c =================================================================== --- branches/Cog/platforms/win32/vm/sqWin32Intel.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/win32/vm/sqWin32Intel.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -1202,6 +1202,7 @@ #endif #if STACKVM || NewspeakVM { ARG_STRING_FUNC, setBreakSelector, "-breaksel:"}, /* break-point selector string */ + { ARG_INT_FUNC, ioSetMaxExtSemTableSize, "-numextsems:"}, /* set num external semaphores */ #endif /* STACKVM || NewspeakVM */ #if STACKVM { ARG_UINT, &checkForLeaks, "-leakcheck:"}, /* leak check on GC */ Modified: branches/Cog/platforms/win32/vm/sqWin32Service.c =================================================================== --- branches/Cog/platforms/win32/vm/sqWin32Service.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/win32/vm/sqWin32Service.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -77,8 +77,8 @@ lstrcat(buffer,TEXT(" ")); } #if STACKVM - { extern sqInt desiredNumStackPages; - extern sqInt desiredEdenBytes; + { extern sqInt desiredNumStackPages; + extern sqInt desiredEdenBytes; if (desiredEdenBytes) { lstrcat(buffer,TEXT("-eden: ")); # ifdef UNICODE @@ -97,6 +97,7 @@ # endif lstrcat(buffer,TEXT(" ")); } + } #endif /* STACKVM */ if(*logName) /* need -log: "logName" */ { Modified: branches/Cog/platforms/win32/vm/sqWin32Window.c =================================================================== --- branches/Cog/platforms/win32/vm/sqWin32Window.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/platforms/win32/vm/sqWin32Window.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -3218,6 +3218,7 @@ TEXT("\n\t-leakcheck: n \t(leak check on GC (1=full,2=incr,3=both))") TEXT("\n\t-eden: bytes \t(set eden memory size to bytes)") TEXT("\n\t-stackpages: n \t(use n stack pages)") + TEXT("\n\t-numextsems: n \t(allow up to n external semaphores)") TEXT("\n\t-noheartbeat \t(no heartbeat for debug)") #endif /* STACKVM */ #if COGVM Modified: branches/Cog/src/vm/cointerp.c =================================================================== --- branches/Cog/src/vm/cointerp.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/src/vm/cointerp.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 from - CoInterpreter VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -504,6 +504,7 @@ static void findNewMethodInClass(sqInt class); sqInt findSelectorOfMethodforReceiver(sqInt meth, sqInt rcvr); static char * findSPOfon(char *theFP, StackPage *thePage); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void * firstFixedField(sqInt oop); void * firstIndexableField(sqInt oop); @@ -1885,7 +1886,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.131]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.133]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -6995,9 +6996,9 @@ rcvr = (rcvr >> 1); arg = (arg >> 1); result = rcvr * arg; - if (((arg == 0) - || ((result / arg) == rcvr)) - && ((result ^ (result << 1)) >= 0)) { + if ((arg == 0) + || (((result / arg) == rcvr) + && ((result ^ (result << 1)) >= 0))) { /* begin internalPop:thenPush: */ longAtPointerput((localSP += (2 - 1) * BytesPerWord), ((result << 1) | 1)); /* begin fetchNextBytecode */ @@ -15739,6 +15740,51 @@ } +/* Print the oops of all string-like things that start with the same + characters as aCString + */ + +void +findStringBeginningWith(char *aCString) +{ + sqInt cssz; + sqInt header; + sqInt obj; + sqInt sz; + + cssz = strlen(aCString); + obj = heapBase + (headerTypeBytes[(longAt(heapBase)) & TypeMask]); + while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) { + if (((longAt(obj)) & TypeMask) == HeaderTypeFree) { + sz = (longAt(obj)) & AllButTypeMask; + } + else { + if ((((((usqInt) (longAt(obj))) >> 8) & 15) >= 8) + && (((lengthOf(obj)) >= cssz) + && ((strncmp(aCString, pointerForOop(obj + BaseHeaderSize), cssz)) == 0))) { + printHex(obj); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printNum(lengthOf(obj)); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printOopShort(obj); + /* begin cr */ + printf("\n"); + } + /* begin sizeBitsOf: */ + header = longAt(obj); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(obj - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + } + obj = (obj + sz) + (headerTypeBytes[(longAt(obj + sz)) & TypeMask]); + } +} + + /* Print the oops of all string-like things that have the same characters as aCString */ Modified: branches/Cog/src/vm/cointerp.h =================================================================== --- branches/Cog/src/vm/cointerp.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/src/vm/cointerp.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ @@ -68,6 +68,7 @@ sqInt failed(void); sqInt falseObject(void); sqInt fetchByteofObject(sqInt byteIndex, sqInt oop); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void flushExternalPrimitiveOf(sqInt methodObj); sqInt formatOfClass(sqInt classPointer); Modified: branches/Cog/src/vm/cointerpmt.c =================================================================== --- branches/Cog/src/vm/cointerpmt.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/src/vm/cointerpmt.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 from - CoInterpreterMT VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CoInterpreterMT VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -554,6 +554,7 @@ static void findNewMethodInClass(sqInt class); sqInt findSelectorOfMethodforReceiver(sqInt meth, sqInt rcvr); static char * findSPOfon(char *theFP, StackPage *thePage); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void * firstFixedField(sqInt oop); void * firstIndexableField(sqInt oop); @@ -1985,7 +1986,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.131]"; +const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.133]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; sqInt willNotThreadWarnCount; @@ -7097,9 +7098,9 @@ rcvr = (rcvr >> 1); arg = (arg >> 1); result = rcvr * arg; - if (((arg == 0) - || ((result / arg) == rcvr)) - && ((result ^ (result << 1)) >= 0)) { + if ((arg == 0) + || (((result / arg) == rcvr) + && ((result ^ (result << 1)) >= 0))) { /* begin internalPop:thenPush: */ longAtPointerput((localSP += (2 - 1) * BytesPerWord), ((result << 1) | 1)); /* begin fetchNextBytecode */ @@ -16356,6 +16357,51 @@ } +/* Print the oops of all string-like things that start with the same + characters as aCString + */ + +void +findStringBeginningWith(char *aCString) +{ + sqInt cssz; + sqInt header; + sqInt obj; + sqInt sz; + + cssz = strlen(aCString); + obj = heapBase + (headerTypeBytes[(longAt(heapBase)) & TypeMask]); + while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) { + if (((longAt(obj)) & TypeMask) == HeaderTypeFree) { + sz = (longAt(obj)) & AllButTypeMask; + } + else { + if ((((((usqInt) (longAt(obj))) >> 8) & 15) >= 8) + && (((lengthOf(obj)) >= cssz) + && ((strncmp(aCString, pointerForOop(obj + BaseHeaderSize), cssz)) == 0))) { + printHex(obj); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printNum(lengthOf(obj)); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printOopShort(obj); + /* begin cr */ + printf("\n"); + } + /* begin sizeBitsOf: */ + header = longAt(obj); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(obj - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + } + obj = (obj + sz) + (headerTypeBytes[(longAt(obj + sz)) & TypeMask]); + } +} + + /* Print the oops of all string-like things that have the same characters as aCString */ Modified: branches/Cog/src/vm/cointerpmt.h =================================================================== --- branches/Cog/src/vm/cointerpmt.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/src/vm/cointerpmt.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ @@ -69,6 +69,7 @@ sqInt failed(void); sqInt falseObject(void); sqInt fetchByteofObject(sqInt byteIndex, sqInt oop); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void flushExternalPrimitiveOf(sqInt methodObj); sqInt formatOfClass(sqInt classPointer); Modified: branches/Cog/src/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/src/vm/gcc3x-cointerp.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/src/vm/gcc3x-cointerp.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 from - CoInterpreter VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -507,6 +507,7 @@ static void findNewMethodInClass(sqInt class); sqInt findSelectorOfMethodforReceiver(sqInt meth, sqInt rcvr); static char * findSPOfon(char *theFP, StackPage *thePage); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void * firstFixedField(sqInt oop); void * firstIndexableField(sqInt oop); @@ -1888,7 +1889,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.131]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.133]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -6999,9 +7000,9 @@ rcvr = (rcvr >> 1); arg = (arg >> 1); result = rcvr * arg; - if (((arg == 0) - || ((result / arg) == rcvr)) - && ((result ^ (result << 1)) >= 0)) { + if ((arg == 0) + || (((result / arg) == rcvr) + && ((result ^ (result << 1)) >= 0))) { /* begin internalPop:thenPush: */ longAtPointerput((localSP += (2 - 1) * BytesPerWord), ((result << 1) | 1)); /* begin fetchNextBytecode */ @@ -15743,6 +15744,51 @@ } +/* Print the oops of all string-like things that start with the same + characters as aCString + */ + +void +findStringBeginningWith(char *aCString) +{ + sqInt cssz; + sqInt header; + sqInt obj; + sqInt sz; + + cssz = strlen(aCString); + obj = heapBase + (headerTypeBytes[(longAt(heapBase)) & TypeMask]); + while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) { + if (((longAt(obj)) & TypeMask) == HeaderTypeFree) { + sz = (longAt(obj)) & AllButTypeMask; + } + else { + if ((((((usqInt) (longAt(obj))) >> 8) & 15) >= 8) + && (((lengthOf(obj)) >= cssz) + && ((strncmp(aCString, pointerForOop(obj + BaseHeaderSize), cssz)) == 0))) { + printHex(obj); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printNum(lengthOf(obj)); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printOopShort(obj); + /* begin cr */ + printf("\n"); + } + /* begin sizeBitsOf: */ + header = longAt(obj); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(obj - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + } + obj = (obj + sz) + (headerTypeBytes[(longAt(obj + sz)) & TypeMask]); + } +} + + /* Print the oops of all string-like things that have the same characters as aCString */ Modified: branches/Cog/src/vm/gcc3x-cointerpmt.c =================================================================== --- branches/Cog/src/vm/gcc3x-cointerpmt.c 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/src/vm/gcc3x-cointerpmt.c 2011-10-09 17:16:26 UTC (rev 2499) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 from - CoInterpreterMT VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CoInterpreterMT VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -557,6 +557,7 @@ static void findNewMethodInClass(sqInt class); sqInt findSelectorOfMethodforReceiver(sqInt meth, sqInt rcvr); static char * findSPOfon(char *theFP, StackPage *thePage); +void findStringBeginningWith(char *aCString); void findString(char *aCString); void * firstFixedField(sqInt oop); void * firstIndexableField(sqInt oop); @@ -1988,7 +1989,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.131]"; +const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.133]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; sqInt willNotThreadWarnCount; @@ -7101,9 +7102,9 @@ rcvr = (rcvr >> 1); arg = (arg >> 1); result = rcvr * arg; - if (((arg == 0) - || ((result / arg) == rcvr)) - && ((result ^ (result << 1)) >= 0)) { + if ((arg == 0) + || (((result / arg) == rcvr) + && ((result ^ (result << 1)) >= 0))) { /* begin internalPop:thenPush: */ longAtPointerput((localSP += (2 - 1) * BytesPerWord), ((result << 1) | 1)); /* begin fetchNextBytecode */ @@ -16360,6 +16361,51 @@ } +/* Print the oops of all string-like things that start with the same + characters as aCString + */ + +void +findStringBeginningWith(char *aCString) +{ + sqInt cssz; + sqInt header; + sqInt obj; + sqInt sz; + + cssz = strlen(aCString); + obj = heapBase + (headerTypeBytes[(longAt(heapBase)) & TypeMask]); + while ((((usqInt) obj)) < (((usqInt) GIV(freeStart)))) { + if (((longAt(obj)) & TypeMask) == HeaderTypeFree) { + sz = (longAt(obj)) & AllButTypeMask; + } + else { + if ((((((usqInt) (longAt(obj))) >> 8) & 15) >= 8) + && (((lengthOf(obj)) >= cssz) + && ((strncmp(aCString, pointerForOop(obj + BaseHeaderSize), cssz)) == 0))) { + printHex(obj); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printNum(lengthOf(obj)); + /* begin space */ + /* begin printChar: */ + putchar(' '); + printOopShort(obj); + /* begin cr */ + printf("\n"); + } + /* begin sizeBitsOf: */ + header = longAt(obj); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(obj - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + } + obj = (obj + sz) + (headerTypeBytes[(longAt(obj + sz)) & TypeMask]); + } +} + + /* Print the oops of all string-like things that have the same characters as aCString */ Modified: branches/Cog/src/vm/interp.h =================================================================== --- branches/Cog/src/vm/interp.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/src/vm/interp.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/src/vm/vmCallback.h =================================================================== --- branches/Cog/src/vm/vmCallback.h 2011-10-04 14:47:44 UTC (rev 2498) +++ branches/Cog/src/vm/vmCallback.h 2011-10-09 17:16:26 UTC (rev 2499) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.131 uuid: 7a963469-105d-4374-9162-62c6dbd745f4 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 */ #define VM_CALLBACK_INC 1 |
Free forum by Nabble | Edit this page |