summaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-05 00:59:48 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-05 00:59:48 +0000
commit9911f32d49966d395e69d87b5dc27d106228ad77 (patch)
tree6ce8f1048cd1d8cac9e29552ec52889a47da2919 /gcc/java
parent26ed225a6fd202766fdd51d23d7a9cccd957c2c8 (diff)
downloadgcc-9911f32d49966d395e69d87b5dc27d106228ad77.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113549 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/boehm.c32
-rw-r--r--gcc/java/class.c12
-rw-r--r--gcc/java/java-tree.h3
4 files changed, 36 insertions, 19 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 9635aa896fc..95a6730b570 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,5 +1,13 @@
2006-05-04 Tom Tromey <tromey@redhat.com>
+ * 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.
+
+2006-05-04 Tom Tromey <tromey@redhat.com>
+
* java-tree.def (THIS_EXPR): Now a tcc_expression.
2006-05-04 Andrew Haley <aph@redhat.com>
diff --git a/gcc/java/boehm.c b/gcc/java/boehm.c
index 6ea59440471..cc6e69e45dd 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));
+}
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 590925d3ab2..05c9944257a 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1611,16 +1611,6 @@ supers_all_compiled (tree type)
return 1;
}
-/* The forth (index of 3) element in the vtable is the GC descriptor.
- A value of 2 indicates that the class uses _Jv_MarkObj. */
-static int
-uses_jv_markobj_p(tree dtable)
-{
- tree v;
- v = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (dtable), 3)->value;
- return (2 == TREE_INT_CST_LOW (v));
-}
-
void
make_class_data (tree type)
{
@@ -1659,7 +1649,7 @@ make_class_data (tree type)
&& !flag_indirect_dispatch)
{
tree dtable = get_dispatch_table (type, this_class_addr);
- uses_jv_markobj = uses_jv_markobj_p(dtable);
+ uses_jv_markobj = uses_jv_markobj_p (dtable);
dtable_decl = build_dtable_decl (type);
DECL_INITIAL (dtable_decl) = dtable;
TREE_STATIC (dtable_decl) = 1;
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index de826b9c52d..c26e1e7c97e 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -1,6 +1,6 @@
/* Definitions for parsing and type checking for the GNU compiler for
the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GCC.
@@ -1358,6 +1358,7 @@ extern void java_debug_context (void);
extern void safe_layout_class (tree);
extern tree get_boehm_type_descriptor (tree);
+extern bool uses_jv_markobj_p (tree);
extern bool class_has_finalize_method (tree);
extern void java_check_methods (tree);
extern void init_jcf_parse (void);