aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2001-12-03 17:10:08 -0800
committerPer Bothner <bothner@gcc.gnu.org>2001-12-03 17:10:08 -0800
commitaedcdb655dd5d6444caca3e1aa2a4786c09ceb8c (patch)
tree74c53a26a18861bde10a625d7b3eca0f8d353671 /gcc/java
parent3acc0e76327f930d3a7094d94bf65963aab68b20 (diff)
downloadgcc-aedcdb655dd5d6444caca3e1aa2a4786c09ceb8c.zip
gcc-aedcdb655dd5d6444caca3e1aa2a4786c09ceb8c.tar.gz
gcc-aedcdb655dd5d6444caca3e1aa2a4786c09ceb8c.tar.bz2
decl.c (complete_start_java_method): Now generate TRY_FINALLY_EXPR instead of CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR.
* decl.c (complete_start_java_method): Now generate TRY_FINALLY_EXPR instead of CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR. * jcf-write.c (generate_bytecode_insns): Remove support for CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR as they are no longer used. * check-init.c (check_init): Likewise. From-SVN: r47587
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/check-init.c23
-rw-r--r--gcc/java/decl.c9
-rw-r--r--gcc/java/jcf-write.c77
4 files changed, 14 insertions, 103 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 87ad138..ca9284c 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,5 +1,13 @@
2001-12-03 Per Bothner <per@bothner.com>
+ * decl.c (complete_start_java_method): Now generate TRY_FINALLY_EXPR
+ instead of CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR.
+ * jcf-write.c (generate_bytecode_insns): Remove support for
+ CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR as they are no longer used.
+ * check-init.c (check_init): Likewise.
+
+2001-12-03 Per Bothner <per@bothner.com>
+
* verify.c (subroutine_nesting): New function.
(verify_jvm_instructions): Use it to fix logic for checking that
we're done with the current subroutine.
diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c
index b108c45..7aea182 100644
--- a/gcc/java/check-init.c
+++ b/gcc/java/check-init.c
@@ -529,29 +529,6 @@ check_init (exp, before)
break;
}
- case CLEANUP_POINT_EXPR:
- {
- struct alternatives alt;
- BEGIN_ALTERNATIVES (before, alt);
- CLEAR_ALL (alt.combined);
- check_init (TREE_OPERAND (exp, 0), before);
- UNION (alt.combined, alt.combined, before);
- END_ALTERNATIVES (before, alt);
- }
- return;
- case WITH_CLEANUP_EXPR:
- {
- struct alternatives *alt = alternatives;
-#ifdef ENABLE_JC1_CHECKING
- if (TREE_CODE (alt->block) != CLEANUP_POINT_EXPR)
- abort ();
-#endif
- check_init (TREE_OPERAND (exp, 0), before);
- UNION (alt->combined, alt->combined, before);
- check_init (TREE_OPERAND (exp, 1), alt->combined);
- return;
- }
-
case TRY_EXPR:
{
tree try_clause = TREE_OPERAND (exp, 0);
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 2577122..1cbd603 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -1714,12 +1714,9 @@ complete_start_java_method (fndecl)
{
tree function_body = DECL_FUNCTION_BODY (fndecl);
tree body = BLOCK_EXPR_BODY (function_body);
- lock = build (WITH_CLEANUP_EXPR, void_type_node,
- enter, exit, NULL_TREE);
- TREE_SIDE_EFFECTS (lock) = 1;
- lock = build (COMPOUND_EXPR, TREE_TYPE (body), lock, body);
- TREE_SIDE_EFFECTS (lock) = 1;
- lock = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (body), lock);
+ lock = build (COMPOUND_EXPR, void_type_node,
+ enter,
+ build (TRY_FINALLY_EXPR, void_type_node, body, exit));
TREE_SIDE_EFFECTS (lock) = 1;
BLOCK_EXPR_BODY (function_body) = lock;
}
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index 1b9ff7b..43622f8 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -112,7 +112,7 @@ struct jcf_block
{
/* For blocks that that are defined, the next block (in pc order).
For blocks that are not-yet-defined the end label of a LABELED_BLOCK_EXPR
- or a cleanup expression (from a WITH_CLEANUP_EXPR),
+ or a cleanup expression (from a TRY_FINALLY_EXPR),
this is the next (outer) such end label, in a stack headed by
labeled_blocks in jcf_partial. */
struct jcf_block *next;
@@ -1348,7 +1348,7 @@ generate_bytecode_conditional (exp, true_label, false_label,
abort ();
}
-/* Call pending cleanups i.e. those for surrounding CLEANUP_POINT_EXPRs
+/* Call pending cleanups i.e. those for surrounding TRY_FINAL_EXPRs.
but only as far out as LIMIT (since we are about to jump to the
emit label that is LIMIT). */
@@ -2279,78 +2279,6 @@ generate_bytecode_insns (exp, target, state)
}
break;
- case CLEANUP_POINT_EXPR:
- {
- struct jcf_block *save_labeled_blocks = state->labeled_blocks;
- int can_complete = CAN_COMPLETE_NORMALLY (TREE_OPERAND (exp, 0));
- generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET, state);
- if (target != IGNORE_TARGET)
- abort ();
- while (state->labeled_blocks != save_labeled_blocks)
- {
- struct jcf_block *finished_label = NULL;
- tree return_link;
- tree exception_type = build_pointer_type (throwable_type_node);
- tree exception_decl = build_decl (VAR_DECL, NULL_TREE,
- exception_type);
- struct jcf_block *end_label = get_jcf_label_here (state);
- struct jcf_block *label = state->labeled_blocks;
- struct jcf_handler *handler;
- tree cleanup = label->u.labeled_block;
- state->labeled_blocks = label->next;
- state->num_finalizers--;
- if (can_complete)
- {
- finished_label = gen_jcf_label (state);
- emit_jsr (label, state);
- emit_goto (finished_label, state);
- if (! CAN_COMPLETE_NORMALLY (cleanup))
- can_complete = 0;
- }
- handler = alloc_handler (label->v.start_label, end_label, state);
- handler->type = NULL_TREE;
- localvar_alloc (exception_decl, state);
- NOTE_PUSH (1);
- emit_store (exception_decl, state);
- emit_jsr (label, state);
- emit_load (exception_decl, state);
- RESERVE (1);
- OP1 (OPCODE_athrow);
- NOTE_POP (1);
-
- /* The finally block. */
- return_link = build_decl (VAR_DECL, NULL_TREE,
- return_address_type_node);
- define_jcf_label (label, state);
- NOTE_PUSH (1);
- localvar_alloc (return_link, state);
- emit_store (return_link, state);
- generate_bytecode_insns (cleanup, IGNORE_TARGET, state);
- maybe_wide (OPCODE_ret, DECL_LOCAL_INDEX (return_link), state);
- localvar_free (return_link, state);
- localvar_free (exception_decl, state);
- if (finished_label != NULL)
- define_jcf_label (finished_label, state);
- }
- }
- break;
-
- case WITH_CLEANUP_EXPR:
- {
- struct jcf_block *label;
- generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET, state);
- label = gen_jcf_label (state);
- label->pc = PENDING_CLEANUP_PC;
- label->next = state->labeled_blocks;
- state->labeled_blocks = label;
- state->num_finalizers++;
- label->u.labeled_block = TREE_OPERAND (exp, 1);
- label->v.start_label = get_jcf_label_here (state);
- if (target != IGNORE_TARGET)
- abort ();
- }
- break;
-
case TRY_EXPR:
{
tree try_clause = TREE_OPERAND (exp, 0);
@@ -2383,6 +2311,7 @@ generate_bytecode_insns (exp, target, state)
define_jcf_label (finished_label, state);
}
break;
+
case TRY_FINALLY_EXPR:
{
struct jcf_block *finished_label,