<div dir="ltr">Hi,<div><br></div><div>Since this commit, when I run this method</div><div><br></div><div><div>21 <01> pushRcvr: 1</div><div>22 <10> pushTemp: 0</div><div>23 <B2> send: <</div><div>24 <99> jumpFalse: 27</div><div>25 <20> pushConstant: 'yes'</div><div>26 <7C> returnTop</div><div>27 <21> pushConstant: 'no'</div><div>28 <7C> returnTop</div></div><div><br></div><div>the VM crashes.</div><div><br></div><div>I run the method using:</div><div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>self assert: (cm valueWithReceiver: 2@2 arguments: #(1)) = 'no' .</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>self assert: (cm valueWithReceiver: 2@2  arguments: #(3)) = 'yes' .<span class="gmail-Apple-tab-span" style="white-space:pre">  </span></div></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 24, 2017 at 9:32 PM,  <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:<br>
<a href="http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2138.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/<wbr>VMMaker/VMMaker.oscog-eem.<wbr>2138.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: VMMaker.oscog-eem.2138<br>
Author: eem<br>
Time: 24 February 2017, 12:31:35.781791 pm<br>
UUID: 8b98184c-9061-45e1-b4ce-<wbr>bd9b8bc8c802<br>
Ancestors: VMMaker.oscog-eem.2137<br>
<br>
StackToRegisterMappingCogit:<br>
Reimplement mclassIsSmallInteger in terms of receiverTags, providing more generality at cheaper cost (receiverTags is computed during set-up for compiling a method).<br>
<br>
Improve special-selector comparison and arithmetic based on this if the receiver or argument is self and known to be a SmallInteger.  Also improve the tag checking to avoid the spurious copy to TempReg unless both receiver and argument need to be tested.  These improve code quality in methods such as SmallInteger>>digitLength:.<br>
<br>
Use anyMask: in ssAllocateRequiredRegMask:<wbr>upThrough:upThroughNative: instead of bitAnd:...~= 0.<br>
<br>
RegisterAllocatingCogit:<br>
Override ssAllocateRequiredRegMask:<wbr>upThrough:upThroughNative: to void optStatus and simStack entries that refer to the allocated register.<br>
<br>
Simulator:<br>
Aim stdio at the coInterpreter's transcript rather than Transcript.<br>
<br>
Fix some tag-related bugs in the CurrentImageCoInterpreterFacad<wbr>e hierarchy.<br>
<br>
=============== Diff against VMMaker.oscog-eem.2137 ===============<br>
<br>
Item was added:<br>
+ ----- Method: CogObjectRepresentation>><wbr>genJumpNotSmallIntegersIn:and:<wbr>scratch: (in category 'compile abstract instructions') -----<br>
+ genJumpNotSmallIntegersIn: aRegister and: bRegister scratch: scratchRegister<br>
+       "Generate a compare and branch to test if aRegister and bRegister contains other than SmallIntegers,<br>
+        i.e. don't branch if both aRegister and bRegister contain SmallIntegers.<br>
+        Answer the jump.  Destroy scratchRegister if required."<br>
+       <returnTypeC: #'AbstractInstruction *'><br>
+       ^self subclassResponsibility!<br>
<br>
Item was removed:<br>
- ----- Method: CogObjectRepresentation>><wbr>genJumpNotSmallIntegersIn:<wbr>andScratch:scratch: (in category 'compile abstract instructions') -----<br>
- genJumpNotSmallIntegersIn: aRegister andScratch: scratchA scratch: scratchB<br>
-       "Generate a compare and branch to test if aRegister and scratchA contains other than SmallIntegers,<br>
-        i.e. don't branch if both aRegister and scratchA contain SmallIntegers.<br>
-        Answer the jump.  Destroy scratchA and scratchB if required."<br>
-       <returnTypeC: #'AbstractInstruction *'><br>
-       ^self subclassResponsibility!<br>
<br>
Item was removed:<br>
- ----- Method: CogObjectRepresentationFor32Bi<wbr>tSpur>><wbr>genJumpNotSmallIntegersIn:<wbr>andScratch:scratch: (in category 'compile abstract instructions') -----<br>
- genJumpNotSmallIntegersIn: aRegister andScratch: scratchA scratch: scratchB<br>
-       "Generate a compare and branch to test if aRegister and scratchA contains other than SmallIntegers,<br>
-        i.e. don't branch if both aRegister and scratchA contain SmallIntegers.<br>
-        Answer the jump.  Destroy scratchA and scratchB if required."<br>
-       <returnTypeC: #'AbstractInstruction *'><br>
-       <inline: true><br>
-       cogit AndR: aRegister R: scratchA.<br>
-       ^self genJumpNotSmallIntegerInScratc<wbr>hReg: scratchA!<br>
<br>
Item was removed:<br>
- ----- Method: CogObjectRepresentationFor64Bi<wbr>tSpur>><wbr>genJumpNotSmallIntegersIn:<wbr>andScratch:scratch: (in category 'compile abstract instructions') -----<br>
- genJumpNotSmallIntegersIn: aRegister andScratch: scratchA scratch: scratchB<br>
-       "Generate a compare and branch to test if aRegister and scratchA contains other than SmallIntegers,<br>
-        i.e. don't branch if both aRegister and scratchA contain SmallIntegers.<br>
-        Answer the jump.  Destroy scratchA and scratchB if required."<br>
-       <returnTypeC: #'AbstractInstruction *'><br>
-       <inline: true><br>
-       cogit AndR: aRegister R: scratchA.<br>
-       ^self genJumpNotSmallIntegerInScratc<wbr>hReg: scratchA!<br>
<br>
Item was added:<br>
+ ----- Method: CogObjectRepresentationForSpur<wbr>>>genJumpNotSmallIntegersIn:<wbr>and:scratch: (in category 'compile abstract instructions') -----<br>
+ genJumpNotSmallIntegersIn: aRegister and: bRegister scratch: scratchRegister<br>
+       "Generate a compare and branch to test if aRegister and bRegister contains other than SmallIntegers,<br>
+        i.e. don't branch if both aRegister and bRegister contain SmallIntegers.<br>
+        Answer the jump.  Destroy scratchRegister if required."<br>
+       <returnTypeC: #'AbstractInstruction *'><br>
+       <returnTypeC: #'AbstractInstruction *'><br>
+       <inline: true><br>
+       cogit<br>
+               MoveR: aRegister R: scratchRegister;<br>
+               AndR: bRegister R: scratchRegister.<br>
+       ^self genJumpNotSmallIntegerInScratc<wbr>hReg: scratchRegister!<br>
<br>
Item was removed:<br>
- ----- Method: CogObjectRepresentationForSque<wbr>akV3>><wbr>genJumpNotSmallIntegersIn:<wbr>andScratch:scratch: (in category 'compile abstract instructions') -----<br>
- genJumpNotSmallIntegersIn: aRegister andScratch: scratchA scratch: scratchB<br>
-       "Generate a compare and branch to test if aRegister and scratchA contains other than SmallIntegers,<br>
-        i.e. don't branch if both aRegister and scratchA contain SmallIntegers.<br>
-        Answer the jump.  Destroy scratchA and scratchB if required."<br>
-       <returnTypeC: #'AbstractInstruction *'><br>
-       <inline: true><br>
-       cogit AndR: aRegister R: scratchA.<br>
-       ^self genJumpNotSmallIntegerInScratc<wbr>hReg: scratchA!<br>
<br>
Item was removed:<br>
- ----- Method: CogRegisterAllocatingSimStackE<wbr>ntry>><wbr>complicatedIsMergedWithTargetE<wbr>ntry: (in category 'comparing') -----<br>
- complicatedIsMergedWithTargetE<wbr>ntry: targetEntry<br>
-       "The receiver is a simStackEntry at a jump to the corresponding simStackEntry at the jump's target.<br>
-        Answer if no merge is required for the jump."<br>
-       <var: 'ssEntry' type: #'CogSimStackEntry *'><br>
-       spilled ~= targetEntry spilled ifTrue: "push or pop required"<br>
-               [^false].<br>
-       (liveRegister = NoReg and: [targetEntry liveRegister ~= NoReg]) ifTrue: "register load required"<br>
-               [^false].<br>
-       (liveRegister ~= NoReg<br>
-        and: [liveRegister = targetEntry liveRegister<br>
-        and: [type = targetEntry type<br>
-        and: [type = SSConstant or: [type = SSRegister and: [register = targetEntry register]]]]]) ifTrue:<br>
-               [^true].<br>
-       ((type = SSBaseOffset or: [type == SSSpill])<br>
-        and: [(targetEntry type = SSBaseOffset or: [targetEntry type == SSSpill])<br>
-        and: [offset = targetEntry offset and: [register = targetEntry register]]]) ifTrue:<br>
-               [^true].<br>
-       "self: const =1 (16r1) (live: Extra4Reg) {172} vs reg ReceiverResultReg {127}"<br>
-       "self: reg ReceiverResultReg {95} vs reg Extra5Reg {85}"<br>
-       ((type = SSConstant and: [targetEntry type = SSRegister and: [liveRegister ~= targetEntry registerOrNone]])<br>
-        or: [type = SSRegister and: [targetEntry type = SSRegister and: [register ~= targetEntry registerOrNone]]]) ifFalse:<br>
-               [self halt: 'comment the incompatible pair please'].<br>
-       ^false!<br>
<br>
Item was removed:<br>
- ----- Method: CogRegisterAllocatingSimStackE<wbr>ntry>>isSameEntryAs: (in category 'comparing') -----<br>
- isSameEntryAs: ssEntry<br>
-       <var: 'ssEntry' type: #'CogSimStackEntry *'><br>
-       ^type = ssEntry type<br>
-         and: [((type = SSBaseOffset or: [type == SSSpill]) and: [offset = ssEntry offset and: [register = ssEntry register]])<br>
-               or: [(type = SSRegister and: [register = ssEntry register])<br>
-               or: [(type = SSConstant and: [constant = ssEntry constant])]]]!<br>
<br>
Item was removed:<br>
- ----- Method: CogRegisterAllocatingSimStackE<wbr>ntry>><wbr>simplifiedIsMergedWithTargetEn<wbr>try: (in category 'comparing') -----<br>
- simplifiedIsMergedWithTargetEn<wbr>try: targetEntry<br>
-       "The receiver is a simStackEntry at a jump to the corresponding simStackEntry at the jump's target.<br>
-        Answer if no merge is required for the jump."<br>
-       <var: 'ssEntry' type: #'CogSimStackEntry *'><br>
-       spilled ~= targetEntry spilled ifTrue: "push or pop required"<br>
-               [^false].<br>
-       (liveRegister = NoReg and: [targetEntry liveRegister ~= NoReg]) ifTrue: "register load required"<br>
-               [^false].<br>
-       (self isSameEntryAs: targetEntry) ifTrue:<br>
-               [^liveRegister = targetEntry liveRegister].<br>
-       (type = SSConstant and: [targetEntry type = SSRegister and: [liveRegister = targetEntry register]]) ifTrue:<br>
-               [^true].<br>
-       "self: const =1 (16r1) (live: Extra4Reg) {172} vs reg ReceiverResultReg {127}"<br>
-       "self: reg ReceiverResultReg {95} vs reg Extra5Reg {85}"<br>
-       "(bo ReceiverResultReg+296 (live: Extra5Reg) {88} vs reg ReceiverResultReg {84}"<br>
-       ((type = SSConstant and: [targetEntry type = SSRegister and: [liveRegister ~= targetEntry registerOrNone]])<br>
-        or: [(type = SSRegister and: [targetEntry type = SSRegister and: [register ~= targetEntry registerOrNone]])<br>
-        or: [type = SSBaseOffset and: [register = ReceiverResultReg and: [targetEntry type = SSRegister]]]]) ifFalse:<br>
-               [self halt: 'comment the incompatible pair please'].<br>
-       ^false!<br>
<br>
Item was added:<br>
+ ----- Method: CogSimStackEntry>><wbr>isSameEntryAs: (in category 'comparing') -----<br>
+ isSameEntryAs: ssEntry<br>
+       <var: 'ssEntry' type: #'CogSimStackEntry *'><br>
+       ^type = ssEntry type<br>
+         and: [((type = SSBaseOffset or: [type == SSSpill]) and: [offset = ssEntry offset and: [register = ssEntry register]])<br>
+               or: [(type = SSRegister and: [register = ssEntry register])<br>
+               or: [(type = SSConstant and: [constant = ssEntry constant])]]]!<br>
<br>
Item was changed:<br>
  CogClass subclass: #Cogit<br>
+       instanceVariableNames: 'coInterpreter objectMemory objectRepresentation processor threadManager methodZone methodZoneBase codeBase minValidCallAddress lastNInstructions simulatedAddresses simulatedTrampolines simulatedVariableGetters simulatedVariableSetters printRegisters printInstructions compilationTrace clickConfirm breakPC breakBlock singleStep guardPageSize traceFlags traceStores breakMethod methodObj enumeratingCogMethod methodHeader initialPC endPC methodOrBlockNumArgs inBlock needsFrame hasYoungReferent primitiveIndex backEnd literalsManager postCompileHook methodLabel stackCheckLabel blockEntryLabel blockEntryNoContextSwitch blockNoContextSwitchOffset stackOverflowCall sendMiss missOffset entryPointMask checkedEntryAlignment uncheckedEntryAlignment cmEntryOffset entry cmNoCheckEntryOffset noCheckEntry fullBlockEntry cbEntryOffset fullBlockNoContextSwitchEntry cbNoSwitchEntryOffset picMNUAbort picInterpretAbort endCPICCase0 endCPICCase1 firstCPICCaseOffset cPICCaseSize cP<br>
 ICEndSize closedPICSize openPICSize fixups abstractOpcodes generatorTable byte0 byte1 byte2 byte3 bytecodePC bytecodeSetOffset opcodeIndex numAbstractOpcodes blockStarts blockCount labelCounter cStackAlignment expectedSPAlignment expectedFPAlignment codeModified maxLitIndex ceMethodAbortTrampoline cePICAbortTrampoline ceCheckForInterruptTrampoline ceCPICMissTrampoline ceReturnToInterpreterTrampolin<wbr>e ceBaseFrameReturnTrampoline ceSendMustBeBooleanAddTrueTram<wbr>poline ceSendMustBeBooleanAddFalseTra<wbr>mpoline ceCannotResumeTrampoline ceEnterCogCodePopReceiverReg ceCallCogCodePopReceiverReg ceCallCogCodePopReceiverAndCla<wbr>ssRegs cePrimReturnEnterCogCode cePrimReturnEnterCogCodeProfil<wbr>ing ceNonLocalReturnTrampoline ceFetchContextInstVarTrampolin<wbr>e ceStoreContextInstVarTrampolin<wbr>e ceEnclosingObjectTrampoline ceFlushICache ceCheckFeaturesFunction ceTraceLinkedSendTrampoline ceTraceBlockActivationTrampoli<wbr>ne ceTraceStoreTrampoline ceGetFP ceGetSP ceCaptureCStackPointers ordinarySendTrampolines superSen<br>
 dTrampolines directedSuperSendTrampolines dynamicSuperSendTrampolines outerSendTrampolines selfSendTrampolines firstSend lastSend realCEEnterCogCodePopReceiverR<wbr>eg realCECallCogCodePopReceiverRe<wbr>g realCECallCogCodePopReceiverAn<wbr>dClassRegs trampolineTableIndex trampolineAddresses objectReferencesInRuntime runtimeObjectRefIndex cFramePointerInUse debugPrimCallStackOffset ceTryLockVMOwner ceUnlockVMOwner extA extB numExtB tempOop numIRCs indexOfIRC theIRCs receiverTags implicitReceiverSendTrampoline<wbr>s cogMethodSurrogateClass cogBlockMethodSurrogateClass nsSendCacheSurrogateClass CStackPointer CFramePointer cPICPrototype cPICEndOfCodeOffset cPICEndOfCodeLabel maxCPICCases debugBytecodePointers debugOpcodeIndices disassemblingMethod ceMallocTrampoline ceFreeTrampoline ceFFICalloutTrampoline'<br>
-       instanceVariableNames: 'coInterpreter objectMemory objectRepresentation processor threadManager methodZone methodZoneBase codeBase minValidCallAddress lastNInstructions simulatedAddresses simulatedTrampolines simulatedVariableGetters simulatedVariableSetters printRegisters printInstructions compilationTrace clickConfirm breakPC breakBlock singleStep guardPageSize traceFlags traceStores breakMethod methodObj enumeratingCogMethod methodHeader initialPC endPC methodOrBlockNumArgs inBlock needsFrame hasYoungReferent primitiveIndex backEnd literalsManager postCompileHook methodLabel stackCheckLabel blockEntryLabel blockEntryNoContextSwitch blockNoContextSwitchOffset stackOverflowCall sendMiss missOffset entryPointMask checkedEntryAlignment uncheckedEntryAlignment cmEntryOffset entry cmNoCheckEntryOffset noCheckEntry fullBlockEntry cbEntryOffset fullBlockNoContextSwitchEntry cbNoSwitchEntryOffset picMNUAbort picInterpretAbort endCPICCase0 endCPICCase1 firstCPICCaseOffset cPICCaseSize cP<br>
 ICEndSize closedPICSize openPICSize fixups abstractOpcodes generatorTable byte0 byte1 byte2 byte3 bytecodePC bytecodeSetOffset opcodeIndex numAbstractOpcodes blockStarts blockCount labelCounter cStackAlignment expectedSPAlignment expectedFPAlignment codeModified maxLitIndex ceMethodAbortTrampoline cePICAbortTrampoline ceCheckForInterruptTrampoline ceCPICMissTrampoline ceReturnToInterpreterTrampolin<wbr>e ceBaseFrameReturnTrampoline ceSendMustBeBooleanAddTrueTram<wbr>poline ceSendMustBeBooleanAddFalseTra<wbr>mpoline ceCannotResumeTrampoline ceEnterCogCodePopReceiverReg ceCallCogCodePopReceiverReg ceCallCogCodePopReceiverAndCla<wbr>ssRegs cePrimReturnEnterCogCode cePrimReturnEnterCogCodeProfil<wbr>ing ceNonLocalReturnTrampoline ceFetchContextInstVarTrampolin<wbr>e ceStoreContextInstVarTrampolin<wbr>e ceEnclosingObjectTrampoline ceFlushICache ceCheckFeaturesFunction ceTraceLinkedSendTrampoline ceTraceBlockActivationTrampoli<wbr>ne ceTraceStoreTrampoline ceGetFP ceGetSP ceCaptureCStackPointers ordinarySendTrampolines superSen<br>
 dTrampolines directedSuperSendTrampolines dynamicSuperSendTrampolines outerSendTrampolines selfSendTrampolines firstSend lastSend realCEEnterCogCodePopReceiverR<wbr>eg realCECallCogCodePopReceiverRe<wbr>g realCECallCogCodePopReceiverAn<wbr>dClassRegs trampolineTableIndex trampolineAddresses objectReferencesInRuntime runtimeObjectRefIndex cFramePointerInUse debugPrimCallStackOffset ceTryLockVMOwner ceUnlockVMOwner extA extB numExtB tempOop numIRCs indexOfIRC theIRCs implicitReceiverSendTrampoline<wbr>s cogMethodSurrogateClass cogBlockMethodSurrogateClass nsSendCacheSurrogateClass CStackPointer CFramePointer cPICPrototype cPICEndOfCodeOffset cPICEndOfCodeLabel maxCPICCases debugBytecodePointers debugOpcodeIndices disassemblingMethod ceMallocTrampoline ceFreeTrampoline ceFFICalloutTrampoline'<br>
        classVariableNames: 'AltBlockCreationBytecodeSize AltFirstSpecialSelector AltNSSendIsPCAnnotated AltNumSpecialSelectors AnnotationConstantNames AnnotationShift AnnotationsWithBytecodePCs BlockCreationBytecodeSize Debug DisplacementMask DisplacementX2N EagerInstructionDecoration FirstAnnotation FirstSpecialSelector HasBytecodePC IsAbsPCReference IsAnnotationExtension IsDirectedSuperSend IsDisplacementX2N IsNSDynamicSuperSend IsNSImplicitReceiverSend IsNSSelfSend IsNSSendCall IsObjectReference IsRelativeCall IsSendCall IsSuperSend MapEnd MaxCPICCases MaxCompiledPrimitiveIndex MaxStackAllocSize MaxX2NDisplacement NSCClassTagIndex NSCEnclosingObjectIndex NSCNumArgsIndex NSCSelectorIndex NSCTargetIndex NSSendIsPCAnnotated NeedsFixupFlag NumObjRefsInRuntime NumOopsPerNSC NumSpecialSelectors NumTrampolines ProcessorClass RRRName'<br>
        poolDictionaries: 'CogAbstractRegisters CogCompilationConstants CogMethodConstants CogRTLOpcodes VMBasicConstants VMBytecodeConstants VMObjectIndices VMStackFrameOffsets'<br>
        category: 'VMMaker-JIT'!<br>
  Cogit class<br>
        instanceVariableNames: 'generatorTable primitiveTable'!<br>
<br>
  !Cogit commentStamp: 'eem 2/9/2017 10:01' prior: 0!<br>
  I am the code generator for the Cog VM.  My job is to produce machine code versions of methods for faster execution and to manage inline caches for faster send performance.  I can be tested in the current image using my class-side in-image compilation facilities.  e.g. try<br>
<br>
        StackToRegisterMappingCogit genAndDis: (Integer >> #benchFib)<br>
<br>
  I have concrete subclasses that implement different levels of optimization:<br>
        SimpleStackBasedCogit is the simplest code generator.<br>
<br>
        StackToRegisterMappingCogit is the current production code generator  It defers pushing operands<br>
        to the stack until necessary and implements a register-based calling convention for low-arity sends.<br>
<br>
        StackToRegisterMappingCogit is an experimental code generator with support for counting<br>
        conditional branches, intended to support adaptive optimization.<br>
<br>
  coInterpreter <CoInterpreterSimulator><br>
        the VM's interpreter with which I cooperate<br>
  methodZoneManager <CogMethodZoneManager><br>
        the manager of the machine code zone<br>
  objectRepresentation <CogObjectRepresentation><br>
        the object used to generate object accesses<br>
  processor <BochsIA32Alien|?><br>
        the simulator that executes the IA32/x86 machine code I generate when simulating execution in Smalltalk<br>
  simulatedTrampolines <Dictionary of Integer -> MessageSend><br>
        the dictionary mapping trap jump addresses to run-time routines used to warp from simulated machine code in to the Smalltalk run-time.<br>
  simulatedVariableGetters <Dictionary of Integer -> MessageSend><br>
        the dictionary mapping trap read addresses to variables in run-time objects used to allow simulated machine code to read variables in the Smalltalk run-time.<br>
  simulatedVariableSetters <Dictionary of Integer -> MessageSend><br>
        the dictionary mapping trap write addresses to variables in run-time objects used to allow simulated machine code to write variables in the Smalltalk run-time.<br>
  printRegisters printInstructions clickConfirm <Boolean><br>
        flags controlling debug printing and code simulation<br>
  breakPC <Integer><br>
        machine code pc breakpoint<br>
  cFramePointer cStackPointer <Integer><br>
        the variables representing the C stack & frame pointers, which must change on FFI callback and return<br>
  selectorOop <sqInt><br>
        the oop of the methodObj being compiled<br>
  methodObj <sqInt><br>
        the bytecode method being compiled<br>
  initialPC endPC <Integer><br>
        the start and end pcs of the methodObj being compiled<br>
  methodOrBlockNumArgs <Integer><br>
        argument count of current method or block being compiled<br>
  needsFrame <Boolean><br>
        whether methodObj or block needs a frame to execute<br>
  primitiveIndex <Integer><br>
        primitive index of current method being compiled<br>
  methodLabel <CogAbstractOpcode><br>
        label for the method header<br>
  blockEntryLabel <CogAbstractOpcode><br>
        label for the start of the block dispatch code<br>
  stackOverflowCall <CogAbstractOpcode><br>
        label for the call of ceStackOverflow in the method prolog<br>
  sendMissCall <CogAbstractOpcode><br>
        label for the call of ceSICMiss in the method prolog<br>
  entryOffset <Integer><br>
        offset of method entry code from start (header) of method<br>
  entry <CogAbstractOpcode><br>
        label for the first instruction of the method entry code<br>
  noCheckEntryOffset <Integer><br>
        offset of the start of a method proper (after the method entry code) from start (header) of method<br>
  noCheckEntry <CogAbstractOpcode><br>
        label for the first instruction of start of a method proper<br>
  fixups <Array of <AbstractOpcode Label | nil>><br>
        the labels for forward jumps that will be fixed up when reaching the relevant bytecode.  fixups has one element per byte in methodObj's bytecode; initialPC maps to fixups[0].<br>
  abstractOpcodes <Array of <AbstractOpcode>><br>
        the code generated when compiling methodObj<br>
  byte0 byte1 byte2 byte3 <Integer><br>
        individual bytes of current bytecode being compiled in methodObj<br>
  bytecodePointer <Integer><br>
        bytecode pc (same as Smalltalk) of the current bytecode being compiled<br>
  opcodeIndex <Integer><br>
        the index of the next free entry in abstractOpcodes (this code is translated into C where OrderedCollection et al do not exist)<br>
  numAbstractOpcodes <Integer><br>
        the number of elements in abstractOpcocdes<br>
  blockStarts <Array of <BlockStart>><br>
        the starts of blocks in the current method<br>
  blockCount<br>
        the index into blockStarts as they are being noted, and hence eventually the total number of blocks in the current method<br>
  labelCounter <Integer><br>
        a nicety for numbering labels not needed in the production system but probably not expensive enough to worry about<br>
  ceStackOverflowTrampoline <Integer><br>
  ceSend0ArgsTrampoline <Integer><br>
  ceSend1ArgsTrampoline <Integer><br>
  ceSend2ArgsTrampoline <Integer><br>
  ceSendNArgsTrampoline <Integer><br>
  ceSendSuper0ArgsTrampoline <Integer><br>
  ceSendSuper1ArgsTrampoline <Integer><br>
  ceSendSuper2ArgsTrampoline <Integer><br>
  ceSendSuperNArgsTrampoline <Integer><br>
  ceSICMissTrampoline <Integer><br>
  ceCPICMissTrampoline <Integer><br>
  ceStoreCheckTrampoline <Integer><br>
  ceReturnToInterpreterTrampolin<wbr>e <Integer><br>
  ceBaseFrameReturnTrampoline <Integer><br>
  ceSendMustBeBooleanTrampoline <Integer><br>
  ceClosureCopyTrampoline <Integer><br>
        the various trampolines (system-call-like jumps from machine code to the run-time).<br>
        See Cogit>>generateTrampolines for the mapping from trampoline to run-time<br>
        routine and then read the run-time routine for a funcitonal description.<br>
  ceEnterCogCodePopReceiverReg <Integer><br>
        the enilopmart (jump from run-time to machine-code)<br>
  methodZoneBase <Integer><br>
  !<br>
  Cogit class<br>
        instanceVariableNames: 'generatorTable primitiveTable'!<br>
<br>
Item was changed:<br>
  ----- Method: Cogit>>cog:selector: (in category 'jit - api') -----<br>
  cog: aMethodObj selector: aSelectorOop<br>
        "Attempt to produce a machine code method for the bytecode method<br>
         object aMethodObj.  N.B. If there is no code memory available do *NOT*<br>
         attempt to reclaim the method zone.  Certain clients (e.g. ceSICMiss:)<br>
         depend on the zone remaining constant across method generation."<br>
        <api><br>
        <returnTypeC: #'CogMethod *'><br>
        | cogMethod |<br>
        <var: #cogMethod type: #'CogMethod *'><br>
        (self exclude: aMethodObj selector: aSelectorOop) ifTrue:<br>
                [^nil].<br>
        "In Newspeak we support anonymous accessors and hence tolerate the same<br>
         method being cogged multiple times.  But only if the method class association is nil."<br>
        NewspeakVM<br>
                ifTrue:<br>
                        [(coInterpreter methodHasCogMethod: aMethodObj) ifTrue:<br>
                                [cogMethod := coInterpreter cogMethodOf: aMethodObj.<br>
                                 self deny: cogMethod selector = aSelectorOop.<br>
                                 cogMethod selector = aSelectorOop ifTrue:<br>
                                        [^cogMethod].<br>
                                 (coInterpreter methodClassAssociationOf: aMethodObj) ~= objectMemory nilObject ifTrue:<br>
                                        [self cCode: 'extern void *firstIndexableField(sqInt)'. "Slang, au natural"<br>
                                         self warnMultiple: cogMethod selectors: aSelectorOop.<br>
                                        ^nil]]]<br>
                ifFalse: [self deny: (coInterpreter methodHasCogMethod: aMethodObj)].<br>
        self deny: (objectMemory isOopCompiledMethod: (coInterpreter ultimateLiteralOf: aMethodObj)).<br>
        "coInterpreter stringOf: aSelectorOop"<br>
        coInterpreter<br>
                compilationBreak: aSelectorOop<br>
                point: (objectMemory lengthOf: aSelectorOop)<br>
                isMNUCase: false.<br>
        aMethodObj = breakMethod ifTrue: [self halt: 'Compilation of breakMethod'].<br>
        NewspeakVM ifTrue:<br>
                [cogMethod := methodZone findPreviouslyCompiledVersionO<wbr>f: aMethodObj with: aSelectorOop.<br>
                 cogMethod ifNotNil:<br>
                        [(coInterpreter methodHasCogMethod: aMethodObj) not ifTrue:<br>
                                [self assert: (coInterpreter rawHeaderOf: aMethodObj) = cogMethod methodHeader.<br>
                                 cogMethod methodObject: aMethodObj.<br>
                                 coInterpreter rawHeaderOf: aMethodObj put: cogMethod asInteger].<br>
                        ^cogMethod]].<br>
        "If the generators for the alternate bytecode set are missing then interpret."<br>
        (coInterpreter methodUsesAlternateBytecodeSet<wbr>: aMethodObj)<br>
                ifTrue:<br>
                        [(self numElementsIn: generatorTable) <= 256 ifTrue:<br>
                                [^nil].<br>
                         bytecodeSetOffset := 256]<br>
                ifFalse:<br>
                        [bytecodeSetOffset := 0].<br>
        objectRepresentation ensureNoForwardedLiteralsIn: aMethodObj.<br>
        methodObj := aMethodObj.<br>
        methodHeader := objectMemory methodHeaderOf: aMethodObj.<br>
+       receiverTags := objectMemory receiverTagBitsForMethod: methodObj.<br>
        cogMethod := self compileCogMethod: aSelectorOop.<br>
        (cogMethod asInteger between: MaxNegativeErrorCode and: -1) ifTrue:<br>
                [cogMethod asInteger = InsufficientCodeSpace ifTrue:<br>
                        [coInterpreter callForCogCompiledCodeCompacti<wbr>on].<br>
                 self maybeFreeCounters.<br>
                 "Right now no errors should be reported, so nothing more to do."<br>
                 "self reportError: (self cCoerceSimple: cogMethod to: #sqInt)."<br>
                 ^nil].<br>
        "self cCode: ''<br>
                inSmalltalk:<br>
                        [coInterpreter printCogMethod: cogMethod.<br>
                         ""coInterpreter symbolicMethod: aMethodObj.""<br>
                         self assertValidMethodMap: cogMethod."<br>
                         "self disassembleMethod: cogMethod."<br>
                         "printInstructions := clickConfirm := true""]."<br>
        ^cogMethod!<br>
<br>
Item was changed:<br>
  ----- Method: Cogit>>cogFullBlockMethod:<wbr>numCopied: (in category 'jit - api') -----<br>
  cogFullBlockMethod: aMethodObj numCopied: numCopied<br>
        "Attempt to produce a machine code method for the bytecode method<br>
         object aMethodObj.  N.B. If there is no code memory available do *NOT*<br>
         attempt to reclaim the method zone.  Certain clients (e.g. ceSICMiss:)<br>
         depend on the zone remaining constant across method generation."<br>
        <api><br>
        <option: #SistaV1BytecodeSet><br>
        <returnTypeC: #'CogMethod *'><br>
        | cogMethod |<br>
        <var: #cogMethod type: #'CogMethod *'><br>
        (self exclude: aMethodObj) ifTrue:<br>
                [^nil].<br>
        self deny: (coInterpreter methodHasCogMethod: aMethodObj).<br>
        self assert: (objectMemory isOopCompiledMethod: (coInterpreter ultimateLiteralOf: aMethodObj)).<br>
        aMethodObj = breakMethod ifTrue: [self halt: 'Compilation of breakMethod'].<br>
        "If the generators for the alternate bytecode set are missing then interpret."<br>
        (coInterpreter methodUsesAlternateBytecodeSet<wbr>: aMethodObj)<br>
                ifTrue:<br>
                        [(self numElementsIn: generatorTable) <= 256 ifTrue:<br>
                                [^nil].<br>
                         bytecodeSetOffset := 256]<br>
                ifFalse:<br>
                        [bytecodeSetOffset := 0].<br>
        objectRepresentation ensureNoForwardedLiteralsIn: aMethodObj.<br>
        methodObj := aMethodObj.<br>
        methodHeader := objectMemory methodHeaderOf: aMethodObj.<br>
+       receiverTags := objectMemory receiverTagBitsForMethod: methodObj.<br>
        cogMethod := self compileCogFullBlockMethod: numCopied.<br>
        (cogMethod asInteger between: MaxNegativeErrorCode and: -1) ifTrue:<br>
                [cogMethod asInteger = InsufficientCodeSpace ifTrue:<br>
                        [coInterpreter callForCogCompiledCodeCompacti<wbr>on].<br>
                 self maybeFreeCounters.<br>
                 "Right now no errors should be reported, so nothing more to do."<br>
                 "self reportError: (self cCoerceSimple: cogMethod to: #sqInt)."<br>
                 ^nil].<br>
        "self cCode: ''<br>
                inSmalltalk:<br>
                        [coInterpreter printCogMethod: cogMethod.<br>
                         ""coInterpreter symbolicMethod: aMethodObj.""<br>
                         self assertValidMethodMap: cogMethod."<br>
                         "self disassembleMethod: cogMethod."<br>
                         "printInstructions := clickConfirm := true""]."<br>
        ^cogMethod!<br>
<br>
Item was changed:<br>
  ----- Method: Cogit>>mclassIsSmallInteger (in category 'initialization') -----<br>
  mclassIsSmallInteger<br>
+       ^objectMemory isIntegerObject: receiverTags!<br>
-       ^(coInterpreter methodClassOf: methodObj) = objectMemory classSmallInteger!<br>
<br>
Item was added:<br>
+ ----- Method: CurrentImageCoInterpreterFacad<wbr>e>>classCharacter (in category 'accessing') -----<br>
+ classCharacter<br>
+       ^self oopForObject: Character!<br>
<br>
Item was added:<br>
+ ----- Method: CurrentImageCoInterpreterFacad<wbr>e>>lookupOrdinary:receiver: (in category 'cog jit support') -----<br>
+ lookupOrdinary: selectorOop receiver: receiverOop<br>
+       | rcvr selector |<br>
+       rcvr := self objectForOop: receiverOop.<br>
+       selector := self objectForOop: selectorOop.<br>
+       (rcvr class canUnderstand: selector) ifTrue:<br>
+               [^self oopForObject: ((rcvr class whichClassIncludesSelector: selector)<br>
+                                                                       compiledMethodAt: selector)].<br>
+       ^SelectorDoesNotUnderstand!<br>
<br>
Item was added:<br>
+ ----- Method: CurrentImageCoInterpreterFacad<wbr>e>>maxLookupNoMNUErrorCode (in category 'accessing') -----<br>
+ maxLookupNoMNUErrorCode<br>
+       ^coInterpreter maxLookupNoMNUErrorCode!<br>
<br>
Item was changed:<br>
  ----- Method: CurrentImageCoInterpreterFacad<wbr>e>>objectForOop: (in category 'private-cacheing') -----<br>
  objectForOop: anOop<br>
        "This is a keyAtValue: search and so needs speeding up either by a reverse map or a simple cache."<br>
+       self subclassResponsibility!<br>
-       ^(anOop bitAnd: 3) caseOf: {<br>
-               [0] -> [anOop = cachedOop<br>
-                               ifTrue: [cachedObject]<br>
-                               ifFalse: [cachedObject := objectMap keyAtValue: anOop. "may raise Error"<br>
-                                               cachedOop := anOop. "Dom't assign until accessed without error"<br>
-                                               cachedObject]].<br>
-               [1] -> [anOop signedIntFromLong >> 1].<br>
-               [3] -> [anOop signedIntFromLong >> 1] }!<br>
<br>
Item was changed:<br>
  ----- Method: CurrentImageCoInterpreterFacad<wbr>e>>stringOf: (in category 'accessing') -----<br>
  stringOf: anOop<br>
+       | thing |<br>
+       thing := objectMap<br>
+                               keyAtValue: anOop<br>
+                               ifAbsent:<br>
+                                       [variables<br>
+                                               keyAtValue: anOop<br>
+                                               ifAbsent: [^nil]].<br>
+       ^((thing isLiteral and: [thing isSymbol not])<br>
+               ifTrue: [thing storeString]<br>
+               ifFalse: [thing asString]) contractTo: 64!<br>
-       ^(self lookupAddress: anOop) asString!<br>
<br>
Item was changed:<br>
  ----- Method: CurrentImageCoInterpreterFacad<wbr>eFor64BitSpurObjectRepresentat<wbr>ion>>objectForOop: (in category 'private-cacheing') -----<br>
  objectForOop: anOop<br>
        "This is a keyAtValue: search and so needs speeding up either by a reverse map or a simple cache."<br>
+       ^(anOop bitAnd: 7) caseOf: {<br>
-       ^(anOop bitAnd: 3) caseOf: {<br>
                [0] -> [anOop = cachedOop<br>
                                ifTrue: [cachedObject]<br>
                                ifFalse: [cachedObject := objectMap keyAtValue: anOop. "may raise Error"<br>
                                                cachedOop := anOop. "Dom't assign until accessed without error"<br>
                                                cachedObject]].<br>
                [1] -> [anOop signedIntFromLong64 >> 3].<br>
                [2] -> [Character value: anOop >> 3].<br>
+               [4] -> [objectMemory smallFloatValueOf: anOop] }!<br>
-               [3] -> [objectMemory smallFloatValueOf: anOop] }!<br>
<br>
Item was added:<br>
+ ----- Method: CurrentImageCoInterpreterFacad<wbr>eForSpurObjectRepresentation>><wbr>objectForOop: (in category 'private-cacheing') -----<br>
+ objectForOop: anOop<br>
+       "This is a keyAtValue: search and so needs speeding up either by a reverse map or a simple cache."<br>
+       ^(anOop bitAnd: 3) caseOf: {<br>
+               [0] -> [anOop = cachedOop<br>
+                               ifTrue: [cachedObject]<br>
+                               ifFalse: [cachedObject := objectMap keyAtValue: anOop. "may raise Error"<br>
+                                               cachedOop := anOop. "Dom't assign until accessed without error"<br>
+                                               cachedObject]].<br>
+               [1] -> [anOop signedIntFromLong >> 1].<br>
+               [2] -> [Character value: anOop >> 2].<br>
+               [3] -> [anOop signedIntFromLong >> 1] }!<br>
<br>
Item was added:<br>
+ ----- Method: CurrentImageCoInterpreterFacad<wbr>eForSqueakV3ObjectRepresentati<wbr>on>>objectForOop: (in category 'private-cacheing') -----<br>
+ objectForOop: anOop<br>
+       "This is a keyAtValue: search and so needs speeding up either by a reverse map or a simple cache."<br>
+       ^(anOop bitAnd: 3) caseOf: {<br>
+               [0] -> [anOop = cachedOop<br>
+                               ifTrue: [cachedObject]<br>
+                               ifFalse: [cachedObject := objectMap keyAtValue: anOop. "may raise Error"<br>
+                                               cachedOop := anOop. "Dom't assign until accessed without error"<br>
+                                               cachedObject]].<br>
+               [1] -> [anOop signedIntFromLong >> 1].<br>
+               [3] -> [anOop signedIntFromLong >> 1] }!<br>
<br>
Item was changed:<br>
  ----- Method: FilePluginSimulator>><wbr>initialiseModule (in category 'initialize-release') -----<br>
  initialiseModule<br>
        "See FilePluginSimulator>><wbr>sqFileStdioHandlesInto:"<br>
        (openFiles := Dictionary new)<br>
                at: 0 put: (FakeStdinStream for: interpreterProxy interpreter); "stdin"<br>
+               at: 1 put: interpreterProxy interpreter transcript; "stdout"<br>
+               at: 2 put: interpreterProxy interpreter transcript. "stderr"<br>
-               at: 1 put: Transcript; "stdout"<br>
-               at: 2 put: Transcript. "stderr"<br>
        states := IdentityDictionary new.<br>
        maxOpenFiles := VMClass initializationOptions at: #MaxFileDescriptors ifAbsent: [1024].<br>
        ^super initialiseModule!<br>
<br>
Item was added:<br>
+ ----- Method: NewCoObjectMemory>><wbr>receiverTagBitsForMethod: (in category 'cog jit support') -----<br>
+ receiverTagBitsForMethod: aMethodObj<br>
+       "Answer the tag bits for the receiver based on the method's methodClass, if any."<br>
+       <api><br>
+       ^(coInterpreter methodClassOf: aMethodObj) = self classSmallInteger<br>
+               ifTrue: [self smallIntegerTag]<br>
+               ifFalse: [0]!<br>
<br>
Item was changed:<br>
  ----- Method: RegisterAllocatingCogit>><wbr>genSpecialSelectorArithmetic (in category 'bytecode generators') -----<br>
  genSpecialSelectorArithmetic<br>
        | primDescriptor rcvrIsConst argIsConst rcvrIsInt argIsInt rcvrInt argInt destReg<br>
         jumpNotSmallInts jumpContinue jumpOverflow index rcvrReg argReg regMask |<br>
        <var: #jumpOverflow type: #'AbstractInstruction *'><br>
        <var: #jumpContinue type: #'AbstractInstruction *'><br>
        <var: #primDescriptor type: #'BytecodeDescriptor *'><br>
        <var: #jumpNotSmallInts type: #'AbstractInstruction *'><br>
        primDescriptor := self generatorAt: byte0.<br>
        argIsInt := (argIsConst := self ssTop type = SSConstant)<br>
                                 and: [objectMemory isIntegerObject: (argInt := self ssTop constant)].<br>
+       rcvrIsInt := ((rcvrIsConst := (self ssValue: 1) type = SSConstant)<br>
+                                 and: [objectMemory isIntegerObject: (rcvrInt := (self ssValue: 1) constant)])<br>
+                               or: [self mclassIsSmallInteger and: [(self ssValue: 1) isSameEntryAs: (self addressOf: simSelf)]].<br>
-       rcvrIsInt := (rcvrIsConst := (self ssValue: 1) type = SSConstant)<br>
-                                and: [objectMemory isIntegerObject: (rcvrInt := (self ssValue: 1) constant)].<br>
<br>
+       (argIsInt and: [rcvrIsInt and: [rcvrIsConst]]) ifTrue:<br>
-       (argIsInt and: [rcvrIsInt]) ifTrue:<br>
                [| result |<br>
                 rcvrInt := objectMemory integerValueOf: rcvrInt.<br>
                 argInt := objectMemory integerValueOf: argInt.<br>
                 primDescriptor opcode caseOf: {<br>
                        [AddRR] -> [result := rcvrInt + argInt].<br>
                        [SubRR] -> [result := rcvrInt - argInt].<br>
                        [AndRR] -> [result := rcvrInt bitAnd: argInt].<br>
                        [OrRR]          -> [result := rcvrInt bitOr: argInt] }.<br>
                (objectMemory isIntegerValue: result) ifTrue:<br>
                        ["Must annotate the bytecode for correct pc mapping."<br>
                        ^self ssPop: 2; ssPushAnnotatedConstant: (objectMemory integerObjectOf: result)].<br>
                ^self genSpecialSelectorSend].<br>
<br>
        "If there's any constant involved other than a SmallInteger don't attempt to inline."<br>
        ((rcvrIsConst and: [rcvrIsInt not])<br>
         or: [argIsConst and: [argIsInt not]]) ifTrue:<br>
                [^self genSpecialSelectorSend].<br>
<br>
        "If we know nothing about the types then better not to inline as the inline cache and<br>
         primitive code is not terribly slow so wasting time on duplicating tag tests is pointless."<br>
        (argIsInt or: [rcvrIsInt]) ifFalse:<br>
                [^self genSpecialSelectorSend].<br>
<br>
        "Since one or other of the arguments is an integer we can very likely profit from inlining.<br>
         But if the other type is not SmallInteger or if the operation overflows then we will need<br>
         to do a send.  Since we're allocating values in registers we would like to keep those<br>
         registers live on the inlined path and reload registers along the non-inlined send path.<br>
         See reconcileRegisterStateForJoinA<wbr>fterSpecialSelectorSend below."<br>
        argIsInt<br>
                ifTrue:<br>
                        [rcvrReg := self allocateRegForStackEntryAt: 1.<br>
                         (self ssValue: 1) popToReg: rcvrReg.<br>
-                        self MoveR: rcvrReg R: TempReg.<br>
                         regMask := self registerMaskFor: rcvrReg]<br>
                ifFalse:<br>
                        [self allocateRegForStackTopTwoEntri<wbr>esInto: [:rTop :rNext| argReg := rTop. rcvrReg := rNext].<br>
                         self ssTop popToReg: argReg.<br>
                         (self ssValue: 1) popToReg: rcvrReg.<br>
-                        self MoveR: argReg R: TempReg.<br>
                         regMask := self registerMaskFor: rcvrReg and: argReg].<br>
<br>
        "rcvrReg can be reused for the result iff the receiver is a constant or is an SSRegister that is not used elsewhere."<br>
+       destReg := ((rcvrIsInt and: [rcvrIsConst])<br>
-       destReg := (rcvrIsInt<br>
                                 or: [(self ssValue: 1) type = SSRegister<br>
                                         and: [(self anyReferencesToRegister: rcvrReg inAllButTopNItems: 2) not]])<br>
                                        ifTrue: [rcvrReg]<br>
                                        ifFalse: [self allocateRegNotConflictingWith: regMask].<br>
        self ssPop: 2.<br>
+       jumpNotSmallInts := (rcvrIsInt and: [argIsInt]) ifFalse:<br>
+                                                       [argIsInt<br>
+                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: rcvrReg]<br>
+                                                               ifFalse:<br>
+                                                                       [rcvrIsInt<br>
+                                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: argReg]<br>
+                                                                               ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: rcvrReg and: argReg scratch: TempReg]]].<br>
-       jumpNotSmallInts := (argIsInt or: [rcvrIsInt])<br>
-                                                       ifTrue: [objectRepresentation genJumpNotSmallIntegerInScratc<wbr>hReg: TempReg]<br>
-                                                       ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: rcvrReg andScratch: TempReg scratch: ClassReg].<br>
        rcvrReg ~= destReg ifTrue:<br>
                [self MoveR: rcvrReg R: destReg].<br>
        primDescriptor opcode caseOf: {<br>
                [AddRR] -> [argIsInt<br>
                                                ifTrue:<br>
                                                        [self AddCq: argInt - ConstZero R: destReg.<br>
                                                         jumpContinue := self JumpNoOverflow: 0.<br>
                                                         "overflow; must undo the damage before doing send"<br>
                                                         rcvrReg = destReg ifTrue:<br>
                                                                [self SubCq: argInt - ConstZero R: rcvrReg]]<br>
                                                ifFalse:<br>
                                                        [objectRepresentation genRemoveSmallIntegerTagsInScr<wbr>atchReg: destReg.<br>
                                                         self AddR: argReg R: destReg.<br>
                                                         jumpContinue := self JumpNoOverflow: 0.<br>
                                                        "overflow; must undo the damage before doing send"<br>
                                                         destReg = rcvrReg ifTrue:<br>
+                                                               [(rcvrIsInt and: [rcvrIsConst])<br>
-                                                               [rcvrIsInt<br>
                                                                        ifTrue: [self MoveCq: rcvrInt R: rcvrReg]<br>
                                                                        ifFalse:<br>
                                                                                [self SubR: argReg R: rcvrReg.<br>
                                                                                 objectRepresentation genSetSmallIntegerTagsIn: rcvrReg]]]].<br>
                [SubRR] -> [argIsInt<br>
                                                ifTrue:<br>
                                                        [self SubCq: argInt - ConstZero R: destReg.<br>
                                                         jumpContinue := self JumpNoOverflow: 0.<br>
                                                         "overflow; must undo the damage before doing send"<br>
                                                         rcvrReg = destReg ifTrue:<br>
                                                                [self AddCq: argInt - ConstZero R: rcvrReg]]<br>
                                                ifFalse:<br>
                                                        [(self anyReferencesToRegister: argReg inAllButTopNItems: 0)<br>
                                                                ifTrue: "argReg is live; cannot strip tags and continue on no overflow without restoring tags"<br>
                                                                        [objectRepresentation genRemoveSmallIntegerTagsInScr<wbr>atchReg: argReg.<br>
                                                                         self SubR: argReg R: destReg.<br>
                                                                         jumpOverflow := self JumpOverflow: 0.<br>
                                                                         "no overflow; must undo the damage before continuing"<br>
                                                                         objectRepresentation genSetSmallIntegerTagsIn: argReg.<br>
                                                                         jumpContinue := self Jump: 0.<br>
                                                                         jumpOverflow jmpTarget: self Label.<br>
                                                                         "overflow; must undo the damage before doing send"<br>
+                                                                        ((rcvrIsInt and: [rcvrIsConst]) or: [destReg ~= rcvrReg]) ifFalse:<br>
-                                                                        (rcvrIsInt or: [destReg ~= rcvrReg]) ifFalse:<br>
                                                                                [self AddR: argReg R: destReg].<br>
                                                                         objectRepresentation genSetSmallIntegerTagsIn: argReg]<br>
                                                                ifFalse:<br>
                                                                        [objectRepresentation genRemoveSmallIntegerTagsInScr<wbr>atchReg: argReg.<br>
                                                                         self SubR: argReg R: destReg.<br>
                                                                         jumpContinue := self JumpNoOverflow: 0.<br>
                                                                         "overflow; must undo the damage before doing send"<br>
+                                                                        ((rcvrIsInt and: [rcvrIsConst]) or: [destReg ~= rcvrReg]) ifFalse:<br>
-                                                                        (rcvrIsInt or: [destReg ~= rcvrReg]) ifFalse:<br>
                                                                                [self AddR: argReg R: rcvrReg].<br>
                                                                         objectRepresentation genSetSmallIntegerTagsIn: argReg]]].<br>
                [AndRR] -> [argIsInt<br>
                                                ifTrue: [self AndCq: argInt R: destReg]<br>
                                                ifFalse: [self AndR: argReg R: destReg].<br>
                                        jumpContinue := self Jump: 0].<br>
                [OrRR]  -> [argIsInt<br>
                                                ifTrue: [self OrCq: argInt R: destReg]<br>
                                                ifFalse: [self OrR: argReg R: destReg].<br>
                                        jumpContinue := self Jump: 0] }.<br>
        jumpNotSmallInts jmpTarget: self Label.<br>
        self ssPushRegister: destReg.<br>
        self copySimStackToScratch: (simSpillBase min: simStackPtr - 1).<br>
        self ssPop: 1.<br>
        self ssFlushTo: simStackPtr.<br>
+       rcvrReg = Arg0Reg<br>
+               ifTrue:<br>
+                       [argReg = ReceiverResultReg<br>
+                               ifTrue: [self SwapR: Arg0Reg R: Arg0Reg Scratch: TempReg. argReg := Arg0Reg]<br>
+                               ifFalse: [self MoveR: rcvrReg R: ReceiverResultReg].<br>
+                        rcvrReg := ReceiverResultReg].<br>
-       self deny: rcvrReg = Arg0Reg.<br>
        argIsInt<br>
                ifTrue: [self MoveCq: argInt R: Arg0Reg]<br>
                ifFalse: [argReg ~= Arg0Reg ifTrue: [self MoveR: argReg R: Arg0Reg]].<br>
        rcvrReg ~= ReceiverResultReg ifTrue: [self MoveR: rcvrReg R: ReceiverResultReg].<br>
        index := byte0 - self firstSpecialSelectorBytecodeOf<wbr>fset.<br>
        self genMarshalledSend: index negated - 1 numArgs: 1 sendTable: ordinarySendTrampolines.<br>
        self reconcileRegisterStateForJoinA<wbr>fterSpecialSelectorSend.<br>
        jumpContinue jmpTarget: self Label.<br>
        ^0!<br>
<br>
Item was changed:<br>
  ----- Method: RegisterAllocatingCogit>><wbr>genSpecialSelectorComparison (in category 'bytecode generators') -----<br>
  genSpecialSelectorComparison<br>
        | nextPC postBranchPC targetPC primDescriptor branchDescriptor<br>
+         rcvrIsInt rcvrIsConst argIsIntConst argInt jumpNotSmallInts inlineCAB index rcvrReg argReg branchToTarget needMergeToContinue needMergeToTarget |<br>
-         rcvrIsInt argIsInt argInt jumpNotSmallInts inlineCAB index rcvrReg argReg branchToTarget needMergeToContinue needMergeToTarget |<br>
        <var: #primDescriptor type: #'BytecodeDescriptor *'><br>
        <var: #branchDescriptor type: #'BytecodeDescriptor *'><br>
        <var: #jumpNotSmallInts type: #'AbstractInstruction *'><br>
        primDescriptor := self generatorAt: byte0.<br>
+       argIsIntConst := self ssTop type = SSConstant<br>
-       argIsInt := self ssTop type = SSConstant<br>
                                 and: [objectMemory isIntegerObject: (argInt := self ssTop constant)].<br>
+       rcvrIsInt := ((rcvrIsConst := (self ssValue: 1) type = SSConstant)<br>
+                                 and: [objectMemory isIntegerObject: (self ssValue: 1) constant])<br>
+                               or: [self mclassIsSmallInteger and: [(self ssValue: 1) isSameEntryAs: (self addressOf: simSelf)]].<br>
-       rcvrIsInt := (self ssValue: 1) type = SSConstant<br>
-                                and: [objectMemory isIntegerObject: (self ssValue: 1) constant].<br>
<br>
+       (argIsIntConst and: [rcvrIsInt and: [rcvrIsConst]]) ifTrue:<br>
-       (argIsInt and: [rcvrIsInt]) ifTrue:<br>
                [^self genStaticallyResolvedSpecialSe<wbr>lectorComparison].<br>
<br>
        self extractMaybeBranchDescriptorIn<wbr>to: [ :descr :next :postBranch :target |<br>
                branchDescriptor := descr. nextPC := next. postBranchPC := postBranch. targetPC := target ].<br>
<br>
        "Only interested in inlining if followed by a conditional branch."<br>
        inlineCAB := branchDescriptor isBranchTrue or: [branchDescriptor isBranchFalse].<br>
        "Further, only interested in inlining = and ~= if there's a SmallInteger constant involved.<br>
         The relational operators successfully statically predict SmallIntegers; the equality operators do not."<br>
        (inlineCAB and: [primDescriptor opcode = JumpZero or: [primDescriptor opcode = JumpNonZero]]) ifTrue:<br>
+               [inlineCAB := argIsIntConst or: [rcvrIsInt]].<br>
-               [inlineCAB := argIsInt or: [rcvrIsInt]].<br>
        inlineCAB ifFalse:<br>
                [^self genSpecialSelectorSend].<br>
<br>
        "In-line the comparison and the jump, but if the types are not SmallInteger then we will need<br>
         to do a send and fall through to the following conditional branch.  Since we're allocating values<br>
         in registers we would like to keep those registers live on the inlined path and reload registers<br>
         along the non-inlined send path.  The merge logic at the branch destinations handles this."<br>
+       argIsIntConst<br>
-       argIsInt<br>
                ifTrue:<br>
                        [rcvrReg := self allocateRegForStackEntryAt: 1.<br>
+                        (self ssValue: 1) popToReg: rcvrReg.<br>
+                        argReg := NoReg]<br>
-                        (self ssValue: 1) popToReg: rcvrReg]<br>
                ifFalse:<br>
                        [self allocateRegForStackTopTwoEntri<wbr>esInto: [:rTop :rNext| argReg := rTop. rcvrReg := rNext].<br>
                         rcvrReg = Arg0Reg ifTrue:<br>
                                [rcvrReg := argReg. argReg := Arg0Reg].<br>
                         self ssTop popToReg: argReg.<br>
+                        (self ssValue: 1) popToReg: rcvrReg].<br>
-                        (self ssValue: 1) popToReg: rcvrReg.<br>
-                        rcvrIsInt ifFalse:<br>
-                               [self MoveR: argReg R: TempReg]].<br>
        self ssPop: 2.<br>
