new gc interface

Date view Thread view Subject view Author view

From: Godmar Back (gback@marker.cs.utah.edu)
Date: Mon Jan 25 1999 - 12:48:19 EST


 In the best kaffe-core tradition of checking in half-baked stuff,
I checked a first cut at the new gc interface in.

The major changes include:

+ removed *everything* about walking/marking from mem/*.
        -> now in gcFuncs.c
+ removed the handling of root references since this is gc-algorithm
  independent. Hence it's now longer part of the gc interface
        -> now in gcRefs.c
  Instead, the gc now invokes a callback to walk the root objects. This is
  how SportModel (EF's gc) does it too.
+ sorted out gc-mem.h and gc-incremental.h somewhat
+ streamlined gc statistics
+ made the collector/allocator a true COM-like object. [1]

The reason I say it's half-baked is because of the many XXX in places that
have to do with the interaction with the thread subsystem. Now that's so
because the threading interface still needs to be sorted out. Also, some
definitions&declarations need to be moved around between header files.
I hope to get to this next week.

For the threading system, I'll probably take a two-sided approach.
I'll move the internal.c files in kaffevm, but also provide a COM-like
interface to it (probably JVMDI or something.) Then, I can benefit from
direct access to such frequently called functions as stackcheck, but I can
also cleanly separate the dependencies of the gc subsystem by passing in
the thread COM object for the (non-performance critical) threading
functionality it needs.

This latest snapshot built and tested for me on Linux with shared/jit
and FreeBSD 2.2.x with static/intr. I didn't test other configurations.
If they're broken, it's libtool's fault. ;-)

        - Godmar

[1]: the new interface looks like this:

typedef struct _Collector {
        struct GarbageCollectorInterface_Ops *ops;
} Collector;

struct GarbageCollectorInterface_Ops {

        void* reserved1;
        void* reserved2;
        void* reserved3;
        void* (*malloc)(Collector *, size_t size, int type);
        void* (*realloc)(Collector *, void* addr, size_t size, int type);
        void (*free)(Collector *, void* addr);
 
        void (*invoke)(Collector *, int mustgc);
        void (*invokeFinalizer)(Collector *);
        void (*init)(Collector *);
        void (*enable)(Collector *);
  
        void (*markAddress)(Collector *, const void* addr);
        void (*markObject)(Collector *, const void* obj);
        uint32 (*getObjectSize)(Collector *, const void* obj);

        void (*walkMemory)(Collector *, void *addr);
        void (*walkConservative)(Collector *,
                        const void* addr, uint32 length);
  
        void (*registerFixedTypeByIndex)(Collector *,
                        int index, const char *description);

        void (*registerGcTypeByIndex)(Collector *,
                        int index,
                        walk_func_t walk, final_func_t final,
                        destroy_func_t destroy, const char *description);
};


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:48 EDT