OSDN Git Service

PR 44103
[pf3gnuchains/gcc-fork.git] / gcc / java / java-tree.h
index 95087b7..c60298b 100644 (file)
@@ -1,7 +1,7 @@
 /* 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 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -30,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_?:
@@ -154,6 +145,9 @@ extern int flag_newer;
 /* When nonzero, call a library routine to do integer divisions. */
 extern int flag_use_divide_subroutine;
 
+/* When nonzero, use atomic builtins. */
+extern int flag_use_atomic_builtins;
+
 /* When nonzero, generate code for the Boehm GC.  */
 extern int flag_use_boehm_gc;
 
@@ -644,8 +638,7 @@ extern GTY(()) tree java_global_trees[JTI_MAX];
 /* 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;
@@ -656,11 +649,10 @@ struct lang_identifier GTY(())
 };
 
 /* The resulting tree type.  */
-union lang_tree_node 
-  GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
-       chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%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;
@@ -722,10 +714,8 @@ 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
@@ -773,8 +763,7 @@ union lang_tree_node
 #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)) = GGC_CNEW (struct lang_decl);  \
       DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR;            \
     }
 
@@ -786,8 +775,7 @@ union lang_tree_node
    || TREE_CODE (NODE) == REAL_CST)
 
 /* 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;
@@ -797,11 +785,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 */
+  tree exc_obj;                        /* Decl holding the exception object.  */
 
   /* Class initialization test variables  */
   htab_t GTY ((param_is (struct treetreehash_entry))) init_test_table;
@@ -810,7 +796,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 strictfp : 1;
   unsigned int invisible : 1;  /* Set for methods we generate
                                   internally but which shouldn't be
@@ -821,8 +806,7 @@ struct lang_decl_func GTY(())
   unsigned int varargs : 1;    /* Varargs method.  */
 };
 
-struct treetreehash_entry GTY(())
-{
+struct GTY(()) treetreehash_entry {
   tree key;
   tree value;
 };
@@ -858,8 +842,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. */
@@ -871,8 +854,7 @@ extern htab_t java_treetreehash_create (size_t size, int ggc);
 
 /* 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;
@@ -889,8 +871,7 @@ struct lang_decl_var GTY(())
 
 enum lang_decl_desc {LANG_DECL_FUNC, LANG_DECL_VAR};
 
-struct lang_decl GTY(())
-{
+struct GTY(()) lang_decl {
   enum lang_decl_desc desc;
   union lang_decl_u
     {
@@ -908,7 +889,7 @@ 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_CNEW (struct lang_type);
 
 #define TYPE_DUMMY(T)          (TYPE_LANG_SPECIFIC(T)->dummy_class)
 
@@ -945,8 +926,7 @@ struct lang_decl GTY(())
 #define TYPE_REFLECTION_DATASIZE(T)                                    \
                                (TYPE_LANG_SPECIFIC (T)->reflection_datasize)
 
-struct lang_type GTY(())
-{
+struct GTY(()) lang_type {
   tree signature;
   struct JCF *jcf;
   struct CPool *cpool;
@@ -1011,7 +991,6 @@ struct lang_type GTY(())
 struct eh_range;
 
 extern void java_parse_file (int);
-extern bool java_mark_addressable (tree);
 extern tree java_type_for_mode (enum machine_mode, int);
 extern tree java_type_for_size (unsigned int, int);
 extern tree java_truthvalue_conversion (tree);
@@ -1032,6 +1011,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);
@@ -1058,7 +1038,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);
@@ -1145,7 +1124,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);
@@ -1211,6 +1190,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);
@@ -1249,6 +1229,8 @@ extern void java_read_sourcefilenames (const char *fsource_filename);
 
 extern void rewrite_reflection_indexes (void *);
 
+int cxx_keyword_p (const char *name, int length);
+
 #define DECL_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
 
 /* Access flags etc for a method (a FUNCTION_DECL): */
@@ -1460,15 +1442,15 @@ 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                                 \
@@ -1479,50 +1461,54 @@ extern tree *type_map;
 
 #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)); \
+      constructor_elt *_elt___ = VEC_last (constructor_elt, V); \
       tree _next___ = TREE_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)); \
+      constructor_elt *_elt___ = VEC_last (constructor_elt, V); \
       tree _next___ = TREE_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)
@@ -1572,7 +1558,7 @@ enum
 #undef DEBUG_JAVA_BINDING_LEVELS
 
 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;