+       jumpNotSmallInts := (rcvrIsInt and: [argIsIntConst]) ifFalse:<br>
+                                                       [argIsIntConst<br>
+                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: rcvrReg]<br>
+                                                               ifFalse:<br>
+                                                                       [rcvrIsInt<br>
+                                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: argReg]<br>
+                                                                               ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: rcvrReg and: argReg scratch: TempReg]]].<br>
+       argIsIntConst<br>
-       jumpNotSmallInts := (argIsInt or: [rcvrIsInt])<br>
-                                                       ifFalse: "Neither known to be ints; and them together for the test..."<br>
-                                                               [objectRepresentation genJumpNotSmallIntegersIn: rcvrReg andScratch: TempReg scratch: ClassReg]<br>
-                                                       ifTrue: "One known; in-place single-bit test for the other"<br>
-                                                               [objectRepresentation genJumpNotSmallInteger: (rcvrIsInt ifTrue: [argReg] ifFalse: [rcvrReg])].<br>
-       argIsInt<br>
                ifTrue: [self CmpCq: argInt R: rcvrReg]<br>
                ifFalse: [self CmpR: argReg R: rcvrReg].<br>
<br>
        "self printSimStack; printSimStack: (self fixupAt: postBranchPC) mergeSimStack; printSimStack: (self fixupAt: targetPC) mergeSimStack"<br>
        "If there are merges to be performed on the forward branches we have to execute<br>
         the merge code only along the path requiring that merge, and exactly once."<br>
        needMergeToTarget := self mergeRequiredForJumpTo: targetPC.<br>
        needMergeToContinue := self mergeRequiredForJumpTo: postBranchPC.<br>
        "Cmp is weird/backwards so invert the comparison."<br>
        (needMergeToTarget and: [needMergeToContinue]) ifTrue:<br>
                [branchToTarget := self genConditionalBranch: (branchDescriptor isBranchTrue<br>
                                                                                ifTrue: [primDescriptor opcode]<br>
                                                                                ifFalse: [self inverseBranchFor: primDescriptor opcode])<br>
                                                                operand: 0.<br>
                 self Jump: (self ensureFixupAt: postBranchPC).<br>
                 branchToTarget jmpTarget: self Label.<br>
                 self Jump: (self ensureFixupAt: targetPC)].<br>
        (needMergeToTarget and: [needMergeToContinue not]) ifTrue:<br>
                [self genConditionalBranch: (branchDescriptor isBranchFalse<br>
                                                                                ifTrue: [primDescriptor opcode]<br>
                                                                                ifFalse: [self inverseBranchFor: primDescriptor opcode])<br>
                        operand: (self ensureFixupAt: postBranchPC) asUnsignedInteger.<br>
                 self Jump: (self ensureFixupAt: targetPC)].<br>
        (needMergeToTarget not and: [needMergeToContinue]) ifTrue:<br>
                [self genConditionalBranch: (branchDescriptor isBranchTrue<br>
                                                                                ifTrue: [primDescriptor opcode]<br>
                                                                                ifFalse: [self inverseBranchFor: primDescriptor opcode])<br>
                        operand: (self ensureFixupAt: targetPC) asUnsignedInteger.<br>
                 self Jump: (self ensureFixupAt: postBranchPC)].<br>
        (needMergeToTarget or: [needMergeToContinue]) ifFalse:<br>
                [self genConditionalBranch: (branchDescriptor isBranchTrue<br>
                                                                                ifTrue: [primDescriptor opcode]<br>
                                                                                ifFalse: [self inverseBranchFor: primDescriptor opcode])<br>
                        operand: (self ensureFixupAt: targetPC) asUnsignedInteger.<br>
                 self Jump: (self ensureFixupAt: postBranchPC)].<br>
