java-tree.h (throw_node): Define as a single member of java_global_trees instead...
authorRichard Henderson <rth@redhat.com>
Wed, 28 Mar 2001 08:59:30 +0000 (00:59 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 28 Mar 2001 08:59:30 +0000 (00:59 -0800)
        * java-tree.h (throw_node): Define as a single member of
        java_global_trees instead of a separate array.
        (JTI_THROW_NODE): New.
        * decl.c (throw_node): Don't declare.
        (init_decl_processing): Init a scalar throw_node.
        Don't register it for gc.
        * check-init.c (check_init): Reference scalar throw_node.
        * expr.c (build_java_athrow): Likewise.
        * jcf-write.c (generate_bytecode_insns): Likewise.
        * parse.h (BUILD_THROW): Likewise.

From-SVN: r40922

gcc/java/ChangeLog
gcc/java/check-init.c
gcc/java/decl.c
gcc/java/expr.c
gcc/java/java-tree.h
gcc/java/jcf-write.c
gcc/java/parse.h

index 081dab16a930dbf03e7d75aff1313302015efbb3..8ccb4b29d03adb5f45266986f9924ce969174104 100644 (file)
@@ -1,3 +1,16 @@
+2001-03-28  Richard Henderson  <rth@redhat.com>
+
+       * java-tree.h (throw_node): Define as a single member of
+       java_global_trees instead of a separate array.
+       (JTI_THROW_NODE): New.
+       * decl.c (throw_node): Don't declare.
+       (init_decl_processing): Init a scalar throw_node.
+       Don't register it for gc.
+       * check-init.c (check_init): Reference scalar throw_node.
+       * expr.c (build_java_athrow): Likewise.
+       * jcf-write.c (generate_bytecode_insns): Likewise.
+       * parse.h (BUILD_THROW): Likewise.
+
 2001-03-28  Richard Henderson  <rth@redhat.com>
 
        * decl.c (end_java_method): Do not save and restore
index 49df07291d5c949a78b5e42490c1a188b3a80f8c..74144020afbd0de1ac0dd3b50eb131c55c0e5f60 100644 (file)
@@ -694,8 +694,7 @@ check_init (exp, before)
 
        for ( ;  x != NULL_TREE;  x = TREE_CHAIN (x))
          check_init (TREE_VALUE (x), before);
-       if (func == throw_node[0]
-           || func == throw_node[1])
+       if (func == throw_node)
          goto never_continues;
       }
       break;
index c81c342110455bea2255661572575c91d82fbcd5..c0b67b22d7caf20ea7533eb6fd528c2f43296815 100644 (file)
@@ -72,8 +72,6 @@ tree decl_map;
 
 static 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. */
 
@@ -727,18 +725,13 @@ init_decl_processing ()
                                                               t),
                                          0, NOT_BUILT_IN,
                                          NULL_PTR);
-  throw_node[0] = builtin_function ("_Jv_Throw",
-                                   build_function_type (ptr_type_node, t),
-                                   0, NOT_BUILT_IN, NULL_PTR);
+  throw_node = builtin_function ((USING_SJLJ_EXCEPTIONS
+                                 ? "_Jv_Throw" : "_Jv_Sjlj_Throw"),
+                                build_function_type (ptr_type_node, t),
+                                0, NOT_BUILT_IN, NULL_PTR);
   /* Mark throw_nodes as `noreturn' functions with side effects.  */
-  TREE_THIS_VOLATILE (throw_node[0]) = 1;
-  TREE_SIDE_EFFECTS (throw_node[0]) = 1;
-  t = tree_cons (NULL_TREE, ptr_type_node, endlink);
-  throw_node[1] = builtin_function ("_Jv_Sjlj_Throw",
-                                   build_function_type (ptr_type_node, t),
-                                   0, NOT_BUILT_IN, NULL_PTR);
-  TREE_THIS_VOLATILE (throw_node[1]) = 1;
-  TREE_SIDE_EFFECTS (throw_node[1]) = 1;
+  TREE_THIS_VOLATILE (throw_node) = 1;
+  TREE_SIDE_EFFECTS (throw_node) = 1;
   t = build_function_type (int_type_node, endlink);
   soft_monitorenter_node 
     = builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN,
