Commit 19e223db by Mark Mitchell Committed by Mark Mitchell

Make-lang.in (JAVA_SRCS): Include java-tree.h.

	* Make-lang.in (JAVA_SRCS): Include java-tree.h.
	* Makefile.in (parse.o): Depend on ggc.h.
	(class.o): Likewise.
	(constants.o): Likewise.
	(decl.o): Likewise.
	(expr.o): Likewise.
	(jcf-parse.o): Likewise.
	(jcf-write.o): Likewise.
	(mangle.o): Likewise.
	* class.c: Include ggc.h.
	(build_static_field_ref): Register GC roots.
	(layout_class): Likewise.
	(init_class_processing): Likewise.
	* constants.c: Include ggc.h.
	(current_constant_pool_data_ref): Remove.
	(tag_nodes): Move it to ...
	(get_tag_node): ... here.  Register GC roots.
	* decl.c: Include ggc.h.  Remove many global tree definitions.
	(throw_node): Define.
	(java_global_trees): Likewise.
	(predef_filenames): Make the size a constant.
	(init_decl_processing): Adjust accordingly.
	(init_decl_processing): Call init_jcf_parse.  Register GC roots.
	* expr.c: Include ggc.h.
	(init_expr_processing): Register GC roots.
	(build_invokeinterface): Likewise.
	* java-tree.h: Replace extern tree declarations with macros.
	(java_global_trees): New variable.
	(java_tree_index): New enumeration.
	(init_jcf_parse): Declare.
	* jcf-parse.c: Include ggc.h.
	(current_class): Remove declaration.
	(main_class): Likewise.
	(all_class_list): Likewise.
	(predefined_filename_p): Adjust for constant size of
	predef_filenames.
	(init_jcf_parse): New function.
	* jcf-write.c: Include ggc.h.
	(generate_classfile): Register GC roots.
	(append_synthetic_attribute): Likewise.
	(append_innerclass_attribute_entry): Likewise.
	* lang.c: Include ggc.h.
	(lang_print_error): Register GC roots.
	* parse.h (struct parser_ctxt): Rename fields to avoid conflicts
	with macros.
	* parse.y: Include ggc.h.
	(wfl_operator): Remove.
	(goal): Register GC roots.
	(java_pop_parser_context): Adjust for new field names.
	(java_parser_context_save_global): Likewse.
	(java_parser_context_restore_global): Likewise.
	(java_parser_context_suspend): Likewise.
	(java_parser_context_resume): Likewise.
	(verify_constructor_circularity): Register GC roots.
	(lookup_cl): Likewise.
	(java_reorder_fields): Likewise.
	(build_current_this): Likewise.
	(class_in_current_package): Likewise.
	(argument_types_convertible): Likewise.
	(patch_cast): Rename wfl_op parameter to avoid macro conflicts.

