Author: eliot Date: 2011-10-19 11:07:48 -0700 (Wed, 19 Oct 2011) New Revision: 2501 Added: branches/Cog/macbuild/SqueakMTFFIPrims/ branches/Cog/macbuild/SqueakMTFFIPrims/Info.plist branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFI.xcodeproj/ branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFI.xcodeproj/project.pbxproj branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFIPrims_Prefix.pch Modified: branches/Cog/nscogsrc/vm/cogit.c branches/Cog/nscogsrc/vm/cogit.h branches/Cog/nscogsrc/vm/cogmethod.h branches/Cog/nscogsrc/vm/cointerp.c branches/Cog/nscogsrc/vm/cointerp.h branches/Cog/nscogsrc/vm/gcc3x-cointerp.c branches/Cog/nscogsrc/vm/interp.h branches/Cog/nscogsrc/vm/vmCallback.h branches/Cog/platforms/Cross/vm/sqSCCSVersion.h branches/Cog/platforms/win32/vm/sqWin32Intel.c branches/Cog/src/vm/cogit.c branches/Cog/src/vm/cogit.h branches/Cog/src/vm/cogmethod.h branches/Cog/src/vm/cointerp.c branches/Cog/src/vm/cointerp.h branches/Cog/src/vm/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.134. Fix remaining bug in context access fixes of VMMaker.oscog-eem.119. stObject:at: and stObject:at:put: need to use stackPointerForMaybeMarriedContext: not fetchStackPointerOf:, since the context's stack pointer may be stale. Fix send trace printing. Interpreter sends need also to be printed. (A better fix is probably to redo sendBreakpoint: but this will serve for now). N.B. this reassigns the sendtrace flag values. Add primitiveNotEquivalent with prim # 169. Added: branches/Cog/macbuild/SqueakMTFFIPrims/Info.plist =================================================================== --- branches/Cog/macbuild/SqueakMTFFIPrims/Info.plist (rev 0) +++ branches/Cog/macbuild/SqueakMTFFIPrims/Info.plist 2011-10-19 18:07:48 UTC (rev 2501) @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>SqueakFFIPrims</string> + <key>CFBundleIdentifier</key> + <string>org.squeak.SqueakFFIPrims</string> + <key>CFBundleGetInfoString</key> + <string>SqueakFFIPrims for Squeak</string> + <key>CFBundleName</key> + <string>SqueakFFIPrims for Squeak</string> + <key>CFBundleIconFile</key> + <string>SqueakPlugin.icns</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>BNDL</string> + <key>CFBundleSignature</key> + <string>FAST</string> + <key>CFBundleVersion</key> + <string>1.1</string> + <key>CFBundleShortVersionString</key> + <string>1.1</string> + <key>CSResourcesFileMapped</key> + <true/> +</dict> +</plist> Added: branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFI.xcodeproj/project.pbxproj =================================================================== --- branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFI.xcodeproj/project.pbxproj (rev 0) +++ branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFI.xcodeproj/project.pbxproj 2011-10-19 18:07:48 UTC (rev 2501) @@ -0,0 +1,270 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 44; + objects = { + +/* Begin PBXBuildFile section */ + 458E6DD111C6D5850024C822 /* sqManualSurface.c in Sources */ = {isa = PBXBuildFile; fileRef = 458E6DD011C6D5850024C822 /* sqManualSurface.c */; }; + 730BD72610AA25350023C110 /* SqueakFFIPrims.c in Sources */ = {isa = PBXBuildFile; fileRef = 730BD72510AA25350023C110 /* SqueakFFIPrims.c */; }; + 730BD72810AA26D00023C110 /* sqFFIPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 730BD72710AA26D00023C110 /* sqFFIPlugin.c */; }; + 730BD73110AA277B0023C110 /* SqueakPlugin.icns in Resources */ = {isa = PBXBuildFile; fileRef = 730BD73010AA277B0023C110 /* SqueakPlugin.icns */; }; + 7386749111ED15E500E5B738 /* sqFFITestFuncs.c in Sources */ = {isa = PBXBuildFile; fileRef = 7386749011ED15E500E5B738 /* sqFFITestFuncs.c */; }; + 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; + 458E6DD011C6D5850024C822 /* sqManualSurface.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.c; fileEncoding = 4; name = sqManualSurface.c; path = ../../platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c; sourceTree = SOURCE_ROOT; }; + 730BD72510AA25350023C110 /* SqueakFFIPrims.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.c; fileEncoding = 4; name = SqueakFFIPrims.c; path = ../../src/plugins/SqueakFFIPrims/SqueakFFIPrims.c; sourceTree = SOURCE_ROOT; }; + 730BD72710AA26D00023C110 /* sqFFIPlugin.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.c; fileEncoding = 4; name = sqFFIPlugin.c; path = ../../platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c; sourceTree = SOURCE_ROOT; }; + 730BD72910AA26EF0023C110 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = "../../platforms/Mac OS/vm/config.h"; sourceTree = SOURCE_ROOT; }; + 730BD72A10AA26FB0023C110 /* interp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = interp.h; path = ../../src/vm/interp.h; sourceTree = SOURCE_ROOT; }; + 730BD72D10AA27410023C110 /* sqMemoryAccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqMemoryAccess.h; path = ../../platforms/Cross/vm/sqMemoryAccess.h; sourceTree = SOURCE_ROOT; }; + 730BD72F10AA27590023C110 /* sqVirtualMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqVirtualMachine.h; path = ../../platforms/Cross/vm/sqVirtualMachine.h; sourceTree = SOURCE_ROOT; }; + 730BD73010AA277B0023C110 /* SqueakPlugin.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = SqueakPlugin.icns; path = ../resources/ProjectBuilder/SqueakPlugin.icns; sourceTree = SOURCE_ROOT; }; + 733EFEAC10B4D31C00A2FDA5 /* sqFFI.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = sqFFI.h; path = ../../platforms/Cross/plugins/SqueakFFIPrims/sqFFI.h; sourceTree = SOURCE_ROOT; }; + 7386749011ED15E500E5B738 /* sqFFITestFuncs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sqFFITestFuncs.c; path = ../../platforms/Cross/plugins/SqueakFFIPrims/sqFFITestFuncs.c; sourceTree = SOURCE_ROOT; }; + 739A636B10AA442600F87ADB /* sqConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqConfig.h; path = "../../platforms/Mac OS/vm/sqConfig.h"; sourceTree = SOURCE_ROOT; }; + 739A636C10AA444800F87ADB /* sqPlatformSpecific.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqPlatformSpecific.h; path = "../../platforms/Mac OS/vm/sqPlatformSpecific.h"; sourceTree = SOURCE_ROOT; }; + 739BEEE011C96C240093BD8A /* sq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sq.h; path = ../../platforms/Cross/vm/sq.h; sourceTree = SOURCE_ROOT; }; + 73E2C0B310AA5C4700E80856 /* sqAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqAssert.h; path = ../../platforms/Cross/vm/sqAssert.h; sourceTree = SOURCE_ROOT; }; + 8D576316048677EA00EA77CD /* SqueakFFIPrims.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SqueakFFIPrims.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D576313048677EA00EA77CD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 089C166AFE841209C02AAC07 /* SqueakFFI */ = { + isa = PBXGroup; + children = ( + 08FB77AFFE84173DC02AAC07 /* Source */, + 089C167CFE841241C02AAC07 /* Resources */, + 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, + 19C28FB6FE9D52B211CA2CBB /* Products */, + ); + name = SqueakFFI; + sourceTree = "<group>"; + }; + 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = "<group>"; + }; + 089C167CFE841241C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 730BD73010AA277B0023C110 /* SqueakPlugin.icns */, + 8D576317048677EA00EA77CD /* Info.plist */, + ); + name = Resources; + sourceTree = "<group>"; + }; + 08FB77AFFE84173DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 7386749011ED15E500E5B738 /* sqFFITestFuncs.c */, + 739BEEE011C96C240093BD8A /* sq.h */, + 733EFEAC10B4D31C00A2FDA5 /* sqFFI.h */, + 73E2C0B310AA5C4700E80856 /* sqAssert.h */, + 739A636C10AA444800F87ADB /* sqPlatformSpecific.h */, + 739A636B10AA442600F87ADB /* sqConfig.h */, + 730BD72910AA26EF0023C110 /* config.h */, + 730BD72A10AA26FB0023C110 /* interp.h */, + 730BD72D10AA27410023C110 /* sqMemoryAccess.h */, + 730BD72F10AA27590023C110 /* sqVirtualMachine.h */, + 730BD72710AA26D00023C110 /* sqFFIPlugin.c */, + 730BD72510AA25350023C110 /* SqueakFFIPrims.c */, + 458E6DD011C6D5850024C822 /* sqManualSurface.c */, + ); + name = Source; + sourceTree = "<group>"; + }; + 19C28FB6FE9D52B211CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D576316048677EA00EA77CD /* SqueakFFIPrims.bundle */, + ); + name = Products; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D57630D048677EA00EA77CD /* SqueakFFIPrims */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "SqueakFFIPrims" */; + buildPhases = ( + 8D57630F048677EA00EA77CD /* Resources */, + 8D576311048677EA00EA77CD /* Sources */, + 8D576313048677EA00EA77CD /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SqueakFFIPrims; + productInstallPath = "$(HOME)/Library/Bundles"; + productName = SqueakFFI; + productReference = 8D576316048677EA00EA77CD /* SqueakFFIPrims.bundle */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 089C1669FE841209C02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "SqueakFFI" */; + compatibilityVersion = "Xcode 3.0"; + hasScannedForEncodings = 1; + mainGroup = 089C166AFE841209C02AAC07 /* SqueakFFI */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D57630D048677EA00EA77CD /* SqueakFFIPrims */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D57630F048677EA00EA77CD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 730BD73110AA277B0023C110 /* SqueakPlugin.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D576311048677EA00EA77CD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 730BD72610AA25350023C110 /* SqueakFFIPrims.c in Sources */, + 730BD72810AA26D00023C110 /* sqFFIPlugin.c in Sources */, + 458E6DD111C6D5850024C822 /* sqManualSurface.c in Sources */, + 7386749111ED15E500E5B738 /* sqFFITestFuncs.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB911B08733D790010E9CD /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "COGMTVM=1", + ); + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Library/Bundles"; + PRODUCT_NAME = SqueakFFIPrims; + WRAPPER_EXTENSION = bundle; + ZERO_LINK = YES; + }; + name = Development; + }; + 1DEB911C08733D790010E9CD /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = i386; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_OPTIMIZATION_LEVEL = 2; + GCC_PREPROCESSOR_DEFINITIONS = ( + "COGMTVM=1", + ); + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Library/Bundles"; + PRODUCT_NAME = SqueakFFIPrims; + WRAPPER_EXTENSION = bundle; + }; + name = Deployment; + }; + 1DEB911F08733D790010E9CD /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DEBUGGING_SYMBOLS = full; + GCC_ENABLE_OBJC_EXCEPTIONS = NO; + GCC_MODEL_TUNING = ""; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "COGMTVM=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-fno-omit-frame-pointer"; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Development; + }; + 1DEB912008733D790010E9CD /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + GCC_ENABLE_OBJC_EXCEPTIONS = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = ""; + GCC_OPTIMIZATION_LEVEL = 2; + GCC_PREPROCESSOR_DEFINITIONS = ( + "COGMTVM=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-fno-omit-frame-pointer"; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Deployment; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "SqueakFFIPrims" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB911B08733D790010E9CD /* Development */, + 1DEB911C08733D790010E9CD /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Deployment; + }; + 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "SqueakFFI" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB911F08733D790010E9CD /* Development */, + 1DEB912008733D790010E9CD /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Deployment; + }; +/* End XCConfigurationList section */ + }; + rootObject = 089C1669FE841209C02AAC07 /* Project object */; +} Added: branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFIPrims_Prefix.pch =================================================================== --- branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFIPrims_Prefix.pch (rev 0) +++ branches/Cog/macbuild/SqueakMTFFIPrims/SqueakFFIPrims_Prefix.pch 2011-10-19 18:07:48 UTC (rev 2501) @@ -0,0 +1,5 @@ +// +// Prefix header for all source files of the 'Template' target in the 'Template' project. +// + +#include <Carbon/Carbon.h> Modified: branches/Cog/nscogsrc/vm/cogit.c =================================================================== --- branches/Cog/nscogsrc/vm/cogit.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/nscogsrc/vm/cogit.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa + CCodeGenerator VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa + StackToRegisterMappingCogit VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -675,6 +675,7 @@ static sqInt genPrimitiveMod(void); static sqInt genPrimitiveMultiply(void); static sqInt genPrimitiveNotEqual(void); +static sqInt genPrimitiveNotEquivalent(void); static sqInt genPrimitiveQuo(void); static sqInt genPrimitiveSize(void); static sqInt genPrimitiveStringAt(void); @@ -1550,6 +1551,7 @@ { 0, -1, 0 }, { 0, -1, 0 }, { 0, -1, 0 }, + { genPrimitiveNotEquivalent, 1, 0 }, { 0, -1, 0 }, { 0, -1, 0 }, { 0, -1, 0 }, @@ -1578,7 +1580,6 @@ { 0, -1, 0 }, { 0, -1, 0 }, { 0, -1, 0 }, - { 0, -1, 0 }, { genFastPrimFail, -1, 0 }, { genFastPrimFail, -1, 0 }, { 0, -1, 0 }, @@ -1621,7 +1622,7 @@ static AbstractInstruction * stackCheckLabel; static AbstractInstruction * stackOverflowCall; static sqInt superSendTrampolines[NumSendTrampolines]; -int traceLinkedSends = 2 /* prim trace log on by default */; +int traceLinkedSends = 8 /* prim trace log on by default */; sqInt traceStores; static char *trampolineAddresses[NumTrampolines*2]; static sqInt trampolineTableIndex; @@ -1644,7 +1645,7 @@ opcodeIndex = labelCounter = annotationIndex = 0; \ } while (0) #define blockStartAt(index) (&blockStarts[index]) -#define breakOnImplicitReceiver() (traceLinkedSends & 16) +#define breakOnImplicitReceiver() (traceLinkedSends & 32) #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline) #define ceCheckFeatures() ceCheckFeaturesFunction() @@ -1676,11 +1677,12 @@ #define notYetImplemented() warning("not yet implemented") #define numRegArgs() 1 #define printNum(n) printf("%ld", (long) n) -#define printOnTrace() (traceLinkedSends & 8) +#define printOnTrace() (traceLinkedSends & 1) #define print(aString) printf(aString) -#define recordEventTrace() (traceLinkedSends & 4) -#define recordPrimTrace() (traceLinkedSends & 2) -#define recordSendTrace() (traceLinkedSends & 1) +#define recordBlockTrace() (traceLinkedSends & 4) +#define recordEventTrace() (traceLinkedSends & 16) +#define recordPrimTrace() (traceLinkedSends & 8) +#define recordSendTrace() (traceLinkedSends & 2) #define reportError(n) warning("compilation error") #define setCFramePointer(theFP) (CFramePointer = (void *)(theFP)) #define setCStackPointer(theSP) (CStackPointer = (void *)(theSP)) @@ -3581,7 +3583,7 @@ (blockStart->entryLabel = gLabel()); if (needsFrame) { compileBlockFrameBuild(blockStart); - if (recordSendTrace()) { + if (recordBlockTrace()) { CallRT(ceTraceBlockActivationTrampoline); } } @@ -10644,7 +10646,30 @@ return genSmallIntegerComparison(JumpNonZero); } + +/* Receiver and arg in registers. + Stack looks like + return address */ + static sqInt +genPrimitiveNotEquivalent(void) +{ + AbstractInstruction *jumpFalse; + + /* begin CmpR:R: */ + genoperandoperand(CmpRR, Arg0Reg, ReceiverResultReg); + /* begin JumpZero: */ + jumpFalse = genoperand(JumpZero, ((sqInt)0)); + annotateobjRef(gMoveCwR(trueObject(), ReceiverResultReg), trueObject()); + /* begin RetN: */ + genoperand(RetN, 0); + jmpTarget(jumpFalse, annotateobjRef(gMoveCwR(falseObject(), ReceiverResultReg), falseObject())); + /* begin RetN: */ + genoperand(RetN, 0); + return 0; +} + +static sqInt genPrimitiveQuo(void) { AbstractInstruction *jumpNotSI; Modified: branches/Cog/nscogsrc/vm/cogit.h =================================================================== --- branches/Cog/nscogsrc/vm/cogit.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/nscogsrc/vm/cogit.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa + CCodeGenerator VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ @@ -109,7 +109,7 @@ /*** Macros ***/ -#define breakOnImplicitReceiver() (traceLinkedSends & 16) +#define breakOnImplicitReceiver() (traceLinkedSends & 32) #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline) #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline) @@ -120,10 +120,11 @@ #define noCheckEntryOffset() cmNoCheckEntryOffset #define noContextSwitchBlockEntryOffset() blockNoContextSwitchOffset #define numRegArgs() 1 -#define printOnTrace() (traceLinkedSends & 8) -#define recordEventTrace() (traceLinkedSends & 4) -#define recordPrimTrace() (traceLinkedSends & 2) -#define recordSendTrace() (traceLinkedSends & 1) +#define printOnTrace() (traceLinkedSends & 1) +#define recordBlockTrace() (traceLinkedSends & 4) +#define recordEventTrace() (traceLinkedSends & 16) +#define recordPrimTrace() (traceLinkedSends & 8) +#define recordSendTrace() (traceLinkedSends & 2) #define setCFramePointer(theFP) (CFramePointer = (void *)(theFP)) #define setCStackPointer(theSP) (CStackPointer = (void *)(theSP)) #define tryLockVMOwner() (ceTryLockVMOwner() != 0) Modified: branches/Cog/nscogsrc/vm/cogmethod.h =================================================================== --- branches/Cog/nscogsrc/vm/cogmethod.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/nscogsrc/vm/cogmethod.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa + CCodeGenerator VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ typedef struct { Modified: branches/Cog/nscogsrc/vm/cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/nscogsrc/vm/cointerp.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 from - CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CoInterpreter VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -893,6 +893,7 @@ static void primitiveNoop(void); static void primitiveNotEqual(void); EXPORT(void) primitiveNotEqualLargeIntegers(void); +static void primitiveNotIdentical(void); static void primitiveObjectAt(void); static void primitiveObjectAtPut(void); static void primitiveObjectPointsTo(void); @@ -967,6 +968,7 @@ static void primitiveYield(void); void * primTraceLogAddress(void); usqInt primTraceLogIndexAddress(void); +static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); void printAllStacks(void); void printCallStack(void); @@ -1486,7 +1488,7 @@ /* 166 */ primitiveIntegerAtPut, /* 167 */ primitiveYield, /* 168 */ primitiveCopyObject, - /* 169 */ (void (*)(void))0, + /* 169 */ primitiveNotIdentical, /* 170 */ (void (*)(void))0, /* 171 */ (void (*)(void))0, /* 172 */ (void (*)(void))0, @@ -1895,7 +1897,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.133"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.134"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -4997,6 +4999,11 @@ GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector); GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromInterpreter; GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), GIV(lkupClass)); + /* begin cr */ + printf("\n"); + } } /* begin internalFindNewMethod */ VM_LABEL(0internalFindNewMethod); @@ -11287,21 +11294,21 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt selector; - if (recordSendTrace()) { + if (recordBlockTrace()) { /* begin recordTrace:thing:source: */ selector = (mframeHomeMethod(GIV(framePointer))->methodObject); GIV(traceLog)[GIV(traceLogIndex)] = TraceBlockActivation; GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase + ? longAt(GIV(framePointer) + FoxMFReceiver) + : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); + /* begin cr */ + printf("\n"); + } } - if (printOnTrace()) { - printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase - ? longAt(GIV(framePointer) + FoxMFReceiver) - : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); - /* begin cr */ - printf("\n"); - } } void @@ -11312,29 +11319,30 @@ CogMethod *cogMethod; sqInt selector; + + /* cogit recordSendTrace ifTrue: is implicit; wouldn't compile the call otherwise. */ + cogMethod = ((CogMethod *) ((longAt(GIV(stackPointer))) - (traceLinkedSendOffset()))); - if (recordSendTrace()) { - /* begin recordTrace:thing:source: */ - /* begin fetchClassOf: */ - if ((theReceiver & 1)) { - classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); - goto l1; - } - if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { - classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; - goto l1; - } - else { - classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l1; - } - l1: /* end fetchClassOf: */; - selector = (cogMethod->selector); - GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; - GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; - GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + /* begin recordTrace:thing:source: */ + /* begin fetchClassOf: */ + if ((theReceiver & 1)) { + classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); + goto l1; } + if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { + classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; + goto l1; + } + else { + classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); + goto l1; + } +l1: /* end fetchClassOf: */; + selector = (cogMethod->selector); + GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; + GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; + GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; if (printOnTrace()) { printActivationNameForreceiverisBlockfirstTemporary((cogMethod->methodObject), theReceiver, 0, null); /* begin cr */ @@ -12430,9 +12438,6 @@ /* Return a shallow copy of the given object. May cause GC */ /* Assume: Oop is a real object, not a small integer. Override to assert it's not a married context */ -/* Return a shallow copy of the given object. May cause GC */ -/* Assume: Oop is a real object, not a small integer. - Override to assert it's not a cogged method */ sqInt clone(sqInt obj) @@ -12452,8 +12457,6 @@ sqInt remappedOop; sqInt toIndex; - assert((!(isOopCompiledMethod(obj))) - || (!(methodHasCogMethod(obj)))); assert((!(isContext(obj))) || (!(isMarriedOrWidowedContext(obj)))); assert(isNonIntegerObject(obj)); @@ -26337,10 +26340,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -26417,54 +26419,45 @@ /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l4; + goto l5; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l4; + goto l5; } - l4: /* end fetchClassOfNonInt: */; + l5: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(0stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l5; - } /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l5; + goto l3; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l5: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l3: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { (GIV(primFailCode) = PrimErrBadIndex); return; } /* begin subscript:with:format: */ if (fmt <= 4) { value = longAt((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord)); - goto l3; + goto l4; } if (fmt < 8) { value = positive32BitIntegerFor(long32At((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << 2))); - goto l3; + goto l4; } else { value = (((byteAt((aContext + BaseHeaderSize) + ((index + fixedFields) - 1))) << 1) | 1); - goto l3; + goto l4; } - l3: /* end subscript:with:format: */; + l4: /* end subscript:with:format: */; /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return; } /* begin frameOfMarriedContext: */ @@ -26483,8 +26476,8 @@ ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)) : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)))); /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; } @@ -26505,10 +26498,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -26572,43 +26564,34 @@ if ((fmt > 4) || (fmt == 2)) { fixedFields = 0; - goto l2; + goto l3; } if (fmt < 2) { fixedFields = totalLength; - goto l2; + goto l3; } /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l3; + goto l4; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l3; + goto l4; } - l3: /* end fetchClassOfNonInt: */; + l4: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; - l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(1stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l4; - } + l3: /* end fixedFieldsOf:format:length: */; /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l4; + goto l2; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l4: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l2: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { return (GIV(primFailCode) = PrimErrBadIndex); } @@ -26662,8 +26645,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return null; } /* begin frameOfMarriedContext: */ @@ -26692,8 +26675,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; return null; } @@ -26779,7 +26762,7 @@ (GIV(stackPage)->headSP = GIV(stackPointer)); assert(pageListIsWellFormed()); /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(2stackPointerForMaybeMarriedContext); + VM_LABEL(0stackPointerForMaybeMarriedContext); if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) && (!(isWidowedContext(rcvr)))) { sp2 = stackPointerIndexForFrame(frameOfMarriedContext(rcvr)); @@ -32956,6 +32939,28 @@ } +/* is the receiver/first argument not the same object as the (last) + argument?. pop argumentCount because this can be used as a mirror + primitive. + */ + +static void +primitiveNotIdentical(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt otherObject; + char *sp; + sqInt thisObject; + + otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + thisObject = longAt(GIV(stackPointer)); + /* begin pop:thenPushBool: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject != otherObject + ? GIV(trueObj) + : GIV(falseObj))); + GIV(stackPointer) = sp; +} + + /* Defined for CompiledMethods only */ static void @@ -33244,6 +33249,11 @@ GIV(argumentCount) = arraySize; GIV(messageSelector) = selector; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), actualReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if ((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -33328,6 +33338,11 @@ } l1: /* end fetchClassOf: */; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), newReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if (!((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -37779,6 +37794,90 @@ } static void +printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt class; + sqInt classDict; + sqInt classDictSize; + sqInt currClass; + sqInt header; + sqInt i; + sqInt methClass; + sqInt sz; + + if (((startClass & 3) == 0) + && (((((usqInt)startClass)) >= heapBase) + && (((((usqInt)startClass)) < GIV(freeStart)) + && (((longAt(startClass)) & TypeMask) != HeaderTypeGC)))) { + /* begin findClassForSelector:lookupClass:do: */ + VM_LABEL(0findClassForSelectorlookupClassdo); + currClass = startClass; + do { + classDict = longAt((currClass + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)); + /* begin fetchWordLengthOf: */ + /* begin sizeBitsOf: */ + header = longAt(classDict); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(classDict - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + classDictSize = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; + i = SelectorStart; + while (i < classDictSize) { + if (aSelector == (longAt((classDict + BaseHeaderSize) + (i << ShiftForWord)))) { + methClass = currClass; + + goto l1; + } + i += 1; + } + currClass = longAt((currClass + BaseHeaderSize) + (SuperclassIndex << ShiftForWord)); + } while(!(currClass == GIV(nilObj))); + methClass = null; + + l1: /* end findClassForSelector:lookupClass:do: */; + if ((methClass == null) + || (startClass == methClass)) { + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar('>'); + if (!(methClass)) { + printStringOf(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorDoesNotUnderstand << ShiftForWord))); + print(" "); + } + } + else { + printNameOfClasscount(startClass, 5); + /* begin printChar: */ + putchar('('); + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar(')'); + /* begin printChar: */ + putchar('>'); + } + } + else { + print("INVALID CLASS"); + } + if (((aSelector & 1)) + || (((aSelector & 3) == 0) + && (((((usqInt)aSelector)) >= heapBase) + && (((((usqInt)aSelector)) < GIV(freeStart)) + && (((longAt(aSelector)) & TypeMask) != HeaderTypeGC))))) { + if (((aSelector & 1) == 0) + && (((((usqInt) (longAt(aSelector))) >> 8) & 15) >= 8)) { + printStringOf(aSelector); + } + else { + printOopShort(aSelector); + } + } + else { + print("INVALID SELECTOR"); + } +} + +static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ccIndex; @@ -43180,6 +43279,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -43196,17 +43296,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -43232,15 +43332,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(1stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) @@ -43283,6 +43392,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -43300,17 +43410,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -43336,15 +43446,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(2stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) Modified: branches/Cog/nscogsrc/vm/cointerp.h =================================================================== --- branches/Cog/nscogsrc/vm/cointerp.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/nscogsrc/vm/cointerp.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ Modified: branches/Cog/nscogsrc/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/nscogsrc/vm/gcc3x-cointerp.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 from - CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CoInterpreter VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -896,6 +896,7 @@ static void primitiveNoop(void); static void primitiveNotEqual(void); EXPORT(void) primitiveNotEqualLargeIntegers(void); +static void primitiveNotIdentical(void); static void primitiveObjectAt(void); static void primitiveObjectAtPut(void); static void primitiveObjectPointsTo(void); @@ -970,6 +971,7 @@ static void primitiveYield(void); void * primTraceLogAddress(void); usqInt primTraceLogIndexAddress(void); +static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); void printAllStacks(void); void printCallStack(void); @@ -1489,7 +1491,7 @@ /* 166 */ primitiveIntegerAtPut, /* 167 */ primitiveYield, /* 168 */ primitiveCopyObject, - /* 169 */ (void (*)(void))0, + /* 169 */ primitiveNotIdentical, /* 170 */ (void (*)(void))0, /* 171 */ (void (*)(void))0, /* 172 */ (void (*)(void))0, @@ -1898,7 +1900,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.133"; +const char *interpreterVersion = "Newspeak Virtual Machine CoInterpreter_VMMaker.oscog-eem.134"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -5001,6 +5003,11 @@ GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector); GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromInterpreter; GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), GIV(lkupClass)); + /* begin cr */ + printf("\n"); + } } /* begin internalFindNewMethod */ VM_LABEL(0internalFindNewMethod); @@ -11291,21 +11298,21 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt selector; - if (recordSendTrace()) { + if (recordBlockTrace()) { /* begin recordTrace:thing:source: */ selector = (mframeHomeMethod(GIV(framePointer))->methodObject); GIV(traceLog)[GIV(traceLogIndex)] = TraceBlockActivation; GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase + ? longAt(GIV(framePointer) + FoxMFReceiver) + : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); + /* begin cr */ + printf("\n"); + } } - if (printOnTrace()) { - printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase - ? longAt(GIV(framePointer) + FoxMFReceiver) - : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); - /* begin cr */ - printf("\n"); - } } void @@ -11316,29 +11323,30 @@ CogMethod *cogMethod; sqInt selector; + + /* cogit recordSendTrace ifTrue: is implicit; wouldn't compile the call otherwise. */ + cogMethod = ((CogMethod *) ((longAt(GIV(stackPointer))) - (traceLinkedSendOffset()))); - if (recordSendTrace()) { - /* begin recordTrace:thing:source: */ - /* begin fetchClassOf: */ - if ((theReceiver & 1)) { - classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); - goto l1; - } - if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { - classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; - goto l1; - } - else { - classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l1; - } - l1: /* end fetchClassOf: */; - selector = (cogMethod->selector); - GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; - GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; - GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + /* begin recordTrace:thing:source: */ + /* begin fetchClassOf: */ + if ((theReceiver & 1)) { + classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); + goto l1; } + if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { + classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; + goto l1; + } + else { + classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); + goto l1; + } +l1: /* end fetchClassOf: */; + selector = (cogMethod->selector); + GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; + GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; + GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; if (printOnTrace()) { printActivationNameForreceiverisBlockfirstTemporary((cogMethod->methodObject), theReceiver, 0, null); /* begin cr */ @@ -12434,9 +12442,6 @@ /* Return a shallow copy of the given object. May cause GC */ /* Assume: Oop is a real object, not a small integer. Override to assert it's not a married context */ -/* Return a shallow copy of the given object. May cause GC */ -/* Assume: Oop is a real object, not a small integer. - Override to assert it's not a cogged method */ sqInt clone(sqInt obj) @@ -12456,8 +12461,6 @@ sqInt remappedOop; sqInt toIndex; - assert((!(isOopCompiledMethod(obj))) - || (!(methodHasCogMethod(obj)))); assert((!(isContext(obj))) || (!(isMarriedOrWidowedContext(obj)))); assert(isNonIntegerObject(obj)); @@ -26341,10 +26344,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -26421,54 +26423,45 @@ /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l4; + goto l5; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l4; + goto l5; } - l4: /* end fetchClassOfNonInt: */; + l5: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(0stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l5; - } /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l5; + goto l3; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l5: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l3: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { (GIV(primFailCode) = PrimErrBadIndex); return; } /* begin subscript:with:format: */ if (fmt <= 4) { value = longAt((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord)); - goto l3; + goto l4; } if (fmt < 8) { value = positive32BitIntegerFor(long32At((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << 2))); - goto l3; + goto l4; } else { value = (((byteAt((aContext + BaseHeaderSize) + ((index + fixedFields) - 1))) << 1) | 1); - goto l3; + goto l4; } - l3: /* end subscript:with:format: */; + l4: /* end subscript:with:format: */; /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return; } /* begin frameOfMarriedContext: */ @@ -26487,8 +26480,8 @@ ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)) : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)))); /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; } @@ -26509,10 +26502,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -26576,43 +26568,34 @@ if ((fmt > 4) || (fmt == 2)) { fixedFields = 0; - goto l2; + goto l3; } if (fmt < 2) { fixedFields = totalLength; - goto l2; + goto l3; } /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l3; + goto l4; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l3; + goto l4; } - l3: /* end fetchClassOfNonInt: */; + l4: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; - l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(1stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l4; - } + l3: /* end fixedFieldsOf:format:length: */; /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l4; + goto l2; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l4: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l2: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { return (GIV(primFailCode) = PrimErrBadIndex); } @@ -26666,8 +26649,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return null; } /* begin frameOfMarriedContext: */ @@ -26696,8 +26679,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; return null; } @@ -26783,7 +26766,7 @@ (GIV(stackPage)->headSP = GIV(stackPointer)); assert(pageListIsWellFormed()); /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(2stackPointerForMaybeMarriedContext); + VM_LABEL(0stackPointerForMaybeMarriedContext); if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) && (!(isWidowedContext(rcvr)))) { sp2 = stackPointerIndexForFrame(frameOfMarriedContext(rcvr)); @@ -32960,6 +32943,28 @@ } +/* is the receiver/first argument not the same object as the (last) + argument?. pop argumentCount because this can be used as a mirror + primitive. + */ + +static void +primitiveNotIdentical(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt otherObject; + char *sp; + sqInt thisObject; + + otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + thisObject = longAt(GIV(stackPointer)); + /* begin pop:thenPushBool: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject != otherObject + ? GIV(trueObj) + : GIV(falseObj))); + GIV(stackPointer) = sp; +} + + /* Defined for CompiledMethods only */ static void @@ -33248,6 +33253,11 @@ GIV(argumentCount) = arraySize; GIV(messageSelector) = selector; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), actualReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if ((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -33332,6 +33342,11 @@ } l1: /* end fetchClassOf: */; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), newReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if (!((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -37783,6 +37798,90 @@ } static void +printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt class; + sqInt classDict; + sqInt classDictSize; + sqInt currClass; + sqInt header; + sqInt i; + sqInt methClass; + sqInt sz; + + if (((startClass & 3) == 0) + && (((((usqInt)startClass)) >= heapBase) + && (((((usqInt)startClass)) < GIV(freeStart)) + && (((longAt(startClass)) & TypeMask) != HeaderTypeGC)))) { + /* begin findClassForSelector:lookupClass:do: */ + VM_LABEL(0findClassForSelectorlookupClassdo); + currClass = startClass; + do { + classDict = longAt((currClass + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)); + /* begin fetchWordLengthOf: */ + /* begin sizeBitsOf: */ + header = longAt(classDict); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(classDict - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + classDictSize = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; + i = SelectorStart; + while (i < classDictSize) { + if (aSelector == (longAt((classDict + BaseHeaderSize) + (i << ShiftForWord)))) { + methClass = currClass; + + goto l1; + } + i += 1; + } + currClass = longAt((currClass + BaseHeaderSize) + (SuperclassIndex << ShiftForWord)); + } while(!(currClass == GIV(nilObj))); + methClass = null; + + l1: /* end findClassForSelector:lookupClass:do: */; + if ((methClass == null) + || (startClass == methClass)) { + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar('>'); + if (!(methClass)) { + printStringOf(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorDoesNotUnderstand << ShiftForWord))); + print(" "); + } + } + else { + printNameOfClasscount(startClass, 5); + /* begin printChar: */ + putchar('('); + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar(')'); + /* begin printChar: */ + putchar('>'); + } + } + else { + print("INVALID CLASS"); + } + if (((aSelector & 1)) + || (((aSelector & 3) == 0) + && (((((usqInt)aSelector)) >= heapBase) + && (((((usqInt)aSelector)) < GIV(freeStart)) + && (((longAt(aSelector)) & TypeMask) != HeaderTypeGC))))) { + if (((aSelector & 1) == 0) + && (((((usqInt) (longAt(aSelector))) >> 8) & 15) >= 8)) { + printStringOf(aSelector); + } + else { + printOopShort(aSelector); + } + } + else { + print("INVALID SELECTOR"); + } +} + +static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ccIndex; @@ -43184,6 +43283,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -43200,17 +43300,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -43236,15 +43336,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(1stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) @@ -43287,6 +43396,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -43304,17 +43414,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -43340,15 +43450,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(2stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) Modified: branches/Cog/nscogsrc/vm/interp.h =================================================================== --- branches/Cog/nscogsrc/vm/interp.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/nscogsrc/vm/interp.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/nscogsrc/vm/vmCallback.h =================================================================== --- branches/Cog/nscogsrc/vm/vmCallback.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/nscogsrc/vm/vmCallback.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ #define VM_CALLBACK_INC 1 Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h ___________________________________________________________________ Modified: checkindate - Sun Oct 9 10:12:20 PDT 2011 + Wed Oct 19 11:05:54 PDT 2011 Modified: branches/Cog/platforms/win32/vm/sqWin32Intel.c =================================================================== --- branches/Cog/platforms/win32/vm/sqWin32Intel.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/platforms/win32/vm/sqWin32Intel.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -1212,7 +1212,7 @@ #endif /* STACKVM */ #if COGVM { ARG_UINT, &desiredCogCodeSize, "-codesize:"}, /* machine code memory to use */ - { ARG_FLAG, &traceLinkedSends, "-sendtrace" }, /* trace sends in log */ + { ARG_UINT, &traceLinkedSends, "-sendtrace:" }, /* trace sends in log */ { ARG_INT, &traceLinkedSends, "-trace:" }, /* trace sends in log */ { ARG_FLAG, &traceStores, "-tracestores" }, /* assert-check stores */ { ARG_UINT, &debugPrimCallStackOffset, "-dpcso:"}, /* debug prim call stack offset */ Modified: branches/Cog/src/vm/cogit.c =================================================================== --- branches/Cog/src/vm/cogit.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/cogit.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa + CCodeGenerator VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 from - StackToRegisterMappingCogit VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa + StackToRegisterMappingCogit VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ -static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa " __DATE__ ; +static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 " __DATE__ ; char *__cogitBuildInfo = __buildInfo; @@ -670,6 +670,7 @@ static sqInt genPrimitiveMod(void); static sqInt genPrimitiveMultiply(void); static sqInt genPrimitiveNotEqual(void); +static sqInt genPrimitiveNotEquivalent(void); static sqInt genPrimitiveQuo(void); static sqInt genPrimitiveSize(void); static sqInt genPrimitiveStringAt(void); @@ -1533,6 +1534,7 @@ { 0, -1, 0 }, { 0, -1, 0 }, { 0, -1, 0 }, + { genPrimitiveNotEquivalent, 1, 0 }, { 0, -1, 0 }, { 0, -1, 0 }, { 0, -1, 0 }, @@ -1561,7 +1563,6 @@ { 0, -1, 0 }, { 0, -1, 0 }, { 0, -1, 0 }, - { 0, -1, 0 }, { genFastPrimFail, -1, 0 }, { genFastPrimFail, -1, 0 }, { 0, -1, 0 }, @@ -1604,7 +1605,7 @@ static AbstractInstruction * stackCheckLabel; static AbstractInstruction * stackOverflowCall; static sqInt superSendTrampolines[NumSendTrampolines]; -int traceLinkedSends = 2 /* prim trace log on by default */; +int traceLinkedSends = 8 /* prim trace log on by default */; sqInt traceStores; static char *trampolineAddresses[NumTrampolines*2]; static sqInt trampolineTableIndex; @@ -1627,7 +1628,7 @@ opcodeIndex = labelCounter = annotationIndex = 0; \ } while (0) #define blockStartAt(index) (&blockStarts[index]) -#define breakOnImplicitReceiver() (traceLinkedSends & 16) +#define breakOnImplicitReceiver() (traceLinkedSends & 32) #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline) #define ceCheckFeatures() ceCheckFeaturesFunction() @@ -1659,11 +1660,12 @@ #define notYetImplemented() warning("not yet implemented") #define numRegArgs() 1 #define printNum(n) printf("%ld", (long) n) -#define printOnTrace() (traceLinkedSends & 8) +#define printOnTrace() (traceLinkedSends & 1) #define print(aString) printf(aString) -#define recordEventTrace() (traceLinkedSends & 4) -#define recordPrimTrace() (traceLinkedSends & 2) -#define recordSendTrace() (traceLinkedSends & 1) +#define recordBlockTrace() (traceLinkedSends & 4) +#define recordEventTrace() (traceLinkedSends & 16) +#define recordPrimTrace() (traceLinkedSends & 8) +#define recordSendTrace() (traceLinkedSends & 2) #define reportError(n) warning("compilation error") #define setCFramePointer(theFP) (CFramePointer = (void *)(theFP)) #define setCStackPointer(theSP) (CStackPointer = (void *)(theSP)) @@ -3504,7 +3506,7 @@ (blockStart->entryLabel = gLabel()); if (needsFrame) { compileBlockFrameBuild(blockStart); - if (recordSendTrace()) { + if (recordBlockTrace()) { CallRT(ceTraceBlockActivationTrampoline); } } @@ -10487,7 +10489,30 @@ return genSmallIntegerComparison(JumpNonZero); } + +/* Receiver and arg in registers. + Stack looks like + return address */ + static sqInt +genPrimitiveNotEquivalent(void) +{ + AbstractInstruction *jumpFalse; + + /* begin CmpR:R: */ + genoperandoperand(CmpRR, Arg0Reg, ReceiverResultReg); + /* begin JumpZero: */ + jumpFalse = genoperand(JumpZero, ((sqInt)0)); + annotateobjRef(gMoveCwR(trueObject(), ReceiverResultReg), trueObject()); + /* begin RetN: */ + genoperand(RetN, 0); + jmpTarget(jumpFalse, annotateobjRef(gMoveCwR(falseObject(), ReceiverResultReg), falseObject())); + /* begin RetN: */ + genoperand(RetN, 0); + return 0; +} + +static sqInt genPrimitiveQuo(void) { AbstractInstruction *jumpNotSI; Modified: branches/Cog/src/vm/cogit.h =================================================================== --- branches/Cog/src/vm/cogit.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/cogit.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa + CCodeGenerator VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ @@ -108,7 +108,7 @@ /*** Macros ***/ -#define breakOnImplicitReceiver() (traceLinkedSends & 16) +#define breakOnImplicitReceiver() (traceLinkedSends & 32) #define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline #define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline) #define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline) @@ -119,10 +119,11 @@ #define noCheckEntryOffset() cmNoCheckEntryOffset #define noContextSwitchBlockEntryOffset() blockNoContextSwitchOffset #define numRegArgs() 1 -#define printOnTrace() (traceLinkedSends & 8) -#define recordEventTrace() (traceLinkedSends & 4) -#define recordPrimTrace() (traceLinkedSends & 2) -#define recordSendTrace() (traceLinkedSends & 1) +#define printOnTrace() (traceLinkedSends & 1) +#define recordBlockTrace() (traceLinkedSends & 4) +#define recordEventTrace() (traceLinkedSends & 16) +#define recordPrimTrace() (traceLinkedSends & 8) +#define recordSendTrace() (traceLinkedSends & 2) #define setCFramePointer(theFP) (CFramePointer = (void *)(theFP)) #define setCStackPointer(theSP) (CStackPointer = (void *)(theSP)) #define tryLockVMOwner() (ceTryLockVMOwner() != 0) Modified: branches/Cog/src/vm/cogmethod.h =================================================================== --- branches/Cog/src/vm/cogmethod.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/cogmethod.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGenerator VMMaker.oscog-eem.132 uuid: bd35186a-b5f6-490a-ad8b-2a9c487674fa + CCodeGenerator VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ typedef struct { Modified: branches/Cog/src/vm/cointerp.c =================================================================== --- branches/Cog/src/vm/cointerp.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/cointerp.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 from - CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CoInterpreter VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -884,6 +884,7 @@ static void primitiveNoop(void); static void primitiveNotEqual(void); EXPORT(void) primitiveNotEqualLargeIntegers(void); +static void primitiveNotIdentical(void); static void primitiveObjectAt(void); static void primitiveObjectAtPut(void); static void primitiveObjectPointsTo(void); @@ -958,6 +959,7 @@ static void primitiveYield(void); void * primTraceLogAddress(void); usqInt primTraceLogIndexAddress(void); +static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); void printAllStacks(void); void printCallStack(void); @@ -1143,8 +1145,8 @@ _iss sqInt nilObj; _iss usqInt instructionPointer; _iss sqInt argumentCount; +_iss usqInt freeStart; _iss usqInt method; -_iss usqInt freeStart; _iss usqInt newMethod; _iss sqInt messageSelector; _iss StackPage * pages; @@ -1477,7 +1479,7 @@ /* 166 */ primitiveIntegerAtPut, /* 167 */ primitiveYield, /* 168 */ primitiveCopyObject, - /* 169 */ (void (*)(void))0, + /* 169 */ primitiveNotIdentical, /* 170 */ (void (*)(void))0, /* 171 */ (void (*)(void))0, /* 172 */ (void (*)(void))0, @@ -1886,7 +1888,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.133]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.134]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -4772,6 +4774,11 @@ GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector); GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromInterpreter; GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), GIV(lkupClass)); + /* begin cr */ + printf("\n"); + } } /* begin internalFindNewMethod */ VM_LABEL(0internalFindNewMethod); @@ -10908,21 +10915,21 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt selector; - if (recordSendTrace()) { + if (recordBlockTrace()) { /* begin recordTrace:thing:source: */ selector = (mframeHomeMethod(GIV(framePointer))->methodObject); GIV(traceLog)[GIV(traceLogIndex)] = TraceBlockActivation; GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase + ? longAt(GIV(framePointer) + FoxMFReceiver) + : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); + /* begin cr */ + printf("\n"); + } } - if (printOnTrace()) { - printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase - ? longAt(GIV(framePointer) + FoxMFReceiver) - : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); - /* begin cr */ - printf("\n"); - } } void @@ -10933,29 +10940,30 @@ CogMethod *cogMethod; sqInt selector; + + /* cogit recordSendTrace ifTrue: is implicit; wouldn't compile the call otherwise. */ + cogMethod = ((CogMethod *) ((longAt(GIV(stackPointer))) - (traceLinkedSendOffset()))); - if (recordSendTrace()) { - /* begin recordTrace:thing:source: */ - /* begin fetchClassOf: */ - if ((theReceiver & 1)) { - classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); - goto l1; - } - if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { - classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; - goto l1; - } - else { - classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l1; - } - l1: /* end fetchClassOf: */; - selector = (cogMethod->selector); - GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; - GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; - GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + /* begin recordTrace:thing:source: */ + /* begin fetchClassOf: */ + if ((theReceiver & 1)) { + classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); + goto l1; } + if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { + classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; + goto l1; + } + else { + classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); + goto l1; + } +l1: /* end fetchClassOf: */; + selector = (cogMethod->selector); + GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; + GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; + GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; if (printOnTrace()) { printActivationNameForreceiverisBlockfirstTemporary((cogMethod->methodObject), theReceiver, 0, null); /* begin cr */ @@ -12051,9 +12059,6 @@ /* Return a shallow copy of the given object. May cause GC */ /* Assume: Oop is a real object, not a small integer. Override to assert it's not a married context */ -/* Return a shallow copy of the given object. May cause GC */ -/* Assume: Oop is a real object, not a small integer. - Override to assert it's not a cogged method */ sqInt clone(sqInt obj) @@ -12073,8 +12078,6 @@ sqInt remappedOop; sqInt toIndex; - assert((!(isOopCompiledMethod(obj))) - || (!(methodHasCogMethod(obj)))); assert((!(isContext(obj))) || (!(isMarriedOrWidowedContext(obj)))); assert(isNonIntegerObject(obj)); @@ -25655,10 +25658,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -25735,54 +25737,45 @@ /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l4; + goto l5; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l4; + goto l5; } - l4: /* end fetchClassOfNonInt: */; + l5: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(0stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l5; - } /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l5; + goto l3; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l5: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l3: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { (GIV(primFailCode) = PrimErrBadIndex); return; } /* begin subscript:with:format: */ if (fmt <= 4) { value = longAt((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord)); - goto l3; + goto l4; } if (fmt < 8) { value = positive32BitIntegerFor(long32At((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << 2))); - goto l3; + goto l4; } else { value = (((byteAt((aContext + BaseHeaderSize) + ((index + fixedFields) - 1))) << 1) | 1); - goto l3; + goto l4; } - l3: /* end subscript:with:format: */; + l4: /* end subscript:with:format: */; /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return; } /* begin frameOfMarriedContext: */ @@ -25801,8 +25794,8 @@ ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)) : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)))); /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; } @@ -25823,10 +25816,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -25890,43 +25882,34 @@ if ((fmt > 4) || (fmt == 2)) { fixedFields = 0; - goto l2; + goto l3; } if (fmt < 2) { fixedFields = totalLength; - goto l2; + goto l3; } /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l3; + goto l4; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l3; + goto l4; } - l3: /* end fetchClassOfNonInt: */; + l4: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; - l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(1stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l4; - } + l3: /* end fixedFieldsOf:format:length: */; /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l4; + goto l2; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l4: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l2: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { return (GIV(primFailCode) = PrimErrBadIndex); } @@ -25980,8 +25963,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return null; } /* begin frameOfMarriedContext: */ @@ -26010,8 +25993,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; return null; } @@ -26097,7 +26080,7 @@ (GIV(stackPage)->headSP = GIV(stackPointer)); assert(pageListIsWellFormed()); /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(2stackPointerForMaybeMarriedContext); + VM_LABEL(0stackPointerForMaybeMarriedContext); if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) && (!(isWidowedContext(rcvr)))) { sp2 = stackPointerIndexForFrame(frameOfMarriedContext(rcvr)); @@ -32274,6 +32257,28 @@ } +/* is the receiver/first argument not the same object as the (last) + argument?. pop argumentCount because this can be used as a mirror + primitive. + */ + +static void +primitiveNotIdentical(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt otherObject; + char *sp; + sqInt thisObject; + + otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + thisObject = longAt(GIV(stackPointer)); + /* begin pop:thenPushBool: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject != otherObject + ? GIV(trueObj) + : GIV(falseObj))); + GIV(stackPointer) = sp; +} + + /* Defined for CompiledMethods only */ static void @@ -32562,6 +32567,11 @@ GIV(argumentCount) = arraySize; GIV(messageSelector) = selector; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), actualReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if ((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -32646,6 +32656,11 @@ } l1: /* end fetchClassOf: */; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), newReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if (!((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -37097,6 +37112,90 @@ } static void +printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt class; + sqInt classDict; + sqInt classDictSize; + sqInt currClass; + sqInt header; + sqInt i; + sqInt methClass; + sqInt sz; + + if (((startClass & 3) == 0) + && (((((usqInt)startClass)) >= heapBase) + && (((((usqInt)startClass)) < GIV(freeStart)) + && (((longAt(startClass)) & TypeMask) != HeaderTypeGC)))) { + /* begin findClassForSelector:lookupClass:do: */ + VM_LABEL(0findClassForSelectorlookupClassdo); + currClass = startClass; + do { + classDict = longAt((currClass + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)); + /* begin fetchWordLengthOf: */ + /* begin sizeBitsOf: */ + header = longAt(classDict); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(classDict - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + classDictSize = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; + i = SelectorStart; + while (i < classDictSize) { + if (aSelector == (longAt((classDict + BaseHeaderSize) + (i << ShiftForWord)))) { + methClass = currClass; + + goto l1; + } + i += 1; + } + currClass = longAt((currClass + BaseHeaderSize) + (SuperclassIndex << ShiftForWord)); + } while(!(currClass == GIV(nilObj))); + methClass = null; + + l1: /* end findClassForSelector:lookupClass:do: */; + if ((methClass == null) + || (startClass == methClass)) { + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar('>'); + if (!(methClass)) { + printStringOf(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorDoesNotUnderstand << ShiftForWord))); + print(" "); + } + } + else { + printNameOfClasscount(startClass, 5); + /* begin printChar: */ + putchar('('); + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar(')'); + /* begin printChar: */ + putchar('>'); + } + } + else { + print("INVALID CLASS"); + } + if (((aSelector & 1)) + || (((aSelector & 3) == 0) + && (((((usqInt)aSelector)) >= heapBase) + && (((((usqInt)aSelector)) < GIV(freeStart)) + && (((longAt(aSelector)) & TypeMask) != HeaderTypeGC))))) { + if (((aSelector & 1) == 0) + && (((((usqInt) (longAt(aSelector))) >> 8) & 15) >= 8)) { + printStringOf(aSelector); + } + else { + printOopShort(aSelector); + } + } + else { + print("INVALID SELECTOR"); + } +} + +static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ccIndex; @@ -42498,6 +42597,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -42514,17 +42614,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -42550,15 +42650,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(1stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) @@ -42601,6 +42710,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -42618,17 +42728,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -42654,15 +42764,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(2stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) Modified: branches/Cog/src/vm/cointerp.h =================================================================== --- branches/Cog/src/vm/cointerp.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/cointerp.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ Modified: branches/Cog/src/vm/cointerpmt.c =================================================================== --- branches/Cog/src/vm/cointerpmt.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/cointerpmt.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,9 +1,9 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 from - CoInterpreterMT VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CoInterpreterMT VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -947,6 +947,7 @@ static void primitiveNoop(void); static void primitiveNotEqual(void); EXPORT(void) primitiveNotEqualLargeIntegers(void); +static void primitiveNotIdentical(void); static void primitiveObjectAt(void); static void primitiveObjectAtPut(void); static void primitiveObjectPointsTo(void); @@ -1024,6 +1025,7 @@ static void primitiveYield(void); void * primTraceLogAddress(void); usqInt primTraceLogIndexAddress(void); +static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); void printAllStacks(void); void printCallStack(void); @@ -1226,8 +1228,8 @@ _iss sqInt nilObj; _iss usqInt instructionPointer; _iss sqInt argumentCount; +_iss usqInt freeStart; _iss usqInt method; -_iss usqInt freeStart; _iss usqInt newMethod; _iss usqInt youngStart; _iss sqInt messageSelector; @@ -1577,7 +1579,7 @@ /* 166 */ primitiveIntegerAtPut, /* 167 */ primitiveYield, /* 168 */ primitiveCopyObject, - /* 169 */ (void (*)(void))0, + /* 169 */ primitiveNotIdentical, /* 170 */ (void (*)(void))0, /* 171 */ (void (*)(void))0, /* 172 */ (void (*)(void))0, @@ -1986,7 +1988,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.133]"; +const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.134]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; sqInt willNotThreadWarnCount; @@ -4874,6 +4876,11 @@ GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector); GIV(traceLog)[GIV(traceLogIndex) + 2] = (TraceIsFromInterpreter + (((usqInt) (getVMOwner()) << 16))); GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), GIV(lkupClass)); + /* begin cr */ + printf("\n"); + } } /* begin internalFindNewMethod */ VM_LABEL(0internalFindNewMethod); @@ -11255,21 +11262,21 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt selector; - if (recordSendTrace()) { + if (recordBlockTrace()) { /* begin recordTrace:thing:source: */ selector = (mframeHomeMethod(GIV(framePointer))->methodObject); GIV(traceLog)[GIV(traceLogIndex)] = TraceBlockActivation; GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; GIV(traceLog)[GIV(traceLogIndex) + 2] = (TraceIsFromMachineCode + (((usqInt) (getVMOwner()) << 16))); GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase + ? longAt(GIV(framePointer) + FoxMFReceiver) + : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); + /* begin cr */ + printf("\n"); + } } - if (printOnTrace()) { - printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase - ? longAt(GIV(framePointer) + FoxMFReceiver) - : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); - /* begin cr */ - printf("\n"); - } } void @@ -11280,29 +11287,30 @@ CogMethod *cogMethod; sqInt selector; + + /* cogit recordSendTrace ifTrue: is implicit; wouldn't compile the call otherwise. */ + cogMethod = ((CogMethod *) ((longAt(GIV(stackPointer))) - (traceLinkedSendOffset()))); - if (recordSendTrace()) { - /* begin recordTrace:thing:source: */ - /* begin fetchClassOf: */ - if ((theReceiver & 1)) { - classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); - goto l1; - } - if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { - classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; - goto l1; - } - else { - classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l1; - } - l1: /* end fetchClassOf: */; - selector = (cogMethod->selector); - GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; - GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; - GIV(traceLog)[GIV(traceLogIndex) + 2] = (TraceIsFromMachineCode + (((usqInt) (getVMOwner()) << 16))); - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + /* begin recordTrace:thing:source: */ + /* begin fetchClassOf: */ + if ((theReceiver & 1)) { + classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); + goto l1; } + if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { + classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; + goto l1; + } + else { + classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); + goto l1; + } +l1: /* end fetchClassOf: */; + selector = (cogMethod->selector); + GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; + GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; + GIV(traceLog)[GIV(traceLogIndex) + 2] = (TraceIsFromMachineCode + (((usqInt) (getVMOwner()) << 16))); + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; if (printOnTrace()) { printActivationNameForreceiverisBlockfirstTemporary((cogMethod->methodObject), theReceiver, 0, null); /* begin cr */ @@ -12467,9 +12475,6 @@ /* Return a shallow copy of the given object. May cause GC */ /* Assume: Oop is a real object, not a small integer. Override to assert it's not a married context */ -/* Return a shallow copy of the given object. May cause GC */ -/* Assume: Oop is a real object, not a small integer. - Override to assert it's not a cogged method */ sqInt clone(sqInt obj) @@ -12489,8 +12494,6 @@ sqInt remappedOop; sqInt toIndex; - assert((!(isOopCompiledMethod(obj))) - || (!(methodHasCogMethod(obj)))); assert((!(isContext(obj))) || (!(isMarriedOrWidowedContext(obj)))); assert(isNonIntegerObject(obj)); @@ -26864,10 +26867,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -26944,54 +26946,45 @@ /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l4; + goto l5; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l4; + goto l5; } - l4: /* end fetchClassOfNonInt: */; + l5: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(0stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l5; - } /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l5; + goto l3; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l5: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l3: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { (GIV(primFailCode) = PrimErrBadIndex); return; } /* begin subscript:with:format: */ if (fmt <= 4) { value = longAt((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord)); - goto l3; + goto l4; } if (fmt < 8) { value = positive32BitIntegerFor(long32At((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << 2))); - goto l3; + goto l4; } else { value = (((byteAt((aContext + BaseHeaderSize) + ((index + fixedFields) - 1))) << 1) | 1); - goto l3; + goto l4; } - l3: /* end subscript:with:format: */; + l4: /* end subscript:with:format: */; /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return; } /* begin frameOfMarriedContext: */ @@ -27010,8 +27003,8 @@ ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)) : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)))); /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; } @@ -27032,10 +27025,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -27099,43 +27091,34 @@ if ((fmt > 4) || (fmt == 2)) { fixedFields = 0; - goto l2; + goto l3; } if (fmt < 2) { fixedFields = totalLength; - goto l2; + goto l3; } /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l3; + goto l4; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l3; + goto l4; } - l3: /* end fetchClassOfNonInt: */; + l4: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; - l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(1stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l4; - } + l3: /* end fixedFieldsOf:format:length: */; /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l4; + goto l2; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l4: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l2: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { return (GIV(primFailCode) = PrimErrBadIndex); } @@ -27189,8 +27172,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return null; } /* begin frameOfMarriedContext: */ @@ -27219,8 +27202,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; return null; } @@ -27306,7 +27289,7 @@ (GIV(stackPage)->headSP = GIV(stackPointer)); assert(pageListIsWellFormed()); /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(2stackPointerForMaybeMarriedContext); + VM_LABEL(0stackPointerForMaybeMarriedContext); if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) && (!(isWidowedContext(rcvr)))) { sp2 = stackPointerIndexForFrame(frameOfMarriedContext(rcvr)); @@ -33483,6 +33466,28 @@ } +/* is the receiver/first argument not the same object as the (last) + argument?. pop argumentCount because this can be used as a mirror + primitive. + */ + +static void +primitiveNotIdentical(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt otherObject; + char *sp; + sqInt thisObject; + + otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + thisObject = longAt(GIV(stackPointer)); + /* begin pop:thenPushBool: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject != otherObject + ? GIV(trueObj) + : GIV(falseObj))); + GIV(stackPointer) = sp; +} + + /* Defined for CompiledMethods only */ static void @@ -33771,6 +33776,11 @@ GIV(argumentCount) = arraySize; GIV(messageSelector) = selector; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), actualReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if ((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -33855,6 +33865,11 @@ } l1: /* end fetchClassOf: */; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), newReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if (!((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -38424,6 +38439,90 @@ } static void +printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt class; + sqInt classDict; + sqInt classDictSize; + sqInt currClass; + sqInt header; + sqInt i; + sqInt methClass; + sqInt sz; + + if (((startClass & 3) == 0) + && (((((usqInt)startClass)) >= heapBase) + && (((((usqInt)startClass)) < GIV(freeStart)) + && (((longAt(startClass)) & TypeMask) != HeaderTypeGC)))) { + /* begin findClassForSelector:lookupClass:do: */ + VM_LABEL(0findClassForSelectorlookupClassdo); + currClass = startClass; + do { + classDict = longAt((currClass + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)); + /* begin fetchWordLengthOf: */ + /* begin sizeBitsOf: */ + header = longAt(classDict); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(classDict - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + classDictSize = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; + i = SelectorStart; + while (i < classDictSize) { + if (aSelector == (longAt((classDict + BaseHeaderSize) + (i << ShiftForWord)))) { + methClass = currClass; + + goto l1; + } + i += 1; + } + currClass = longAt((currClass + BaseHeaderSize) + (SuperclassIndex << ShiftForWord)); + } while(!(currClass == GIV(nilObj))); + methClass = null; + + l1: /* end findClassForSelector:lookupClass:do: */; + if ((methClass == null) + || (startClass == methClass)) { + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar('>'); + if (!(methClass)) { + printStringOf(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorDoesNotUnderstand << ShiftForWord))); + print(" "); + } + } + else { + printNameOfClasscount(startClass, 5); + /* begin printChar: */ + putchar('('); + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar(')'); + /* begin printChar: */ + putchar('>'); + } + } + else { + print("INVALID CLASS"); + } + if (((aSelector & 1)) + || (((aSelector & 3) == 0) + && (((((usqInt)aSelector)) >= heapBase) + && (((((usqInt)aSelector)) < GIV(freeStart)) + && (((longAt(aSelector)) & TypeMask) != HeaderTypeGC))))) { + if (((aSelector & 1) == 0) + && (((((usqInt) (longAt(aSelector))) >> 8) & 15) >= 8)) { + printStringOf(aSelector); + } + else { + printOopShort(aSelector); + } + } + else { + print("INVALID SELECTOR"); + } +} + +static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ccIndex; @@ -43996,6 +44095,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -44012,17 +44112,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -44048,15 +44148,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(1stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) @@ -44099,6 +44208,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -44116,17 +44226,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -44152,15 +44262,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(2stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) Modified: branches/Cog/src/vm/cointerpmt.h =================================================================== --- branches/Cog/src/vm/cointerpmt.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/cointerpmt.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ Modified: branches/Cog/src/vm/gcc3x-cointerp.c =================================================================== --- branches/Cog/src/vm/gcc3x-cointerp.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/gcc3x-cointerp.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 from - CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CoInterpreter VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ -static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; +static char __buildInfo[] = "CoInterpreter VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -887,6 +887,7 @@ static void primitiveNoop(void); static void primitiveNotEqual(void); EXPORT(void) primitiveNotEqualLargeIntegers(void); +static void primitiveNotIdentical(void); static void primitiveObjectAt(void); static void primitiveObjectAtPut(void); static void primitiveObjectPointsTo(void); @@ -961,6 +962,7 @@ static void primitiveYield(void); void * primTraceLogAddress(void); usqInt primTraceLogIndexAddress(void); +static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); void printAllStacks(void); void printCallStack(void); @@ -1146,8 +1148,8 @@ _iss sqInt nilObj; _iss usqInt instructionPointer; _iss sqInt argumentCount; +_iss usqInt freeStart; _iss usqInt method; -_iss usqInt freeStart; _iss usqInt newMethod; _iss sqInt messageSelector; _iss StackPage * pages; @@ -1480,7 +1482,7 @@ /* 166 */ primitiveIntegerAtPut, /* 167 */ primitiveYield, /* 168 */ primitiveCopyObject, - /* 169 */ (void (*)(void))0, + /* 169 */ primitiveNotIdentical, /* 170 */ (void (*)(void))0, /* 171 */ (void (*)(void))0, /* 172 */ (void (*)(void))0, @@ -1889,7 +1891,7 @@ /* 575 */ (void (*)(void))0, 0 }; static void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* 4097 */])(void); -const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.133]"; +const char *interpreterVersion = "Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.134]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; @@ -4776,6 +4778,11 @@ GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector); GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromInterpreter; GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), GIV(lkupClass)); + /* begin cr */ + printf("\n"); + } } /* begin internalFindNewMethod */ VM_LABEL(0internalFindNewMethod); @@ -10912,21 +10919,21 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt selector; - if (recordSendTrace()) { + if (recordBlockTrace()) { /* begin recordTrace:thing:source: */ selector = (mframeHomeMethod(GIV(framePointer))->methodObject); GIV(traceLog)[GIV(traceLogIndex)] = TraceBlockActivation; GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase + ? longAt(GIV(framePointer) + FoxMFReceiver) + : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); + /* begin cr */ + printf("\n"); + } } - if (printOnTrace()) { - printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase - ? longAt(GIV(framePointer) + FoxMFReceiver) - : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); - /* begin cr */ - printf("\n"); - } } void @@ -10937,29 +10944,30 @@ CogMethod *cogMethod; sqInt selector; + + /* cogit recordSendTrace ifTrue: is implicit; wouldn't compile the call otherwise. */ + cogMethod = ((CogMethod *) ((longAt(GIV(stackPointer))) - (traceLinkedSendOffset()))); - if (recordSendTrace()) { - /* begin recordTrace:thing:source: */ - /* begin fetchClassOf: */ - if ((theReceiver & 1)) { - classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); - goto l1; - } - if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { - classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; - goto l1; - } - else { - classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l1; - } - l1: /* end fetchClassOf: */; - selector = (cogMethod->selector); - GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; - GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; - GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + /* begin recordTrace:thing:source: */ + /* begin fetchClassOf: */ + if ((theReceiver & 1)) { + classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); + goto l1; } + if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { + classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; + goto l1; + } + else { + classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); + goto l1; + } +l1: /* end fetchClassOf: */; + selector = (cogMethod->selector); + GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; + GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; + GIV(traceLog)[GIV(traceLogIndex) + 2] = TraceIsFromMachineCode; + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; if (printOnTrace()) { printActivationNameForreceiverisBlockfirstTemporary((cogMethod->methodObject), theReceiver, 0, null); /* begin cr */ @@ -12055,9 +12063,6 @@ /* Return a shallow copy of the given object. May cause GC */ /* Assume: Oop is a real object, not a small integer. Override to assert it's not a married context */ -/* Return a shallow copy of the given object. May cause GC */ -/* Assume: Oop is a real object, not a small integer. - Override to assert it's not a cogged method */ sqInt clone(sqInt obj) @@ -12077,8 +12082,6 @@ sqInt remappedOop; sqInt toIndex; - assert((!(isOopCompiledMethod(obj))) - || (!(methodHasCogMethod(obj)))); assert((!(isContext(obj))) || (!(isMarriedOrWidowedContext(obj)))); assert(isNonIntegerObject(obj)); @@ -25659,10 +25662,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -25739,54 +25741,45 @@ /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l4; + goto l5; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l4; + goto l5; } - l4: /* end fetchClassOfNonInt: */; + l5: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(0stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l5; - } /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l5; + goto l3; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l5: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l3: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { (GIV(primFailCode) = PrimErrBadIndex); return; } /* begin subscript:with:format: */ if (fmt <= 4) { value = longAt((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord)); - goto l3; + goto l4; } if (fmt < 8) { value = positive32BitIntegerFor(long32At((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << 2))); - goto l3; + goto l4; } else { value = (((byteAt((aContext + BaseHeaderSize) + ((index + fixedFields) - 1))) << 1) | 1); - goto l3; + goto l4; } - l3: /* end subscript:with:format: */; + l4: /* end subscript:with:format: */; /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return; } /* begin frameOfMarriedContext: */ @@ -25805,8 +25798,8 @@ ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)) : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)))); /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; } @@ -25827,10 +25820,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -25894,43 +25886,34 @@ if ((fmt > 4) || (fmt == 2)) { fixedFields = 0; - goto l2; + goto l3; } if (fmt < 2) { fixedFields = totalLength; - goto l2; + goto l3; } /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l3; + goto l4; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l3; + goto l4; } - l3: /* end fetchClassOfNonInt: */; + l4: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; - l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(1stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l4; - } + l3: /* end fixedFieldsOf:format:length: */; /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l4; + goto l2; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l4: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l2: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { return (GIV(primFailCode) = PrimErrBadIndex); } @@ -25984,8 +25967,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return null; } /* begin frameOfMarriedContext: */ @@ -26014,8 +25997,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; return null; } @@ -26101,7 +26084,7 @@ (GIV(stackPage)->headSP = GIV(stackPointer)); assert(pageListIsWellFormed()); /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(2stackPointerForMaybeMarriedContext); + VM_LABEL(0stackPointerForMaybeMarriedContext); if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) && (!(isWidowedContext(rcvr)))) { sp2 = stackPointerIndexForFrame(frameOfMarriedContext(rcvr)); @@ -32278,6 +32261,28 @@ } +/* is the receiver/first argument not the same object as the (last) + argument?. pop argumentCount because this can be used as a mirror + primitive. + */ + +static void +primitiveNotIdentical(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt otherObject; + char *sp; + sqInt thisObject; + + otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + thisObject = longAt(GIV(stackPointer)); + /* begin pop:thenPushBool: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject != otherObject + ? GIV(trueObj) + : GIV(falseObj))); + GIV(stackPointer) = sp; +} + + /* Defined for CompiledMethods only */ static void @@ -32566,6 +32571,11 @@ GIV(argumentCount) = arraySize; GIV(messageSelector) = selector; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), actualReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if ((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -32650,6 +32660,11 @@ } l1: /* end fetchClassOf: */; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), newReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if (!((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -37101,6 +37116,90 @@ } static void +printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt class; + sqInt classDict; + sqInt classDictSize; + sqInt currClass; + sqInt header; + sqInt i; + sqInt methClass; + sqInt sz; + + if (((startClass & 3) == 0) + && (((((usqInt)startClass)) >= heapBase) + && (((((usqInt)startClass)) < GIV(freeStart)) + && (((longAt(startClass)) & TypeMask) != HeaderTypeGC)))) { + /* begin findClassForSelector:lookupClass:do: */ + VM_LABEL(0findClassForSelectorlookupClassdo); + currClass = startClass; + do { + classDict = longAt((currClass + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)); + /* begin fetchWordLengthOf: */ + /* begin sizeBitsOf: */ + header = longAt(classDict); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(classDict - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + classDictSize = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; + i = SelectorStart; + while (i < classDictSize) { + if (aSelector == (longAt((classDict + BaseHeaderSize) + (i << ShiftForWord)))) { + methClass = currClass; + + goto l1; + } + i += 1; + } + currClass = longAt((currClass + BaseHeaderSize) + (SuperclassIndex << ShiftForWord)); + } while(!(currClass == GIV(nilObj))); + methClass = null; + + l1: /* end findClassForSelector:lookupClass:do: */; + if ((methClass == null) + || (startClass == methClass)) { + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar('>'); + if (!(methClass)) { + printStringOf(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorDoesNotUnderstand << ShiftForWord))); + print(" "); + } + } + else { + printNameOfClasscount(startClass, 5); + /* begin printChar: */ + putchar('('); + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar(')'); + /* begin printChar: */ + putchar('>'); + } + } + else { + print("INVALID CLASS"); + } + if (((aSelector & 1)) + || (((aSelector & 3) == 0) + && (((((usqInt)aSelector)) >= heapBase) + && (((((usqInt)aSelector)) < GIV(freeStart)) + && (((longAt(aSelector)) & TypeMask) != HeaderTypeGC))))) { + if (((aSelector & 1) == 0) + && (((((usqInt) (longAt(aSelector))) >> 8) & 15) >= 8)) { + printStringOf(aSelector); + } + else { + printOopShort(aSelector); + } + } + else { + print("INVALID SELECTOR"); + } +} + +static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ccIndex; @@ -42502,6 +42601,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -42518,17 +42618,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -42554,15 +42654,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(1stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) @@ -42605,6 +42714,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -42622,17 +42732,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -42658,15 +42768,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(2stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) Modified: branches/Cog/src/vm/gcc3x-cointerpmt.c =================================================================== --- branches/Cog/src/vm/gcc3x-cointerpmt.c 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/gcc3x-cointerpmt.c 2011-10-19 18:07:48 UTC (rev 2501) @@ -2,11 +2,11 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 from - CoInterpreterMT VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CoInterpreterMT VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ -static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 " __DATE__ ; +static char __buildInfo[] = "CoInterpreterMT VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 " __DATE__ ; char *__interpBuildInfo = __buildInfo; @@ -950,6 +950,7 @@ static void primitiveNoop(void); static void primitiveNotEqual(void); EXPORT(void) primitiveNotEqualLargeIntegers(void); +static void primitiveNotIdentical(void); static void primitiveObjectAt(void); static void primitiveObjectAtPut(void); static void primitiveObjectPointsTo(void); @@ -1027,6 +1028,7 @@ static void primitiveYield(void); void * primTraceLogAddress(void); usqInt primTraceLogIndexAddress(void); +static void printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass); static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage); void printAllStacks(void); void printCallStack(void); @@ -1229,8 +1231,8 @@ _iss sqInt nilObj; _iss usqInt instructionPointer; _iss sqInt argumentCount; +_iss usqInt freeStart; _iss usqInt method; -_iss usqInt freeStart; _iss usqInt newMethod; _iss usqInt youngStart; _iss sqInt messageSelector; @@ -1580,7 +1582,7 @@ /* 166 */ primitiveIntegerAtPut, /* 167 */ primitiveYield, /* 168 */ primitiveCopyObject, - /* 169 */ (void (*)(void))0, + /* 169 */ primitiveNotIdentical, /* 170 */ (void (*)(void))0, /* 171 */ (void (*)(void))0, /* 172 */ (void (*)(void))0, @@ -1989,7 +1991,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.133]"; +const char *interpreterVersion = "Croquet Closure Cog MT VM [CoInterpreterMT VMMaker.oscog-eem.134]"; sqInt minBackwardJumpCountForCompile = MinBackwardJumpCountForCompile /* 10 */; volatile int sendTrace; sqInt willNotThreadWarnCount; @@ -4878,6 +4880,11 @@ GIV(traceLog)[GIV(traceLogIndex) + 1] = GIV(messageSelector); GIV(traceLog)[GIV(traceLogIndex) + 2] = (TraceIsFromInterpreter + (((usqInt) (getVMOwner()) << 16))); GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), GIV(lkupClass)); + /* begin cr */ + printf("\n"); + } } /* begin internalFindNewMethod */ VM_LABEL(0internalFindNewMethod); @@ -11259,21 +11266,21 @@ { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt selector; - if (recordSendTrace()) { + if (recordBlockTrace()) { /* begin recordTrace:thing:source: */ selector = (mframeHomeMethod(GIV(framePointer))->methodObject); GIV(traceLog)[GIV(traceLogIndex)] = TraceBlockActivation; GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; GIV(traceLog)[GIV(traceLogIndex) + 2] = (TraceIsFromMachineCode + (((usqInt) (getVMOwner()) << 16))); GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + if (printOnTrace()) { + printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase + ? longAt(GIV(framePointer) + FoxMFReceiver) + : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); + /* begin cr */ + printf("\n"); + } } - if (printOnTrace()) { - printActivationNameForreceiverisBlockfirstTemporary((mframeHomeMethod(GIV(framePointer))->methodObject), ((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase - ? longAt(GIV(framePointer) + FoxMFReceiver) - : longAt(GIV(framePointer) + FoxIFReceiver)), 1, null); - /* begin cr */ - printf("\n"); - } } void @@ -11284,29 +11291,30 @@ CogMethod *cogMethod; sqInt selector; + + /* cogit recordSendTrace ifTrue: is implicit; wouldn't compile the call otherwise. */ + cogMethod = ((CogMethod *) ((longAt(GIV(stackPointer))) - (traceLinkedSendOffset()))); - if (recordSendTrace()) { - /* begin recordTrace:thing:source: */ - /* begin fetchClassOf: */ - if ((theReceiver & 1)) { - classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); - goto l1; - } - if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { - classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; - goto l1; - } - else { - classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l1; - } - l1: /* end fetchClassOf: */; - selector = (cogMethod->selector); - GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; - GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; - GIV(traceLog)[GIV(traceLogIndex) + 2] = (TraceIsFromMachineCode + (((usqInt) (getVMOwner()) << 16))); - GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; + /* begin recordTrace:thing:source: */ + /* begin fetchClassOf: */ + if ((theReceiver & 1)) { + classOrInteger = longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (ClassInteger << ShiftForWord)); + goto l1; } + if (((ccIndex = (((usqInt) (longAt(theReceiver))) >> 12) & 31)) == 0) { + classOrInteger = (longAt(theReceiver - BaseHeaderSize)) & AllButTypeMask; + goto l1; + } + else { + classOrInteger = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); + goto l1; + } +l1: /* end fetchClassOf: */; + selector = (cogMethod->selector); + GIV(traceLog)[GIV(traceLogIndex)] = classOrInteger; + GIV(traceLog)[GIV(traceLogIndex) + 1] = selector; + GIV(traceLog)[GIV(traceLogIndex) + 2] = (TraceIsFromMachineCode + (((usqInt) (getVMOwner()) << 16))); + GIV(traceLogIndex) = (GIV(traceLogIndex) + 3) % TraceBufferSize; if (printOnTrace()) { printActivationNameForreceiverisBlockfirstTemporary((cogMethod->methodObject), theReceiver, 0, null); /* begin cr */ @@ -12471,9 +12479,6 @@ /* Return a shallow copy of the given object. May cause GC */ /* Assume: Oop is a real object, not a small integer. Override to assert it's not a married context */ -/* Return a shallow copy of the given object. May cause GC */ -/* Assume: Oop is a real object, not a small integer. - Override to assert it's not a cogged method */ sqInt clone(sqInt obj) @@ -12493,8 +12498,6 @@ sqInt remappedOop; sqInt toIndex; - assert((!(isOopCompiledMethod(obj))) - || (!(methodHasCogMethod(obj)))); assert((!(isContext(obj))) || (!(isMarriedOrWidowedContext(obj)))); assert(isNonIntegerObject(obj)); @@ -26868,10 +26871,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -26948,54 +26950,45 @@ /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l4; + goto l5; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l4; + goto l5; } - l4: /* end fetchClassOfNonInt: */; + l5: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(0stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l5; - } /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l5; + goto l3; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l5: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l3: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { (GIV(primFailCode) = PrimErrBadIndex); return; } /* begin subscript:with:format: */ if (fmt <= 4) { value = longAt((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << ShiftForWord)); - goto l3; + goto l4; } if (fmt < 8) { value = positive32BitIntegerFor(long32At((aContext + BaseHeaderSize) + (((index + fixedFields) - 1) << 2))); - goto l3; + goto l4; } else { value = (((byteAt((aContext + BaseHeaderSize) + ((index + fixedFields) - 1))) << 1) | 1); - goto l3; + goto l4; } - l3: /* end subscript:with:format: */; + l4: /* end subscript:with:format: */; /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return; } /* begin frameOfMarriedContext: */ @@ -27014,8 +27007,8 @@ ? longAt((spouseFP + FoxCallerSavedIP) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)) : longAt(((spouseFP + FoxIFReceiver) - BytesPerWord) + ((frameNumArgs1 - (index - 1)) * BytesPerWord)))); /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; } @@ -27036,10 +27029,9 @@ sqInt hdr; sqInt index; char *sp; - char *sp1; - sqInt sp11; + sqInt sp1; char *sp2; - sqInt sp3; + char *sp3; char *spouseFP; sqInt stSize; sqInt sz; @@ -27103,43 +27095,34 @@ if ((fmt > 4) || (fmt == 2)) { fixedFields = 0; - goto l2; + goto l3; } if (fmt < 2) { fixedFields = totalLength; - goto l2; + goto l3; } /* begin fetchClassOfNonInt: */ if (((ccIndex = (((usqInt) (longAt(aContext))) >> 12) & 31)) == 0) { class = (longAt(aContext - BaseHeaderSize)) & AllButTypeMask; - goto l3; + goto l4; } else { class = longAt(((longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (CompactClasses << ShiftForWord))) + BaseHeaderSize) + ((ccIndex - 1) << ShiftForWord)); - goto l3; + goto l4; } - l3: /* end fetchClassOfNonInt: */; + l4: /* end fetchClassOfNonInt: */; classFormat = (longAt((class + BaseHeaderSize) + (InstanceSpecificationIndex << ShiftForWord))) - 1; fixedFields = (((((usqInt) classFormat) >> 11) & 192) + ((((usqInt) classFormat) >> 2) & 63)) - 1; - l2: /* end fixedFieldsOf:format:length: */; - /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(1stackPointerForMaybeMarriedContext); - if ((((longAt((aContext + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) - && (!(isWidowedContext(aContext)))) { - sp3 = stackPointerIndexForFrame(frameOfMarriedContext(aContext)); - assert((ReceiverIndex + ((sp3 >> 1))) < (lengthOf(aContext))); - stSize = sp3; - goto l4; - } + l3: /* end fixedFieldsOf:format:length: */; /* begin fetchStackPointerOf: */ - sp11 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp11 & 1))) { + sp1 = longAt((aContext + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l4; + goto l2; } - assert((ReceiverIndex + ((sp11 >> 1))) < (lengthOf(aContext))); - stSize = (sp11 >> 1); - l4: /* end stackPointerForMaybeMarriedContext: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(aContext))); + stSize = (sp1 >> 1); + l2: /* end fetchStackPointerOf: */; if (!(((index >= 1) && (index <= stSize)))) { return (GIV(primFailCode) = PrimErrBadIndex); } @@ -27193,8 +27176,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp1 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp1; + longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp2; return null; } /* begin frameOfMarriedContext: */ @@ -27223,8 +27206,8 @@ } } /* begin pop:thenPush: */ - longAtput((sp2 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); - GIV(stackPointer) = sp2; + longAtput((sp3 = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), value); + GIV(stackPointer) = sp3; return null; } @@ -27310,7 +27293,7 @@ (GIV(stackPage)->headSP = GIV(stackPointer)); assert(pageListIsWellFormed()); /* begin stackPointerForMaybeMarriedContext: */ - VM_LABEL(2stackPointerForMaybeMarriedContext); + VM_LABEL(0stackPointerForMaybeMarriedContext); if ((((longAt((rcvr + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) && (!(isWidowedContext(rcvr)))) { sp2 = stackPointerIndexForFrame(frameOfMarriedContext(rcvr)); @@ -33487,6 +33470,28 @@ } +/* is the receiver/first argument not the same object as the (last) + argument?. pop argumentCount because this can be used as a mirror + primitive. + */ + +static void +primitiveNotIdentical(void) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt otherObject; + char *sp; + sqInt thisObject; + + otherObject = longAt(GIV(stackPointer) + (1 * BytesPerWord)); + thisObject = longAt(GIV(stackPointer)); + /* begin pop:thenPushBool: */ + longAtput((sp = GIV(stackPointer) + (((GIV(argumentCount) + 1) - 1) * BytesPerWord)), (thisObject != otherObject + ? GIV(trueObj) + : GIV(falseObj))); + GIV(stackPointer) = sp; +} + + /* Defined for CompiledMethods only */ static void @@ -33775,6 +33780,11 @@ GIV(argumentCount) = arraySize; GIV(messageSelector) = selector; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), actualReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if ((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -33859,6 +33869,11 @@ } l1: /* end fetchClassOf: */; sendBreakpointreceiver(GIV(messageSelector) + BaseHeaderSize, lengthOf(GIV(messageSelector)), newReceiver); + if (printOnTrace()) { + printActivationNameForSelectorstartClass(GIV(messageSelector), lookupClass); + /* begin cr */ + printf("\n"); + } findNewMethodInClass(lookupClass); if (!((((GIV(newMethod) & 1) == 0) && (((((usqInt) (longAt(GIV(newMethod)))) >> 8) & 15) >= 12)) @@ -38428,6 +38443,90 @@ } static void +printActivationNameForSelectorstartClass(sqInt aSelector, sqInt startClass) +{ DECL_MAYBE_SQ_GLOBAL_STRUCT + sqInt class; + sqInt classDict; + sqInt classDictSize; + sqInt currClass; + sqInt header; + sqInt i; + sqInt methClass; + sqInt sz; + + if (((startClass & 3) == 0) + && (((((usqInt)startClass)) >= heapBase) + && (((((usqInt)startClass)) < GIV(freeStart)) + && (((longAt(startClass)) & TypeMask) != HeaderTypeGC)))) { + /* begin findClassForSelector:lookupClass:do: */ + VM_LABEL(0findClassForSelectorlookupClassdo); + currClass = startClass; + do { + classDict = longAt((currClass + BaseHeaderSize) + (MethodDictionaryIndex << ShiftForWord)); + /* begin fetchWordLengthOf: */ + /* begin sizeBitsOf: */ + header = longAt(classDict); + sz = ((header & TypeMask) == HeaderTypeSizeAndClass + ? (longAt(classDict - (BytesPerWord * 2))) & LongSizeMask + : header & SizeMask); + classDictSize = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; + i = SelectorStart; + while (i < classDictSize) { + if (aSelector == (longAt((classDict + BaseHeaderSize) + (i << ShiftForWord)))) { + methClass = currClass; + + goto l1; + } + i += 1; + } + currClass = longAt((currClass + BaseHeaderSize) + (SuperclassIndex << ShiftForWord)); + } while(!(currClass == GIV(nilObj))); + methClass = null; + + l1: /* end findClassForSelector:lookupClass:do: */; + if ((methClass == null) + || (startClass == methClass)) { + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar('>'); + if (!(methClass)) { + printStringOf(longAt((GIV(specialObjectsOop) + BaseHeaderSize) + (SelectorDoesNotUnderstand << ShiftForWord))); + print(" "); + } + } + else { + printNameOfClasscount(startClass, 5); + /* begin printChar: */ + putchar('('); + printNameOfClasscount(methClass, 5); + /* begin printChar: */ + putchar(')'); + /* begin printChar: */ + putchar('>'); + } + } + else { + print("INVALID CLASS"); + } + if (((aSelector & 1)) + || (((aSelector & 3) == 0) + && (((((usqInt)aSelector)) >= heapBase) + && (((((usqInt)aSelector)) < GIV(freeStart)) + && (((longAt(aSelector)) & TypeMask) != HeaderTypeGC))))) { + if (((aSelector & 1) == 0) + && (((((usqInt) (longAt(aSelector))) >> 8) & 15) >= 8)) { + printStringOf(aSelector); + } + else { + printOopShort(aSelector); + } + } + else { + print("INVALID SELECTOR"); + } +} + +static void printActivationNameForreceiverisBlockfirstTemporary(sqInt aMethod, sqInt anObject, sqInt isBlock, sqInt maybeMessage) { DECL_MAYBE_SQ_GLOBAL_STRUCT sqInt ccIndex; @@ -44000,6 +44099,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -44016,17 +44116,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -44052,15 +44152,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(1stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) @@ -44103,6 +44212,7 @@ sqInt fmt; sqInt hdr; sqInt sp; + sqInt sp1; sqInt stSize; sqInt sz; sqInt totalLength; @@ -44120,17 +44230,17 @@ sz -= hdr & Size4Bit; if (fmt <= 4) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> ShiftForWord; - goto l2; + goto l1; } if (fmt < 8) { totalLength = ((usqInt) (sz - BaseHeaderSize)) >> 2; - goto l2; + goto l1; } else { totalLength = (sz - BaseHeaderSize) - (fmt & 3); - goto l2; + goto l1; } -l2: /* end lengthOf:baseHeader:format: */; +l1: /* end lengthOf:baseHeader:format: */; /* begin fixedFieldsOf:format:length: */ if ((fmt > 4) || (fmt == 2)) { @@ -44156,15 +44266,24 @@ l3: /* end fixedFieldsOf:format:length: */; if ((fmt == 3) && (((((usqInt) hdr) >> 12) & 31) == ClassMethodContextCompactIndex)) { + /* begin stackPointerForMaybeMarriedContext: */ + VM_LABEL(2stackPointerForMaybeMarriedContext); + if ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) + && (!(isWidowedContext(array)))) { + sp = stackPointerIndexForFrame(frameOfMarriedContext(array)); + assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); + stSize = sp; + goto l2; + } /* begin fetchStackPointerOf: */ - sp = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); - if (!((sp & 1))) { + sp1 = longAt((array + BaseHeaderSize) + (StackPointerIndex << ShiftForWord)); + if (!((sp1 & 1))) { stSize = 0; - goto l1; + goto l2; } - assert((ReceiverIndex + ((sp >> 1))) < (lengthOf(array))); - stSize = (sp >> 1); - l1: /* end fetchStackPointerOf: */; + assert((ReceiverIndex + ((sp1 >> 1))) < (lengthOf(array))); + stSize = (sp1 >> 1); + l2: /* end stackPointerForMaybeMarriedContext: */; if (((((usqInt) index)) >= (((usqInt) 1))) && (((((usqInt) index)) <= (((usqInt) stSize))) && ((((longAt((array + BaseHeaderSize) + (SenderIndex << ShiftForWord))) & 1)) Modified: branches/Cog/src/vm/interp.h =================================================================== --- branches/Cog/src/vm/interp.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/interp.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ #define VM_PROXY_MAJOR 1 Modified: branches/Cog/src/vm/vmCallback.h =================================================================== --- branches/Cog/src/vm/vmCallback.h 2011-10-10 18:03:19 UTC (rev 2500) +++ branches/Cog/src/vm/vmCallback.h 2011-10-19 18:07:48 UTC (rev 2501) @@ -1,5 +1,5 @@ /* Automatically generated by - CCodeGeneratorGlobalStructure VMMaker.oscog-eem.133 uuid: 1ca6557f-8901-4791-8473-e2c09d25bbf3 + CCodeGeneratorGlobalStructure VMMaker.oscog-eem.134 uuid: a0d46c48-3d9a-43f9-a769-51f31ce120e9 */ #define VM_CALLBACK_INC 1 |
Free forum by Nabble | Edit this page |