+       jumpNotSmallInts ifNil:<br>
+               [self annotateInstructionForBytecode<wbr>.<br>
+                deadCode := true.<br>
+                ^0].<br>
        jumpNotSmallInts jmpTarget: self Label.<br>
        self ssFlushTo: simStackPtr.<br>
+       rcvrReg = Arg0Reg<br>
+               ifTrue:<br>
+                       [argReg = ReceiverResultReg<br>
+                               ifTrue: [self SwapR: Arg0Reg R: Arg0Reg Scratch: TempReg. argReg := Arg0Reg]<br>
+                               ifFalse: [self MoveR: rcvrReg R: ReceiverResultReg].<br>
+                        rcvrReg := ReceiverResultReg].<br>
+       argIsIntConst<br>
-       self deny: rcvrReg = Arg0Reg.<br>
-       argIsInt<br>
                ifTrue: [self MoveCq: argInt R: Arg0Reg]<br>
                ifFalse: [argReg ~= Arg0Reg ifTrue: [self MoveR: argReg R: Arg0Reg]].<br>
        rcvrReg ~= ReceiverResultReg ifTrue: [self MoveR: rcvrReg R: ReceiverResultReg].<br>
        index := byte0 - self firstSpecialSelectorBytecodeOf<wbr>fset.<br>
        ^self genMarshalledSend: index negated - 1 numArgs: 1 sendTable: ordinarySendTrampolines!<br>
