Accessing an oop
Stephen Pair
spair at advantive.com
Tue Jun 22 22:48:54 UTC 1999
I just wanted a quick and easy way of generating nicely distributed numbers
to keep track of some externally referenced objects and give the external
system a handle to referenced the objects.
I was think maybe doing something like:
(oop * 65536) + oop
where oop is the short oop given by #asOop...I would then simply increment
this number until I find a slot in event of a collision.
Is there a better way?
- Stephen
> -----Original Message-----
> From: Tim Olson [mailto:tim at jumpnet.com]
> Sent: Tuesday, June 22, 1999 5:55 PM
> To: Squeak
> Subject: Re: Accessing an oop
>
>
> >Is there a way to access an Object's oop from within Squeak? The best I
> >could find was #asOop, but it's only half of the oop.
>
> In Squeak there are 2 different kinds of Oops (Object Oriented Pointer?):
>
> 1) Smalltalk code accessible Oops, visible with "asOop"
> this Oop is a 12-bit random number built at object creation time and
> stored in the header word of the object. Its main purpose is to
> provide
> a value to use for identity hashing.
>
> 2) the memory pointer value used in the virtual machine as an object
> reference. This value directly points to the object header, and is
> subject to change during garbage collection.
>
> #2 is not accessible in Smalltalk code, mainly because it can change from
> instant to instant, and therefore is not of any real use.
>
> What are you attempting to do with the Oop value? There probably is a
> better way to do it that doesn't involve trying to get an object's
> address.
>
>
>
> -- tim
>
>
>
More information about the Squeak-dev
mailing list
|