OSDN Git Service

Do not rewrite out of SSA scalar dependences crossing the limits of the scop.
[pf3gnuchains/gcc-fork.git] / gcc / java / java-tree.h
index ab3ff47..3addcca 100644 (file)
@@ -1,13 +1,13 @@
 /* Definitions for parsing and type checking for the GNU compiler for
    the Java(TM) language.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GCC is distributed in the hope that it will be useful,
@@ -16,9 +16,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  
 
 Java and all Java-based marks are trademarks or registered trademarks
 of Sun Microsystems, Inc. in the United States and other countries.
@@ -31,15 +30,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 
 #include "hashtab.h"
 
-/* Java language-specific tree codes.  */
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
-enum java_tree_code {
-  __DUMMY = LAST_AND_UNUSED_TREE_CODE,
-#include "java-tree.def"
-  LAST_JAVA_TREE_CODE
-};
-#undef DEFTREECODE
-
 struct JCF;
 
 /* Usage of TREE_LANG_FLAG_?:
@@ -49,12 +39,10 @@ struct JCF;
    4: IS_A_COMMAND_LINE_FILENAME_P (in IDENTIFIER_NODE)
       IS_ARRAY_LENGTH_ACCESS (in INDIRECT_REF)
    5: HAS_BEEN_ALREADY_PARSED_P (in IDENTIFIER_NODE)
-   6: CAN_COMPLETE_NORMALLY (in statement nodes)
 
    Usage of TYPE_LANG_FLAG_?:
    1: TYPE_ARRAY_P (in RECORD_TYPE).
    2: CLASS_PARSED_P (in RECORD_TYPE).
-   3: CLASS_FROM_SOURCE_P (in RECORD_TYPE).
    4: CLASS_P (in RECORD_TYPE).
    5: CLASS_FROM_CURRENTLY_COMPILED_P (in RECORD_TYPE)
    6: CLASS_BEING_LAIDOUT (in RECORD_TYPE)
@@ -81,11 +69,8 @@ struct JCF;
       CLASS_ABSTRACT (in TYPE_DECL)
       FIELD_TRANSIENT (in FIELD_DECL)
    6: CLASS_SUPER (in TYPE_DECL, ACC_SUPER flag)
-      FIELD_LOCAL_ALIAS (in FIELD_DECL)
    7: DECL_CONSTRUCTOR_P (in FUNCTION_DECL).
       CLASS_STATIC (in TYPE_DECL)
-      FIELD_LOCAL_ALIAS_USED (in FIELD_DECL)
-      FIELD_THISN (in FIELD_DECL)
 */
 
 #define VAR_OR_FIELD_CHECK(DECL) \
@@ -117,10 +102,6 @@ struct JCF;
 #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]
-
 /* List of virtual decls referred to by this translation unit, used to
    generate virtual method offset symbol table.  */
 
@@ -131,61 +112,11 @@ struct JCF;
 /* The virtual offset symbol table. Used by the runtime to fill out
    the otable. */
 
-extern int flag_filelist_file;
-
-/* When nonzero, permit the use of the assert keyword.  */
-
-extern int flag_assert;
-
-/* When nonzero, assume all native functions are implemented with
-   JNI, not CNI.  */
-
-extern int flag_jni;
-
-/* When nonzero, always check for a non gcj generated classes archive.  */
-
-extern int flag_force_classes_archive_check;
-
 /* Resource name.  */
 extern const char *resource_name;
 
 /* Turned to 1 if -Wall was encountered. See lang.c for their meanings.  */
 extern int flag_wall;
-extern int flag_redundant;
-
-/* When nonzero, warn when source file is newer than matching class
-   file.  */
-extern int flag_newer;
-
-/* When nonzero, call a library routine to do integer divisions. */
-extern int flag_use_divide_subroutine;
-
-/* When nonzero, generate code for the Boehm GC.  */
-extern int flag_use_boehm_gc;
-
-/* When nonzero, assume the runtime uses a hash table to map an
-   object to its synchronization structure.  */
-extern int flag_hash_synchronization;
-
-/* When nonzero, generate checks for references to NULL.  */
-extern int flag_check_references;
-
-/* Used through STATIC_CLASS_INIT_OPT_P to check whether static
-   initialization optimization should be performed.  */
-extern int flag_optimize_sci;
-
-/* Generate instances of Class at runtime.  */
-extern int flag_indirect_classes;
-
-/* When nonzero, use offset tables for virtual method calls
-   in order to improve binary compatibility. */
-extern int flag_indirect_dispatch;
-
-/* When zero, don't generate runtime array store checks. */
-extern int flag_store_check;
-
-/* When nonzero, generate only a limited set of class meta-data. */
-extern int flag_reduced_reflection;
 
 /* The Java .class file that provides main_class;  the main input file. */
 extern GTY(()) struct JCF * current_jcf;