<br>
Item was changed:<br>
  ----- Method: RegisterAllocatingCogit>><wbr>mergeCurrentSimStackWith:<wbr>forwards: (in category 'bytecode generator support') -----<br>
  mergeCurrentSimStackWith: fixup forwards: forwards<br>
        "At a merge point the cogit expects the stack to be in the same state as mergeSimStack.<br>
         mergeSimStack is the state as of some jump forward or backward to this point.  So make simStack agree<br>
         with mergeSimStack (it is, um, problematic to plant code at the jump).<br>
         Values may have to be assigned to registers.  Registers may have to be swapped.<br>
         The state of optStatus must agree.<br>
         Generate code to merge the current simStack with that of the target fixup,<br>
         the goal being to keep as many registers live as possible.  If the merge is forwards<br>
         registers can be deassigned (since registers are always written to temp vars).<br>
         But if backwards, nothing can be deassigned, and the state /must/ reflect the target."<br>
        "self printSimStack; printSimStack: fixup mergeSimStack"<br>
+       "abstractOpcodes object copyFrom: startIndex to: opcodeIndex"<br>
        <var: #fixup type: #'BytecodeFixup *'><br>
        | startIndex mergeSimStack currentEntry targetEntry writtenToRegisters |<br>
        <var: #mergeSimStack type: #'SimStackEntry *'><br>
        <var: #targetEntry type: #'SimStackEntry *'><br>
        <var: #currentEntry type: #'SimStackEntry *'><br>
        (mergeSimStack := fixup mergeSimStack) ifNil: [^self].<br>
        startIndex := opcodeIndex. "for debugging"<br>
        "Assignments amongst the registers must be made in order to avoid overwriting.<br>
         If necessary exchange registers amongst simStack's entries to resolve any conflicts."<br>
        self resolveRegisterOrderConflictsB<wbr>etweenCurrentSimStackAnd: mergeSimStack.<br>
        (self asserta: (self conflictsResolvedBetweenSimSta<wbr>ckAnd: mergeSimStack)) ifFalse:<br>
                [Notification new tag: #failedMerge; signal].<br>
        writtenToRegisters := 0.<br>
        (self pushForMergeWith: mergeSimStack)<br>
                ifTrue:<br>
                        [methodOrBlockNumArgs to: simStackPtr do:<br>
                                [:i|<br>
                                 currentEntry := self simStack: simStack at: i.<br>
                                 targetEntry := self simStack: mergeSimStack at: i.<br>
                                 writtenToRegisters := writtenToRegisters bitOr: targetEntry registerMask.<br>
                                 (currentEntry reconcileForwardsWith: targetEntry) ifTrue:<br>
                                        [self assert: i >= methodOrBlockNumArgs.<br>
                                         self deassignRegisterForTempVar: targetEntry in: mergeSimStack].<br>
                                 "Note, we could update the simStack and spillBase here but that is done in restoreSimStackAtMergePoint:<br>
                                 spilled ifFalse:<br>
                                        [simSpillBase := i - 1].<br>
                                 simStack<br>
                                        at: i<br>
                                        put: (self<br>
                                                        cCode: [mergeSimStack at: i]<br>
                                                        inSmalltalk: [(mergeSimStack at: i) copy])"]]<br>
                ifFalse:<br>
                        [simStackPtr to: methodOrBlockNumArgs by: -1 do:<br>
                                [:i|<br>
                                 currentEntry := self simStack: simStack at: i.<br>
                                 targetEntry := self simStack: mergeSimStack at: i.<br>
                                 writtenToRegisters := writtenToRegisters bitOr: targetEntry registerMask.<br>
                                 (currentEntry reconcileForwardsWith: targetEntry) ifTrue:<br>
                                        [self assert: i >= methodOrBlockNumArgs.<br>
                                         self deassignRegisterForTempVar: targetEntry in: mergeSimStack].<br>
                                 "Note, we could update the simStack and spillBase here but that is done in restoreSimStackAtMergePoint:<br>
                                 spilled ifFalse:<br>
                                        [simSpillBase := i - 1].<br>
                                 simStack<br>
                                        at: i<br>
                                        put: (self<br>
                                                        cCode: [mergeSimStack at: i]<br>
                                                        inSmalltalk: [(mergeSimStack at: i) copy])"]].<br>
        methodOrBlockNumArgs - 1 to: 0 by: -1 do:<br>
                [:i|<br>
                 targetEntry := self simStack: mergeSimStack at: i.<br>
                 (targetEntry registerMask noMask: writtenToRegisters) ifTrue:<br>
                        [currentEntry := self simStack: simStack at: i.<br>
                         writtenToRegisters := writtenToRegisters bitOr: targetEntry registerMask.<br>
                         (currentEntry reconcileForwardsWith: targetEntry) ifTrue:<br>
                                [self assert: i >= methodOrBlockNumArgs.<br>
                                 self deassignRegisterForTempVar: targetEntry in: mergeSimStack]]].<br>
        optStatus isReceiverResultRegLive ifFalse:<br>
                [forwards<br>
                        ifTrue: "a.k.a. fixup isReceiverResultRegSelf: (fixup isReceiverResultRegSelf and: [optStatus isReceiverResultRegLive])"<br>
                                [fixup isReceiverResultRegSelf: false]<br>
                        ifFalse:<br>
                                [fixup isReceiverResultRegSelf ifTrue:<br>
                                        [self putSelfInReceiverResultReg]]]!<br>
<br>
Item was added:<br>
+ ----- Method: RegisterAllocatingCogit>><wbr>ssAllocateRequiredRegMask:<wbr>upThrough:upThroughNative: (in category 'simulation stack') -----<br>
+ ssAllocateRequiredRegMask: requiredRegsMask upThrough: stackPtr upThroughNative: nativeStackPtr<br>
+       "Override to void any required registers in temp vars."<br>
+       (requiredRegsMask anyMask: (self registerMaskFor: ReceiverResultReg)) ifTrue:<br>
+               [optStatus isReceiverResultRegLive: false.<br>
+                optStatus ssEntry liveRegister: NoReg].<br>
+       0 to: methodOrBlockNumTemps - 1 do:<br>
+               [:i|<br>
+               ((self simStackAt: i) registerMask anyMask: requiredRegsMask) ifTrue:<br>
+                       [(self simStackAt: i) liveRegister: 0]].<br>
+       super ssAllocateRequiredRegMask: requiredRegsMask upThrough: stackPtr upThroughNative: nativeStackPtr!<br>
<br>
Item was changed:<br>
  ----- Method: SimpleStackBasedCogit>><wbr>genLongUnconditionalBackwardJu<wbr>mp (in category 'bytecode generators') -----<br>
  genLongUnconditionalBackwardJu<wbr>mp<br>
+       | distance |<br>
-       | distance targetpc |<br>
        distance := self v3: (self generatorAt: byte0)<br>
                                        Long: bytecodePC<br>
                                        Branch: 0<br>
                                        Distance: methodObj.<br>
        self assert: distance < 0.<br>
+       ^self genJumpBackTo: distance + 2 + bytecodePC!<br>
-       targetpc := distance + 2 + bytecodePC.<br>
-       ^self genJumpBackTo: targetpc!<br>
<br>
Item was changed:<br>
  ----- Method: SistaCogit>><wbr>genSpecialSelectorComparison (in category 'bytecode generators') -----<br>
  genSpecialSelectorComparison<br>
        "Override to count inlined branches if followed by a conditional branch.<br>
         We borrow the following conditional branch's counter and when about to<br>
         inline the comparison we decrement the counter (without writing it back)<br>
         and if it trips simply abort the inlining, falling back to the normal send which<br>
         will then continue to the conditional branch which will trip and enter the abort."<br>
+       | nextPC postBranchPC targetPC primDescriptor branchDescriptor<br>
+         rcvrIsInt rcvrIsConst argIsIntConst argInt jumpNotSmallInts inlineCAB<br>
-       | nextPC postBranchPC targetBytecodePC primDescriptor branchDescriptor<br>
-         rcvrIsInt argIsInt argInt jumpNotSmallInts inlineCAB<br>
          counterAddress countTripped counterReg index |<br>
        <var: #countTripped type: #'AbstractInstruction *'><br>
        <var: #primDescriptor type: #'BytecodeDescriptor *'><br>
        <var: #jumpNotSmallInts type: #'AbstractInstruction *'><br>
        <var: #branchDescriptor type: #'BytecodeDescriptor *'><br>
<br>
        (coInterpreter isOptimizedMethod: methodObj) ifTrue: [ ^ self genSpecialSelectorComparisonWi<wbr>thoutCounters ].<br>
<br>
        self ssFlushTo: simStackPtr - 2.<br>
        primDescriptor := self generatorAt: byte0.<br>
+       argIsIntConst := self ssTop type = SSConstant<br>
-       argIsInt := self ssTop type = SSConstant<br>
                                 and: [objectMemory isIntegerObject: (argInt := self ssTop constant)].<br>
+       rcvrIsInt := ((rcvrIsConst := (self ssValue: 1) type = SSConstant)<br>
+                                 and: [objectMemory isIntegerObject:(self ssValue: 1) constant])<br>
+                               or: [self mclassIsSmallInteger and: [(self ssValue: 1) isSameEntryAs: simSelf]].<br>
-       rcvrIsInt := (self ssValue: 1) type = SSConstant<br>
-                                and: [objectMemory isIntegerObject: (self ssValue: 1) constant].<br>
<br>
        "short-cut the jump if operands are SmallInteger constants."<br>
+       (argIsIntConst and: [rcvrIsInt and: [rcvrIsConst]]) ifTrue:<br>
-       (argIsInt and: [rcvrIsInt]) ifTrue:<br>
                [^ self genStaticallyResolvedSpecialSe<wbr>lectorComparison].<br>
<br>
        self extractMaybeBranchDescriptorIn<wbr>to: [ :descr :next :postBranch :target |<br>
+               branchDescriptor := descr. nextPC := next. postBranchPC := postBranch. targetPC := target ].<br>
-               branchDescriptor := descr. nextPC := next. postBranchPC := postBranch. targetBytecodePC := target ].<br>
<br>
        "Only interested in inlining if followed by a conditional branch."<br>
        inlineCAB := branchDescriptor isBranchTrue or: [branchDescriptor isBranchFalse].<br>
        "Further, only interested in inlining = and ~= if there's a SmallInteger constant involved.<br>
         The relational operators successfully statically predict SmallIntegers; the equality operators do not."<br>
        (inlineCAB and: [primDescriptor opcode = JumpZero or: [primDescriptor opcode = JumpNonZero]]) ifTrue:<br>
+               [inlineCAB := argIsIntConst or: [rcvrIsInt]].<br>
-               [inlineCAB := argIsInt or: [rcvrIsInt]].<br>
        inlineCAB ifFalse:<br>
                [^self genSpecialSelectorSend].<br>
<br>
+       argIsIntConst<br>
-       argIsInt<br>
                ifTrue:<br>
                        [(self ssValue: 1) popToReg: ReceiverResultReg.<br>
+                        self ssPop: 2]<br>
-                        self ssPop: 2.<br>
-                        self MoveR: ReceiverResultReg R: TempReg]<br>
                ifFalse:<br>
+                       [self marshallSendArguments: 1].<br>
+       jumpNotSmallInts := (rcvrIsInt and: [argIsIntConst]) ifFalse:<br>
+                                                       [argIsIntConst<br>
+                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: ReceiverResultReg]<br>
+                                                               ifFalse:<br>
+                                                                       [rcvrIsInt<br>
+                                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: Arg0Reg]<br>
+                                                                               ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: ReceiverResultReg and: Arg0Reg scratch: TempReg]]].<br>
-                       [self marshallSendArguments: 1.<br>
-                        self MoveR: Arg0Reg R: TempReg].<br>
-       jumpNotSmallInts := (argIsInt or: [rcvrIsInt])<br>
-                                                       ifTrue: [objectRepresentation genJumpNotSmallIntegerInScratc<wbr>hReg: TempReg]<br>
-                                                       ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: ReceiverResultReg andScratch: TempReg scratch: ClassReg].<br>
<br>
        counterReg := self allocateRegNotConflictingWith: (self registerMaskFor: ReceiverResultReg and: Arg0Reg).<br>
        self<br>
                genExecutionCountLogicInto: [ :cAddress :countTripBranch |<br>
                        counterAddress := cAddress.<br>
                        countTripped := countTripBranch ]<br>
                counterReg: counterReg.<br>