From-SVN: r36581
parent a3b434a2
2000-09-23 Mark Mitchell <mark@codesourcery.com>
* Make-lang.in (JAVA_SRCS): Include java-tree.h.
* Makefile.in (parse.o): Depend on ggc.h.
(class.o): Likewise.
(constants.o): Likewise.
(decl.o): Likewise.
(expr.o): Likewise.
(jcf-parse.o): Likewise.
(jcf-write.o): Likewise.
(mangle.o): Likewise.
* class.c: Include ggc.h.
(build_static_field_ref): Register GC roots.
(layout_class): Likewise.
(init_class_processing): Likewise.
* constants.c: Include ggc.h.
(current_constant_pool_data_ref): Remove.
(tag_nodes): Move it to ...
(get_tag_node): ... here. Register GC roots.
* decl.c: Include ggc.h. Remove many global tree definitions.
(throw_node): Define.
(java_global_trees): Likewise.
(predef_filenames): Make the size a constant.
(init_decl_processing): Adjust accordingly.
(init_decl_processing): Call init_jcf_parse. Register GC roots.
* expr.c: Include ggc.h.
(init_expr_processing): Register GC roots.
(build_invokeinterface): Likewise.
* java-tree.h: Replace extern tree declarations with macros.
(java_global_trees): New variable.
(java_tree_index): New enumeration.
(init_jcf_parse): Declare.
* jcf-parse.c: Include ggc.h.
(current_class): Remove declaration.
(main_class): Likewise.
(all_class_list): Likewise.
(predefined_filename_p): Adjust for constant size of
predef_filenames.
(init_jcf_parse): New function.
* jcf-write.c: Include ggc.h.
(generate_classfile): Register GC roots.
(append_synthetic_attribute): Likewise.
(append_innerclass_attribute_entry): Likewise.
* lang.c: Include ggc.h.
(lang_print_error): Register GC roots.
* parse.h (struct parser_ctxt): Rename fields to avoid conflicts
with macros.
* parse.y: Include ggc.h.
(wfl_operator): Remove.
(goal): Register GC roots.
(java_pop_parser_context): Adjust for new field names.
(java_parser_context_save_global): Likewse.
(java_parser_context_restore_global): Likewise.
(java_parser_context_suspend): Likewise.
(java_parser_context_resume): Likewise.
(verify_constructor_circularity): Register GC roots.
(lookup_cl): Likewise.
(java_reorder_fields): Likewise.
(build_current_this): Likewise.
(class_in_current_package): Likewise.
(argument_types_convertible): Likewise.
(patch_cast): Rename wfl_op parameter to avoid macro conflicts.
2000-09-14 Tom Tromey <tromey@cygnus.com>
* lex.h: Use HAVE_ICONV_H, not HAVE_ICONV.
......
......@@ -75,7 +75,8 @@ JAVA_SRCS = $(srcdir)/java/parse.y $(srcdir)/java/class.c \
$(srcdir)/java/jcf-parse.c $(srcdir)/java/mangle.c \
$(srcdir)/java/jcf-write.c $(srcdir)/java/buffer.c \
$(srcdir)/java/check-init.c $(srcdir)/java/lex.c $(srcdir)/java/boehm.c \
$(srcdir)/java/jcf-depend.c $(srcdir)/java/jcf-path.c
$(srcdir)/java/jcf-depend.c $(srcdir)/java/jcf-path.c \
$(srcdir)/java/java-tree.h
jvspec.o: $(srcdir)/java/jvspec.c system.h $(GCC_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
......
......@@ -273,7 +273,7 @@ force:
parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h \
$(srcdir)/../function.h $(JAVA_TREE_H) $(srcdir)/lex.c $(PARSE_H) \
$(srcdir)/lex.h
$(srcdir)/lex.h $(srcdir)/../ggc.h
jcf-dump.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) jcf-dump.c \
jcf-reader.c jcf.h javaop.h javaop.def $(srcdir)/../version.h
gjavah.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) gjavah.c \
......@@ -286,12 +286,12 @@ check-init.o : check-init.c $(CONFIG_H) $(srcdir)/../gansidecl.h \
$(JAVA_TREE_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
class.o : class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) jcf.h $(PARSE_H) \
$(srcdir)/../gansidecl.h $(srcdir)/../toplev.h $(srcdir)/../system.h \
$(srcdir)/../output.h
$(srcdir)/../output.h $(srcdir)/../ggc.h
constants.o : constants.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
$(srcdir)/../toplev.h $(srcdir)/../system.h
$(srcdir)/../toplev.h $(srcdir)/../system.h $(srcdir)/../ggc.h
decl.o : decl.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
$(srcdir)/../toplev.h $(srcdir)/../system.h $(srcdir)/../function.h \
$(srcdir)/../defaults.h
$(srcdir)/../defaults.h $(srcdir)/../gcc.h
except.o : except.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
$(RTL_H) javaop.h java-opcodes.h $(srcdir)/../except.h java-except.h \
$(srcdir)/../eh-common.h $(srcdir)/../toplev.h $(srcdir)/../system.h \
......@@ -299,20 +299,21 @@ except.o : except.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
$(RTL_H) $(EXPR_H) javaop.h java-opcodes.h $(srcdir)/../except.h \
java-except.h java-except.h parse.h $(srcdir)/../toplev.h \
$(srcdir)/../system.h
$(srcdir)/../system.h $(srcdir)/../ggc.h
jcf-depend.o : jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H)
jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h java-except.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(PARSE_H)
$(srcdir)/../toplev.h $(PARSE_H) $(srcdir)/../ggc.h
jcf-write.o : jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(RTL_H) \
java-opcodes.h parse.h buffer.h $(srcdir)/../system.h $(srcdir)/../toplev.h
java-opcodes.h parse.h buffer.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../ggc.h
jv-scan.o : jv-scan.c $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../version.h
jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h
lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
$(srcdir)/../toplev.h $(srcdir)/../system.h $(RTL_H) $(EXPR_H)
mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
$(srcdir)/../toplev.h $(srcdir)/../ggc.h
parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \
$(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h
typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
......
......@@ -35,6 +35,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "toplev.h"
#include "output.h"
#include "parse.h"
#include "ggc.h"
static tree mangle_class_field PARAMS ((tree class));
static tree make_method_value PARAMS ((tree));
......@@ -1011,9 +1012,15 @@ build_static_field_ref (fdecl)
int field_index = 0;
ref = build1 (INDIRECT_REF, class_type_node, ref);
if (fields_ident == NULL_TREE)
fields_ident = get_identifier ("fields");
{
fields_ident = get_identifier ("fields");
ggc_add_tree_root (&fields_ident, 1);
}
if (info_ident == NULL_TREE)
info_ident = get_identifier ("info");
{
info_ident = get_identifier ("info");
ggc_add_tree_root (&info_ident, 1);
}
ref = build (COMPONENT_REF, field_ptr_type_node, ref,
lookup_field (&class_type_node, fields_ident));
......@@ -1779,9 +1786,17 @@ layout_class (this_class)
tree this_class;
{
static tree list = NULL_TREE;
static int initialized_p;
tree super_class = CLASSTYPE_SUPER (this_class);
tree field;
/* Register LIST with the garbage collector. */
if (!initialized_p)
{
ggc_add_tree_root (&list, 1);
initialized_p = 1;
}
list = tree_cons (this_class, NULL_TREE, list);
if (CLASS_BEING_LAIDOUT (this_class))
{
......@@ -2044,6 +2059,9 @@ static tree registered_class = NULL_TREE;
void
register_class ()
{
/* 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);
......@@ -2102,4 +2120,5 @@ void
init_class_processing ()
{
registerClass_libfunc = gen_rtx (SYMBOL_REF, Pmode, "_Jv_RegisterClass");
ggc_add_tree_root (&registered_class, 1);
}
......@@ -27,6 +27,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "tree.h"
#include "java-tree.h"
#include "toplev.h"
#include "ggc.h"
extern struct obstack permanent_obstack;
......@@ -318,17 +319,21 @@ write_constant_pool (cpool, buffer, length)
CPool *outgoing_cpool;
/* If non-NULL, an ADDR_EXPR referencing a VAR_DECL containing
the constant data array for the current class. */
tree current_constant_pool_data_ref;
/* A Cache for build_int_2 (CONSTANT_XXX, 0). */
static tree tag_nodes[13];
static tree
get_tag_node (tag)
int tag;
{
/* A Cache for build_int_2 (CONSTANT_XXX, 0). */
static tree tag_nodes[13];
static int initialized_p;
/* Register the TAG_NODES with the garbage collector. */
if (!initialized_p)
{
ggc_add_tree_root (tag_nodes, 13);
initialized_p = 1;
}
if (tag_nodes[tag] == NULL_TREE)
{
push_obstacks (&permanent_obstack, &permanent_obstack);
......
......@@ -37,6 +37,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "except.h"
#include "defaults.h"
#include "java-except.h"
#include "ggc.h"
#if defined (DEBUG_JAVA_BINDING_LEVELS)
extern void indent PROTO((void));
......@@ -69,6 +70,8 @@ tree decl_map;
tree pending_local_decls = NULL_TREE;
tree throw_node [2];
/* Push a local variable or stack slot into the decl_map,
and assign it an rtl. */
......@@ -283,122 +286,10 @@ static int keep_next_level_flag;
if it has subblocks. */
static int keep_next_if_subblocks;
tree java_global_trees[JTI_MAX];
tree object_type_node;
tree unqualified_object_id_node;
tree object_ptr_type_node;
tree string_type_node;
tree string_ptr_type_node;
tree throwable_type_node;
tree runtime_exception_type_node;
tree error_exception_type_node;
tree rawdata_ptr_type_node;
tree *predef_filenames;
int predef_filenames_size;
tree boolean_type_node;
tree return_address_type_node;
tree byte_type_node;
tree short_type_node;
tree int_type_node;
tree long_type_node;
tree promoted_byte_type_node;
tree promoted_short_type_node;
tree promoted_char_type_node;
tree promoted_boolean_type_node;
tree unsigned_byte_type_node;
tree unsigned_short_type_node;
tree unsigned_int_type_node;
tree unsigned_long_type_node;
/* The type for struct methodtable. */
tree methodtable_type;
tree methodtable_ptr_type;
tree utf8const_type;
tree utf8const_ptr_type;
tree class_type_node;
tree class_ptr_type;
tree field_type_node;
tree field_ptr_type_node;
tree field_info_union_node;
tree jexception_type;
tree jexception_ptr_type;
tree lineNumberEntry_type;
tree lineNumbers_type;
tree constants_type_node;
tree dtable_type;
tree dtable_ptr_type;
tree method_type_node;
tree method_ptr_type_node;
tree nativecode_ptr_array_type_node;
tree one_elt_array_domain_type;
tree access_flags_type_node;
tree class_dtable_decl;
/* Expressions that are constants with value zero, of types
`long', `float' and `double'. */
tree long_zero_node;
tree float_zero_node;
tree double_zero_node;
tree empty_stmt_node;
/* Nodes for boolean constants TRUE and FALSE. */
tree boolean_true_node;
tree boolean_false_node;
tree TYPE_identifier_node;
tree init_identifier_node;
tree clinit_identifier_node;
tree finit_identifier_node;
tree finit_leg_identifier_node;
tree void_signature_node;
tree length_identifier_node;
tree this_identifier_node;
tree super_identifier_node;
tree continue_identifier_node;
tree access0_identifier_node; /* 1.1 */
tree end_params_node;
/* References to internal libjava functions we use. */
tree alloc_object_node;
tree soft_instanceof_node;
tree soft_checkcast_node;
tree soft_initclass_node;
tree soft_newarray_node;
tree soft_anewarray_node;
tree soft_multianewarray_node;
tree soft_badarrayindex_node;
tree soft_nullpointer_node;
tree throw_node [2];
tree soft_checkarraystore_node;
tree soft_monitorenter_node;
tree soft_monitorexit_node;
tree soft_lookupinterfacemethod_node;
tree soft_lookupjnimethod_node;
tree soft_getjnienvnewframe_node;
tree soft_jnipopsystemframe_node;
tree soft_fmod_node;
tree soft_exceptioninfo_call_node;
tree soft_idiv_node;
tree soft_irem_node;
tree soft_ldiv_node;
tree soft_lrem_node;
/* Declarations for vtables for primitive arrays. */
tree boolean_array_vtable;
tree byte_array_vtable;
tree char_array_vtable;
tree short_array_vtable;
tree int_array_vtable;
tree long_array_vtable;
tree float_array_vtable;
tree double_array_vtable;
tree predef_filenames[PREDEF_FILENAMES_SIZE];
/* Build (and pushdecl) a "promoted type" for all standard
types shorter than int. */
......@@ -426,11 +317,6 @@ push_promoted_type (name, actual_type)
return type;
}
/* Nodes for integer constants. */
tree integer_two_node;
tree integer_four_node;
tree integer_negative_one_node;
/* Return a definition for a builtin function named NAME and whose data type
is TYPE. TYPE should be a function type with argument types.
FUNCTION_CODE tells later passes how to compile calls to this function.
......@@ -623,10 +509,8 @@ init_decl_processing ()
rawdata_ptr_type_node
= promote_type (lookup_class (get_identifier ("gnu.gcj.RawData")));
/* This section has to be updated as items are added to the previous
section. */
predef_filenames_size = 7;
predef_filenames = (tree *)xmalloc (predef_filenames_size * sizeof (tree));
/* If you add to this section, don't forget to increase
PREDEF_FILENAMES_SIZE. */
predef_filenames [0] = get_identifier ("java/lang/Class.java");
predef_filenames [1] = get_identifier ("java/lang/Error.java");
predef_filenames [2] = get_identifier ("java/lang/Object.java");
......@@ -958,6 +842,15 @@ init_decl_processing ()
0, NOT_BUILT_IN, NULL_PTR);
init_class_processing ();
init_jcf_parse ();
/* Register nodes with the garbage collector. */
ggc_add_tree_root (java_global_trees,
sizeof (java_global_trees) / sizeof (tree));
ggc_add_tree_root (throw_node,
sizeof (throw_node) / sizeof (tree));
ggc_add_tree_root (predef_filenames,
sizeof (predef_filenames) / sizeof (tree));
}
......
......@@ -40,6 +40,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "toplev.h"
#include "except.h"
#include "defaults.h"
#include "ggc.h"
static void flush_quick_stack PARAMS ((void));
static void push_value PARAMS ((tree));
......@@ -83,6 +84,10 @@ static tree case_identity PARAMS ((tree, tree));
static tree operand_type[59];
extern struct obstack permanent_obstack;
static tree methods_ident = NULL_TREE;
static tree ncode_ident = NULL_TREE;
tree dtable_ident = NULL_TREE;
/* Set to non-zero value in order to emit class initilization code
before static field references. */
int always_initialize_class_p;
......@@ -95,6 +100,9 @@ init_expr_processing()
operand_type[23] = operand_type[56] = float_type_node;
operand_type[24] = operand_type[57] = double_type_node;
operand_type[25] = operand_type[58] = ptr_type_node;
ggc_add_tree_root (operand_type, 59);
ggc_add_tree_root (&methods_ident, 1);
ggc_add_tree_root (&ncode_ident, 1);
}
/* We store the stack state in two places:
......@@ -1652,10 +1660,6 @@ build_class_init (clas, expr)
return init;
}
static tree methods_ident = NULL_TREE;
static tree ncode_ident = NULL_TREE;
tree dtable_ident = NULL_TREE;
tree
build_known_method_ref (method, method_type, self_type, method_signature, arg_list)
tree method, method_type ATTRIBUTE_UNUSED, self_type,
......@@ -1771,8 +1775,11 @@ build_invokeinterface (dtable, method)
abstract nor static. */
if (class_ident == NULL_TREE)
class_ident = get_identifier ("class");
{
class_ident = get_identifier ("class");
ggc_add_tree_root (&class_ident, 1);
}
dtable = build1 (INDIRECT_REF, dtable_type, dtable);
dtable = build (COMPONENT_REF, class_ptr_type, dtable,
lookup_field (&dtable_type, class_ident));
......
......@@ -34,6 +34,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "java-tree.h"
#include "toplev.h"
#include "parse.h"
#include "ggc.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
......@@ -69,15 +70,6 @@ extern struct obstack permanent_obstack;
before static field references. */
extern int always_initialize_class_p;
/* The class we are currently processing. */
tree current_class = NULL_TREE;
/* The class we started with. */
tree main_class = NULL_TREE;
/* List of all class DECL seen so far. */
tree all_class_list = NULL_TREE;
/* The FIELD_DECL for the current field. */
static tree current_field = NULL_TREE;
......@@ -808,7 +800,7 @@ predefined_filename_p (node)
tree node;
{
int i;
for (i = 0; i < predef_filenames_size; i++)
for (i = 0; i < PREDEF_FILENAMES_SIZE; i++)
if (predef_filenames [i] == node)
return 1;
return 0;
......@@ -1095,3 +1087,12 @@ DEFUN(jcf_figure_file_type, (jcf),
return JCF_SOURCE;
}
/* Initialization. */
void
init_jcf_parse ()
{
/* Register roots with the garbage collector. */
ggc_add_tree_root (&current_field, 1);
ggc_add_tree_root (&current_method, 1);
}
......@@ -34,6 +34,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "parse.h" /* for BLOCK_EXPR_BODY */
#include "buffer.h"
#include "toplev.h"
#include "ggc.h"
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
......@@ -3100,7 +3101,11 @@ generate_classfile (clas, state)
/* generate the SourceFile attribute. */
if (SourceFile_node == NULL_TREE)
SourceFile_node = get_identifier ("SourceFile");
{
SourceFile_node = get_identifier ("SourceFile");
ggc_add_tree_root (&SourceFile_node, 1);
}
i = find_utf8_constant (&state->cpool, SourceFile_node);
PUT2 (i); /* attribute_name_index */
PUT4 (2);
......@@ -3126,7 +3131,10 @@ append_synthetic_attribute (state)
int i;
if (Synthetic_node == NULL_TREE)
Synthetic_node = get_identifier ("Synthetic");
{
Synthetic_node = get_identifier ("Synthetic");
ggc_add_tree_root (&Synthetic_node, 1);
}
i = find_utf8_constant (&state->cpool, Synthetic_node);
PUT2 (i); /* Attribute string index */
PUT4 (0); /* Attribute length */
......@@ -3150,8 +3158,11 @@ append_innerclasses_attribute (state, class)
ptr = append_chunk (NULL, 8, state); /* 2+4+2 */
if (InnerClasses_node == NULL_TREE)
InnerClasses_node = get_identifier ("InnerClasses");
if (InnerClasses_node == NULL_TREE)
{
InnerClasses_node = get_identifier ("InnerClasses");
ggc_add_tree_root (&InnerClasses_node, 1);
}
i = find_utf8_constant (&state->cpool, InnerClasses_node);
PUT2 (i);
length_marker = ptr; PUT4 (0); /* length, to be later patched */
......@@ -3198,8 +3209,11 @@ append_innerclasses_attribute_entry (state, decl, name)
unsigned char *ptr = append_chunk (NULL, 8, state);
if (!anonymous_name)
anonymous_name = get_identifier ("");
{
anonymous_name = get_identifier ("");
ggc_add_tree_root (&anonymous_name, 1);
}
icii = find_class_constant (&state->cpool, TREE_TYPE (decl));
ocii = find_class_constant (&state->cpool, TREE_TYPE (DECL_CONTEXT (decl)));
......
......@@ -35,6 +35,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "toplev.h"
#include "flags.h"
#include "xref.h"
#include "ggc.h"
static void put_decl_string PARAMS ((const char *, int));
static void put_decl_node PARAMS ((tree));
......@@ -518,6 +519,16 @@ lang_print_error (file)
{
static tree last_error_function_context = NULL_TREE;
static tree last_error_function = NULL;
static int initialized_p;
/* Register LAST_ERROR_FUNCTION_CONTEXT and LAST_ERROR_FUNCTION with
the garbage collector. */
if (!initialized_p)
{
ggc_add_tree_root (&last_error_function_context, 1);
ggc_add_tree_root (&last_error_function, 1);
initialized_p = 1;
}
if (current_function_decl != NULL
&& DECL_CONTEXT (current_function_decl) != last_error_function_context)
......
......@@ -764,8 +764,8 @@ struct parser_ctxt {
/* This section is defined only if we compile jc1 */
#ifndef JC1_LITE
tree modifier_ctx [11]; /* WFL of modifiers */
tree current_class; /* Current class */
tree current_function_decl; /* Current function decl, save/restore */
tree class_type; /* Current class */
tree function_decl; /* Current function decl, save/restore */
struct JCF *current_jcf; /* CU jcf */
......
......@@ -65,6 +65,7 @@ definitions and other extensions. */
#include "function.h"
#include "except.h"
#include "defaults.h"
#include "ggc.h"
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
......@@ -361,10 +362,6 @@ static enum tree_code binop_lookup[19] =
in compound assignements. */
#define BINOP_COMPOUND_CANDIDATES 11
/* Fake WFL used to report error message. It is initialized once if
needed and reused with it's location information is overriden. */
tree wfl_operator = NULL_TREE;
/* The "$L" identifier we use to create labels. */
static tree label_id = NULL_TREE;
......@@ -399,6 +396,13 @@ static tree wpv_id;
/* The list of all packages we've seen so far */
static tree package_list = NULL_TREE;
/* Hold THIS for the scope of the current public method decl. */
static tree current_this;
/* Hold a list of catch clauses list. The first element of this list is
the list of the catch clauses of the currently analysed try block. */
static tree currently_caught_type_list;
/* Check modifiers. If one doesn't fit, retrieve it in its declaration
line and point it out. */
/* Should point out the one that don't fit. ASCII/unicode, going
......@@ -577,6 +581,23 @@ static tree package_list = NULL_TREE;
%%
/* 19.2 Production from 2.3: The Syntactic Grammar */
goal:
{
/* Register static variables with the garbage
collector. */
ggc_add_tree_root (&label_id, 1);
ggc_add_tree_root (&wfl_string_buffer, 1);
ggc_add_tree_root (&wfl_append, 1);
ggc_add_tree_root (&wfl_to_string, 1);
ggc_add_tree_root (&java_lang_id, 1);
ggc_add_tree_root (&inst_id, 1);
ggc_add_tree_root (&java_lang_cloneable, 1);
ggc_add_tree_root (&java_io_serializable, 1);
ggc_add_tree_root (&current_static_block, 1);
ggc_add_tree_root (&wpv_id, 1);
ggc_add_tree_root (&package_list, 1);
ggc_add_tree_root (&current_this, 1);
ggc_add_tree_root (&currently_caught_type_list, 1);
}
compilation_unit
{}
;
......@@ -2618,7 +2639,7 @@ java_pop_parser_context (generate)
next->incomplete_class = ctxp->incomplete_class;
next->gclass_list = ctxp->gclass_list;
lineno = ctxp->lineno;
current_class = ctxp->current_class;
current_class = ctxp->class_type;
}
/* If the old and new lexers differ, then free the old one. */
......@@ -2665,9 +2686,9 @@ java_parser_context_save_global ()
create_new_parser_context (1);
ctxp->lineno = lineno;
ctxp->current_class = current_class;
ctxp->class_type = current_class;
ctxp->filename = input_filename;
ctxp->current_function_decl = current_function_decl;
ctxp->function_decl = current_function_decl;
ctxp->saved_data = 1;
}
......@@ -2678,9 +2699,9 @@ void
java_parser_context_restore_global ()
{
lineno = ctxp->lineno;
current_class = ctxp->current_class;
current_class = ctxp->class_type;
input_filename = ctxp->filename;
current_function_decl = ctxp->current_function_decl;
current_function_decl = ctxp->function_decl;
ctxp->saved_data = 0;
if (ctxp->saved_data_ctx)
java_pop_parser_context (0);
......@@ -2699,8 +2720,8 @@ java_parser_context_suspend ()
/* Duplicate the previous context, use it to save the globals we're
interested in */
create_new_parser_context (1);
ctxp->current_function_decl = current_function_decl;
ctxp->current_class = current_class;
ctxp->function_decl = current_function_decl;
ctxp->class_type = current_class;
/* Then create a new context which inherits all data from the
previous one. This will be the new current context */
......@@ -2730,8 +2751,8 @@ java_parser_context_resume ()
restored->class_list = old->class_list;
/* Restore the current class and function from the saver */
current_class = saver->current_class;
current_function_decl = saver->current_function_decl;
current_class = saver->class_type;
current_function_decl = saver->function_decl;
/* Retrive the restored context */
ctxp = restored;
......@@ -4570,7 +4591,17 @@ verify_constructor_circularity (meth, current)
tree meth, current;
{
static tree list = NULL_TREE;
static int initialized_p;
tree c;
/* If we haven't already registered LIST with the garbage collector,
do so now. */
if (!initialized_p)
{
ggc_add_tree_root (&list, 1);
initialized_p = 1;
}
for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
{
if (TREE_VALUE (c) == meth)
......@@ -6409,7 +6440,10 @@ lookup_cl (decl)
return NULL_TREE;
if (cl == NULL_TREE)
cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
{
cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
ggc_add_tree_root (&cl, 1);
}
EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
......@@ -7249,9 +7283,6 @@ add_stmt_to_compound (existing, type, stmt)
return stmt;
}
/* Hold THIS for the scope of the current public method decl. */
static tree current_this;
void java_layout_seen_class_methods ()
{
tree previous_list = all_class_list;
......@@ -7278,8 +7309,16 @@ void
java_reorder_fields ()
{
static tree stop_reordering = NULL_TREE;
static int initialized_p;
tree current;
/* Register STOP_REORDERING with the garbage collector. */
if (!initialized_p)
{
ggc_add_tree_root (&stop_reordering, 1);
initialized_p = 1;
}
for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
{
current_class = TREE_TYPE (TREE_VALUE (current));
......@@ -7490,10 +7529,6 @@ java_complete_expand_methods (class_decl)
TYPE_CPOOL (current_class) = outgoing_cpool;
}
/* Hold a list of catch clauses list. The first element of this list is
the list of the catch clauses of the currently analysed try block. */
static tree currently_caught_type_list;
/* Attempt to create <clinit>. Pre-expand static fields so they can be
safely used in some other methods/constructors. */
......@@ -8175,16 +8210,23 @@ build_current_thisn (type)
{
static int saved_i = -1;
static tree saved_thisn = NULL_TREE;
static tree saved_type = NULL_TREE;
static int saved_type_i = 0;
static int initialized_p;
tree decl;
char buffer [80];
int i = 0;
if (type)
/* Register SAVED_THISN and SAVED_TYPE with the garbage collector. */
if (!initialized_p)
{
static tree saved_type = NULL_TREE;
static int saved_type_i = 0;
ggc_add_tree_root (&saved_thisn, 1);
ggc_add_tree_root (&saved_type, 1);
initialized_p = 1;
}
if (type)
{
if (type == saved_type)
i = saved_type_i;
else
......@@ -8256,6 +8298,8 @@ build_dot_class_method (class)
{
get_message_wfl = build_wfl_node (get_identifier ("getMessage"));
type_parm_wfl = build_wfl_node (get_identifier ("type$"));
ggc_add_tree_root (&get_message_wfl, 1);
ggc_add_tree_root (&type_parm_wfl, 1);
}
/* Build the arguments */
......@@ -9547,6 +9591,14 @@ class_in_current_package (class)
breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
if (ctxp->package == left)
{
static int initialized_p;
/* Register CACHE with the garbage collector. */
if (!initialized_p)
{
ggc_add_tree_root (&cache, 1);
initialized_p = 1;
}
cache = class;
return 1;
}
......@@ -10504,9 +10556,19 @@ argument_types_convertible (m1, m2_or_arglist)
{
static tree m2_arg_value = NULL_TREE;
static tree m2_arg_cache = NULL_TREE;
static int initialized_p;
register tree m1_arg, m2_arg;
/* Register M2_ARG_VALUE and M2_ARG_CACHE with the garbage
collector. */
if (!initialized_p)
{
ggc_add_tree_root (&m2_arg_value, 1);
ggc_add_tree_root (&m2_arg_cache, 1);
initialized_p = 1;
}
SKIP_THIS_AND_ARTIFICIAL_PARMS (m1_arg, m1)
if (m2_arg_value == m2_or_arglist)
......@@ -13459,9 +13521,9 @@ resolve_type_during_patch (type)
found. Otherwise NODE or something meant to replace it is returned. */
static tree
patch_cast (node, wfl_operator)
patch_cast (node, wfl_op)
tree node;
tree wfl_operator;
tree wfl_op;
{
tree op = TREE_OPERAND (node, 0);
tree op_type = TREE_TYPE (op);
......@@ -13530,7 +13592,7 @@ patch_cast (node, wfl_operator)
/* Any other casts are proven incorrect at compile time */
t1 = xstrdup (lang_printable_name (op_type, 0));
parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
parse_error_context (wfl_op, "Invalid cast from `%s' to `%s'",
t1, lang_printable_name (cast_type, 0));
free (t1);
return error_mark_node;
......
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