David T. Lewis wrote:
On Wed, Apr 25, 2007 at 09:48:55AM -0700, Andreas Raab wrote:
Looking over your changes I see two consistent patterns: One is to change all oops from sqInt to usqInt and the other one is to use the "special" unsigned comparison for pointers. Is my interpretation essentially correct?
Yes, exactly so.
Thanks (just trying to make sure that I'm getting the gist of the changes).
All oop arithmetic (e.g. adding to an oop) works fine regardless of signed or unsigned declarations. As an aside, whomever came up with the idea of twos compliment arithmetic deserves great credit for Doing Things Right In The First Place.
Indeed. It's pretty amazing to see how this stuff works regardless ;-)
I thought that adding the four "special" comparison methods was somewhat less ugly than putting the casts into each impacted method throughout ObjectMemory and Interpreter. It also allowed me to add some method comments to explain why it was being done.
Yes, I agree. I far prefer it to sprinkling the casts all over the places; it is a reminder about the fact that one needs to use those methods.
I'm open for any suggestions on how to improve this situation.
Two ideas:
- If we could declare the return type of a method and still generate
inlined code, then it would probably be possible to eliminate most of the type casting, and therefore also eliminate the four "special" comparison methods that implement the type casting.
Yes, that's a good idea and should be entirely doable. Really, all we need is a conversion of #returnType: into a cCoerce: in the inliner. Should be quite doable.
Cheers, - Andreas