[Gc] How can I advise the mark phase?

Boehm, Hans hans.boehm at hp.com
Thu May 19 11:17:33 PDT 2005

I think thet getting this to work correctly should be easy.
In fact, I think the default configuration (with
GC_all_interior_pointers set, and an extra byte added to
the end of each object) should almost just work. 
You probably do need to set POINTER_MASK to mask off the low
order bit, so that object pointers point just past the
end of the object, not another byte beyond that.

Correctly filtering the pointers, so that only pointers
to the proper displacement are recognized is harder, and
might require code changes.  Calls to the FIXUP_POINTER
macro should be good hints as to where those changes would
need to go, and you might just be able to
define that macro suitably.

Limiting scanning to skip the class number etc. would involve
adding a new object "kind".  Assuming you want to scan all
fields and array elements, I suspect that's a performance
loss all around, and not worth doing.


> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Richard A. O'Keefe
> Sent: Wednesday, May 18, 2005 5:59 PM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] How can I advise the mark phase?
> I want to use this GC in the runtime for a compiler I'm 
> writing. The representation I am using is
>     immediate integer:		true value shifted left 2,  00
>     immediate character:	Unicode value shift left 2, 10
>     pointer to object:		pointer to class number | 01
> Characters are immediate because with more than a million 
> possible  Unicode characters, I really don't want to allocate 
> an object for each. The use of 00 for integers simplifies 
> integer arithmetic a lot.
> The layout of each object is                         low addresses
>                                                          |
>     start of block: 	instance variables               |
> 			instance variables               |
>     (coded pointer -1): (class number << 2, 00)          V
>                                                       high 
> addresses or
>     start of block: 	instance variables
>     			instance variables
>     (coded pointer -1): (class number << 2, 00)
> 			(number of indexed elements << 2, 00)
> 			indexed elements
> This representation is chosen so that arrays can be passed to 
> C as C arrays and so that it is easy to find the array size 
> no matter how many instance variables there are.
> So any valid pointer
>     (1) must end in 01, so points "into the middle"
>     (2) must point to a word (0..n)*4 where the number of 
> classes n is known
>     (3) provides, in the class number, an index into a table that says
> 	(a) how many slots precede the class number, which can
> 	    used to check that the pointer is valid
>         (b) whether the elements are pointers, floats, bytes, &c,
>             which can be used to avoid scanning binary data.
> The thing that's not clear to me is how to tell the collector 
> about this. I suspect that I may have to modify the collector 
> myself; where should I start?
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com 
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list