<br>
+       argIsIntConst<br>
-       argIsInt<br>
                ifTrue: [self CmpCq: argInt R: ReceiverResultReg]<br>
                ifFalse: [self CmpR: Arg0Reg R: ReceiverResultReg].<br>
        "Cmp is weird/backwards so invert the comparison.  Further since there is a following conditional<br>
         jump bytecode define non-merge fixups and leave the cond bytecode to set the mergeness."<br>
        self genConditionalBranch: (branchDescriptor isBranchTrue<br>
                                ifTrue: [primDescriptor opcode]<br>
                                ifFalse: [self inverseBranchFor: primDescriptor opcode])<br>
+               operand: (self ensureNonMergeFixupAt: targetPC) asUnsignedInteger.<br>
-               operand: (self ensureNonMergeFixupAt: targetBytecodePC) asUnsignedInteger.<br>
<br>
        self genFallsThroughCountLogicCount<wbr>erReg: counterReg counterAddress: counterAddress.<br>
<br>
        self Jump: (self ensureNonMergeFixupAt: postBranchPC).<br>
+       countTripped jmpTarget: self Label.<br>
+       jumpNotSmallInts ifNil:<br>
+               [self annotateInstructionForBytecode<wbr>.<br>
+                self ensureFixupAt: postBranchPC.<br>
+                self ensureFixupAt: targetPC.<br>
+                deadCode := true.<br>
+                ^0].<br>
+       jumpNotSmallInts jmpTarget: countTripped getJmpTarget.<br>
-       countTripped jmpTarget: (jumpNotSmallInts jmpTarget: self Label).<br>
<br>
+       argIsIntConst ifTrue:<br>
-       argIsInt ifTrue:<br>
                [self MoveCq: argInt R: Arg0Reg].<br>
        index := byte0 - self firstSpecialSelectorBytecodeOf<wbr>fset.<br>
        ^self genMarshalledSend: index negated - 1 numArgs: 1 sendTable: ordinarySendTrampolines!<br>