@@ -303,7 +234,6 @@ enum java_tree_index
   JTI_VOID_SIGNATURE_NODE,       
   JTI_FINALIZE_IDENTIFIER_NODE,
   JTI_THIS_IDENTIFIER_NODE,  
-  JTI_CLASSDOLLAR_IDENTIFIER_NODE,
   JTI_ONE_ELT_ARRAY_DOMAIN_TYPE,
 
   JTI_RETURN_ADDRESS_TYPE_NODE,
@@ -383,9 +313,6 @@ enum java_tree_index
   JTI_MAIN_CLASS,
   JTI_CURRENT_CLASS,
   JTI_OUTPUT_CLASS,
-  JTI_ALL_CLASS_LIST,
-
-  JTI_PREDEF_FILENAMES,
 
   JTI_MAX
 };
@@ -498,8 +425,6 @@ extern GTY(()) tree java_global_trees[JTI_MAX];
   java_global_trees[JTI_FINALIZE_IDENTIFIER_NODE]  /* "finalize" */
 #define this_identifier_node \
   java_global_trees[JTI_THIS_IDENTIFIER_NODE]  /* "this" */
-#define classdollar_identifier_node \
-  java_global_trees[JTI_CLASSDOLLAR_IDENTIFIER_NODE] /* "class$" */
 #define one_elt_array_domain_type \
   java_global_trees[JTI_ONE_ELT_ARRAY_DOMAIN_TYPE]
 /* The type of the return address of a subroutine. */
@@ -645,16 +570,12 @@ extern GTY(()) tree java_global_trees[JTI_MAX];
 #define nativecode_ptr_array_type_node \
   java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]
 
-#define predef_filenames \
-  java_global_trees[JTI_PREDEF_FILENAMES]
-
 #define nativecode_ptr_type_node ptr_type_node
 
 /* The decl for "_Jv_ResolvePoolEntry".  */
 extern GTY(()) tree soft_resolvepoolentry_node;
 