@@ -884,8 +877,6 @@ init_decl_processing ()
   /* 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));
   ggc_add_tree_root (&decl_map, 1);
index 7ec5e832e29216bee2aac69cdb80e028d045f9d2..42c43aad5364cda6e1e69653aa35e609ebe2d14a 100644 (file)
@@ -600,7 +600,7 @@ build_java_athrow (node)
 
   call = build (CALL_EXPR,
                void_type_node,
-               build_address_of (throw_node[USING_SJLJ_EXCEPTIONS ? 1 : 0]),
+               build_address_of (throw_node),
                build_tree_list (NULL_TREE, node),
                NULL_TREE);
   TREE_SIDE_EFFECTS (call) = 1;
index 33f8a5b4c18dfd942bd0933fcac99c3d1b21a521..01a0722d39b0bc5b084ee2b3036c379aab262ff9 100644 (file)
@@ -321,6 +321,7 @@ enum java_tree_index
 
   JTI_END_PARAMS_NODE,
 
+  JTI_THROW_NODE,
   JTI_ALLOC_OBJECT_NODE,
   JTI_SOFT_INSTANCEOF_NODE,
   JTI_SOFT_CHECKCAST_NODE,
@@ -544,6 +545,8 @@ extern tree java_global_trees[JTI_MAX];
   java_global_trees[JTI_END_PARAMS_NODE]
 
 /* References to internal libjava functions we use. */
+#define throw_node \
+  java_global_trees[JTI_THROW_NODE]
 #define alloc_object_node \
   java_global_trees[JTI_ALLOC_OBJECT_NODE]
 #define soft_instanceof_node \
@@ -562,7 +565,6 @@ extern tree java_global_trees[JTI_MAX];
   java_global_trees[JTI_SOFT_BADARRAYINDEX_NODE]
 #define soft_nullpointer_node \
   java_global_trees[JTI_SOFT_NULLPOINTER_NODE]
-extern tree throw_node[];
 #define soft_checkarraystore_node \
   java_global_trees[JTI_SOFT_CHECKARRAYSTORE_NODE]
 #define soft_monitorenter_node \
index 4593e8a64b5f5a4c1b59b98d731769201ac9055b..b84c86ebde2aec93643b433f0ba065760860999e 100644 (file)
@@ -2513,8 +2513,7 @@ generate_bytecode_insns (exp, target, state)
          }
        else if (f == soft_monitorenter_node
                 || f == soft_monitorexit_node
-                || f == throw_node[0]
-                || f == throw_node[1])
+                || f == throw_node)
          {
            if (f == soft_monitorenter_node)
              op = OPCODE_monitorenter;
index 05fb2119e8ed920c889a387c4cafcacb7da5b9cd..9ca55d4aa472b4eef9437359607f62919b9adc28 100644 (file)
@@ -669,13 +669,13 @@ typedef struct _jdeplist {
     TREE_SIDE_EFFECTS (WHERE) = 1;                     \
   }
 
-#define BUILD_THROW(WHERE, WHAT)                                           \
-  {                                                                        \
-    (WHERE) =                                                              \
-      build (CALL_EXPR, void_type_node,                                            \
-            build_address_of (throw_node[USING_SJLJ_EXCEPTIONS ? 1 : 0]), \
-            build_tree_list (NULL_TREE, (WHAT)), NULL_TREE);               \
-    TREE_SIDE_EFFECTS ((WHERE)) = 1;                                       \
+#define BUILD_THROW(WHERE, WHAT)                               \
+  {                                                            \
+    (WHERE) =                                                  \
+      build (CALL_EXPR, void_type_node,                                \
+            build_address_of (throw_node),                     \
+            build_tree_list (NULL_TREE, (WHAT)), NULL_TREE);   \
+    TREE_SIDE_EFFECTS ((WHERE)) = 1;                           \
   }
 
 /* Set wfl_operator for the most accurate error location */