<br>
Item was changed:<br>
  ----- Method: SistaRegisterAllocatingCogit>><wbr>genSpecialSelectorComparison (in category 'bytecode generators') -----<br>
  genSpecialSelectorComparison<br>
        "Override to count inlined branches if followed by a conditional branch.<br>
         We borrow the following conditional branch's counter and when about to<br>
         inline the comparison we decrement the counter (without writing it back)<br>
         and if it trips simply abort the inlining, falling back to the normal send which<br>
         will then continue to the conditional branch which will trip and enter the abort."<br>
+       | nextPC postBranchPC targetPC primDescriptor branchDescriptor<br>
+         rcvrIsInt rcvrIsConst argIsIntConst argInt jumpNotSmallInts inlineCAB<br>
-       | nextPC postBranchPC targetBytecodePC primDescriptor branchDescriptor<br>
-         rcvrIsInt argIsInt argInt jumpNotSmallInts inlineCAB<br>
          counterAddress countTripped counterReg index rcvrReg argReg |<br>
        <var: #countTripped type: #'AbstractInstruction *'><br>
        <var: #primDescriptor type: #'BytecodeDescriptor *'><br>
        <var: #jumpNotSmallInts type: #'AbstractInstruction *'><br>
        <var: #branchDescriptor type: #'BytecodeDescriptor *'><br>
<br>
        (coInterpreter isOptimizedMethod: methodObj) ifTrue:<br>
                [^self genSpecialSelectorComparisonWi<wbr>thoutCounters].<br>
<br>
        primDescriptor := self generatorAt: byte0.<br>
+       argIsIntConst := self ssTop type = SSConstant<br>
-       argIsInt := self ssTop type = SSConstant<br>
                                 and: [objectMemory isIntegerObject: (argInt := self ssTop constant)].<br>
+       rcvrIsInt := ((rcvrIsConst := (self ssValue: 1) type = SSConstant)<br>
+                                 and: [objectMemory isIntegerObject: (self ssValue: 1) constant])<br>
+                               or: [self mclassIsSmallInteger and: [(self ssValue: 1) isSameEntryAs: (self addressOf: simSelf)]].<br>
-       rcvrIsInt := (self ssValue: 1) type = SSConstant<br>
-                                and: [objectMemory isIntegerObject: (self ssValue: 1) constant].<br>
<br>
        "short-cut the jump if operands are SmallInteger constants."<br>
+       (argIsIntConst and: [rcvrIsInt and: [rcvrIsConst]]) ifTrue:<br>
-       (argIsInt and: [rcvrIsInt]) ifTrue:<br>
                [^ self genStaticallyResolvedSpecialSe<wbr>lectorComparison].<br>
