<div dir="ltr">Hi Ryan,<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 18, 2014 at 7:59 PM, Ryan Macnak <span dir="ltr"><<a href="mailto:rmacnak@gmail.com" target="_blank">rmacnak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">What about bytecode pc's? These are indexed based on the physical size of the literals. I don't like the idea of debugging pc -> source mappings, pc coverage data, etc needing invalidation after starting an image on a platform with a different word size.</div></blockquote><div><br></div><div>I think this is taken care of. For example, CompiledMethod>>initialPC already consults wordSize.</div><div><br></div><div>CompiledMethod>>initialPC</div><div><span class="" style="white-space:pre">        </span>"Answer the program counter for the receiver's first bytecode."</div><div><br></div><div><span class="" style="white-space:pre">        </span>^ (self numLiterals + 1) * Smalltalk wordSize + 1</div><div><br></div><div>and of course the image bootstrap maps pcs already. i.e.</div><div><br></div><div><div>Spur32to64BitBootstrap>>fillInPointerObjectWithPC: obj64 from: obj32</div><div><span class="" style="white-space:pre">        </span>| method |</div><div><span class="" style="white-space:pre">        </span>self fillInPointerObject: obj64 from: obj32.</div><div><span class="" style="white-space:pre">        </span>(heap64 classIndexOf: obj64) = ClassBlockClosureCompactIndex ifTrue:</div><div><span class="" style="white-space:pre">                </span>[method := heap32</div><div><span class="" style="white-space:pre">                                                </span>fetchPointer: MethodIndex</div><div><span class="" style="white-space:pre">                                                </span>ofObject: (heap32</div><div><span class="" style="white-space:pre">                                                                        </span>fetchPointer: ClosureOuterContextIndex</div><div><span class="" style="white-space:pre">                                                                        </span>ofObject: obj32).</div><div><span class="" style="white-space:pre">                </span>self incrementPCField: ClosureStartPCIndex ofObject: obj64 for: method].</div><div><span class="" style="white-space:pre">        </span>(heap64 classIndexOf: obj64) = ClassMethodContextCompactIndex ifTrue:</div><div><span class="" style="white-space:pre">                </span>[method := heap32</div><div><span class="" style="white-space:pre">                                                </span>fetchPointer: MethodIndex</div><div><span class="" style="white-space:pre">                                                </span>ofObject: obj32.</div><div><span class="" style="white-space:pre">                </span> self incrementPCField: InstructionPointerIndex ofObject: obj64 for: method]</div></div><div><br></div><div><div>Spur32to64BitBootstrap>>incrementPCField: fieldIndex ofObject: obj64 for: method32</div><div><span class="" style="white-space:pre">        </span>| value nLits |</div><div><span class="" style="white-space:pre">        </span>value := heap64 fetchPointer: fieldIndex ofObject: obj64.</div><div><span class="" style="white-space:pre">        </span>(heap64 isIntegerObject: value)</div><div><span class="" style="white-space:pre">                </span>ifTrue:</div><div><span class="" style="white-space:pre">                        </span>[nLits := heap32 literalCountOf: method32.</div><div><span class="" style="white-space:pre">                        </span> heap64</div><div><span class="" style="white-space:pre">                                </span>storePointerUnchecked: fieldIndex</div><div><span class="" style="white-space:pre">                                </span>ofObject: obj64</div><div><span class="" style="white-space:pre">                                </span>withValue: (heap64 integerObjectOf: nLits + LiteralStart * 4 + (heap64 integerValueOf: value))]</div><div><span class="" style="white-space:pre">                </span>ifFalse:</div><div><span class="" style="white-space:pre">                        </span>[self assert: (reverseMap at: value) = heap32 nilObject]</div></div><div> </div><div>So I'm more looking for issues where the code implicitly assumes 32-bit pointers, such as digitAt: below.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div class="h5"><div><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 18, 2014 at 7:12 PM, Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi All,<div><br></div><div> I'm making good progress on 64-bit Spur in the Stack VM simulator. But I've just noticed an image-level issue which could be indicative of lots of 32-bit assumptions baked into the Squeal/Pharo/Newspeak systems.</div><div><br></div><div>SmallInteger>>digitAt: n <div><span style="white-space:pre-wrap">        </span>"Answer the value of an indexable field in the receiver. LargePositiveInteger uses bytes of base two number, and each is a 'digit' base 256. Fail if the argument (the index) is not an Integer or is out of bounds."</div><div><span style="white-space:pre-wrap">        </span>n>4 ifTrue: [^ 0].</div><div><span style="white-space:pre-wrap">        </span>self < 0</div><div><span style="white-space:pre-wrap">                </span>ifTrue: </div><div><span style="white-space:pre-wrap">                        </span>[self = SmallInteger minVal ifTrue:</div><div><span style="white-space:pre-wrap">                                </span>["Can't negate minVal -- treat specially"</div><div><span style="white-space:pre-wrap">                                </span>^ #(0 0 0 64) at: n].</div><div><span style="white-space:pre-wrap">                        </span>^ ((0-self) bitShift: (1-n)*8) bitAnd: 16rFF]</div><div><span style="white-space:pre-wrap">                </span>ifFalse: [^ (self bitShift: (1-n)*8) bitAnd: 16rFF]</div><div><br></div><div>This assumes that SmallInteger is only ever 4 bytes, which is unacceptably wasteful for my approach to 64-bits. In 64-bit Spur, SmallIntegers are 61-bit 2's complement.</div><div><br></div><div>I'm raising this example at this point to see if the community might find similar issues and bring them to my attention.</div><span><font color="#888888">-- <br><div>best,<div>Eliot</div></div>
</font></span></div></div>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>