Why can't I do (aNonSmallInteger becomeFoward: aSmallInteger)?

Brian Keefer mgomes21 at cox.net
Mon Apr 1 20:17:26 UTC 2002


Tim Rowledge wrote:
> 
> Avi Bryant wrote:
> 
> > Read the subject of this thread - the original question, which everyone
> > has been ignoring, is, why can't I do
> >
> > 'foo' becomeForward: 3.
> The pragmatic answer is that as you go through the code involved in
> becomeForward you get to ObjectMemory>containsOnlyOops:and: which
> carefully makes the prim fail if any items in the two arrays are
> SmallIntegers - since you can't become SmallIntegers :-) 

Thanks! I just might have found that myself, if <primitive:> weren't such
a dead end. ([REQ] some comments in primitive calls to show where to trace
from here). So, step 1, I refactor out the and: part of containsOnlyOops.

> I'd hazard a
> guess that the implementor made use of existing code and simply never
> considered that SmallIntegers could in fact be reasonable arguments for
> becomeForward. 

My understanding of become(Foward): was that there would be an (ever so
dainty) full GC-ish walk through memory, doing s/oldref/newref/ on each
object's (variable=reference=pointer=literal SmallInteger) list. Under
this assumption, the only thing really preventing 3 become: 4 would be
your own sense of sanity. Such a capability would actually be quite useful
to various government agencies, such as the Ministry of Truth. However,
with such scary methods as prepareForwardingTableForBecoming:with:twoWay:,
and their talk about fowarding blocks, I fear that that web page about
squeak 2.x just may be out of date. This would be a good time for me to
actually read NuBlue. 

> Without spending a lot more time looking at the prim code
> than I have to spare (I have varnish drying and needing some work) I
> can't say for certain how much change would be needed, but I'm guessing
> it might be complicated since it is not likely to be very clsoe to the
> current code.

At this point, I'm starting to suspect that the fix for ObjectMemory would
have exactly the same effect as making a SmallInteger wrapper (that
normalize-s like Large(+-)Integers). It probably depends on what a
"fowarding block" is (a symlink object?).


> If you really need it, send me an RFQ and I'll get back to you :-)
> 
> tim

It's not that important, this is just a toy project I'm working on.


Buy one, get one free sig -

"By opening this term paper, you consent to the following.."
- The private hell of law school teachers

One thing I never liked about lisp, was having to take off my shoes to
count parenthesis.



More information about the Squeak-dev mailing list