Accessing Object Memory

Tim Rowledge tim at sumeru.stanford.edu
Tue Nov 13 00:17:40 UTC 2001


> I'm interested in storing a reference to a Smalltalk object in a 32 bit
> word array.  A seemingly convenient way to do this would be to store the
> object pointer for the object into the array, then later retrieve the
> object given its object pointer by accessing Squeak's object memory.
Why do you want to do this? What is wrong with a normal
Array/OrderedCollection/etc and the usual at:put: protocols?
>  
> Objects provide an asOop method, which solves half the problem.
Sadly not - in a system without an object table this is very unlikely to
be a reversible function. Squeak has no OT. VisualWorks does have an OT
but still can't provide a reference value that can be converted back
into an object. BrouHaHa had an OT and thus could do this; assuming of
course that the object had not been garbage collected. 


> Although there is an ObjectMemory class that seems to provide the
> services I'd need to retrieve an object, I can't find a way to access
> the instance of ObjectMemory that Squeak actually uses.
An understandable misunderstanding; there is no such instance.
ObjectMemory is one of the several classes used in the building of the
VM  - see also Interpreter, InterpreterPlugin et al. There's a bunch of
detail on the 'Tour of the Obejct Engine' chapter in the nublue book

>  
> Does anyone know if it is possible to access Squeak's object memory
> directly?
Not really what you're asking I suspect, but you access object memroy
every time you do anything in Squeak.

I think we may be able to offer actually useful help if you'd like to
explain what you really want to do.

tim

-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
EBCDIC: Erase, Back up, Chew Disk, Ignite Card





More information about the Squeak-dev mailing list