[Vm-dev] VM Maker: VMMaker.oscog-cb.1487.mcz

Clément Bera bera.clement at gmail.com
Thu Oct 1 14:38:35 UTC 2015


Sorry I forgot the comment on that second slice.

Basically the inlined bit operations were sometimes using register
operations on constants, hence answering incorrect results.

They work now (the test suite pass).

2015-10-01 16:08 GMT+02:00 <commits at source.squeak.org>:

>
> Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-cb.1487.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker.oscog-cb.1487
> Author: cb
> Time: 1 October 2015, 4:07:44.54 pm
> UUID: 7f65b3d4-eb96-4fff-abc2-bb6edd58e98d
> Ancestors: VMMaker.oscog-cb.1486
>
> empty log message
>
> =============== Diff against VMMaker.oscog-cb.1486 ===============
>
> Item was changed:
>   ----- Method:
> StackToRegisterMappingCogit>>genBinaryConstOpVarInlinePrimitive: (in
> category 'inline primitive generators') -----
>   genBinaryConstOpVarInlinePrimitive: prim
>         "Const op var version of binary inline primitives."
>         "SistaV1: 248           11111000        iiiiiiii
> mjjjjjjj                Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1
> means inlined primitive, no hard return after execution.
>          See EncoderForSistaV1's class comment and
> StackInterpreter>>#binaryInlinePrimitive:"
>         | ra val untaggedVal adjust |
>         ra := self allocateRegForStackEntryAt: 0.
>         self ssTop popToReg: ra.
>         self ssPop: 1.
>         val := self ssTop constant.
>         self ssPop: 1.
>         untaggedVal := val - objectMemory smallIntegerTag.
>         prim caseOf: {
>                 "0 through 6, +, -, *, /, //, \\, quo:, SmallInteger op
> SmallInteger => SmallInteger, no overflow"
>                 [0]     ->      [self AddCq: untaggedVal R: ra].
>                 [1]     ->      [self MoveCq: val R: TempReg.
>                                  self SubR: ra R: TempReg.
>                                  objectRepresentation
> genAddSmallIntegerTagsTo: TempReg.
>                                  self MoveR: TempReg R: ra].
>                 [2]     ->      [objectRepresentation
> genRemoveSmallIntegerTagsInScratchReg: ra.
>                                  self MoveCq: (objectMemory
> integerValueOf: val) R: TempReg.
>                                  self MulR: TempReg R: ra.
>                                  objectRepresentation
> genAddSmallIntegerTagsTo: ra].
>
>                 "2016 through 2019, bitAnd:, bitOr:, bitXor, bitShift:,
> SmallInteger op SmallInteger => SmallInteger, no overflow"
> +               [16] -> [ self AndCq: val R: ra ].
> +               [17] -> [ self OrCq: val R: ra ].
> +               [18] -> [ self XorCw: untaggedVal R: ra. ].
> -               [16] -> [ self AndR: val R: ra ].
> -               [17] -> [ self OrR: val R: ra ].
> -               [18] -> [ self XorR: untaggedVal R: ra. ].
>
>                 "2032   through 2037, >, <, >=, <=. =, ~=, SmallInteger op
> SmallInteger => Boolean (flags?? then in jump bytecodes if ssTop is a flags
> value, just generate the instruction!!!!)"
>                 "CmpCqR is SubRCq so everything is reversed, but because
> no CmpRCq things are reversed again and we invert the sense of the jumps."
>                 [32] -> [ self CmpCq: val R: ra.
>                                 self genBinaryInlineComparison: JumpLess
> opFalse: JumpGreaterOrEqual destReg: ra ].
>                 [33] -> [ self CmpCq: val R: ra.
>                                 self genBinaryInlineComparison:
> JumpGreater opFalse: JumpLessOrEqual destReg: ra ].
>                 [34] -> [ self CmpCq: val R: ra.
>                                 self genBinaryInlineComparison:
> JumpLessOrEqual opFalse: JumpGreater destReg: ra ].
>                 [35] -> [ self CmpCq: val R: ra.
>                                 self genBinaryInlineComparison:
> JumpGreaterOrEqual opFalse: JumpLess destReg: ra ].
>                 [36] -> [ self CmpCq: val R: ra.
>                                 self genBinaryInlineComparison: JumpZero
> opFalse: JumpNonZero destReg: ra ].
>                 [37] -> [ self CmpCq: val R: ra.
>                                 self genBinaryInlineComparison:
> JumpNonZero opFalse: JumpZero destReg: ra ].
>
>                 "2064   through 2068, Pointer Object>>at:, Byte
> Object>>at:, Short16 Word Object>>at: LongWord32 Object>>at: Quad64Word
> Object>>at:. obj op 0-rel SmallInteger => oop"
>                 [64] -> [objectRepresentation
> genConvertSmallIntegerToIntegerInReg: ra.
>                                 adjust := (objectMemory baseHeaderSize >>
> objectMemory shiftForWord) - 1. "shift by baseHeaderSize and then move from
> 1 relative to zero relative"
>                                 adjust ~= 0 ifTrue: [ self AddCq: adjust
> R: ra. ].
>                                 self genMoveConstant: val R: TempReg.
>                                 self MoveXwr: ra R: TempReg R: ra].
>                 [65] -> [objectRepresentation
> genConvertSmallIntegerToIntegerInReg: ra.
>                                 adjust := objectMemory baseHeaderSize - 1.
> "shift by baseHeaderSize and then move from 1 relative to zero relative"
>                                 self AddCq: adjust R: ra.
>                                 self genMoveConstant: val R: TempReg.
>                                 self MoveXbr: ra R: TempReg R: ra.
>                                 objectRepresentation
> genConvertIntegerToSmallIntegerInReg: ra]
>         }
>         otherwise: [^EncounteredUnknownBytecode].
>         self ssPushRegister: ra.
>         ^0!
>
> Item was changed:
>   ----- Method:
> StackToRegisterMappingCogit>>genBinaryVarOpConstInlinePrimitive: (in
> category 'inline primitive generators') -----
>   genBinaryVarOpConstInlinePrimitive: prim
>         "Var op const version of inline binary inline primitives."
>         "SistaV1: 248           11111000        iiiiiiii
> mjjjjjjj                Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1
> means inlined primitive, no hard return after execution.
>          See EncoderForSistaV1's class comment and
> StackInterpreter>>#binaryInlinePrimitive:"
>         | rr val untaggedVal |
>         val := self ssTop constant.
>         self ssPop: 1.
>         rr := self allocateRegForStackEntryAt: 0.
>         self ssTop popToReg: rr.
>         self ssPop: 1.
>         untaggedVal := val - objectMemory smallIntegerTag.
>         prim caseOf: {
>                 "0 through 6, +, -, *, /, //, \\, quo:, SmallInteger op
> SmallInteger => SmallInteger, no overflow"
>                 [0]     ->      [self AddCq: untaggedVal R: rr].
>                 [1]     ->      [self SubCq: untaggedVal R: rr ].
>                 [2]     ->      [self flag: 'could use MulCq:R'.
>                                  objectRepresentation
> genShiftAwaySmallIntegerTagsInScratchReg: rr.
>                                  self MoveCq: (objectMemory
> integerValueOf: val) R: TempReg.
>                                  self MulR: TempReg R: rr.
>                                  objectRepresentation
> genAddSmallIntegerTagsTo: rr].
>
>                 "2016 through 2019, bitAnd:, bitOr:, bitXor, bitShift:,
> SmallInteger op SmallInteger => SmallInteger, no overflow"
> +               [16] -> [ self AndCq: val R: rr ].
> +               [17] -> [ self OrCq: val R: rr ].
> +               [18] -> [ self flag: 'could use XorCq:'.
> +                               self XorCw: untaggedVal R: rr. ].
> -               [16] -> [ self AndR: val R: rr ].
> -               [17] -> [ self OrR: val R: rr ].
> -               [18] -> [ self XorR: untaggedVal R: rr. ].
>
>                 "2032   through 2037, >, <, >=, <=. =, ~=, SmallInteger op
> SmallInteger => Boolean (flags?? then in jump bytecodes if ssTop is a flags
> value, just generate the instruction!!!!)"
>                 "CmpCqR is SubRCq so everything is reversed."
>                 [32] -> [ self CmpCq: val R: rr.
>                                 self genBinaryInlineComparison:
> JumpGreater opFalse: JumpLessOrEqual destReg: rr ].
>                 [33] -> [ self CmpCq: val R: rr.
>                                 self genBinaryInlineComparison: JumpLess
> opFalse: JumpGreaterOrEqual destReg: rr ].
>                 [34] -> [ self CmpCq: val R: rr.
>                                 self genBinaryInlineComparison:
> JumpGreaterOrEqual opFalse: JumpLess destReg: rr ].
>                 [35] -> [ self CmpCq: val R: rr.
>                                 self genBinaryInlineComparison:
> JumpLessOrEqual opFalse: JumpGreater destReg: rr ].
>                 [36] -> [ self CmpCq: val R: rr.
>                                 self genBinaryInlineComparison: JumpZero
> opFalse: JumpNonZero destReg: rr ].
>                 [37] -> [ self CmpCq: val R: rr.
>                                 self genBinaryInlineComparison:
> JumpNonZero opFalse: JumpZero destReg: rr ].
>
>                 "2064   through 2068, Pointer Object>>at:, Byte
> Object>>at:, Short16 Word Object>>at: LongWord32 Object>>at: Quad64Word
> Object>>at:. obj op 0-rel SmallInteger => oop"
>                 [64] -> [objectRepresentation genLoadSlot: (objectMemory
> integerValueOf: val) - 1 sourceReg: rr destReg: rr].
>                 [65] -> [self MoveCq: (objectMemory integerValueOf: val) +
> objectMemory baseHeaderSize - 1 R: TempReg.
>                                 self MoveXbr: TempReg R: rr R: rr.
>                                 objectRepresentation
> genConvertIntegerToSmallIntegerInReg: rr]
>
>         }
>         otherwise: [^EncounteredUnknownBytecode].
>         self ssPushRegister: rr.
>         ^0!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20151001/51f89cab/attachment-0001.htm


More information about the Vm-dev mailing list