parse.y (patch_invoke): Call force_evaluation_order on a static arg list.
authorAndrew Haley <aph@redhat.com>
Mon, 21 Oct 2002 18:26:34 +0000 (18:26 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Mon, 21 Oct 2002 18:26:34 +0000 (18:26 +0000)
2002-10-15  Andrew Haley  <aph@redhat.com>

* parse.y (patch_invoke): Call force_evaluation_order on a static
arg list.
(resolve_qualified_expression_name): Call force_evaluation_order
on a arg list that is part of a Qualified Expression Name.

* lang.c (dump_compound_expr): New.
(java_dump_tree): New.

From-SVN: r58369

gcc/java/ChangeLog
gcc/java/lang.c
gcc/java/parse.y

index 8704e4b7201bc6ec0b8e5f2549ce5d29baf0a0d9..cdfbd2c86ccc0958ea7a5b837684a1ccc9db85a8 100644 (file)
@@ -1,3 +1,13 @@
+2002-10-15  Andrew Haley  <aph@redhat.com>
+
+       * parse.y (patch_invoke): Call force_evaluation_order on a static
+       arg list.
+       (resolve_qualified_expression_name): Call force_evaluation_order
+       on a arg list that is part of a Qualified Expression Name.
+
+       * lang.c (dump_compound_expr): New.
+       (java_dump_tree): New.
+
 2002-10-20  Ranjit Mathew <rmathew@hotmail.com>
 
        * gcj.texi: Added item describing the GCJ runtime property
index 6f19961f65c692c939858a387f445d8c4676dc91..ca97f02f1d57c002965c39d0e7e19f685f51a7d9 100644 (file)
@@ -42,6 +42,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #include "diagnostic.h"
 #include "tree-inline.h"
 #include "splay-tree.h"
+#include "tree-dump.h"
 
 struct string_option
 {
@@ -74,6 +75,7 @@ static int merge_init_test_initialization PARAMS ((void * *,
 static int inline_init_test_initialization PARAMS ((void * *, 
                                                    void *));
 static bool java_can_use_bit_fields_p PARAMS ((void));
+static int java_dump_tree PARAMS ((void *, tree));
 
 #ifndef TARGET_OBJECT_SUFFIX
 # define TARGET_OBJECT_SUFFIX ".o"
@@ -286,6 +288,9 @@ struct language_function GTY(())
 #undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
 #define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES java_tree_inlining_walk_subtrees
 
+#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
+#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree
+
 /* Each front end provides its own.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
@@ -1041,4 +1046,113 @@ java_inlining_map_static_initializers (fn, decl_map)
      inline_init_test_initialization, decl_map);
 }
 
+/* Avoid voluminous output for deep recursion of compound exprs.  */
+
+static void
+dump_compound_expr (di, t)
+     dump_info_p di;
+     tree t;
+{
+  int i;
+
+  for (i=0; i<2; i++)
+    {
+      switch (TREE_CODE (TREE_OPERAND (t, i)))
+       {
+       case COMPOUND_EXPR:
+         dump_compound_expr (di, TREE_OPERAND (t, i));
+         break;
+
+       case EXPR_WITH_FILE_LOCATION:
+           {
+             tree wfl_node = EXPR_WFL_NODE (TREE_OPERAND (t, i));
+             dump_child ("expr", wfl_node);
+             break;
+           }
+
+       default:
+         dump_child ("expr", TREE_OPERAND (t, i));
+       }
+    }
+}
+  
+static int
+java_dump_tree (dump_info, t)
+     void *dump_info;
+     tree t;
+{
+  enum tree_code code;
+  dump_info_p di = (dump_info_p) dump_info;
+
+  /* Figure out what kind of node this is.  */
+  code = TREE_CODE (t);
+
+  switch (code)
+    {
+    case FUNCTION_DECL:
+      dump_child ("args", DECL_ARGUMENTS (t));
+      if (DECL_EXTERNAL (t))
+       dump_string (di, "undefined");
+      if (TREE_PUBLIC (t))
+       dump_string (di, "extern");
+      else
+       dump_string (di, "static");
+      if (DECL_LANG_SPECIFIC (t))
+       dump_child ("body", DECL_FUNCTION_BODY (t));
+      if (DECL_LANG_SPECIFIC (t) && !dump_flag (di, TDF_SLIM, t))
+       dump_child ("inline body", DECL_SAVED_TREE (t));
+      return 1;
+
+    case RETURN_EXPR:
+      dump_child ("expr", TREE_OPERAND (t, 0));
+      return 1;
+
+    case GOTO_EXPR:
+      dump_child ("goto", TREE_OPERAND (t, 0));
+      return 1;
+
+    case LABEL_EXPR:
+      dump_child ("label", TREE_OPERAND (t, 0));
+      return 1;
+
+    case LABELED_BLOCK_EXPR:
+      dump_child ("label", TREE_OPERAND (t, 0));
+      dump_child ("block", TREE_OPERAND (t, 1));
+      return 1;
+
+    case EXIT_BLOCK_EXPR:
+      dump_child ("block", TREE_OPERAND (t, 0));
+      dump_child ("val", TREE_OPERAND (t, 1));
+      return 1;
+
+    case BLOCK:
+      if (BLOCK_EXPR_BODY (t))
+       {
+         tree local = BLOCK_VARS (t);
+         while (local)
+           {
+             tree next = TREE_CHAIN (local);
+             dump_child ("var", local);
+             local = next;
+           }
+         
+         {
+           tree block = BLOCK_EXPR_BODY (t);
+           dump_child ("body", block);
+           block = TREE_CHAIN (block);
+         }
+       }
+      return 1;
+      
+    case COMPOUND_EXPR:
+      if (!dump_flag (di, TDF_SLIM, t))
+       return 0;
+      dump_compound_expr (di, t);
+      return 1;
+
+    default:
+      break;
+    }
+  return 0;
+}
 #include "gt-java-lang.h"
index 783c5d37a0d35f6ee73fc22a9615abd6f2629005..61595b87786823b187eae91df27693ec0a396e2b 100644 (file)
@@ -7439,6 +7439,7 @@ dump_java_tree (phase, t)
   int flags;
 
   stream = dump_begin (phase, &flags);
+  flags |= TDF_SLIM;
   if (stream)
     {
       dump_node (t, flags, stream);
@@ -9504,6 +9505,8 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
            }
          *type_found = type = QUAL_DECL_TYPE (*where_found);
 
+         *where_found = force_evaluation_order (*where_found);
+
          /* If we're creating an inner class instance, check for that
             an enclosing instance is in scope */
          if (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
@@ -10785,7 +10788,10 @@ patch_invoke (patch, method, args)
     {
       tree list;
       tree fndecl = current_function_decl;
-      tree save = save_expr (patch);
+      /* We have to call force_evaluation_order now because creating a
+        COMPOUND_EXPR wraps the arg list in a way that makes it
+        unrecognizable by force_evaluation_order later.  Yuk.  */
+      tree save = save_expr (force_evaluation_order (patch));
       tree type = TREE_TYPE (patch);
 
       patch = build (COMPOUND_EXPR, type, save, empty_stmt_node);