<br>
        self extractMaybeBranchDescriptorIn<wbr>to: [ :descr :next :postBranch :target |<br>
+               branchDescriptor := descr. nextPC := next. postBranchPC := postBranch. targetPC := target ].<br>
-               branchDescriptor := descr. nextPC := next. postBranchPC := postBranch. targetBytecodePC := target ].<br>
<br>
        "Only interested in inlining if followed by a conditional branch."<br>
        inlineCAB := branchDescriptor isBranchTrue or: [branchDescriptor isBranchFalse].<br>
        "Further, only interested in inlining = and ~= if there's a SmallInteger constant involved.<br>
         The relational operators successfully statically predict SmallIntegers; the equality operators do not."<br>
        (inlineCAB and: [primDescriptor opcode = JumpZero or: [primDescriptor opcode = JumpNonZero]]) ifTrue:<br>
+               [inlineCAB := argIsIntConst or: [rcvrIsInt]].<br>
-               [inlineCAB := argIsInt or: [rcvrIsInt]].<br>
        inlineCAB ifFalse:<br>
                [^self genSpecialSelectorSend].<br>
<br>
        "In-line the comparison and the jump, but if the types are not SmallInteger then we will need<br>
         to do a send and fall through to the following conditional branch.  Since we're allocating values<br>
         in registers we would like to keep those registers live on the inlined path and reload registers<br>
         along the non-inlined send path.  The merge logic at the branch destinations handles this."<br>
+       argIsIntConst<br>
-       argIsInt<br>
                ifTrue:<br>
                        [rcvrReg := self allocateRegForStackEntryAt: 1.<br>
                         (self ssValue: 1) popToReg: rcvrReg.<br>
-                        self MoveR: rcvrReg R: TempReg.<br>
                         counterReg := self allocateRegNotConflictingWith: (self registerMaskFor: rcvrReg)]<br>
                ifFalse:<br>
                        [self allocateRegForStackTopTwoEntri<wbr>esInto: [:rTop :rNext| argReg := rTop. rcvrReg := rNext].<br>
                         rcvrReg = Arg0Reg ifTrue:<br>
                                [rcvrReg := argReg. argReg := Arg0Reg].<br>
                         self ssTop popToReg: argReg.<br>
                         (self ssValue: 1) popToReg: rcvrReg.<br>
-                        self MoveR: argReg R: TempReg.<br>
                         counterReg := self allocateRegNotConflictingWith: (self registerMaskFor: rcvrReg and: argReg)].<br>
+       jumpNotSmallInts := (rcvrIsInt and: [argIsIntConst]) ifFalse:<br>
+                                                       [argIsIntConst<br>
+                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: ReceiverResultReg]<br>
+                                                               ifFalse:<br>
+                                                                       [rcvrIsInt<br>
+                                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: Arg0Reg]<br>
+                                                                               ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: ReceiverResultReg and: Arg0Reg scratch: TempReg]]].<br>
-       jumpNotSmallInts := (argIsInt or: [rcvrIsInt])<br>
-                                                       ifTrue: [objectRepresentation genJumpNotSmallIntegerInScratc<wbr>hReg: TempReg]<br>
-                                                       ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: rcvrReg andScratch: TempReg scratch: ClassReg].<br>
<br>
        self<br>
                genExecutionCountLogicInto: [ :cAddress :countTripBranch |<br>
                        counterAddress := cAddress.<br>
                        countTripped := countTripBranch ]<br>
                counterReg: counterReg.<br>
<br>
+       argIsIntConst<br>
-       argIsInt<br>
                ifTrue: [self CmpCq: argInt R: rcvrReg]<br>
                ifFalse: [self CmpR: argReg R: rcvrReg].<br>
        "Cmp is weird/backwards so invert the comparison.  Further since there is a following conditional<br>
         jump bytecode define non-merge fixups and leave the cond bytecode to set the mergeness."<br>
        self genConditionalBranch: (branchDescriptor isBranchTrue<br>
                                ifTrue: [primDescriptor opcode]<br>
                                ifFalse: [self inverseBranchFor: primDescriptor opcode])<br>
+               operand: (self ensureFixupAt: targetPC) asUnsignedInteger.<br>
-               operand: (self ensureFixupAt: targetBytecodePC) asUnsignedInteger.<br>
<br>
        self genFallsThroughCountLogicCount<wbr>erReg: counterReg counterAddress: counterAddress.<br>
<br>
        self Jump: (self ensureFixupAt: postBranchPC).<br>
+       countTripped jmpTarget: self Label.<br>
+       jumpNotSmallInts ifNil:<br>
+               [self annotateInstructionForBytecode<wbr>.<br>
+                deadCode := true.<br>
+                ^0].<br>
+       jumpNotSmallInts jmpTarget: countTripped getJmpTarget.<br>
-       countTripped jmpTarget: (jumpNotSmallInts jmpTarget: self Label).<br>
<br>
        self ssFlushTo: simStackPtr.<br>
        self deny: rcvrReg = Arg0Reg.<br>
+       argIsIntConst<br>
-       argIsInt<br>
                ifTrue: [self MoveCq: argInt R: Arg0Reg]<br>
                ifFalse: [argReg ~= Arg0Reg ifTrue: [self MoveR: argReg R: Arg0Reg]].<br>
        rcvrReg ~= ReceiverResultReg ifTrue: [self MoveR: rcvrReg R: ReceiverResultReg].<br>
        index := byte0 - self firstSpecialSelectorBytecodeOf<wbr>fset.<br>
        ^self genMarshalledSend: index negated - 1 numArgs: 1 sendTable: ordinarySendTrampolines!<br>
<br>
Item was added:<br>
+ ----- Method: Spur32BitCoMemoryManager>><wbr>receiverTagBitsForMethod: (in category 'cog jit support') -----<br>
+ receiverTagBitsForMethod: aMethodObj<br>
+       "Answer the tag bits for the receiver based on the method's methodClass, if any."<br>
+       <api><br>
+       | methodClass |<br>
+       methodClass := coInterpreter methodClassOf: aMethodObj.<br>
+       (self instSpecOfClass: methodClass) ~= self forwardedFormat ifTrue:<br>
+               [^0].<br>
+       ^methodClass = (self fetchPointer: self smallIntegerTag ofObject: classTableFirstPage)<br>
+               ifTrue: [self smallIntegerTag]<br>
+               ifFalse: [self assert: methodClass = (self fetchPointer: self characterTag ofObject: classTableFirstPage).<br>
+                               self characterTag]!<br>
<br>
Item was added:<br>
+ ----- Method: Spur64BitCoMemoryManager>><wbr>classSmallFloat (in category 'accessing') -----<br>
+ classSmallFloat<br>
+       <api><br>
+       ^self fetchPointer: self smallFloatTag ofObject: classTableFirstPage!<br>
<br>
Item was added:<br>
+ ----- Method: Spur64BitCoMemoryManager>><wbr>receiverTagBitsForMethod: (in category 'cog jit support') -----<br>
+ receiverTagBitsForMethod: aMethodObj<br>
+       "Answer the tag bits for the receiver based on the method's methodClass, if any."<br>
+       <api><br>
+       | methodClass |<br>
+       methodClass := coInterpreter methodClassOf: aMethodObj.<br>
+       (self instSpecOfClass: methodClass) ~= self forwardedFormat ifTrue:<br>
+               [^0].<br>
+       methodClass = (self fetchPointer: self smallIntegerTag ofObject: classTableFirstPage) ifTrue:<br>
+               [^self smallIntegerTag].<br>
+       methodClass = (self fetchPointer: self characterTag ofObject: classTableFirstPage) ifTrue:<br>
+               [^self characterTag].<br>
+       self assert: methodClass = (self fetchPointer: self smallFloatTag ofObject: classTableFirstPage).<br>
+       ^self smallFloatTag!<br>
<br>
Item was removed:<br>
- ----- Method: Spur64BitCoMemoryManager>><wbr>smallIntegerTag (in category 'cog jit support') -----<br>
- smallIntegerTag<br>
-       <api><br>
-       <cmacro><br>
-       ^1!<br>
<br>
Item was removed:<br>
- ----- Method: Spur64BitMemoryManager>><wbr>smallIntegerTag (in category 'cog jit support') -----<br>
- smallIntegerTag<br>
-       <cmacro><br>
-       ^1!<br>
<br>
Item was changed:<br>
  ----- Method: SpurMemoryManager>><wbr>smallIntegerTag (in category 'cog jit support') -----<br>
  smallIntegerTag<br>
+       <api><br>
+       <cmacro><br>
+       ^1!<br>
-       ^self subclassResponsibility!<br>
<br>
Item was changed:<br>
  ----- Method: StackInterpreter>><wbr>lookupSelector:inClass: (in category 'debug support') -----<br>
  lookupSelector: selector inClass: class<br>
+       "Lookup selector in class.  Answer the method or nil.  This is a debugging routine.<br>
+        It does /not/ side-effect lookupClass or newMethod."<br>
-       "Lookup selector in class.  Answer the method or nil.  This is a debugging routine."<br>
        | currentClass dictionary |<br>
        <api><br>
<br>
        currentClass := class.<br>
        [currentClass ~= objectMemory nilObject] whileTrue:<br>
                [dictionary := objectMemory followObjField: MethodDictionaryIndex ofObject: currentClass.<br>
                 dictionary = objectMemory nilObject ifTrue:<br>
                        [^nil].<br>
                 (self lookupMethodFor: selector InDictionary: dictionary) ifNotNil:<br>
                        [:meth| ^meth].<br>
                currentClass := self superclassOf: currentClass].<br>
        ^nil!<br>
<br>
Item was changed:<br>
  ----- Method: StackToRegisterMappingCogit>><wbr>genSpecialSelectorArithmetic (in category 'bytecode generators') -----<br>
  genSpecialSelectorArithmetic<br>
        | primDescriptor rcvrIsConst argIsConst rcvrIsInt argIsInt rcvrInt argInt result<br>
         jumpNotSmallInts jumpContinue index |<br>
        <var: #jumpContinue type: #'AbstractInstruction *'><br>
        <var: #primDescriptor type: #'BytecodeDescriptor *'><br>
        <var: #jumpNotSmallInts type: #'AbstractInstruction *'><br>
        primDescriptor := self generatorAt: byte0.<br>
        argIsInt := (argIsConst := self ssTop type = SSConstant)<br>
                                 and: [objectMemory isIntegerObject: (argInt := self ssTop constant)].<br>
+       rcvrIsInt := ((rcvrIsConst := (self ssValue: 1) type = SSConstant)<br>
+                                 and: [objectMemory isIntegerObject: (rcvrInt := (self ssValue: 1) constant)])<br>
+                               or: [self mclassIsSmallInteger and: [(self ssValue: 1) isSameEntryAs: (self addressOf: simSelf)]].<br>
-       rcvrIsInt := (rcvrIsConst := (self ssValue: 1) type = SSConstant)<br>
-                                and: [objectMemory isIntegerObject: (rcvrInt := (self ssValue: 1) constant)].<br>
<br>
+       (argIsInt and: [rcvrIsInt and: [rcvrIsConst]]) ifTrue:<br>
-       (argIsInt and: [rcvrIsInt]) ifTrue:<br>
                [rcvrInt := objectMemory integerValueOf: rcvrInt.<br>
                 argInt := objectMemory integerValueOf: argInt.<br>
                 primDescriptor opcode caseOf: {<br>
                        [AddRR] -> [result := rcvrInt + argInt].<br>
                        [SubRR] -> [result := rcvrInt - argInt].<br>
                        [AndRR] -> [result := rcvrInt bitAnd: argInt].<br>
                        [OrRR]  -> [result := rcvrInt bitOr: argInt] }.<br>
                (objectMemory isIntegerValue: result) ifTrue:<br>
                        ["Must annotate the bytecode for correct pc mapping."<br>
                        ^self ssPop: 2; ssPushAnnotatedConstant: (objectMemory integerObjectOf: result)].<br>
                ^self genSpecialSelectorSend].<br>
<br>
        "If there's any constant involved other than a SmallInteger don't attempt to inline."<br>
        ((rcvrIsConst and: [rcvrIsInt not])<br>
         or: [argIsConst and: [argIsInt not]]) ifTrue:<br>
                [^self genSpecialSelectorSend].<br>
<br>
        "If we know nothing about the types then better not to inline as the inline cache and<br>
         primitive code is not terribly slow so wasting time on duplicating tag tests is pointless."<br>
        (argIsInt or: [rcvrIsInt]) ifFalse:<br>
                [^self genSpecialSelectorSend].<br>
<br>
        argIsInt<br>
                ifTrue:<br>
                        [self ssFlushTo: simStackPtr - 2.<br>
                         (self ssValue: 1) popToReg: ReceiverResultReg.<br>
+                        self ssPop: 2]<br>
-                        self ssPop: 2.<br>
-                        self MoveR: ReceiverResultReg R: TempReg]<br>
                ifFalse:<br>
