<div dir="ltr">Sorry I forgot the comment on that second slice.<div><br></div><div>Basically the inlined bit operations were sometimes using register operations on constants, hence answering incorrect results.</div><div><br></div><div>They work now (the test suite pass).</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-10-01 16:08 GMT+02:00  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span>:<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-cb.1487.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/VMMaker/VMMaker.oscog-cb.1487.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: VMMaker.oscog-cb.1487<br>
Author: cb<br>
Time: 1 October 2015, 4:07:44.54 pm<br>
UUID: 7f65b3d4-eb96-4fff-abc2-bb6edd58e98d<br>
Ancestors: VMMaker.oscog-cb.1486<br>
<br>
empty log message<br>
<br>
=============== Diff against VMMaker.oscog-cb.1486 ===============<br>
<br>
Item was changed:<br>
  ----- Method: StackToRegisterMappingCogit&gt;&gt;genBinaryConstOpVarInlinePrimitive: (in category &#39;inline primitive generators&#39;) -----<br>
  genBinaryConstOpVarInlinePrimitive: prim<br>
        &quot;Const op var version of binary inline primitives.&quot;<br>
        &quot;SistaV1: 248           11111000        iiiiiiii                mjjjjjjj                Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution.<br>
         See EncoderForSistaV1&#39;s class comment and StackInterpreter&gt;&gt;#binaryInlinePrimitive:&quot;<br>
        | ra val untaggedVal adjust |<br>
        ra := self allocateRegForStackEntryAt: 0.<br>
        self ssTop popToReg: ra.<br>
        self ssPop: 1.<br>
        val := self ssTop constant.<br>
        self ssPop: 1.<br>
        untaggedVal := val - objectMemory smallIntegerTag.<br>
        prim caseOf: {<br>
                &quot;0 through 6, +, -, *, /, //, \\, quo:, SmallInteger op SmallInteger =&gt; SmallInteger, no overflow&quot;<br>
                [0]     -&gt;      [self AddCq: untaggedVal R: ra].<br>
                [1]     -&gt;      [self MoveCq: val R: TempReg.<br>
                                 self SubR: ra R: TempReg.<br>
                                 objectRepresentation genAddSmallIntegerTagsTo: TempReg.<br>
                                 self MoveR: TempReg R: ra].<br>
                [2]     -&gt;      [objectRepresentation genRemoveSmallIntegerTagsInScratchReg: ra.<br>
                                 self MoveCq: (objectMemory integerValueOf: val) R: TempReg.<br>
                                 self MulR: TempReg R: ra.<br>
                                 objectRepresentation genAddSmallIntegerTagsTo: ra].<br>
<br>
                &quot;2016 through 2019, bitAnd:, bitOr:, bitXor, bitShift:, SmallInteger op SmallInteger =&gt; SmallInteger, no overflow&quot;<br>
+               [16] -&gt; [ self AndCq: val R: ra ].<br>
+               [17] -&gt; [ self OrCq: val R: ra ].<br>
+               [18] -&gt; [ self XorCw: untaggedVal R: ra. ].<br>
-               [16] -&gt; [ self AndR: val R: ra ].<br>
-               [17] -&gt; [ self OrR: val R: ra ].<br>
-               [18] -&gt; [ self XorR: untaggedVal R: ra. ].<br>
<br>
                &quot;2032   through 2037, &gt;, &lt;, &gt;=, &lt;=. =, ~=, SmallInteger op SmallInteger =&gt; Boolean (flags?? then in jump bytecodes if ssTop is a flags value, just generate the instruction!!!!)&quot;<br>
                &quot;CmpCqR is SubRCq so everything is reversed, but because no CmpRCq things are reversed again and we invert the sense of the jumps.&quot;<br>
                [32] -&gt; [ self CmpCq: val R: ra.<br>
                                self genBinaryInlineComparison: JumpLess opFalse: JumpGreaterOrEqual destReg: ra ].<br>
                [33] -&gt; [ self CmpCq: val R: ra.<br>
                                self genBinaryInlineComparison: JumpGreater opFalse: JumpLessOrEqual destReg: ra ].<br>
                [34] -&gt; [ self CmpCq: val R: ra.<br>
                                self genBinaryInlineComparison: JumpLessOrEqual opFalse: JumpGreater destReg: ra ].<br>
                [35] -&gt; [ self CmpCq: val R: ra.<br>
                                self genBinaryInlineComparison: JumpGreaterOrEqual opFalse: JumpLess destReg: ra ].<br>
                [36] -&gt; [ self CmpCq: val R: ra.<br>
                                self genBinaryInlineComparison: JumpZero opFalse: JumpNonZero destReg: ra ].<br>
                [37] -&gt; [ self CmpCq: val R: ra.<br>
                                self genBinaryInlineComparison: JumpNonZero opFalse: JumpZero destReg: ra ].<br>
<br>
                &quot;2064   through 2068, Pointer Object&gt;&gt;at:, Byte Object&gt;&gt;at:, Short16 Word Object&gt;&gt;at: LongWord32 Object&gt;&gt;at: Quad64Word Object&gt;&gt;at:. obj op 0-rel SmallInteger =&gt; oop&quot;<br>
                [64] -&gt; [objectRepresentation genConvertSmallIntegerToIntegerInReg: ra.<br>
                                adjust := (objectMemory baseHeaderSize &gt;&gt; objectMemory shiftForWord) - 1. &quot;shift by baseHeaderSize and then move from 1 relative to zero relative&quot;<br>
                                adjust ~= 0 ifTrue: [ self AddCq: adjust R: ra. ].<br>
                                self genMoveConstant: val R: TempReg.<br>
                                self MoveXwr: ra R: TempReg R: ra].<br>
                [65] -&gt; [objectRepresentation genConvertSmallIntegerToIntegerInReg: ra.<br>
                                adjust := objectMemory baseHeaderSize - 1. &quot;shift by baseHeaderSize and then move from 1 relative to zero relative&quot;<br>
                                self AddCq: adjust R: ra.<br>
                                self genMoveConstant: val R: TempReg.<br>
                                self MoveXbr: ra R: TempReg R: ra.<br>
                                objectRepresentation genConvertIntegerToSmallIntegerInReg: ra]<br>
        }<br>
        otherwise: [^EncounteredUnknownBytecode].<br>
        self ssPushRegister: ra.<br>
        ^0!<br>
<br>
Item was changed:<br>
  ----- Method: StackToRegisterMappingCogit&gt;&gt;genBinaryVarOpConstInlinePrimitive: (in category &#39;inline primitive generators&#39;) -----<br>
  genBinaryVarOpConstInlinePrimitive: prim<br>
        &quot;Var op const version of inline binary inline primitives.&quot;<br>
        &quot;SistaV1: 248           11111000        iiiiiiii                mjjjjjjj                Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution.<br>
         See EncoderForSistaV1&#39;s class comment and StackInterpreter&gt;&gt;#binaryInlinePrimitive:&quot;<br>
        | rr val untaggedVal |<br>
        val := self ssTop constant.<br>
        self ssPop: 1.<br>
        rr := self allocateRegForStackEntryAt: 0.<br>
        self ssTop popToReg: rr.<br>
        self ssPop: 1.<br>
        untaggedVal := val - objectMemory smallIntegerTag.<br>
        prim caseOf: {<br>
                &quot;0 through 6, +, -, *, /, //, \\, quo:, SmallInteger op SmallInteger =&gt; SmallInteger, no overflow&quot;<br>
                [0]     -&gt;      [self AddCq: untaggedVal R: rr].<br>
                [1]     -&gt;      [self SubCq: untaggedVal R: rr ].<br>
                [2]     -&gt;      [self flag: &#39;could use MulCq:R&#39;.<br>
                                 objectRepresentation genShiftAwaySmallIntegerTagsInScratchReg: rr.<br>
                                 self MoveCq: (objectMemory integerValueOf: val) R: TempReg.<br>
                                 self MulR: TempReg R: rr.<br>
                                 objectRepresentation genAddSmallIntegerTagsTo: rr].<br>
<br>
                &quot;2016 through 2019, bitAnd:, bitOr:, bitXor, bitShift:, SmallInteger op SmallInteger =&gt; SmallInteger, no overflow&quot;<br>
+               [16] -&gt; [ self AndCq: val R: rr ].<br>
+               [17] -&gt; [ self OrCq: val R: rr ].<br>
+               [18] -&gt; [ self flag: &#39;could use XorCq:&#39;.<br>
+                               self XorCw: untaggedVal R: rr. ].<br>
-               [16] -&gt; [ self AndR: val R: rr ].<br>
-               [17] -&gt; [ self OrR: val R: rr ].<br>
-               [18] -&gt; [ self XorR: untaggedVal R: rr. ].<br>
<br>
                &quot;2032   through 2037, &gt;, &lt;, &gt;=, &lt;=. =, ~=, SmallInteger op SmallInteger =&gt; Boolean (flags?? then in jump bytecodes if ssTop is a flags value, just generate the instruction!!!!)&quot;<br>
                &quot;CmpCqR is SubRCq so everything is reversed.&quot;<br>
                [32] -&gt; [ self CmpCq: val R: rr.<br>
                                self genBinaryInlineComparison: JumpGreater opFalse: JumpLessOrEqual destReg: rr ].<br>
                [33] -&gt; [ self CmpCq: val R: rr.<br>
                                self genBinaryInlineComparison: JumpLess opFalse: JumpGreaterOrEqual destReg: rr ].<br>
                [34] -&gt; [ self CmpCq: val R: rr.<br>
                                self genBinaryInlineComparison: JumpGreaterOrEqual opFalse: JumpLess destReg: rr ].<br>
                [35] -&gt; [ self CmpCq: val R: rr.<br>
                                self genBinaryInlineComparison: JumpLessOrEqual opFalse: JumpGreater destReg: rr ].<br>
                [36] -&gt; [ self CmpCq: val R: rr.<br>
                                self genBinaryInlineComparison: JumpZero opFalse: JumpNonZero destReg: rr ].<br>
                [37] -&gt; [ self CmpCq: val R: rr.<br>
                                self genBinaryInlineComparison: JumpNonZero opFalse: JumpZero destReg: rr ].<br>
<br>
                &quot;2064   through 2068, Pointer Object&gt;&gt;at:, Byte Object&gt;&gt;at:, Short16 Word Object&gt;&gt;at: LongWord32 Object&gt;&gt;at: Quad64Word Object&gt;&gt;at:. obj op 0-rel SmallInteger =&gt; oop&quot;<br>
                [64] -&gt; [objectRepresentation genLoadSlot: (objectMemory integerValueOf: val) - 1 sourceReg: rr destReg: rr].<br>
                [65] -&gt; [self MoveCq: (objectMemory integerValueOf: val) + objectMemory baseHeaderSize - 1 R: TempReg.<br>
                                self MoveXbr: TempReg R: rr R: rr.<br>
                                objectRepresentation genConvertIntegerToSmallIntegerInReg: rr]<br>
<br>
        }<br>
        otherwise: [^EncounteredUnknownBytecode].<br>
        self ssPushRegister: rr.<br>
        ^0!<br>
<br>
</blockquote></div><br></div>