<div dir="ltr">Hi Nicolas,<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 31, 2016 at 3:38 PM, Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><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/VMMak<wbr>er/VMMaker.oscog-eem.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-7b66f8<wbr>350984<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></div></div></blockquote><div><br></div><div>OK, but in 2's complement they do the same thing, so + sdeems just as good for me.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></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></div></div></blockquote><div><br></div><div>That's not what Slang generated. It generated a cast to usqInt.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></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></div></div></blockquote><div><br></div><div>Well, we have signed right shifts, but no signed left shifts. What I really want is a signed left shift but chose not to introduce e.g. <<<. For me I would make left shift maintain the signedness of the left-hand, generating a warning if the type couldn't be determined. That's closest to what Smalltalk does.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><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>>genExtP<wbr>ushIntegerBytecode (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>>genExtU<wbr>nconditionalJump (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:Long<wbr>: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>>extPushInteg<wbr>erBytecode (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>>extUnconditi<wbr>onalJump (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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>