summaryrefslogtreecommitdiff
path: root/gcc/java/java-tree.h
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-09 17:08:44 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-09 17:08:44 +0000
commit757f6c6c12a8ce0b42a6ac1f27df9c99da15947d (patch)
tree98aa4fb08cdfb195718477b393ddac9e38551240 /gcc/java/java-tree.h
parent843505b2f08e637f8089132b4d8c4aad513f6b8f (diff)
downloadgcc-757f6c6c12a8ce0b42a6ac1f27df9c99da15947d.tar.gz
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755: * parse.y (java_fix_constructors): Set output_class. (java_reorder_fields): Likewise. (java_layout_classes): Likewise. (java_expand_classes): Generate indirect dispatch tables. (java_expand_classes): Set output_class. (java_finish_classes): Likewise. * lang.c (java_init): Turn on always_initialize_class_p if we're using indirect dis[atch. (java_decl_ok_for_sibcall): Use output_class, not current_class. (java_get_callee_fndecl): Use class local atable. * jcf-parse.c (always_initialize_class_p): Decl moved to java-tree.h. (HANDLE_CLASS_INFO): Set output_class. (read_class): Likewise. (parse_class_file): Call gen_indirect_dispatch_tables. (parse_zip_file_entries): Set output_class. (java_parse_file): Set output_class. Don't emit symbol tables. * java-tree.h (output_class): New. Remove global declarations for otable, atable, and ctable. (always_initialize_class_p): moved here from decl.c. (DECL_OWNER): New. (TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL, TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL, TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New. (struct lang_type): Add otable_methods, otable_decl, otable_syms_decl, atable_methods, atable_decl, atable_syms_decl, ctable_decl, catch_classes, type_to_runtime_map. * expr.c (build_field_ref): Make otable, atable, and ctable class local rather than global. (build_known_method_ref): Likewise. (build_invokeinterface): Likewise. (java_expand_expr): Pass runtime type (rather than actual type) to expand_start_catch. * except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for this class. Look up each class in that map to delete duplicates. (expand_end_java_handler): Pass runtime type (rather than actual type) to expand_start_catch. * decl.c: (always_initialize_class_p): Decl moved to java-tree.h. (do_nothing): New. (java_init_decl_processing): Rearrange things. Remove global declarations of otable, atable, and ctable. (java_init_decl_processing): Make lang_eh_runtime_type do_nothing. (java_expand_body): Set output_class. * constants.c (build_constant_data_ref): Use output_class, not current_class. (alloc_name_constant): Likewise. * class.c (gen_indirect_dispatch_tables): New. (build_class_ref): Generate hard reference to superclass, even if using indirect dispatch. (build_static_field_ref): Use class local atable. (make_class_data): Generate hard reference to superclass, even if using indirect dispatch. Generate symbolic references to interfaces when using indirect dispatch. (make_class_data): Emit otable, atable, and ctable. Make otable, atable, and ctable class local rather than global. (emit_catch_table): Make otable, atable, and ctable class local rather than global. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/java-tree.h')
-rw-r--r--gcc/java/java-tree.h78
1 files changed, 50 insertions, 28 deletions
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 88be2a03441..7da5055ad6c 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
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GCC.
@@ -134,10 +134,17 @@ extern int compiling_from_source;
#define main_class \
java_global_trees[JTI_MAIN_CLASS]
-/* The class we are currently processing. */
+/* The class we use as the base for name resolution. It's usually the
+ class we're generating code for but sometimes it points to an inner
+ class. If you really want to know the class we're currently
+ generating code for, use output_class instead. */
#define current_class \
java_global_trees[JTI_CURRENT_CLASS]
+/* The class we are currently generating. Really. */
+#define output_class \
+ java_global_trees[JTI_OUTPUT_CLASS]
+
/* List of all class DECLs seen so far. */
#define all_class_list \
java_global_trees[JTI_ALL_CLASS_LIST]
@@ -147,27 +154,13 @@ extern int compiling_from_source;
/* List of virtual decls referred to by this translation unit, used to
generate virtual method offset symbol table. */
-#define otable_methods java_global_trees [JTI_OTABLE_METHODS]
-/* List of static decls referred to by this translation unit, used to
- generate virtual method offset symbol table. */
-#define atable_methods java_global_trees [JTI_ATABLE_METHODS]
/* The virtual offset table. This is emitted as uninitialized data of
the required length, and filled out at run time during class
linking. */
-#define otable_decl java_global_trees [JTI_OTABLE_DECL]
-/* The static address table. */
-#define atable_decl java_global_trees [JTI_ATABLE_DECL]
/* The virtual offset symbol table. Used by the runtime to fill out
the otable. */
-#define otable_syms_decl java_global_trees [JTI_OTABLE_SYMS_DECL]
-/* The static symbol table. Used by the runtime to fill out the
- otable. */
-#define atable_syms_decl java_global_trees [JTI_ATABLE_SYMS_DECL]
-
-#define ctable_decl java_global_trees [JTI_CTABLE_DECL]
-#define catch_classes java_global_trees [JTI_CATCH_CLASSES]
extern int flag_emit_class_files;
@@ -244,6 +237,10 @@ extern const char *current_encoding;
/* The Java .class file that provides main_class; the main input file. */
extern GTY(()) struct JCF * current_jcf;
+/* Set to nonzero value in order to emit class initialization code
+ before static field references. */
+extern int always_initialize_class_p;
+
typedef struct CPool constant_pool;
#define CONSTANT_ResolvedFlag 16
@@ -413,20 +410,10 @@ enum java_tree_index
JTI_MAIN_CLASS,
JTI_CURRENT_CLASS,
+ JTI_OUTPUT_CLASS,
JTI_ALL_CLASS_LIST,
JTI_ALL_CLASS_FILENAME,
- JTI_OTABLE_METHODS,
- JTI_OTABLE_DECL,
- JTI_OTABLE_SYMS_DECL,
-
- JTI_ATABLE_METHODS,
- JTI_ATABLE_DECL,
- JTI_ATABLE_SYMS_DECL,
-
- JTI_CTABLE_DECL,
- JTI_CATCH_CLASSES,
-
JTI_PREDEF_FILENAMES,
JTI_MAX
@@ -923,6 +910,9 @@ union lang_tree_node
/* The original WFL of a final variable. */
#define DECL_FIELD_FINAL_WFL(NODE) \
(DECL_LANG_SPECIFIC(NODE)->u.v.wfl)
+/* The class that's the owner of a dynamic binding table. */
+#define DECL_OWNER(NODE) \
+ (DECL_LANG_SPECIFIC(NODE)->u.v.owner)
/* True if NODE is a local variable final. */
#define LOCAL_FINAL_P(NODE) (DECL_LANG_SPECIFIC (NODE) && DECL_FINAL (NODE))
/* True if NODE is a final field. */
@@ -1022,6 +1012,7 @@ struct lang_decl_var GTY(())
tree slot_chain;
tree am; /* Access method for this field (1.1) */
tree wfl; /* Original wfl */
+ tree owner;
unsigned int final_iud : 1; /* Final initialized upon declaration */
unsigned int cif : 1; /* True: decl is a class initialization flag */
unsigned int freed; /* Decl is no longer in scope. */
@@ -1070,6 +1061,19 @@ struct lang_decl GTY(())
#define TYPE_STRICTFP(T) (TYPE_LANG_SPECIFIC(T)->strictfp)
#define TYPE_USES_ASSERTIONS(T) (TYPE_LANG_SPECIFIC(T)->assertions)
+#define TYPE_ATABLE_METHODS(T) (TYPE_LANG_SPECIFIC(T)->atable_methods)
+#define TYPE_ATABLE_SYMS_DECL(T) (TYPE_LANG_SPECIFIC(T)->atable_syms_decl)
+#define TYPE_ATABLE_DECL(T) (TYPE_LANG_SPECIFIC(T)->atable_decl)
+
+#define TYPE_OTABLE_METHODS(T) (TYPE_LANG_SPECIFIC(T)->otable_methods)
+#define TYPE_OTABLE_SYMS_DECL(T) (TYPE_LANG_SPECIFIC(T)->otable_syms_decl)
+#define TYPE_OTABLE_DECL(T) (TYPE_LANG_SPECIFIC(T)->otable_decl)
+
+#define TYPE_CTABLE_DECL(T) (TYPE_LANG_SPECIFIC(T)->ctable_decl)
+#define TYPE_CATCH_CLASSES(T) (TYPE_LANG_SPECIFIC(T)->catch_classes)
+
+#define TYPE_TO_RUNTIME_MAP(T) (TYPE_LANG_SPECIFIC(T)->type_to_runtime_map)
+
struct lang_type GTY(())
{
tree signature;
@@ -1086,6 +1090,21 @@ struct lang_type GTY(())
tree package_list; /* List of package names, progressive */
tree import_list; /* Imported types, in the CU of this class */
tree import_demand_list; /* Imported types, in the CU of this class */
+
+ tree otable_methods; /* List of static decls referred to by this class. */
+ tree otable_decl; /* The static address table. */
+ tree otable_syms_decl;
+
+ tree atable_methods; /* List of static decls referred to by this class. */
+ tree atable_decl; /* The static address table. */
+ tree atable_syms_decl;
+
+ tree ctable_decl; /* The table of classes for the runtime type matcher. */
+ tree catch_classes;
+
+ htab_t GTY ((param_is (struct treetreehash_entry))) type_to_runtime_map;
+ /* The mapping of classes to exception region markers. */
+
unsigned pic:1; /* Private Inner Class. */
unsigned poic:1; /* Protected Inner Class. */
unsigned strictfp:1; /* `strictfp' class. */
@@ -1200,6 +1219,7 @@ extern tree build_instanceof (tree, tree);
extern tree create_label_decl (tree);
extern void push_labeled_block (tree);
extern tree prepare_eh_table_type (tree);
+extern void java_expand_catch_classes (tree);
extern tree build_exception_object_ref (tree);
extern tree generate_name (void);
extern void pop_labeled_block (void);
@@ -1322,7 +1342,9 @@ extern void java_expand_body (tree);
extern int get_symbol_table_index (tree, tree *);
extern tree make_catch_class_record (tree, tree);
-extern void emit_catch_table (void);
+extern tree emit_catch_table (tree);
+
+extern void gen_indirect_dispatch_tables (tree type);
#define DECL_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)