aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2002-10-21 18:26:34 +0000
committerAndrew Haley <aph@redhat.com>2002-10-21 18:26:34 +0000
commit3047f07e21d90101afde1b48bc3fd82b85f9c46a (patch)
tree0f4b1ecaaca983ab44a922c2c9a6dba080d34f94 /gcc/java
parentef5d7b8c3368f8aca5091d7d519ffa85f4d9f30c (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@58369 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog10
-rw-r--r--gcc/java/lang.c114
-rw-r--r--gcc/java/parse.y8
3 files changed, 131 insertions, 1 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 8704e4b7201..cdfbd2c86cc 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -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
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 6f19961f65c..ca97f02f1d5 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -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"
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 783c5d37a0d..61595b87786 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -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);