-struct lang_identifier GTY(())
-{
+struct GTY(()) lang_identifier {
   struct tree_identifier ignore;
   tree global_value;
   tree local_value;
@@ -665,11 +586,10 @@ struct lang_identifier GTY(())
 };
 
 /* The resulting tree type.  */
-union lang_tree_node 
-  GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
-       chain_next ("(GIMPLE_STMT_P (&%h.generic) ? (union lang_tree_node *) 0 : (union lang_tree_node *)TREE_CHAIN (&%h.generic))")))
-
-{
+union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
+       chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+  lang_tree_node {
   union tree_node GTY ((tag ("0"), 
                        desc ("tree_node_structure (&%h)"))) 
     generic;
@@ -731,19 +651,14 @@ union lang_tree_node
 /* List of checked thrown exceptions, as specified with the `throws'
    keyword */
 #define DECL_FUNCTION_THROWS(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.throws_list)
-/* Pointer to the function's current's COMPOUND_EXPR tree (while
-   completing its body) or the function's block */
-#define DECL_FUNCTION_BODY(DECL) \
-  (DECL_LANG_SPECIFIC(DECL)->u.f.function_decl_body)
+/* VAR_DECL containing the caught exception object.  */
+#define DECL_FUNCTION_EXC_OBJ(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.exc_obj)
 /* For each function decl, init_test_table contains a hash table whose
    entries are keyed on class names, and whose values are local
    boolean decls.  The variables are intended to be TRUE when the
    class has been initialized in this function, and FALSE otherwise.  */
 #define DECL_FUNCTION_INIT_TEST_TABLE(DECL) \
   (DECL_LANG_SPECIFIC(DECL)->u.f.init_test_table)
-/* If LOCAL_CLASS_INITIALIZATION_FLAG_P(decl), give class it initializes. */
-#define DECL_FUNCTION_INIT_TEST_CLASS(DECL) \
-  (DECL_LANG_SPECIFIC(DECL)->u.v.slot_chain)
 /* For each static function decl, itc contains a hash table whose
    entries are keyed on class named that are definitively initialized
    in DECL.  */
@@ -753,35 +668,9 @@ union lang_tree_node
 #define DECL_LOCAL_CNI_METHOD_P(NODE) \
     (DECL_LANG_SPECIFIC (NODE)->u.f.local_cni)
 
-/* A constructor that calls this. */
-#define DECL_INIT_CALLS_THIS(DECL) \
-  (DECL_LANG_SPECIFIC(DECL)->u.f.init_calls_this)
-
 /* True when DECL (a field) is Synthetic.  */
 #define FIELD_SYNTHETIC(DECL) DECL_LANG_FLAG_2 (VAR_OR_FIELD_CHECK (DECL))
 
-/* True when DECL aliases an outer context local variable.  */
-#define FIELD_LOCAL_ALIAS(DECL) DECL_LANG_FLAG_6 (VAR_OR_FIELD_CHECK (DECL))
-
-/* True when DECL, which aliases an outer context local variable is
-   used by the inner classes.  */
-#define FIELD_LOCAL_ALIAS_USED(DECL) DECL_LANG_FLAG_7 (VAR_OR_FIELD_CHECK (DECL))
-
-/* True when DECL is a this$<n> field. Note that
-   FIELD_LOCAL_ALIAS_USED can be differentiated when tested against
-   FIELD_LOCAL_ALIAS.  */
-#define FIELD_THISN(DECL) DECL_LANG_FLAG_7 (VAR_OR_FIELD_CHECK (DECL))
-
-/* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
-#define LABEL_TYPE_STATE(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_1)
-
-/* In a LABEL_DECL, the corresponding bytecode program counter. */
-#define LABEL_PC(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_4)
-
-/* In a LABEL_DECL, true if we have verified instructions starting here. */
-#define LABEL_VERIFIED(NODE) \
-  (instruction_bits[LABEL_PC (NODE)] & BCODE_VERIFIED)
-
 /* The slot number for this local variable. */
 #define DECL_LOCAL_SLOT_NUMBER(NODE) \
   (DECL_LANG_SPECIFIC (NODE)->u.v.slot_number)
@@ -792,35 +681,10 @@ union lang_tree_node
 /* For a VAR_DECL or PARM_DECL, used to chain decls with the same
    slot_number in decl_map. */
 #define DECL_LOCAL_SLOT_CHAIN(NODE) (DECL_LANG_SPECIFIC(NODE)->u.v.slot_chain)
-/* For a FIELD_DECL, holds the name of the access method. Used to
-   read/write the content of the field across nested class boundaries.  */
-#define FIELD_NESTED_ACCESS(DECL) \
-  (DECL_LANG_SPECIFIC (VAR_OR_FIELD_CHECK (DECL))->u.v.am)
-/* Safely tests whether FIELD_NESTED_ACCESS exists or not.  */
-#define FIELD_NESTED_ACCESS_P(DECL) \
-  DECL_LANG_SPECIFIC (DECL) && FIELD_NESTED_ACCESS (DECL)
-/* True if a final field was initialized upon its declaration
-   or in an initializer.  Set after definite assignment.  */
-#define DECL_FIELD_FINAL_IUD(NODE)  (DECL_LANG_SPECIFIC (NODE)->u.v.final_iud)
 /* 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 a final local variable was initialized upon its declaration.  */
-#define DECL_LOCAL_FINAL_IUD(NODE)  (DECL_LANG_SPECIFIC (NODE)->u.v.final_iud)
-/* True if NODE is a final field. */
-#define FINAL_VARIABLE_P(NODE) (FIELD_FINAL (NODE) && !FIELD_STATIC (NODE))
 /* True if NODE is a class final field. */
 #define FIELD_ENUM(DECL)           (DECL_LANG_SPECIFIC (DECL)->u.v.field_enum)
-#define CLASS_FINAL_VARIABLE_P(NODE) \
-  (FIELD_FINAL (NODE) && FIELD_STATIC (NODE))
-/* True if NODE is a class initialization flag. This macro accesses
-   the flag to read or set it.  */
-#define LOCAL_CLASS_INITIALIZATION_FLAG(NODE) \
-    (DECL_LANG_SPECIFIC (NODE)->u.v.cif)
-/* True if NODE is a class initialization flag. */
-#define LOCAL_CLASS_INITIALIZATION_FLAG_P(NODE) \
-    (DECL_LANG_SPECIFIC (NODE) && LOCAL_CLASS_INITIALIZATION_FLAG(NODE))
 /* True if NODE is a variable that is out of scope.  */
 #define LOCAL_VAR_OUT_OF_SCOPE_P(NODE) \
     (DECL_LANG_SPECIFIC (NODE)->u.v.freed)
@@ -833,12 +697,12 @@ union lang_tree_node
     (DECL_LANG_SPECIFIC (NODE)->u.v.vtable)
 
 /* Create a DECL_LANG_SPECIFIC if necessary. */
-#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T)                 \
-  if (DECL_LANG_SPECIFIC (T) == NULL)                          \
-    {                                                          \
-      DECL_LANG_SPECIFIC ((T))                                 \
-       = ggc_alloc_cleared (sizeof (struct lang_decl));        \
-      DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR;            \
+#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T)                       \
+  if (DECL_LANG_SPECIFIC (T) == NULL)                                \
+    {                                                                \
+      DECL_LANG_SPECIFIC ((T))                                       \
+        = ggc_alloc_cleared_lang_decl (sizeof (struct lang_decl));   \
+      DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR;                  \
     }
 
 /* A ConstantExpression, after folding and name resolution. */
@@ -848,15 +712,8 @@ union lang_tree_node
        && TREE_CODE (TREE_TYPE (NODE)) != POINTER_TYPE) \
    || TREE_CODE (NODE) == REAL_CST)
 
-/* For a local VAR_DECL or PARM_DECL, holds the index into a words bitstring
-   that specifies if this decl is definitively assigned.
-   The value -1 means the variable has been definitely assigned (and not
-   definitely unassigned).  The value -2 means we already reported an error. */
-#define DECL_BIT_INDEX(DECL) VAR_OR_FIELD_CHECK (DECL)->decl_common.pointer_alias_set
-
 /* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
-struct lang_decl_func GTY(())
-{
+struct GTY(()) lang_decl_func {
   /*  tree chain; not yet used. */
   long code_offset;
   int code_length;
@@ -866,11 +723,9 @@ struct lang_decl_func GTY(())
   int max_locals;
   int max_stack;
   int arg_slot_count;
-  /* A temporary lie for the sake of ggc.  Actually, last_line is
-     only a source_location if USE_MAPPED_LOCATION.  FIXME.  */
   source_location last_line;   /* End line number for a function decl */
-  tree throws_list;            /* Exception specified by `throws' */
-  tree function_decl_body;     /* Hold all function's statements */
+  VEC(tree,gc) *throws_list;   /* Exception specified by `throws' */
+  tree exc_obj;                        /* Decl holding the exception object.  */
 
   /* Class initialization test variables  */
   htab_t GTY ((param_is (struct treetreehash_entry))) init_test_table;
@@ -879,8 +734,6 @@ struct lang_decl_func GTY(())
   htab_t GTY ((param_is (union tree_node))) ict;
 
   unsigned int native : 1;     /* Nonzero if this is a native method  */
-  unsigned int init_final : 1; /* Nonzero all finals are initialized */
-  unsigned int init_calls_this : 1;
   unsigned int strictfp : 1;
   unsigned int invisible : 1;  /* Set for methods we generate
                                   internally but which shouldn't be
@@ -891,8 +744,7 @@ struct lang_decl_func GTY(())
   unsigned int varargs : 1;    /* Varargs method.  */
 };
 
