Commit 8cfb12bf by Richard Henderson

class.c (registered_class): Take it out of class_roots; turn into a vec of trees.

        * class.c (registered_class): Take it out of class_roots; turn into
        a vec of trees.
        (register_class): Make static.  Don't duplicate decl node.  Use
        VEC_safe_push.
        (emit_register_classes): Use VEC_iterate.  Use output_constant
        instead of assemble_integer.  Don't call mark_decl_referenced
        directly.
        * java-tree.h (register_class): Remove decl.

From-SVN: r100107
parent e777303f
2005-05-24 Richard Henderson <rth@redhat.com>
* class.c (registered_class): Take it out of class_roots; turn into
a vec of trees.
(register_class): Make static. Don't duplicate decl node. Use
VEC_safe_push.
(emit_register_classes): Use VEC_iterate. Use output_constant
instead of assemble_integer. Don't call mark_decl_referenced
directly.
* java-tree.h (register_class): Remove decl.
2005-05-19 Paolo Bonzini <bonzini@gnu.org> 2005-05-19 Paolo Bonzini <bonzini@gnu.org>
PR java/17845 PR java/17845
...@@ -19,7 +30,7 @@ ...@@ -19,7 +30,7 @@
2005-05-12 Aaron Luchko <aluchko@redhat.com> 2005-05-12 Aaron Luchko <aluchko@redhat.com>
* gcj.texi: Add '-verify', '-noverify', and '-verifyremote'. * gcj.texi: Add '-verify', '-noverify', and '-verifyremote'.
2005-05-11 Tom Tromey <tromey@redhat.com> 2005-05-11 Tom Tromey <tromey@redhat.com>
......
...@@ -64,6 +64,7 @@ static void add_miranda_methods (tree, tree); ...@@ -64,6 +64,7 @@ static void add_miranda_methods (tree, tree);
static int assume_compiled (const char *); static int assume_compiled (const char *);
static tree build_symbol_entry (tree); static tree build_symbol_entry (tree);
static tree emit_assertion_table (tree); static tree emit_assertion_table (tree);
static void register_class (void);
struct obstack temporary_obstack; struct obstack temporary_obstack;
...@@ -98,12 +99,13 @@ static class_flag_node *assume_compiled_tree; ...@@ -98,12 +99,13 @@ static class_flag_node *assume_compiled_tree;
static class_flag_node *enable_assert_tree; static class_flag_node *enable_assert_tree;
static GTY(()) tree class_roots[5]; static GTY(()) tree class_roots[4];
#define registered_class class_roots[0] #define fields_ident class_roots[0] /* get_identifier ("fields") */
#define fields_ident class_roots[1] /* get_identifier ("fields") */ #define info_ident class_roots[1] /* get_identifier ("info") */
#define info_ident class_roots[2] /* get_identifier ("info") */ #define class_list class_roots[2]
#define class_list class_roots[3] #define class_dtable_decl class_roots[3]
#define class_dtable_decl class_roots[4]
static GTY(()) VEC(tree,gc) *registered_class;
/* Return the node that most closely represents the class whose name /* Return the node that most closely represents the class whose name
is IDENT. Start the search from NODE (followed by its siblings). is IDENT. Start the search from NODE (followed by its siblings).
...@@ -2407,23 +2409,16 @@ layout_class_method (tree this_class, tree super_class, ...@@ -2407,23 +2409,16 @@ layout_class_method (tree this_class, tree super_class,
return dtable_count; return dtable_count;
} }
void static void
register_class (void) register_class (void)
{ {
/* END does not need to be registered with the garbage collector tree node;
because it always points into the list given by REGISTERED_CLASS,
and that variable is registered with the collector. */
static tree end;
tree node = TREE_OPERAND (build_class_ref (current_class), 0);
tree current = copy_node (node);
XEXP (DECL_RTL (current), 0) = copy_rtx (XEXP (DECL_RTL(node), 0));
if (!registered_class) if (!registered_class)
registered_class = current; registered_class = VEC_alloc (tree, gc, 8);
else
TREE_CHAIN (end) = current;
end = current; node = TREE_OPERAND (build_class_ref (current_class), 0);
VEC_safe_push (tree, gc, registered_class, node);
} }
/* Emit something to register classes at start-up time. /* Emit something to register classes at start-up time.
...@@ -2448,25 +2443,28 @@ emit_register_classes (tree *list_p) ...@@ -2448,25 +2443,28 @@ emit_register_classes (tree *list_p)
targets can overide the default in tm.h to use the fallback mechanism. */ targets can overide the default in tm.h to use the fallback mechanism. */
if (TARGET_USE_JCR_SECTION) if (TARGET_USE_JCR_SECTION)
{ {
tree klass, t;
int i;
#ifdef JCR_SECTION_NAME #ifdef JCR_SECTION_NAME
tree t;
named_section_flags (JCR_SECTION_NAME, SECTION_WRITE); named_section_flags (JCR_SECTION_NAME, SECTION_WRITE);
#else
/* A target has defined TARGET_USE_JCR_SECTION,
but doesn't have a JCR_SECTION_NAME. */
gcc_unreachable ();
#endif
assemble_align (POINTER_SIZE); assemble_align (POINTER_SIZE);
for (t = registered_class; t; t = TREE_CHAIN (t))
for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
{ {
mark_decl_referenced (t); t = build_fold_addr_expr (klass);
assemble_integer (XEXP (DECL_RTL (t), 0), output_constant (t, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE);
POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
} }
#else
/* A target has defined TARGET_USE_JCR_SECTION, but doesn't have a
JCR_SECTION_NAME. */
abort ();
#endif
} }
else else
{ {
tree klass, t, register_class_fn; tree klass, t, register_class_fn;
int i;
t = build_function_type_list (void_type_node, class_ptr_type, NULL); t = build_function_type_list (void_type_node, class_ptr_type, NULL);
t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterClass"), t); t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterClass"), t);
...@@ -2474,7 +2472,7 @@ emit_register_classes (tree *list_p) ...@@ -2474,7 +2472,7 @@ emit_register_classes (tree *list_p)
DECL_EXTERNAL (t) = 1; DECL_EXTERNAL (t) = 1;
register_class_fn = t; register_class_fn = t;
for (klass = registered_class; klass; klass = TREE_CHAIN (klass)) for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
{ {
t = build_fold_addr_expr (klass); t = build_fold_addr_expr (klass);
t = tree_cons (NULL, t, NULL); t = tree_cons (NULL, t, NULL);
......
...@@ -1286,7 +1286,6 @@ extern tree build_result_decl (tree); ...@@ -1286,7 +1286,6 @@ extern tree build_result_decl (tree);
extern void set_method_index (tree decl, tree method_index); extern void set_method_index (tree decl, tree method_index);
extern tree get_method_index (tree decl); extern tree get_method_index (tree decl);
extern void make_class_data (tree); extern void make_class_data (tree);
extern void register_class (void);
extern int alloc_name_constant (int, tree); extern int alloc_name_constant (int, tree);
extern int alloc_constant_fieldref (tree, tree); extern int alloc_constant_fieldref (tree, tree);
extern void emit_register_classes (tree *); extern void emit_register_classes (tree *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment