[Vm-dev] Re: I would not have thought I ever say that: lets have a new primitve (was: Re: [squeak-dev] The Trunk: System-cwp.660.mcz)

Bert Freudenberg bert at freudenbergs.de
Tue Jan 14 11:07:59 UTC 2014

(moving to vm-dev)

On 14.01.2014, at 10:56, Stefan Marr <smalltalk at stefan-marr.de> wrote:

> Hi Tobias:
> On 14 Jan 2014, at 10:41, Tobias Pape <Das.Linux at gmx.de> wrote:
>>> How do you implement that efficiently in RPython, or Java?
>>> Keeping some kind of object table around?
>> Well, I have no Idea currently, but i think some #primAllObjectsDo:
>> (or #primAllObjects, as it seems now) has IMHO less severe constraints
>> than the #someObject/#nextObject way.
>> OT is one path. Manual heap scanning another. Collecting objects from
>> the roots (special objects array) a third. All these do not require 
>> the #nextObject invariant.
> I am just trying to think of how to implement that in the SOM VMs.
> Without GC support for tracing/enumerating the objects, it’s not going to be pretty.
> #someObject/#nextObject don’t make any sense for me in the long term.

Some VMs support those easily and they're more efficient, so I would not abandon them. But, as I wrote before, I'd make them optional, if a VM instead provides allObjects.

> I want to support one form or another of parallel execution. So, if I want to offer #allObjects at all, it needs to be an atomic snapshot. Most likely with stop-the-world semantics, which is a severe burden on performance. 

Sure, but then allObjects shouldn't be used in production code anyway. Users need to be aware that it's going to be slow.

> And without support of the underlying platform, I think, #allObjects can’t be complete. Just thinking of how TruffleSOM works, traversing only from specialObjectsArray on, will only find part of the live heap.

You need to traverse from specialObjectsArray and activeContext. This will find all objects.

> There are way to many important references on the Java stack, that I can’t easily access. And making them accessible, is going to cost a lot of performance even when #allObjects is never used. I think. :-/

But if you support thisContext then you must have those mechanisms in place already.

> In case you find a nice solution for RSqueak, I would be very interested.

In SqueakJS I support nextObject for oldspace objects only (old space is a linked list). If you call nextObject on a new object, I do a full GC, which makes it old.

- Bert -

More information about the Vm-dev mailing list