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>
PR java/17845
......
......@@ -64,6 +64,7 @@ static void add_miranda_methods (tree, tree);
static int assume_compiled (const char *);
static tree build_symbol_entry (tree);
static tree emit_assertion_table (tree);
static void register_class (void);
struct obstack temporary_obstack;
......@@ -98,12 +99,13 @@ static class_flag_node *assume_compiled_tree;
static class_flag_node *enable_assert_tree;
static GTY(()) tree class_roots[5];
#define registered_class class_roots[0]
#define fields_ident class_roots[1] /* get_identifier ("fields") */
#define info_ident class_roots[2] /* get_identifier ("info") */
#define class_list class_roots[3]
#define class_dtable_decl class_roots[4]
static GTY(()) tree class_roots[4];
#define fields_ident class_roots[0] /* get_identifier ("fields") */
#define info_ident class_roots[1] /* get_identifier ("info") */
#define class_list class_roots[2]
#define class_dtable_decl class_roots[3]
static GTY(()) VEC(tree,gc) *registered_class;
/* Return the node that most closely represents the class whose name
is IDENT. Start the search from NODE (followed by its siblings).
......@@ -2407,23 +2409,16 @@ layout_class_method (tree this_class, tree super_class,
return dtable_count;
}
void
static void
register_class (void)
{
/* END does not need to be registered with the garbage collector
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);
tree node;
XEXP (DECL_RTL (current), 0) = copy_rtx (XEXP (DECL_RTL(node), 0));
if (!registered_class)
registered_class = current;
else
TREE_CHAIN (end) = current;
registered_class = VEC_alloc (tree, gc, 8);
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.
......@@ -2448,25 +2443,28 @@ emit_register_classes (tree *list_p)
targets can overide the default in tm.h to use the fallback mechanism. */
if (TARGET_USE_JCR_SECTION)
{
tree klass, t;
int i;
#ifdef JCR_SECTION_NAME
tree t;
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);
for (t = registered_class; t; t = TREE_CHAIN (t))
for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
{
mark_decl_referenced (t);
assemble_integer (XEXP (DECL_RTL (t), 0),
POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
t = build_fold_addr_expr (klass);
output_constant (t, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE);
}
#else
/* A target has defined TARGET_USE_JCR_SECTION, but doesn't have a
JCR_SECTION_NAME. */
abort ();
#endif
}
else
{
tree klass, t, register_class_fn;
int i;
t = build_function_type_list (void_type_node, class_ptr_type, NULL);
t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterClass"), t);
......@@ -2474,7 +2472,7 @@ emit_register_classes (tree *list_p)
DECL_EXTERNAL (t) = 1;
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 = tree_cons (NULL, t, NULL);
......
......@@ -1286,7 +1286,6 @@ extern tree build_result_decl (tree);
extern void set_method_index (tree decl, tree method_index);
extern tree get_method_index (tree decl);
extern void make_class_data (tree);
extern void register_class (void);
extern int alloc_name_constant (int, tree);
extern int alloc_constant_fieldref (tree, 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