<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-10-31 22:42 GMT+01:00 <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></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-eem.1972.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/<wbr>VMMaker/VMMaker.oscog-eem.<wbr>1972.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: VMMaker.oscog-eem.1972<br>
Author: eem<br>
Time: 31 October 2016, 2:42:12.362675 pm<br>
UUID: 0e6a54ad-d62f-4b69-9f0d-<wbr>7b66f8350984<br>
Ancestors: VMMaker.oscog-eem.1971<br>
<br>
Redo fixing extB sign extension in NewsqueakV4 & SistaV1 extPushIntegerBytecode & extUnconditionalJump in interpreter and Cogit using bitShift: 8 instead of << 8. Slang seems to generate the correct code with bitAShift:, but not with <<.<br>
<br></blockquote><div><br></div><div>Hi Eliot,<br></div><div>it would have worked if you would have used bitOr: instead of +<br>I'd say bitOr: better fits the intention:<br></div><div>you want to assemble the bits, you do not really want to perform arithmetic here.<br></div><div><br></div><div>Also, the result we are after is a signed int, so consider that << is doing the right thing, it gives you a signed int.<br></div><div>The expression you propose is unsigned. It works OK in this context, because we assign immediately to a signed int.<br>But for a more general usage, it could deceive the inliner (for example if variable is automatically typed or eliminated...)<br></div><div><br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
=============== Diff against VMMaker.oscog-eem.1971 ===============<br>
<br>
Item was changed:<br>
----- Method: SimpleStackBasedCogit>><wbr>genExtPushIntegerBytecode (in category 'bytecode generators') -----<br>
genExtPushIntegerBytecode<br>
"NewsqueakV4: 229 11100101 iiiiiiii Push Integer #iiiiiiii (+ Extend B * 256, where bbbbbbbb = sddddddd, e.g. -32768 = i=0, a=0, s=1)<br>
SistaV1: 232 11101000 iiiiiiii Push Integer #iiiiiiii (+ Extend B * 256, where bbbbbbbb = sddddddd, e.g. -32768 = i=0, a=0, s=1)"<br>
| value |<br>
+ value := byte1 + ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) bitShift: 8).<br>
- value := byte1 + ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) << 8).<br>
extB := 0.<br>
^self genPushLiteral: (objectMemory integerObjectOf: value)!<br>
<br>
Item was changed:<br>
----- Method: SimpleStackBasedCogit>><wbr>genExtUnconditionalJump (in category 'bytecode generators') -----<br>
genExtUnconditionalJump<br>
"242 11110010 i i i i i i i i Jump i i i i i i i i (+ Extend B * 256, where bbbbbbbb = sddddddd, e.g. -32768 = i=0, a=0, s=1)"<br>
| distance target |<br>
+ distance := byte1 + ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) bitShift: 8).<br>
- distance := byte1 + ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) << 8).<br>
self assert: distance = (self v4: (self generatorAt: byte0)<br>
Long: bytecodePC<br>
Branch: (extA ~= 0 ifTrue: [1] ifFalse: [0]) + (extB ~= 0 ifTrue: [1] ifFalse: [0])<br>
Distance: methodObj).<br>
extB := 0.<br>
target := distance + 2 + bytecodePC.<br>
distance < 0 ifTrue:<br>
[^self genJumpBackTo: target].<br>
self genJumpTo: target.<br>
"The bytecode must be mapped since it can be either forward or backward, and<br>
backwards branches must be mapped. So if forward, we need to map."<br>
self annotateBytecode: self lastOpcode.<br>
^0!<br>
<br>
Item was changed:<br>
----- Method: SimpleStackBasedCogit>>v4:<wbr>Long:Branch:Distance: (in category 'span functions') -----<br>
v4: descriptor Long: pc Branch: nExts Distance: aMethodObj<br>
"242 11110010 i i i i i i i i Jump i i i i i i i i (+ Extend B * 256, where bbbbbbbb = sddddddd, e.g. -32768 = i=0, a=0, s=1)"<br>
<var: #descriptor type: #'BytecodeDescriptor *'><br>
| extBValue |<br>
self assert: nExts >= 0.<br>
self parseV4Exts: nExts priorTo: pc in: aMethodObj into: [:ea :eb| extBValue := eb].<br>
^(objectMemory fetchByte: pc + 1 ofObject: aMethodObj)<br>
+ + (extBValue bitShift: 8)!<br>
- + (extBValue << 8)!<br>
<br>
Item was changed:<br>
----- Method: StackInterpreter>><wbr>extPushIntegerBytecode (in category 'stack bytecodes') -----<br>
extPushIntegerBytecode<br>
"229 11100101 i i i i i i i i Push Integer #iiiiiiii (+ Extend B * 256, where bbbbbbbb = sddddddd, e.g. -32768 = i=0, a=0, s=1)"<br>
| value |<br>
+ value := self fetchByte + ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) bitShift: 8).<br>
- value := self fetchByte + ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) << 8).<br>
self fetchNextBytecode.<br>
extB := 0.<br>
self internalPush: (objectMemory integerObjectOf: value)!<br>
<br>
Item was changed:<br>
----- Method: StackInterpreter>><wbr>extUnconditionalJump (in category 'jump bytecodes') -----<br>
extUnconditionalJump<br>
"242 11110010 i i i i i i i i Jump i i i i i i i i (+ Extend B * 256, where bbbbbbbb = sddddddd, e.g. -32768 = i=0, a=0, s=1)"<br>
| byte offset |<br>
byte := self fetchByte.<br>
+ offset := byte + ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) bitShift: 8).<br>
- offset := byte + ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) << 8).<br>
extB := 0.<br>
localIP := localIP + offset.<br>
self ifBackwardsCheckForEvents: offset.<br>
self fetchNextBytecode!<br>
<br>
</blockquote></div><br></div></div>