-struct treetreehash_entry GTY(())
-{
+struct GTY(()) treetreehash_entry {
   tree key;
   tree value;
 };
@@ -928,8 +780,7 @@ typedef enum
   JV_ANNOTATION_DEFAULT_KIND
 } jv_attr_kind;
 
-typedef struct type_assertion GTY(())
-{
+typedef struct GTY(()) type_assertion {
   int assertion_code; /* 'opcode' for the type of this assertion. */
   tree op1;           /* First operand. */
   tree op2;           /* Second operand. */
@@ -937,20 +788,16 @@ typedef struct type_assertion GTY(())
 
 extern tree java_treetreehash_find (htab_t, tree);
 extern tree * java_treetreehash_new (htab_t, tree);
-extern htab_t java_treetreehash_create (size_t size, int ggc);
+extern htab_t java_treetreehash_create (size_t size);
 
 /* DECL_LANG_SPECIFIC for VAR_DECL, PARM_DECL and sometimes FIELD_DECL
    (access methods on outer class fields) and final fields. */
-struct lang_decl_var GTY(())
-{
+struct GTY(()) lang_decl_var {
   int slot_number;
   int start_pc;
   int end_pc;
   tree slot_chain;
-  tree am;                     /* Access method for this field (1.1) */
   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 : 1;              /* Decl is no longer in scope.  */
   unsigned int local_slot : 1; /* Decl is a temporary in the stack frame.  */
   unsigned int class_field : 1; /* Decl needs mangle_class_field.  */
@@ -962,8 +809,7 @@ struct lang_decl_var GTY(())
 
 enum lang_decl_desc {LANG_DECL_FUNC, LANG_DECL_VAR};
 
-struct lang_decl GTY(())
-{
+struct GTY((variable_size)) lang_decl {
   enum lang_decl_desc desc;
   union lang_decl_u
     {
@@ -981,14 +827,10 @@ struct lang_decl GTY(())
 #define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \
   if (TYPE_LANG_SPECIFIC ((T)) == NULL)                \
      TYPE_LANG_SPECIFIC ((T))                  \
-     = ggc_alloc_cleared (sizeof (struct lang_type));
+       = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
 
 #define TYPE_DUMMY(T)          (TYPE_LANG_SPECIFIC(T)->dummy_class)
 
-/* The decl of the synthetic method `class$' used to handle `.class'
-   for non primitive types when compiling to bytecode. */
-
-#define TYPE_DOT_CLASS(T)        (TYPE_LANG_SPECIFIC (T)->dot_class)
 #define TYPE_PACKAGE_LIST(T)     (TYPE_LANG_SPECIFIC (T)->package_list)
 #define TYPE_PRIVATE_INNER_CLASS(T) (TYPE_LANG_SPECIFIC (T)->pic)
 #define TYPE_PROTECTED_INNER_CLASS(T) (TYPE_LANG_SPECIFIC (T)->poic)
@@ -1013,7 +855,6 @@ struct lang_decl GTY(())
 
 #define TYPE_CTABLE_DECL(T)      (TYPE_LANG_SPECIFIC (T)->ctable_decl)
 #define TYPE_CATCH_CLASSES(T)    (TYPE_LANG_SPECIFIC (T)->catch_classes)
-#define TYPE_VERIFY_METHOD(T)    (TYPE_LANG_SPECIFIC (T)->verify_method)
 
 #define TYPE_TO_RUNTIME_MAP(T)   (TYPE_LANG_SPECIFIC (T)->type_to_runtime_map)
 #define TYPE_ASSERTIONS(T)      (TYPE_LANG_SPECIFIC (T)->type_assertions)
@@ -1023,39 +864,42 @@ struct lang_decl GTY(())
 #define TYPE_REFLECTION_DATASIZE(T)                                    \
                                (TYPE_LANG_SPECIFIC (T)->reflection_datasize)
 
-struct lang_type GTY(())
-{
+typedef struct GTY(()) method_entry_d {
+  tree method;
+  tree special;
+} method_entry;
+
+DEF_VEC_O(method_entry);
+DEF_VEC_ALLOC_O(method_entry,gc);
+
+/* FIXME: the variable_size annotation here is needed because these types are
+   variable-sized in some other frontends.  Due to gengtype deficiency the GTY
+   options of such types have to agree across all frontends. */
+struct GTY((variable_size)) lang_type {
   tree signature;
   struct JCF *jcf;
   struct CPool *cpool;
   tree cpool_data_ref;         /* Cached */
-  tree dot_class;              /* The decl of the `class$' function that
-                                  needs to be invoked and generated when
-                                  compiling to bytecode to implement
-                                  <non_primitive_type>.class */
   tree package_list;           /* List of package names, progressive */
 
-  tree otable_methods;          /* List of static decls referred to by this
-                                  class.  */
+  VEC(method_entry,gc) *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.  */
+  VEC(method_entry,gc) *atable_methods; /* List of abstract methods
+                                          referred to by this class.  */
   tree atable_decl;            /* The static address table.  */
   tree atable_syms_decl;
 
-  tree itable_methods;          /* List of interfaces methods referred
-                                  to by this class.  */
+  VEC(method_entry,gc) *itable_methods; /* List of interface methods
+                                          referred to by this class.  */
   tree itable_decl;            /* The interfaces table.  */
   tree itable_syms_decl;
 
   tree ctable_decl;             /* The table of classes for the runtime
                                   type matcher.  */
-  tree catch_classes;
-
-  tree verify_method;          /* The verify method for this class.
-                                  Used in split verification.  */
+  VEC(constructor_elt,gc) *catch_classes;
 
   htab_t GTY ((param_is (struct treetreehash_entry))) type_to_runtime_map;   
                                 /* The mapping of classes to exception region
@@ -1095,13 +939,9 @@ struct lang_type GTY(())
 /* Defined in java-except.h  */
 struct eh_range;
 
-extern void java_parse_file (int);
-extern bool java_mark_addressable (tree);
+extern void java_parse_file (void);
 extern tree java_type_for_mode (enum machine_mode, int);
 extern tree java_type_for_size (unsigned int, int);
-extern tree java_unsigned_type (tree);
-extern tree java_signed_type (tree);
-extern tree java_signed_or_unsigned_type (int, tree);
 extern tree java_truthvalue_conversion (tree);
 extern void add_assume_compiled (const char *, int);
 extern void add_enable_assert (const char *, int);
@@ -1120,6 +960,7 @@ extern tree parse_signature (struct JCF *jcf, int sig_index);
 extern tree add_field (tree, tree, tree, int);
 extern tree add_method (tree, int, tree, tree);
 extern tree add_method_1 (tree, int, tree, tree);
+extern void java_hide_decl (tree);
 extern tree make_class (void);
 extern tree push_class (tree, tree);
 extern tree unmangle_classname (const char *name, int name_length);
@@ -1130,6 +971,7 @@ extern int get_interface_method_index (tree, tree);
 extern tree layout_class_method (tree, tree, tree, tree);
 extern void layout_class_methods (tree);
 extern void cache_this_class_ref (tree);
+extern void uncache_this_class_ref (tree);
 extern tree build_class_ref (tree);
 extern tree build_dtable_decl (tree);
 extern tree build_internal_class_name (tree);
@@ -1145,7 +987,6 @@ extern int global_bindings_p (void);
 extern tree getdecls (void);
 extern void pushlevel (int);
 extern tree poplevel (int,int, int);
-extern void insert_block (tree);
 extern tree pushdecl (tree);
 extern void java_init_decl_processing (void);
 extern void java_dup_lang_specific_decl (tree);
@@ -1174,14 +1015,15 @@ extern tree check_for_builtin (tree, tree);
 extern void initialize_builtins (void);
 
 extern tree lookup_name (tree);
-extern void maybe_rewrite_invocation (tree *, tree *, tree *, tree *);
-extern tree build_known_method_ref (tree, tree, tree, tree, tree, tree);
+extern bool special_method_p (tree);
+extern void maybe_rewrite_invocation (tree *, VEC(tree,gc) **, tree *, tree *);
+extern tree build_known_method_ref (tree, tree, tree, tree, VEC(tree,gc) *, tree);
 extern tree build_class_init (tree, tree);
 extern int attach_init_test_initialization_flags (void **, void *);
 extern tree build_invokevirtual (tree, tree, tree);
 extern tree build_invokeinterface (tree, tree);
 extern tree build_jni_stub (tree);
-extern tree invoke_build_dtable (int, tree);
+extern tree invoke_build_dtable (int, VEC(tree,gc) *);
 extern tree build_field_ref (tree, tree, tree);
 extern tree java_modify_addr_for_volatile (tree);
 extern void pushdecl_force_head (tree);
@@ -1199,12 +1041,10 @@ extern tree java_check_reference (tree, int);
 extern tree build_get_class (tree);
 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);
 extern const char *lang_printable_name (tree, int);
 extern tree maybe_add_interface (tree, tree);
 extern void set_super_info (int, tree, tree, int);
@@ -1222,7 +1062,8 @@ extern void make_class_data (tree);
 extern int alloc_name_constant (int, tree);
 extern int alloc_constant_fieldref (tree, tree);
 extern void emit_register_classes (tree *);
-extern tree emit_symbol_table (tree, tree, tree, tree, tree, int);
+extern tree emit_symbol_table (tree, tree, VEC(method_entry,gc) *,
+                              tree, tree, int);
 extern void lang_init_source (int);
 extern void write_classfile (tree);
 extern char *print_int_node (tree);
@@ -1233,7 +1074,7 @@ extern int find_class_or_string_constant (struct CPool *, int, tree);
 
 extern tree pushdecl_top_level (tree);
 extern tree pushdecl_function_level (tree);
-extern tree java_replace_reference (tree, bool);
+extern tree java_replace_references (tree *, int *, void *);
 extern int alloc_class_constant (tree);
 extern void init_expr_processing (void);
 extern void push_super_field (tree, tree);
@@ -1252,7 +1093,6 @@ extern void set_local_type (int, tree);
 extern int merge_type_state (tree);
 extern int push_type_0 (tree);
 extern void push_type (tree);
-extern void load_type_state (tree);
 extern void add_interface (tree, tree);
 extern tree force_evaluation_order (tree);
 extern tree java_create_object (tree);
@@ -1300,6 +1140,7 @@ extern void java_check_methods (tree);
 extern void java_mangle_decl (tree);
 extern tree java_mangle_class_field (struct obstack *, tree);
 extern tree java_mangle_vtable (struct obstack *, tree);
+extern tree java_mangle_resource_name (const char *);
 extern void append_gpp_mangled_name (const char *, int);
 
 extern void add_predefined_file (tree);
@@ -1325,7 +1166,7 @@ extern void register_exception_range(struct eh_range *, int, int);
 extern void finish_method (tree);
 extern void java_expand_body (tree);
 
-extern int get_symbol_table_index (tree, tree, tree *);
+extern int get_symbol_table_index (tree, tree, VEC(method_entry,gc) **);
 
 extern tree make_catch_class_record (tree, tree);
 extern tree emit_catch_table (tree);
@@ -1338,6 +1179,12 @@ extern void java_read_sourcefilenames (const char *fsource_filename);
 
 extern void rewrite_reflection_indexes (void *);
 
+int cxx_keyword_p (const char *name, int length);
+
+extern GTY(()) VEC(tree,gc) *pending_static_fields;
+
+extern void java_write_globals (void);   
+
 #define DECL_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
 
 /* Access flags etc for a method (a FUNCTION_DECL): */
@@ -1375,7 +1222,6 @@ extern void rewrite_reflection_indexes (void *);
    them  */
 #define ID_INIT_P(ID)   ((ID) == init_identifier_node)
 #define ID_CLINIT_P(ID) ((ID) == clinit_identifier_node)
-#define ID_CLASSDOLLAR_P(ID) ((ID) == classdollar_identifier_node)
 
 /* Access flags etc for variable/field (FIELD_DECL, VAR_DECL, or PARM_DECL): */
 
@@ -1422,6 +1268,9 @@ extern void rewrite_reflection_indexes (void *);
 /* Use CLASS_LOADED_P? FIXME */
 #define CLASS_COMPLETE_P(DECL) DECL_LANG_FLAG_2 (DECL) 
 
+/* A vector used to track type states for the current method.  */
+extern VEC(tree, gc) *type_states;
+
 /* This maps a bytecode offset (PC) to various flags,
    listed below (starting with BCODE_). */
 extern char *instruction_bits;
@@ -1453,9 +1302,6 @@ extern const unsigned char *linenumber_table;
 /* The length (in items) of the line number table. */
 extern int linenumber_count;
 
-/* In type_map, means that slot is uninitialized or otherwise unusable. */
-#define TYPE_UNKNOWN NULL_TREE
-
 /* In type_map, means the second half of a 64-bit double or long. */
 #define TYPE_SECOND void_type_node
 
@@ -1467,7 +1313,7 @@ extern int linenumber_count;
 
 /* A array mapping variable/stack slot index to the type current
    in that variable/stack slot.
-   TYPE_UNKNOWN, TYPE_SECOND, and TYPE_NULL are special cases. */
+   TYPE_SECOND and TYPE_NULL are special cases. */
 extern tree *type_map;
 
 /* Map a stack index to the type currently in that slot. */
@@ -1499,9 +1345,6 @@ extern tree *type_map;
 /* True if class TYPE has been parsed (first pass). */
 #define CLASS_PARSED_P(TYPE) TYPE_LANG_FLAG_2 (TYPE)
 
-/* True if class TYPE was defined in Java source code. */
-#define CLASS_FROM_SOURCE_P(TYPE) TYPE_LANG_FLAG_3 (TYPE)
-
 /* True of a RECORD_TYPE of a class/interface type (not array type) */
 #define CLASS_P(TYPE) TYPE_LANG_FLAG_4 (TYPE)
 
@@ -1526,9 +1369,6 @@ extern tree *type_map;
    feature a finalizer method. */
 #define HAS_FINALIZER_P(EXPR) TREE_LANG_FLAG_3 (EXPR)
 
-/* True if NODE (a statement) can complete normally. */
-#define CAN_COMPLETE_NORMALLY(NODE) TREE_LANG_FLAG_6 (NODE)
-
 /* True if NODE belongs to an inner class TYPE_DECL node.
    Verifies that NODE as the attributes of a decl.  */
 #define INNER_CLASS_DECL_P(NODE) (TYPE_NAME (TREE_TYPE (NODE)) == NODE \
@@ -1556,89 +1396,91 @@ extern tree *type_map;
 #define DECL_INNER_CLASS_LIST(NODE) DECL_INITIAL (TYPE_DECL_CHECK (NODE))
 
 /* Add a FIELD_DECL to RECORD_TYPE RTYPE.
-   The field has name NAME (a char*), and type FTYPE.
+   The field has name NAME (a char*), a type FTYPE, and a location of LOC.
    Unless this is the first field, FIELD most hold the previous field.
    FIELD is set to the newly created FIELD_DECL.
 
    We set DECL_ARTIFICIAL so these fields get skipped by make_class_data
    if compiling java.lang.Object or java.lang.Class. */
 
-#define PUSH_FIELD(RTYPE, FIELD, NAME, FTYPE) \
-{ tree _field = build_decl (FIELD_DECL, get_identifier ((NAME)), (FTYPE)); \
+#define PUSH_FIELD(LOC, RTYPE, FIELD, NAME, FTYPE) \
+{ tree _field = build_decl (LOC, FIELD_DECL, get_identifier ((NAME)), (FTYPE)); \
   if (TYPE_FIELDS (RTYPE) == NULL_TREE)        \
     TYPE_FIELDS (RTYPE) = _field;      \
   else                                 \
-    TREE_CHAIN(FIELD) = _field;                \
+    DECL_CHAIN(FIELD) = _field;                \
   DECL_CONTEXT (_field) = (RTYPE);     \
   DECL_ARTIFICIAL (_field) = 1;                \
   FIELD = _field; }
 
 #define FINISH_RECORD(RTYPE) layout_type (RTYPE)
 
-/* Start building a RECORD_TYPE constructor with a given TYPE in CONS. */
-#define START_RECORD_CONSTRUCTOR(CONS, CTYPE) \
+/* Start building a RECORD_TYPE constructor's elements in V.  The
+   constructor will have type CTYPE.  */
+#define START_RECORD_CONSTRUCTOR(V, CTYPE) \
   do \
     { \
-      CONS = build_constructor ((CTYPE), VEC_alloc (constructor_elt, gc, 0)); \
-      CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (CONS), TYPE_FIELDS (CTYPE), \
-                             NULL); \
+      V = VEC_alloc (constructor_elt, gc, 0); \
+      CONSTRUCTOR_APPEND_ELT (V, TYPE_FIELDS (CTYPE), NULL); \
     } \
   while (0)
 
-/* Append a field initializer to CONS for the dummy field for the inherited
+/* Append a field initializer to V for the dummy field for the inherited
    fields.  The dummy field has the given VALUE, and the same type as the
    super-class.   Must be specified before calls to PUSH_FIELD_VALUE. */
-#define PUSH_SUPER_VALUE(CONS, VALUE) \
+#define PUSH_SUPER_VALUE(V, VALUE) \
   do \
     { \
-      constructor_elt *_elt___ = VEC_last (constructor_elt, \
-                                          CONSTRUCTOR_ELTS (CONS)); \
-      tree _next___ = TREE_CHAIN (_elt___->index); \
+      constructor_elt *_elt___ = VEC_last (constructor_elt, V); \
+      tree _next___ = DECL_CHAIN (_elt___->index); \
       gcc_assert (!DECL_NAME (_elt___->index)); \
       _elt___->value = VALUE; \
-      CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (CONS), _next___, NULL); \
+      CONSTRUCTOR_APPEND_ELT (V, _next___, NULL); \
     } \
   while (0)
 
-/* Append a field initializer to CONS for a field with the given VALUE.
+/* Append a field initializer to V for a field with the given VALUE.
    NAME is a char* string used for error checking;
    the initializer must be specified in order. */
-#define PUSH_FIELD_VALUE(CONS, NAME, VALUE)                            \
+#define PUSH_FIELD_VALUE(V, NAME, VALUE)                               \
   do \
     { \
-      constructor_elt *_elt___ = VEC_last (constructor_elt, \
-                                          CONSTRUCTOR_ELTS (CONS)); \
-      tree _next___ = TREE_CHAIN (_elt___->index); \
+      constructor_elt *_elt___ = VEC_last (constructor_elt, V); \
+      tree _next___ = DECL_CHAIN (_elt___->index); \
       gcc_assert (strcmp (IDENTIFIER_POINTER (DECL_NAME (_elt___->index)), \
                          NAME) == 0); \
       _elt___->value = VALUE; \
-      CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (CONS), _next___, NULL); \
+      CONSTRUCTOR_APPEND_ELT (V, _next___, NULL); \
     } \
   while (0)
 
-/* Finish creating a record CONSTRUCTOR CONS. */
-#define FINISH_RECORD_CONSTRUCTOR(CONS) \
-  VEC_pop (constructor_elt, CONSTRUCTOR_ELTS (CONS))
+/* Finish creating a record CONSTRUCTOR CONS with type CTYPE and elements V.  */
+#define FINISH_RECORD_CONSTRUCTOR(CONS, V, CTYPE)        \
+  do \
+    { \
+      VEC_pop (constructor_elt, V); \
+      CONS = build_constructor (CTYPE, V); \
+      TREE_CONSTANT (CONS) = 0; \
+    } \
+  while (0)
 
 #define BLOCK_EXPR_DECLS(NODE)  BLOCK_VARS(NODE)
 #define BLOCK_EXPR_BODY(NODE)   BLOCK_SUBBLOCKS(NODE)
 
 #define BUILD_MONITOR_ENTER(WHERE, ARG)                                        \
   {                                                                    \
-    (WHERE) = build3 (CALL_EXPR, int_type_node,                                \
-                     build_address_of (soft_monitorenter_node),        \
-                     build_tree_list (NULL_TREE, (ARG)),               \
-                     NULL_TREE);                                       \
+    (WHERE) = build_call_nary (int_type_node,                          \
+                              build_address_of (soft_monitorenter_node), \
+                              1, (ARG));                               \
     TREE_SIDE_EFFECTS (WHERE) = 1;                                     \
   }
 
-#define BUILD_MONITOR_EXIT(WHERE, ARG)                         \
-  {                                                            \
-    (WHERE) = build3 (CALL_EXPR, int_type_node,                        \
-                     build_address_of (soft_monitorexit_node), \
-                     build_tree_list (NULL_TREE, (ARG)),       \
-                     NULL_TREE);                               \
-    TREE_SIDE_EFFECTS (WHERE) = 1;                             \
+#define BUILD_MONITOR_EXIT(WHERE, ARG)                                 \
+  {                                                                    \
+    (WHERE) = build_call_nary (int_type_node,                          \
+                              build_address_of (soft_monitorexit_node), \
+                              1, (ARG));                               \
+    TREE_SIDE_EFFECTS (WHERE) = 1;                                     \
   }
 
 /* True when we can perform static class initialization optimization */
@@ -1669,18 +1511,8 @@ enum
 
 #undef DEBUG_JAVA_BINDING_LEVELS
 
-/* In a LABELED_BLOCK_EXPR node.  */
-#define LABELED_BLOCK_LABEL(NODE) \
-  TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 0)
-#define LABELED_BLOCK_BODY(NODE) \
-  TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 1)
-
-/* In an EXIT_BLOCK_EXPR node.  */
-#define EXIT_BLOCK_LABELED_BLOCK(NODE) \
-  TREE_OPERAND_CHECK_CODE (NODE, EXIT_BLOCK_EXPR, 0)
-
 extern void java_genericize (tree);
-extern int java_gimplify_expr (tree *, tree *, tree *);
+extern int java_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
 
 extern FILE *finput;