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
This commit is contained in:
Mark Mitchell 2000-09-23 17:09:39 +00:00 committed by Mark Mitchell
parent a3b434a235
commit 19e223db83
13 changed files with 643 additions and 304 deletions

View File

@ -1,3 +1,66 @@
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.

View File

@ -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) \

View File

@ -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 \

View File

@ -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);
}

View File

@ -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);

View File

@ -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));
}

View File

@ -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));

View File

@ -121,13 +121,16 @@ struct JCF;
extern int compiling_from_source;
/* The class defined by the actual (main) file we are compiling. */
extern tree main_class;
#define main_class \
java_global_trees[JTI_MAIN_CLASS]
/* The class we are currently processing. */
extern tree current_class;
#define current_class \
java_global_trees[JTI_CURRENT_CLASS]
/* List of all class DECLs seen so far. */
extern tree all_class_list;
#define all_class_list \
java_global_trees[JTI_ALL_CLASS_LIST]
/* Nonzero if we should make is_compiled_class always return 1 for
appropriate classes that we're referencing. */
@ -205,139 +208,397 @@ typedef struct CPool constant_pool;
#define COMPONENT_REF_SIGNATURE(CPOOL, IDX) \
NAME_AND_TYPE_SIGNATURE (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
enum java_tree_index
{
JTI_PROMOTED_BYTE_TYPE_NODE,
JTI_PROMOTED_SHORT_TYPE_NODE,
JTI_PROMOTED_CHAR_TYPE_NODE,
JTI_PROMOTED_BOOLEAN_TYPE_NODE,
JTI_BYTE_TYPE_NODE,
JTI_SHORT_TYPE_NODE,
JTI_INT_TYPE_NODE,
JTI_LONG_TYPE_NODE,
JTI_UNSIGNED_BYTE_TYPE_NODE,
JTI_UNSIGNED_SHORT_TYPE_NODE,
JTI_UNSIGNED_INT_TYPE_NODE,
JTI_UNSIGNED_LONG_TYPE_NODE,
JTI_BOOLEAN_TYPE_NODE,
JTI_OBJECT_TYPE_NODE,
JTI_UNQUALIFIED_OBJECT_ID_NODE,
JTI_OBJECT_PTR_TYPE_NODE,
JTI_STRING_TYPE_NODE,
JTI_STRING_PTR_TYPE_NODE,
JTI_THROWABLE_TYPE_NODE,
JTI_RUNTIME_EXCEPTION_TYPE_NODE,
JTI_ERROR_EXCEPTION_TYPE_NODE,
JTI_RAWDATA_PTR_TYPE_NODE,
JTI_BYTE_ARRAY_TYPE_NODE,
JTI_SHORT_ARRAY_TYPE_NODE,
JTI_INT_ARRAY_TYPE_NODE,
JTI_LONG_ARRAY_TYPE_NODE,
JTI_BOOLEAN_ARRAY_TYPE_NODE,
JTI_CHAR_ARRAY_TYPE_NODE,
JTI_DOUBLE_ARRAY_TYPE_NODE,
JTI_FLOAT_ARRAY_TYPE_NODE,
JTI_ARRAY_ARRAY_TYPE_NODE,
JTI_OBJECT_ARRAY_TYPE_NODE,
JTI_STRING_ARRAY_TYPE_NODE,
JTI_BOOLEAN_ARRAY_VTABLE,
JTI_BYTE_ARRAY_VTABLE,
JTI_CHAR_ARRAY_VTABLE,
JTI_SHORT_ARRAY_VTABLE,
JTI_INT_ARRAY_VTABLE,
JTI_LONG_ARRAY_VTABLE,
JTI_FLOAT_ARRAY_VTABLE,
JTI_DOUBLE_ARRAY_VTABLE,
JTI_TYPE_IDENTIFIER_NODE,
JTI_INIT_IDENTIFIER_NODE,
JTI_CLINIT_IDENTIFIER_NODE,
JTI_FINIT_IDENTIFIER_NODE,
JTI_FINIT_LEG_IDENTIFIER_NODE,
JTI_VOID_SIGNATURE_NODE,
JTI_LENGTH_IDENTIFIER_NODE,
JTI_THIS_IDENTIFIER_NODE,
JTI_SUPER_IDENTIFIER_NODE,
JTI_CONTINUE_IDENTIFIER_NODE,
JTI_ACCESS0_IDENTIFIER_NODE,
JTI_ONE_ELT_ARRAY_DOMAIN_TYPE,
JTI_RETURN_ADDRESS_TYPE_NODE,
JTI_BOOLEAN_TRUE_NODE,
JTI_BOOLEAN_FALSE_NODE,
JTI_LONG_ZERO_NODE,
JTI_FLOAT_ZERO_NODE,
JTI_DOUBLE_ZERO_NODE,
JTI_INTEGER_NEGATIVE_ONE_NODE,
JTI_INTEGER_TWO_NODE,
JTI_INTEGER_FOUR_NODE,
JTI_EMPTY_STMT_NODE,
JTI_METHODTABLE_TYPE,
JTI_METHODTABLE_PTR_TYPE,
JTI_UTF8CONST_TYPE,
JTI_UTF8CONST_PTR_TYPE,
JTI_CLASS_TYPE_NODE,
JTI_CLASS_PTR_TYPE,
JTI_FIELD_TYPE_NODE,
JTI_CONSTANTS_TYPE_NODE,
JTI_DTABLE_TYPE,
JTI_DTABLE_PTR_TYPE,
JTI_FIELD_PTR_TYPE_NODE,
JTI_FIELD_INFO_UNION_NODE,
JTI_EXCEPTION_TYPE,
JTI_EXCEPTION_PTR_TYPE,
JTI_LINENUMBERENTRY_TYPE,
JTI_LINENUMBERS_TYPE,
JTI_METHOD_TYPE_NODE,
JTI_METHOD_PTR_TYPE_NODE,
JTI_END_PARAMS_NODE,
JTI_ALLOC_OBJECT_NODE,
JTI_SOFT_INSTANCEOF_NODE,
JTI_SOFT_CHECKCAST_NODE,
JTI_SOFT_INITCLASS_NODE,
JTI_SOFT_NEWARRAY_NODE,
JTI_SOFT_ANEWARRAY_NODE,
JTI_SOFT_MULTIANEWARRAY_NODE,
JTI_SOFT_BADARRAYINDEX_NODE,
JTI_SOFT_NULLPOINTER_NODE,
JTI_SOFT_CHECKARRAYSTORE_NODE,
JTI_SOFT_MONITORENTER_NODE,
JTI_SOFT_MONITOREXIT_NODE,
JTI_SOFT_LOOKUPINTERFACEMETHOD_NODE,
JTI_SOFT_LOOKUPJNIMETHOD_NODE,
JTI_SOFT_GETJNIENVNEWFRAME_NODE,
JTI_SOFT_JNIPOPSYSTEMFRAME_NODE,
JTI_SOFT_FMOD_NODE,
JTI_SOFT_EXCEPTIONINFO_CALL_NODE,
JTI_SOFT_IDIV_NODE,
JTI_SOFT_IREM_NODE,
JTI_SOFT_LDIV_NODE,
JTI_SOFT_LREM_NODE,
JTI_ACCESS_FLAGS_TYPE_NODE,
JTI_CLASS_DTABLE_DECL,
JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE,
JTI_WFL_OPERATOR,
JTI_CURRENT_CONSTANT_POOL_DATA_REF,
JTI_MAIN_CLASS,
JTI_CURRENT_CLASS,
JTI_ALL_CLASS_LIST,
JTI_MAX
};
extern tree java_global_trees[JTI_MAX];
/* "Promoted types" that are used for primitive types smaller
than int. We could use int_type_node, but then we would lose
type information (such as needed for debugging). */
extern tree promoted_byte_type_node;
extern tree promoted_short_type_node;
extern tree promoted_char_type_node;
extern tree promoted_boolean_type_node;
#define promoted_byte_type_node \
java_global_trees[JTI_PROMOTED_BYTE_TYPE_NODE]
#define promoted_short_type_node \
java_global_trees[JTI_PROMOTED_SHORT_TYPE_NODE]
#define promoted_char_type_node \
java_global_trees[JTI_PROMOTED_CHAR_TYPE_NODE]
#define promoted_boolean_type_node \
java_global_trees[JTI_PROMOTED_BOOLEAN_TYPE_NODE]
extern tree byte_type_node;
extern tree short_type_node;
extern tree int_type_node;
extern tree long_type_node;
#define byte_type_node \
java_global_trees[JTI_BYTE_TYPE_NODE]
#define short_type_node \
java_global_trees[JTI_SHORT_TYPE_NODE]
#define int_type_node \
java_global_trees[JTI_INT_TYPE_NODE]
#define long_type_node \
java_global_trees[JTI_LONG_TYPE_NODE]
extern tree unsigned_byte_type_node;
extern tree unsigned_short_type_node;
extern tree unsigned_int_type_node;
extern tree unsigned_long_type_node;
#define unsigned_byte_type_node \
java_global_trees[JTI_UNSIGNED_BYTE_TYPE_NODE]
#define unsigned_short_type_node \
java_global_trees[JTI_UNSIGNED_SHORT_TYPE_NODE]
#define unsigned_int_type_node \
java_global_trees[JTI_UNSIGNED_INT_TYPE_NODE]
#define unsigned_long_type_node \
java_global_trees[JTI_UNSIGNED_LONG_TYPE_NODE]
extern tree boolean_type_node;
#define boolean_type_node \
java_global_trees[JTI_BOOLEAN_TYPE_NODE]
extern tree object_type_node;
extern tree unqualified_object_id_node;
extern tree object_ptr_type_node;
extern tree string_type_node;
extern tree string_ptr_type_node;
extern tree throwable_type_node;
extern tree runtime_exception_type_node;
extern tree error_exception_type_node;
extern tree rawdata_ptr_type_node;
#define object_type_node \
java_global_trees[JTI_OBJECT_TYPE_NODE]
#define unqualified_object_id_node \
java_global_trees[JTI_UNQUALIFIED_OBJECT_ID_NODE]
#define object_ptr_type_node \
java_global_trees[JTI_OBJECT_PTR_TYPE_NODE]
#define string_type_node \
java_global_trees[JTI_STRING_TYPE_NODE]
#define string_ptr_type_node \
java_global_trees[JTI_STRING_PTR_TYPE_NODE]
#define throwable_type_node \
java_global_trees[JTI_THROWABLE_TYPE_NODE]
#define runtime_exception_type_node \
java_global_trees[JTI_RUNTIME_EXCEPTION_TYPE_NODE]
#define error_exception_type_node \
java_global_trees[JTI_ERROR_EXCEPTION_TYPE_NODE]
#define rawdata_ptr_type_node \
java_global_trees[JTI_RAWDATA_PTR_TYPE_NODE]
extern tree *predef_filenames;
extern int predef_filenames_size;
extern tree byte_array_type_node;
extern tree short_array_type_node;
extern tree int_array_type_node;
extern tree long_array_type_node;
extern tree boolean_array_type_node;
extern tree char_array_type_node;
extern tree double_array_type_node;
extern tree float_array_type_node;
extern tree array_array_type_node;
extern tree object_array_type_node;
extern tree string_array_type_node;
extern tree boolean_array_vtable;
extern tree byte_array_vtable;
extern tree char_array_vtable;
extern tree short_array_vtable;
extern tree int_array_vtable;
extern tree long_array_vtable;
extern tree float_array_vtable;
extern tree double_array_vtable;
extern tree TYPE_identifier_node; /* "TYPE" */
extern tree init_identifier_node; /* "<init>" */
extern tree clinit_identifier_node; /* "<clinit>" */
extern tree finit_identifier_node; /* "finit$" */
extern tree finit_leg_identifier_node; /* "$finit$" */
extern tree void_signature_node; /* "()V" */
extern tree length_identifier_node; /* "length" */
extern tree this_identifier_node; /* "this" */
extern tree super_identifier_node; /* "super" */
extern tree continue_identifier_node; /* "continue" */
extern tree access0_identifier_node; /* "access$0" */
extern tree one_elt_array_domain_type;
#define byte_array_type_node \
java_global_trees[JTI_BYTE_ARRAY_TYPE_NODE]
#define short_array_type_node \
java_global_trees[JTI_SHORT_ARRAY_TYPE_NODE]
#define int_array_type_node \
java_global_trees[JTI_INT_ARRAY_TYPE_NODE]
#define long_array_type_node \
java_global_trees[JTI_LONG_ARRAY_TYPE_NODE]
#define boolean_array_type_node \
java_global_trees[JTI_BOOLEAN_ARRAY_TYPE_NODE]
#define char_array_type_node \
java_global_trees[JTI_CHAR_ARRAY_TYPE_NODE]
#define double_array_type_node \
java_global_trees[JTI_DOUBLE_ARRAY_TYPE_NODE]
#define float_array_type_node \
java_global_trees[JTI_FLOAT_ARRAY_TYPE_NODE]
#define array_array_type_node \
java_global_trees[JTI_ARRAY_ARRAY_TYPE_NODE]
#define object_array_type_node \
java_global_trees[JTI_OBJECT_ARRAY_TYPE_NODE]
#define string_array_type_node \
java_global_trees[JTI_STRING_ARRAY_TYPE_NODE]
#define boolean_array_vtable \
java_global_trees[JTI_BOOLEAN_ARRAY_VTABLE]
#define byte_array_vtable \
java_global_trees[JTI_BYTE_ARRAY_VTABLE]
#define char_array_vtable \
java_global_trees[JTI_CHAR_ARRAY_VTABLE]
#define short_array_vtable \
java_global_trees[JTI_SHORT_ARRAY_VTABLE]
#define int_array_vtable \
java_global_trees[JTI_INT_ARRAY_VTABLE]
#define long_array_vtable \
java_global_trees[JTI_LONG_ARRAY_VTABLE]
#define float_array_vtable \
java_global_trees[JTI_FLOAT_ARRAY_VTABLE]
#define double_array_vtable \
java_global_trees[JTI_DOUBLE_ARRAY_VTABLE]
#define TYPE_identifier_node \
java_global_trees[JTI_TYPE_IDENTIFIER_NODE] /* "TYPE" */
#define init_identifier_node \
java_global_trees[JTI_INIT_IDENTIFIER_NODE] /* "<init>" */
#define clinit_identifier_node \
java_global_trees[JTI_CLINIT_IDENTIFIER_NODE] /* "<clinit>" */
#define finit_identifier_node \
java_global_trees[JTI_FINIT_IDENTIFIER_NODE] /* "finit$" */
#define finit_leg_identifier_node \
java_global_trees[JTI_FINIT_LEG_IDENTIFIER_NODE] /* "$finit$" */
#define void_signature_node \
java_global_trees[JTI_VOID_SIGNATURE_NODE] /* "()V" */
#define length_identifier_node \
java_global_trees[JTI_LENGTH_IDENTIFIER_NODE] /* "length" */
#define this_identifier_node \
java_global_trees[JTI_THIS_IDENTIFIER_NODE] /* "this" */
#define super_identifier_node \
java_global_trees[JTI_SUPER_IDENTIFIER_NODE] /* "super" */
#define continue_identifier_node \
java_global_trees[JTI_CONTINUE_IDENTIFIER_NODE] /* "continue" */
#define access0_identifier_node \
java_global_trees[JTI_ACCESS0_IDENTIFIER_NODE] /* "access$0" */
#define one_elt_array_domain_type \
java_global_trees[JTI_ONE_ELT_ARRAY_DOMAIN_TYPE]
/* The type of the return address of a subroutine. */
extern tree return_address_type_node;
#define return_address_type_node \
java_global_trees[JTI_RETURN_ADDRESS_TYPE_NODE]
/* Nodes for boolean constants TRUE and FALSE. */
extern tree boolean_true_node, boolean_false_node;
#define boolean_true_node \
java_global_trees[JTI_BOOLEAN_TRUE_NODE]
#define boolean_false_node \
java_global_trees[JTI_BOOLEAN_FALSE_NODE]
/* Integer constants not declared in tree.h. */
extern tree long_zero_node;
extern tree float_zero_node;
extern tree double_zero_node;
extern tree integer_negative_one_node;
extern tree integer_two_node;
extern tree integer_four_node;
extern tree empty_stmt_node;
#define long_zero_node \
java_global_trees[JTI_LONG_ZERO_NODE]
#define float_zero_node \
java_global_trees[JTI_FLOAT_ZERO_NODE]
#define double_zero_node \
java_global_trees[JTI_DOUBLE_ZERO_NODE]
#define integer_negative_one_node \
java_global_trees[JTI_INTEGER_NEGATIVE_ONE_NODE]
#define integer_two_node \
java_global_trees[JTI_INTEGER_TWO_NODE]
#define integer_four_node \
java_global_trees[JTI_INTEGER_FOUR_NODE]
#define empty_stmt_node \
java_global_trees[JTI_EMPTY_STMT_NODE]
/* The type for struct methodtable. */
extern tree methodtable_type;
extern tree methodtable_ptr_type;
#define methodtable_type \
java_global_trees[JTI_METHODTABLE_TYPE]
#define methodtable_ptr_type \
java_global_trees[JTI_METHODTABLE_PTR_TYPE]
extern tree utf8const_type;
extern tree utf8const_ptr_type;
#define utf8const_type \
java_global_trees[JTI_UTF8CONST_TYPE]
#define utf8const_ptr_type \
java_global_trees[JTI_UTF8CONST_PTR_TYPE]
extern tree class_type_node;
extern tree class_ptr_type;
extern tree field_type_node;
extern tree constants_type_node;
extern tree dtable_type, dtable_ptr_type;
extern tree field_ptr_type_node;
extern tree field_info_union_node;
extern tree method_type_node;
extern tree method_ptr_type_node;
#define nativecode_ptr_type_node ptr_type_node
#define class_type_node \
java_global_trees[JTI_CLASS_TYPE_NODE]
#define class_ptr_type \
java_global_trees[JTI_CLASS_PTR_TYPE]
#define field_type_node \
java_global_trees[JTI_FIELD_TYPE_NODE]
#define constants_type_node \
java_global_trees[JTI_CONSTANTS_TYPE_NODE]
#define dtable_type \
java_global_trees[JTI_DTABLE_TYPE]
#define dtable_ptr_type \
java_global_trees[JTI_DTABLE_PTR_TYPE]
#define field_ptr_type_node \
java_global_trees[JTI_FIELD_PTR_TYPE_NODE]
#define field_info_union_node \
java_global_trees[JTI_FIELD_INFO_UNION_NODE]
#define jexception_type \
java_global_trees[JTI_EXCEPTION_TYPE]
#define jexception_ptr_type \
java_global_trees[JTI_EXCEPTION_PTR_TYPE]
#define lineNumberEntry_type \
java_global_trees[JTI_LINENUMBERENTRY_TYPE]
#define lineNumbers_type \
java_global_trees[JTI_LINENUMBERS_TYPE]
#define method_type_node \
java_global_trees[JTI_METHOD_TYPE_NODE]
#define method_ptr_type_node \
java_global_trees[JTI_METHOD_PTR_TYPE_NODE]
extern tree end_params_node;
#define end_params_node \
java_global_trees[JTI_END_PARAMS_NODE]
/* References to internal libjava functions we use. */
extern tree alloc_object_node;
extern tree soft_instanceof_node;
extern tree soft_checkcast_node;
extern tree soft_initclass_node;
extern tree soft_newarray_node;
extern tree soft_anewarray_node;
extern tree soft_multianewarray_node;
extern tree soft_badarrayindex_node;
extern tree soft_nullpointer_node;
#define alloc_object_node \
java_global_trees[JTI_ALLOC_OBJECT_NODE]
#define soft_instanceof_node \
java_global_trees[JTI_SOFT_INSTANCEOF_NODE]
#define soft_checkcast_node \
java_global_trees[JTI_SOFT_CHECKCAST_NODE]
#define soft_initclass_node \
java_global_trees[JTI_SOFT_INITCLASS_NODE]
#define soft_newarray_node \
java_global_trees[JTI_SOFT_NEWARRAY_NODE]
#define soft_anewarray_node \
java_global_trees[JTI_SOFT_ANEWARRAY_NODE]
#define soft_multianewarray_node \
java_global_trees[JTI_SOFT_MULTIANEWARRAY_NODE]
#define soft_badarrayindex_node \
java_global_trees[JTI_SOFT_BADARRAYINDEX_NODE]
#define soft_nullpointer_node \
java_global_trees[JTI_SOFT_NULLPOINTER_NODE]
extern tree throw_node[];
extern tree soft_checkarraystore_node;
extern tree soft_monitorenter_node;
extern tree soft_monitorexit_node;
extern tree soft_lookupinterfacemethod_node;
extern tree soft_lookupjnimethod_node;
extern tree soft_getjnienvnewframe_node;
extern tree soft_jnipopsystemframe_node;
extern tree soft_fmod_node;
extern tree soft_exceptioninfo_call_node;
extern tree soft_idiv_node;
extern tree soft_irem_node;
extern tree soft_ldiv_node;
extern tree soft_lrem_node;
#define soft_checkarraystore_node \
java_global_trees[JTI_SOFT_CHECKARRAYSTORE_NODE]
#define soft_monitorenter_node \
java_global_trees[JTI_SOFT_MONITORENTER_NODE]
#define soft_monitorexit_node \
java_global_trees[JTI_SOFT_MONITOREXIT_NODE]
#define soft_lookupinterfacemethod_node \
java_global_trees[JTI_SOFT_LOOKUPINTERFACEMETHOD_NODE]
#define soft_lookupjnimethod_node \
java_global_trees[JTI_SOFT_LOOKUPJNIMETHOD_NODE]
#define soft_getjnienvnewframe_node \
java_global_trees[JTI_SOFT_GETJNIENVNEWFRAME_NODE]
#define soft_jnipopsystemframe_node \
java_global_trees[JTI_SOFT_JNIPOPSYSTEMFRAME_NODE]
#define soft_fmod_node \
java_global_trees[JTI_SOFT_FMOD_NODE]
#define soft_exceptioninfo_call_node \
java_global_trees[JTI_SOFT_EXCEPTIONINFO_CALL_NODE]
#define soft_idiv_node \
java_global_trees[JTI_SOFT_IDIV_NODE]
#define soft_irem_node \
java_global_trees[JTI_SOFT_IREM_NODE]
#define soft_ldiv_node \
java_global_trees[JTI_SOFT_LDIV_NODE]
#define soft_lrem_node \
java_global_trees[JTI_SOFT_LREM_NODE]
extern tree access_flags_type_node;
#define access_flags_type_node \
java_global_trees[JTI_ACCESS_FLAGS_TYPE_NODE]
extern tree class_dtable_decl;
#define class_dtable_decl \
java_global_trees[JTI_CLASS_DTABLE_DECL]
#define nativecode_ptr_array_type_node \
java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]
#define PREDEF_FILENAMES_SIZE 7
extern tree predef_filenames[PREDEF_FILENAMES_SIZE];
#define nativecode_ptr_type_node ptr_type_node
/* They need to be reset before processing each class */
extern struct CPool *outgoing_cpool;
extern tree current_constant_pool_data_ref;
/* If non-NULL, an ADDR_EXPR referencing a VAR_DECL containing
the constant data array for the current class. */
#define current_constant_pool_data_ref \
java_global_trees[JTI_CURRENT_CONSTANT_POOL_DATA_REF]
extern tree wfl_operator;
#define wfl_operator \
java_global_trees[JTI_WFL_OPERATOR]
extern char *cyclic_inheritance_report;
@ -798,6 +1059,7 @@ extern unsigned long java_hash_hash_tree_node PARAMS ((hash_table_key));
extern boolean java_hash_compare_tree_node PARAMS ((hash_table_key,
hash_table_key));
extern void java_check_methods PARAMS ((tree));
extern void init_jcf_parse PARAMS((void));
/* We use ARGS_SIZE_RTX to indicate that gcc/expr.h has been included
to declare `enum expand_modifier'. */

View File

@ -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);
}

View File

@ -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)));

View File

@ -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)

View File

@ -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 */

View File

@ -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;
/* Register SAVED_THISN and SAVED_TYPE with the garbage collector. */
if (!initialized_p)
{
ggc_add_tree_root (&saved_thisn, 1);
ggc_add_tree_root (&saved_type, 1);
initialized_p = 1;
}
if (type)
{
static tree saved_type = NULL_TREE;
static int saved_type_i = 0;
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;