On 15 Aug 2005, at 13:17, Yuval Kogman wrote:
On Mon, Aug 15, 2005 at 12:40:05 +0100, Adrian Howard wrote:
[snip]
1) Some way of declaring objects as being "fixed" so we can pass them to external code without having to worry about the GC moving them around.

A handle to an object should always be fixed, I would think... Even
under a copying mechanism, you can have an arena for handles, and an
arena for the actual data which is actually collected, and points
back to the data.

Optimized access (auto unboxing, various inferrencing by the
compiler) could be made such that it doesn't go through the handle
unless absolutely necessary.

I'm not sure what you're proposing here. A separate arena for stuff you want to allocate and not be moved by the GC? How would I tell the compiler?

2) Some way of being able to tell the garbage collector to ignore the current contents of the heap for the purposes of GC. One Pop-11 idiom was to do something like:

     ;;; create a whole bunch of complicated self referencing
     ;;; objects that we know are going to persist over time

     sys_garbage();    ;;; run the garbage collector
     sys_lock_heap();  ;;; lock stuff currently in the heap

     ;;; do lots of stuff that now runs quicker since the GC doesn't
     ;;; have to worry about marking the objects that we know are
     ;;; not going away

     sys_unlock_heap();    ;;; give the GC full rein again


We are trying to design a requirement based interface, so that the
GC can be changed, but behavior remains consistent.

This should be more like
[interesting options snipped]

How about

    do : GC::priority(:new) {
        # only GC things allocated during the lifetime
        # of the block
    }

?

[snip]
        do :GC::nodelay {
[snip]
        do :GC::nodestroy {
[snip]

no_delay and no_destroy please (I spent a minute trying to figure out what a "node lay" was :-)

[snip]
4) Hooks to run code before/after GC. Occasionally very useful. (e.g. with the gc hooks and heap locking/unlocking you could implement your own ephemeral GC system in Pop-11).

This is possibly done by introspecting
$*RUNTIME.Memory.GarbageCollector, and seeing if it supports events.
[snip]

Actually, since to my naive eyes it looks like the GC is a first class object the problem can probably be solver better by adding your own.

Adrian

Reply via email to