diff options
author | Tom Tromey <tromey@redhat.com> | 2006-05-05 00:59:48 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2006-05-05 00:59:48 +0000 |
commit | b11382213a2e25a0b0ccd70783641b33b6dc51f1 (patch) | |
tree | 6ce8f1048cd1d8cac9e29552ec52889a47da2919 /gcc/java/boehm.c | |
parent | d31f43306b18932fa4e007dcc45ae4b88165a194 (diff) | |
download | gcc-b11382213a2e25a0b0ccd70783641b33b6dc51f1.zip gcc-b11382213a2e25a0b0ccd70783641b33b6dc51f1.tar.gz gcc-b11382213a2e25a0b0ccd70783641b33b6dc51f1.tar.bz2 |
java-tree.h (uses_jv_markobj_p): Declare.
* java-tree.h (uses_jv_markobj_p): Declare.
* class.c (uses_jv_markobj_p): Removed.
* boehm.c (PROCEDURE_OBJECT_DESCRIPTOR): New define.
(get_boehm_type_descriptor): Use it.
(uses_jv_markobj_p): Moved from class.c. Return bool.
From-SVN: r113549
Diffstat (limited to 'gcc/java/boehm.c')
-rw-r--r-- | gcc/java/boehm.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/gcc/java/boehm.c b/gcc/java/boehm.c index 6ea5944..cc6e69e 100644 --- a/gcc/java/boehm.c +++ b/gcc/java/boehm.c @@ -40,6 +40,14 @@ static void mark_reference_fields (tree, unsigned HOST_WIDE_INT *, static void set_bit (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *, unsigned int); +/* A procedure-based object descriptor. We know that our + `kind' is 0, and `env' is likewise 0, so we have a simple + computation. From the GC sources: + (((((env) << LOG_MAX_MARK_PROCS) | (proc_index)) << DS_TAG_BITS) \ + | DS_PROC) + Here DS_PROC == 2. */ +#define PROCEDURE_OBJECT_DESCRIPTOR 2 + /* Treat two HOST_WIDE_INT's as a contiguous bitmap, with bit 0 being the least significant. This function sets bit N in the bitmap. */ static void @@ -220,15 +228,25 @@ get_boehm_type_descriptor (tree type) } else { - /* Compute a procedure-based object descriptor. We know that our - `kind' is 0, and `env' is likewise 0, so we have a simple - computation. From the GC sources: - (((((env) << LOG_MAX_MARK_PROCS) | (proc_index)) << DS_TAG_BITS) \ - | DS_PROC) - Here DS_PROC == 2. */ procedure_object_descriptor: - value = build_int_cst (value_type, 2); + value = build_int_cst (value_type, PROCEDURE_OBJECT_DESCRIPTOR); } return value; } + +/* The fourth (index of 3) element in the vtable is the GC descriptor. + A value of 2 indicates that the class uses _Jv_MarkObj. */ +bool +uses_jv_markobj_p (tree dtable) +{ + tree v; + /* FIXME: what do we return if !flag_use_boehm_gc ? */ + gcc_assert (flag_use_boehm_gc); + /* FIXME: this is wrong if TARGET_VTABLE_USES_DESCRIPTORS. However, + this function is only used with flag_reduced_reflection. No + point in asserting unless we hit the bad case. */ + gcc_assert (!flag_reduced_reflection || TARGET_VTABLE_USES_DESCRIPTORS == 0); + v = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (dtable), 3)->value; + return (PROCEDURE_OBJECT_DESCRIPTOR == TREE_INT_CST_LOW (v)); +} |