[Vm-dev] I don't understand the GC root table

Stefan Marr squeak at stefan-marr.de
Mon Sep 26 09:23:31 UTC 2011


Hi:


On 26 Sep 2011, at 11:12, Mariano Martinez Peck wrote:

> Hi guys. I usually thought that the root table of the GC was the #specialObjectsArray. Now, checking a little bit the VM and image side, it seems I am totally wrong. 

The `roots` are usually something VM internal.
You will have to find that in the Slang sources yourself, but a look at what we have in the RoarVM might help you to find it: https://github.com/smarr/RoarVM/blob/master/vm/src/objects/roots.h

class Roots {
  Oop specialObjectsOop;
  Oop nilObj, falseObj, trueObj;
  Oop freeContexts, freeLargeContexts;

  Oop receiverClass;
  Oop newNativeMethod;
  Oop methodClass; // unused?
  Oop sched_list_class;
  Oop dnuSelector; // for debugging

  // these get sent for control transfers
  Oop _activeContext;
  Oop _method;
  Oop _theHomeContext;
  Oop receiver;
  Oop messageSelector;
  Oop newMethod;
  Oop lkupClass;
  Oop running_process_or_nil;
  
  Oop emergency_semaphore;
};

And that is basically only the stuff that the interpreter needs during execution, and which might not be reachable by other means anymore. As you can see, the special objects array is part of the roots object, too.

> "Smalltalk rootTable" answers an array that I cannot understand how such array can be the root.
In my old MVC image there is not rootTable, but I would expect it to be a primitive which returns the content of a data structure similar to ours.

Best regards
Stefan


-- 
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525



More information about the Vm-dev mailing list