diff options
author | Hans Boehm <boehm@acm.org> | 2000-09-30 09:56:58 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2000-09-30 10:56:58 +0100 |
commit | bf3b8e42e291aeaeae178f6be1a49deebcd4e527 (patch) | |
tree | 546907bd61de305c953b5ae99d05489fc543bc16 /libjava/include | |
parent | 0476f09843348e065b11bac1265b723266b85fd5 (diff) | |
download | gcc-bf3b8e42e291aeaeae178f6be1a49deebcd4e527.zip gcc-bf3b8e42e291aeaeae178f6be1a49deebcd4e527.tar.gz gcc-bf3b8e42e291aeaeae178f6be1a49deebcd4e527.tar.bz2 |
Implement bitmap descriptor based marking for Boehm GC.
2000-09-30 Hans Boehm <boehm@acm.org>
Bryce McKinlay <bryce@albatross.co.nz>
Implement bitmap descriptor based marking for Boehm GC.
* configure.in: Define JC1GCSPEC. Set it if boehm-gc is used.
* configure: Rebuilt.
* libgcj.spec.in: Pass JC1GCSPEC to jc1.
* include/jvm.h (struct _Jv_VTable): New field `gc_descr'. New inline
method get_finalizer().
(struct _Jv_ArrayVTable): Ditto. Declare method array with
NUM_OBJECT_METHODS elements instead of NUM_OBJECT_METHODS + 1.
(_Jv_AllocObj): Add new jclass parameter.
(_Jv_AllocArray): Ditto.
(_Jv_BuildGCDescr): New prototype.
* prims.cc (_Jv_AllocObject): Rename parameter `c' to `klass'. Pass
`klass' to _Jv_AllocObj. Don't set the new object's vtable. Use
get_finalizer() instead of direct finalizer vtable offset.
(_Jv_NewObjectArray): Rename parameter `clas' to `klass'. Pass
`klass' to _Jv_AllocArray. Don't set the new array's vtable.
(_Jv_NewPrimArray): Call _Jv_FindArrayClass before _Jv_AllocObj.
Pass `klass' to _Jv_AllocObj. Don't set the new array's vtable.
* resolve.cc (METHOD_NOT_THERE, METHOD_INACCESSIBLE): New #defines.
(_Jv_ResolvePoolEntry): Use METHOD_NOT_THERE and METHOD_INACCESSIBLE.
(_Jv_DetermineVTableIndex): Ditto.
(_Jv_PrepareClass): Ditto. Remove offset-by-one adjustments from vtable
calculations to account for new gc_descr field.
* boehm.cc: #include gc_gcj.h.
(obj_kind_x, obj_free_list): `#if 0'-ed away.
(_Jv_MarkObj): Check that vtable doesn't point to a cleared object.
New commentary from HB. Mark the classes vtable.
(_Jv_MarkArray): Check that vtable doesn't point to a cleared object.
(GC_DEFAULT_DESCR): New #define.
(_Jv_BuildGCDescr): New function. Use GC_DEFAULT_DESCR, for now.
(_Jv_AllocObj): New parameter `klass'. Use GC_GCJ_MALLOC ().
(_Jv_AllocArray): New parameter `klass'. Allocate with GC_MALLOC and
scan conservativly if size is less than min_heap_addr. Set vtable
pointer of new object before returning.
(_Jv_AllocBytes): Use GC_MALLOC_ATOMIC, not GC_GENERIC_MALLOC.
(_Jv_InitGC): Call GC_init_gcj_malloc(). Don't set up marking and
allocation for obj_kind_x.
* nogc.cc (_Jv_BuildGCDescr): New function. Return 0.
(_Jv_AllocObj): Set vtable on returned object.
(_Jv_AllocArray): Ditto.
* java/lang/Class.h (_Jv_NewObjectArray): No longer a friend.
(_Jv_NewPrimArray): Ditto.
(_Jv_AllocObj): Declare as a friend.
(_Jv_AllocArray): Ditto.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Copy gc_descr
from &ObjectClass into new array class. Remove offset-by-one
adjustments from `method' size calculations to account for gc_descr
field.
Co-Authored-By: Bryce McKinlay <bryce@albatross.co.nz>
From-SVN: r36679
Diffstat (limited to 'libjava/include')
-rw-r--r-- | libjava/include/jvm.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index e6e6fa6..8d93ed5 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -31,7 +31,9 @@ details. */ struct _Jv_VTable { jclass clas; + void *gc_descr; void *method[1]; + void *get_finalizer() { return method[0]; } }; // Number of virtual methods on object. FIXME: it sucks that we have @@ -42,8 +44,9 @@ struct _Jv_VTable struct _Jv_ArrayVTable { jclass clas; - // `+1' because there is an extra slot for C++ RTTI compatibility. - void *method[NUM_OBJECT_METHODS + 1]; + void *gc_descr; + void *method[NUM_OBJECT_METHODS]; + void *get_finalizer() { return method[0]; } }; union _Jv_word @@ -106,15 +109,19 @@ extern java::lang::Class StringClass; typedef void _Jv_FinalizerFunc (jobject); /* Allocate space for a new Java object. */ -void *_Jv_AllocObj (jsize size) __attribute__((__malloc__)); +void *_Jv_AllocObj (jsize size, jclass cl) __attribute__((__malloc__)); /* Allocate space for an array of Java objects. */ -void *_Jv_AllocArray (jsize size) __attribute__((__malloc__)); +void *_Jv_AllocArray (jsize size, jclass cl) __attribute__((__malloc__)); /* Allocate space that is known to be pointer-free. */ void *_Jv_AllocBytes (jsize size) __attribute__((__malloc__)); /* Initialize the GC. */ void _Jv_InitGC (void); /* Register a finalizer. */ void _Jv_RegisterFinalizer (void *object, _Jv_FinalizerFunc *method); +/* Compute the GC descriptor for a class */ +#ifdef INTERPRETER +void * _Jv_BuildGCDescr(jclass); +#endif /* Allocate some unscanned, unmoveable memory. Return NULL if out of memory. */ |