aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/parse.y
diff options
context:
space:
mode:
authorPer Bothner <bothner@gcc.gnu.org>1999-02-21 07:42:27 -0800
committerPer Bothner <bothner@gcc.gnu.org>1999-02-21 07:42:27 -0800
commit939d7216dca76eac6675e54f10154ad5d2898cfa (patch)
treebc94f54b074dc8162b8ed7adee22a07f1784413d /gcc/java/parse.y
parent2d5a51939f53e104020ac07784f5f2087aa06275 (diff)
downloadgcc-939d7216dca76eac6675e54f10154ad5d2898cfa.zip
gcc-939d7216dca76eac6675e54f10154ad5d2898cfa.tar.gz
gcc-939d7216dca76eac6675e54f10154ad5d2898cfa.tar.bz2
decl.c (build_result_decl): New method.
d * decl.c (build_result_decl), java-tree.h: New method. (complete_start_java_method): Handle synchronized methods. Don't build DECL_RESULT here. (Ordering dependency problem.) (start_java_method): Call build_result_decl here instead ... * parse.y (java_complete_expand_method): ... and here. (expand_start_java_method): Don't call complete_start_java_method here. (java_complete_expand_method): Call it here instead. * parse.h (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT): Moved to .. * java-tree.h: ... here. * expr.c (force_evaluation_order): Fix typo, don't handle ARRAY_REF. * parse.y (java_complete_lhs): Don't call force_evaluation_order for ARRAY_REF - it doesn't work when array bounds are checked. (patch_array_ref): Handle it here instead. From-SVN: r25346
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r--gcc/java/parse.y17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index b548ad1..8964e45 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -5464,7 +5464,6 @@ expand_start_java_method (fndecl)
*ptr = NULL_TREE;
pushdecl_force_head (DECL_ARGUMENTS (fndecl));
lineno = DECL_SOURCE_LINE_FIRST (fndecl);
- complete_start_java_method (fndecl);
}
/* Terminate a function and expand its body. */
@@ -5731,6 +5730,7 @@ java_complete_expand_method (mdecl)
tree fbody = DECL_FUNCTION_BODY (mdecl);
tree block_body = BLOCK_EXPR_BODY (fbody);
expand_start_java_method (mdecl);
+ build_result_decl (mdecl);
current_this
= (!METHOD_STATIC (mdecl) ?
@@ -5753,6 +5753,8 @@ java_complete_expand_method (mdecl)
&& TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE)
missing_return_error (current_function_decl);
+ complete_start_java_method (mdecl);
+
/* Don't go any further if we've found error(s) during the
expansion */
if (!java_error_count)
@@ -8053,7 +8055,7 @@ java_complete_lhs (node)
return error_mark_node;
if (!flag_emit_class_files)
TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
- return force_evaluation_order (patch_array_ref (node));
+ return patch_array_ref (node);
case RECORD_TYPE:
return node;;
@@ -9886,7 +9888,16 @@ patch_array_ref (node)
TREE_OPERAND (node, 1) = index;
}
else
- node = build_java_arrayaccess (array, array_type, index);
+ {
+ /* The save_expr is for correct evaluation order. It would be cleaner
+ to use force_evaluation_order (see comment there), but that is
+ difficult when we also have to deal with bounds checking. */
+ if (TREE_SIDE_EFFECTS (index))
+ array = save_expr (array);
+ node = build_java_arrayaccess (array, array_type, index);
+ if (TREE_SIDE_EFFECTS (index))
+ node = build (COMPOUND_EXPR, array_type, array, node);
+ }
TREE_TYPE (node) = array_type;
return node;
}