aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2001-10-11 16:50:49 -0700
committerPer Bothner <bothner@gcc.gnu.org>2001-10-11 16:50:49 -0700
commit89b894e19b9297d4d7e2f85c33253c59356a48b1 (patch)
tree9837bfb596fefc897129f0b0c0659bf932161e23 /gcc/java
parent9e2b96271da2e46088221b201054383643ae935b (diff)
downloadgcc-89b894e19b9297d4d7e2f85c33253c59356a48b1.zip
gcc-89b894e19b9297d4d7e2f85c33253c59356a48b1.tar.gz
gcc-89b894e19b9297d4d7e2f85c33253c59356a48b1.tar.bz2
parse.y (patch_synchronized_statement): Use a TRY_FINALLY_EXPR rather than a CLEANUP_POINT_EXPR/WITH_CLEANUP_EXPR pair.
* parse.y (patch_synchronized_statement): Use a TRY_FINALLY_EXPR rather than a CLEANUP_POINT_EXPR/WITH_CLEANUP_EXPR pair. The former is simpler, and jcf-write.c handles it better. (java_complete_lhs): No longer need to handle CLEANUP_POINT_EXPR or WITH_CLEANUP_EXPR. * jcf-write.c: Revert Alex's change from 2000-10-18. It is no longer needed, as we already handle empty TRY_FINALLY_EXPR bodies fine. From-SVN: r46209
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/jcf-write.c15
-rw-r--r--gcc/java/parse.y25
3 files changed, 13 insertions, 35 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 634bdc3..7ea1bc8 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,5 +1,13 @@
2001-10-11 Per Bothner <per@bothner.com>
+ * parse.y (patch_synchronized_statement): Use a TRY_FINALLY_EXPR
+ rather than a CLEANUP_POINT_EXPR/WITH_CLEANUP_EXPR pair.
+ The former is simpler, and jcf-write.c handles it better.
+ (java_complete_lhs): No longer need to handle CLEANUP_POINT_EXPR
+ or WITH_CLEANUP_EXPR.
+ * jcf-write.c: Revert Alex's change from 2000-10-18. It is no
+ longer needed, as we already handle empty TRY_FINALLY_EXPR bodies fine.
+
* parse.y (patch_if_else_statement): If the condition is constant,
optimize away the test.
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index 63ee86d..5f72b7c 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -57,7 +57,7 @@ char *jcf_write_base_directory = NULL;
/* Add a 1-byte instruction/operand I to bytecode.data,
assuming space has already been RESERVE'd. */
-#define OP1(I) (state->last_bc = *state->bytecode.ptr++ = (I), CHECK_OP(state))
+#define OP1(I) (*state->bytecode.ptr++ = (I), CHECK_OP(state))
/* Like OP1, but I is a 2-byte big endian integer. */
@@ -275,8 +275,6 @@ struct jcf_partial
/* Information about the current switch statement. */
struct jcf_switch_state *sw_state;
-
- enum java_opcode last_bc; /* The last emitted bytecode */
};
static void generate_bytecode_insns PARAMS ((tree, int, struct jcf_partial *));
@@ -2167,16 +2165,7 @@ generate_bytecode_insns (exp, target, state)
tree src = TREE_OPERAND (exp, 0);
tree src_type = TREE_TYPE (src);
tree dst_type = TREE_TYPE (exp);
- /* Detect the situation of compiling an empty synchronized
- block. A nop should be emitted in order to produce
- verifiable bytecode. */
- if (exp == empty_stmt_node
- && state->last_bc == OPCODE_monitorenter
- && state->labeled_blocks
- && state->labeled_blocks->pc == PENDING_CLEANUP_PC)
- OP1 (OPCODE_nop);
- else
- generate_bytecode_insns (TREE_OPERAND (exp, 0), target, state);
+ generate_bytecode_insns (TREE_OPERAND (exp, 0), target, state);
if (target == IGNORE_TARGET || src_type == dst_type)
break;
if (TREE_CODE (dst_type) == POINTER_TYPE)
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index a5c9867..f699c5d 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -11582,21 +11582,6 @@ java_complete_lhs (node)
TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0));
return node;
- case CLEANUP_POINT_EXPR:
- COMPLETE_CHECK_OP_0 (node);
- TREE_TYPE (node) = void_type_node;
- CAN_COMPLETE_NORMALLY (node) =
- CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
- return node;
-
- case WITH_CLEANUP_EXPR:
- COMPLETE_CHECK_OP_0 (node);
- COMPLETE_CHECK_OP_1 (node);
- CAN_COMPLETE_NORMALLY (node) =
- CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
- TREE_TYPE (node) = void_type_node;
- return node;
-
case LABELED_BLOCK_EXPR:
PUSH_LABELED_BLOCK (node);
if (LABELED_BLOCK_BODY (node))
@@ -15690,13 +15675,9 @@ patch_synchronized_statement (node, wfl_op1)
CAN_COMPLETE_NORMALLY (exit) = 1;
assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
TREE_SIDE_EFFECTS (assignment) = 1;
- node = build1 (CLEANUP_POINT_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE,
- build (WITH_CLEANUP_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE,
- assignment, enter),
- exit, NULL_TREE),
- block));
+ node = build (COMPOUND_EXPR, NULL_TREE,
+ build (COMPOUND_EXPR, NULL_TREE, assignment, enter),
+ build (TRY_FINALLY_EXPR, NULL_TREE, block, exit));
node = build_expr_block (node, expr_decl);
return java_complete_tree (node);