+                       [self marshallSendArguments: 1].<br>
+       jumpNotSmallInts := (rcvrIsInt and: [argIsInt]) ifFalse:<br>
+                                                       [argIsInt<br>
+                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: ReceiverResultReg]<br>
+                                                               ifFalse:<br>
+                                                                       [rcvrIsInt<br>
+                                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: Arg0Reg]<br>
+                                                                               ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: ReceiverResultReg and: Arg0Reg scratch: TempReg]]].<br>
-                       [self marshallSendArguments: 1.<br>
-                        self MoveR: Arg0Reg R: TempReg].<br>
-       jumpNotSmallInts := (argIsInt or: [rcvrIsInt])<br>
-                                                       ifTrue: [objectRepresentation genJumpNotSmallIntegerInScratc<wbr>hReg: TempReg]<br>
-                                                       ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: ReceiverResultReg andScratch: TempReg scratch: ClassReg].<br>
        primDescriptor opcode caseOf: {<br>
                [AddRR] -> [argIsInt<br>
                                                ifTrue:<br>
                                                        [self AddCq: argInt - ConstZero R: ReceiverResultReg.<br>
                                                         jumpContinue := self JumpNoOverflow: 0.<br>
                                                         "overflow; must undo the damage before continuing"<br>
                                                         self SubCq: argInt - ConstZero R: ReceiverResultReg]<br>
                                                ifFalse:<br>
                                                        [objectRepresentation genRemoveSmallIntegerTagsInScr<wbr>atchReg: ReceiverResultReg.<br>
                                                         self AddR: Arg0Reg R: ReceiverResultReg.<br>
                                                        jumpContinue := self JumpNoOverflow: 0.<br>
                                                        "overflow; must undo the damage before continuing"<br>
+                                                        (rcvrIsInt and: [rcvrIsConst])<br>
-                                                        rcvrIsInt<br>
                                                                ifTrue: [self MoveCq: rcvrInt R: ReceiverResultReg]<br>
                                                                ifFalse:<br>
                                                                        [self SubR: Arg0Reg R: ReceiverResultReg.<br>
                                                                         objectRepresentation genSetSmallIntegerTagsIn: ReceiverResultReg]]].<br>
                [SubRR] -> [argIsInt<br>
                                                ifTrue:<br>
                                                        [self SubCq: argInt - ConstZero R: ReceiverResultReg.<br>
                                                         jumpContinue := self JumpNoOverflow: 0.<br>
                                                         "overflow; must undo the damage before continuing"<br>
                                                         self AddCq: argInt - ConstZero R: ReceiverResultReg]<br>
                                                ifFalse:<br>
                                                        [objectRepresentation genRemoveSmallIntegerTagsInScr<wbr>atchReg: Arg0Reg.<br>
                                                         self SubR: Arg0Reg R: ReceiverResultReg.<br>
                                                         jumpContinue := self JumpNoOverflow: 0.<br>
                                                         "overflow; must undo the damage before continuing"<br>
                                                         self AddR: Arg0Reg R: ReceiverResultReg.<br>
                                                         objectRepresentation genSetSmallIntegerTagsIn: Arg0Reg]].<br>
                [AndRR] -> [argIsInt<br>
                                                ifTrue: [self AndCq: argInt R: ReceiverResultReg]<br>
                                                ifFalse: [self AndR: Arg0Reg R: ReceiverResultReg].<br>
+                                       jumpContinue := jumpNotSmallInts ifNotNil: [self Jump: 0]].<br>
-                                       jumpContinue := self Jump: 0].<br>
                [OrRR]  -> [argIsInt<br>
                                                ifTrue: [self OrCq: argInt R: ReceiverResultReg]<br>
                                                ifFalse: [self OrR: Arg0Reg R: ReceiverResultReg].<br>
+                                       jumpContinue := jumpNotSmallInts ifNotNil: [self Jump: 0]] }.<br>
+       jumpNotSmallInts<br>
+               ifNil: [jumpContinue ifNil: "overflow cannot happen"<br>
+                               [self annotateInstructionForBytecode<wbr>.<br>
+                                self ssPushRegister: ReceiverResultReg.<br>
+                                ^0]]<br>
+               ifNotNil:<br>
+                       [jumpNotSmallInts jmpTarget: self Label].<br>
-                                       jumpContinue := self Jump: 0] }.<br>
-       jumpNotSmallInts jmpTarget: self Label.<br>
        argIsInt ifTrue:<br>
                [self MoveCq: argInt R: Arg0Reg].<br>
        index := byte0 - self firstSpecialSelectorBytecodeOf<wbr>fset.<br>
        self genMarshalledSend: index negated - 1 numArgs: 1 sendTable: ordinarySendTrampolines.<br>
        jumpContinue jmpTarget: self Label.<br>
        ^0!<br>
<br>
Item was changed:<br>
  ----- Method: StackToRegisterMappingCogit>><wbr>genSpecialSelectorComparison (in category 'bytecode generators') -----<br>
  genSpecialSelectorComparison<br>
+       | nextPC postBranchPC targetPC primDescriptor branchDescriptor<br>
+         rcvrIsInt rcvrIsConst argIsIntConst argInt jumpNotSmallInts inlineCAB index |<br>
-       | nextPC postBranchPC targetBytecodePC primDescriptor branchDescriptor<br>
-         rcvrIsInt argIsInt argInt jumpNotSmallInts inlineCAB index |<br>
        <var: #primDescriptor type: #'BytecodeDescriptor *'><br>
        <var: #branchDescriptor type: #'BytecodeDescriptor *'><br>
        <var: #jumpNotSmallInts type: #'AbstractInstruction *'><br>
        self ssFlushTo: simStackPtr - 2.<br>
        primDescriptor := self generatorAt: byte0.<br>
+       argIsIntConst := self ssTop type = SSConstant<br>
-       argIsInt := self ssTop type = SSConstant<br>
                                 and: [objectMemory isIntegerObject: (argInt := self ssTop constant)].<br>
+       rcvrIsInt := ((rcvrIsConst := (self ssValue: 1) type = SSConstant)<br>
+                                 and: [objectMemory isIntegerObject: (self ssValue: 1) constant])<br>
+                               or: [self mclassIsSmallInteger and: [(self ssValue: 1) isSameEntryAs: (self addressOf: simSelf)]].<br>
-       rcvrIsInt := (self ssValue: 1) type = SSConstant<br>
-                                and: [objectMemory isIntegerObject: (self ssValue: 1) constant].<br>
<br>
+       (argIsIntConst and: [rcvrIsInt and: [rcvrIsConst]]) ifTrue:<br>
-       (argIsInt and: [rcvrIsInt]) ifTrue:<br>
                [^ self genStaticallyResolvedSpecialSe<wbr>lectorComparison].<br>
<br>
        self extractMaybeBranchDescriptorIn<wbr>to: [ :descr :next :postBranch :target |<br>
+               branchDescriptor := descr. nextPC := next. postBranchPC := postBranch. targetPC := target ].<br>
-               branchDescriptor := descr. nextPC := next. postBranchPC := postBranch. targetBytecodePC := target ].<br>
<br>
        "Only interested in inlining if followed by a conditional branch."<br>
        inlineCAB := branchDescriptor isBranchTrue or: [branchDescriptor isBranchFalse].<br>
        "Further, only interested in inlining = and ~= if there's a SmallInteger constant involved.<br>
         The relational operators successfully statically predict SmallIntegers; the equality operators do not."<br>
        (inlineCAB and: [primDescriptor opcode = JumpZero or: [primDescriptor opcode = JumpNonZero]]) ifTrue:<br>
+               [inlineCAB := argIsIntConst or: [rcvrIsInt]].<br>
-               [inlineCAB := argIsInt or: [rcvrIsInt]].<br>
        inlineCAB ifFalse:<br>
                [^self genSpecialSelectorSend].<br>
<br>
+       argIsIntConst<br>
-       argIsInt<br>
                ifTrue:<br>
                        [(self ssValue: 1) popToReg: ReceiverResultReg.<br>
                         self ssPop: 2]<br>
                ifFalse:<br>
+                       [self marshallSendArguments: 1].<br>
+       jumpNotSmallInts := (rcvrIsInt and: [argIsIntConst]) ifFalse:<br>
+                                                       [argIsIntConst<br>
+                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: ReceiverResultReg]<br>
+                                                               ifFalse:<br>
+                                                                       [rcvrIsInt<br>
+                                                                               ifTrue: [objectRepresentation genJumpNotSmallInteger: Arg0Reg]<br>
+                                                                               ifFalse: [objectRepresentation genJumpNotSmallIntegersIn: ReceiverResultReg and: Arg0Reg scratch: TempReg]]].<br>
+       argIsIntConst<br>
-                       [self marshallSendArguments: 1.<br>
-                        rcvrIsInt ifFalse:<br>
-                               [self MoveR: Arg0Reg R: TempReg]].<br>
-       jumpNotSmallInts := (argIsInt or: [rcvrIsInt])<br>
-                                                       ifFalse: "Neither known to be ints; and them together for the test..."<br>
-                                                               [objectRepresentation genJumpNotSmallIntegersIn: ReceiverResultReg andScratch: TempReg scratch: ClassReg]<br>
-                                                       ifTrue: "One known; in-place single-bit test for the other"<br>
-                                                               [objectRepresentation genJumpNotSmallInteger: (rcvrIsInt ifTrue: [Arg0Reg] ifFalse: [ReceiverResultReg])].<br>
-       argIsInt<br>
                ifTrue: [self CmpCq: argInt R: ReceiverResultReg]<br>
                ifFalse: [self CmpR: Arg0Reg R: ReceiverResultReg].<br>
        "Cmp is weird/backwards so invert the comparison.  Further since there is a following conditional<br>
         jump bytecode define non-merge fixups and leave the cond bytecode to set the mergeness."<br>
        self genConditionalBranch: (branchDescriptor isBranchTrue<br>
                                ifTrue: [primDescriptor opcode]<br>
                                ifFalse: [self inverseBranchFor: primDescriptor opcode])<br>
+               operand: (self ensureNonMergeFixupAt: targetPC) asUnsignedInteger.<br>
-               operand: (self ensureNonMergeFixupAt: targetBytecodePC) asUnsignedInteger.<br>
        self Jump: (self ensureNonMergeFixupAt: postBranchPC).<br>
+       jumpNotSmallInts ifNil:<br>
+               [self annotateInstructionForBytecode<wbr>.<br>
+                self ensureFixupAt: postBranchPC.<br>
+                self ensureFixupAt: targetPC.<br>
+                deadCode := true.<br>
+                ^0].<br>
        jumpNotSmallInts jmpTarget: self Label.<br>
+       argIsIntConst ifTrue:<br>
-       argIsInt ifTrue:<br>
                [self MoveCq: argInt R: Arg0Reg].<br>
        index := byte0 - self firstSpecialSelectorBytecodeOf<wbr>fset.<br>
        ^self genMarshalledSend: index negated - 1 numArgs: 1 sendTable: ordinarySendTrampolines!<br>
<br>
Item was added:<br>
+ ----- Method: StackToRegisterMappingCogit>><wbr>simSelf (in category 'accessing') -----<br>
+ simSelf<br>
+       ^simSelf!<br>
<br>
Item was changed:<br>
  ----- Method: StackToRegisterMappingCogit>><wbr>ssAllocateRequiredRegMask:<wbr>upThrough:upThroughNative: (in category 'simulation stack') -----<br>
  ssAllocateRequiredRegMask: requiredRegsMask upThrough: stackPtr upThroughNative: nativeStackPtr<br>
        | lastRequired lastRequiredNative liveRegs |<br>
        lastRequired := -1.<br>
        lastRequiredNative := -1.<br>
        "compute live regs while noting the last occurrence of required regs.<br>
         If these are not free we must spill from simSpillBase to last occurrence.<br>
         Note we are conservative here; we could allocate FPReg in frameless methods."<br>
        liveRegs := self registerMaskFor: FPReg and: SPReg.<br>
        (simSpillBase max: 0) to: stackPtr do:<br>
                [:i|<br>
                liveRegs := liveRegs bitOr: (self simStackAt: i) registerMask.<br>
                ((self simStackAt: i) registerMask bitAnd: requiredRegsMask) ~= 0 ifTrue:<br>
                        [lastRequired := i]].<br>
+       LowcodeVM ifTrue:<br>
+               [(simNativeSpillBase max: 0) to: nativeStackPtr do:<br>
-       LowcodeVM ifTrue: [<br>
-               (simNativeSpillBase max: 0) to: nativeStackPtr do:<br>
                        [:i|<br>
                        liveRegs := liveRegs bitOr: (self simNativeStackAt: i) nativeRegisterMask.<br>
+                       ((self simNativeStackAt: i) nativeRegisterMask anyMask: requiredRegsMask) ifTrue:<br>
+                               [lastRequiredNative := i]]].<br>
-                       ((self simNativeStackAt: i) nativeRegisterMask bitAnd: requiredRegsMask) ~= 0 ifTrue:<br>
-                               [lastRequiredNative := i]].<br>
-       ].<br>
        "If any of requiredRegsMask are live we must spill."<br>
+       (liveRegs anyMask: requiredRegsMask) ifTrue:<br>
+               [self ssFlushTo: lastRequired nativeFlushTo: lastRequiredNative.<br>
-       (liveRegs bitAnd: requiredRegsMask) = 0 ifFalse:<br>
-               ["Some live, must spill"<br>
-               self ssFlushTo: lastRequired nativeFlushTo: lastRequiredNative.<br>
                self assert: (self liveRegisters bitAnd: requiredRegsMask) = 0]!<br>
<br>
</blockquote></div><br></div>