summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-21 23:53:36 +0000
committerapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-21 23:53:36 +0000
commitc70627e6c8acc53c068c10a96b4337c2e35dac07 (patch)
tree424b297b151611bab940b1e6ad26e5096b801614
parenta61deedf3d55a0e29c0500f603877419160a3651 (diff)
downloadppe42-gcc-c70627e6c8acc53c068c10a96b4337c2e35dac07.tar.gz
ppe42-gcc-c70627e6c8acc53c068c10a96b4337c2e35dac07.zip
Thu Feb 17 14:30:37 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
* jcf-write.c (generate_bytecode_insns): Don't generate empty `finally' clauses. Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com> * jcf-parse.c (load_class): Call `fatal' if no file containing the target class are found. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32095 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/java/ChangeLog10
-rw-r--r--gcc/java/jcf-parse.c13
-rw-r--r--gcc/java/jcf-write.c53
3 files changed, 48 insertions, 28 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 453705620ff..8b631e0625a 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -28,6 +28,16 @@ Wed Nov 03 02:16:00 PST 1999 Pekka Nikander <pekka.nikander@hut.fi>
* jv-scan.c (help): Likewise.
* jcf-dump.c (help): Likewise.
+Thu Feb 17 14:30:37 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
+
+ * jcf-write.c (generate_bytecode_insns): Don't generate empty
+ `finally' clauses.
+
+Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
+
+ * jcf-parse.c (load_class): Call `fatal' if no file containing
+ the target class are found.
+
2000-02-16 Zack Weinberg <zack@wolery.cumb.org>
* Makefile.in (PARSE_C, PARSE_SCAN_C): Move dependencies on
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 5c965da7d85..a10f605cb75 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -526,18 +526,7 @@ load_class (class_or_name, verbose)
name = DECL_NAME (TYPE_NAME (class_or_name));
if (read_class (name) == 0 && verbose)
- {
- error ("Cannot find file for class %s.",
- IDENTIFIER_POINTER (name));
- if (TREE_CODE (class_or_name) == RECORD_TYPE)
- TYPE_SIZE (class_or_name) = error_mark_node;
-#if 0
- /* FIXME: what to do here? */
- if (!strcmp (classpath, DEFAULT_CLASS_PATH))
- fatal ("giving up");
-#endif
- return;
- }
+ fatal ("Cannot find file for class %s.", IDENTIFIER_POINTER (name));
}
/* Parse a source file when JCF refers to a source file. */
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index 615697dc535..45552d3d47a 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -2297,31 +2297,52 @@ generate_bytecode_insns (exp, target, state)
break;
case TRY_FINALLY_EXPR:
{
+ struct jcf_block *finished_label, *finally_label, *start_label;
+ struct jcf_handler *handler;
+ int worthwhile_finally = 1;
tree try_block = TREE_OPERAND (exp, 0);
tree finally = TREE_OPERAND (exp, 1);
- struct jcf_block *finished_label = gen_jcf_label (state);
- struct jcf_block *finally_label = gen_jcf_label (state);
- struct jcf_block *start_label = get_jcf_label_here (state);
- tree return_link = build_decl (VAR_DECL, NULL_TREE,
- return_address_type_node);
- tree exception_type = build_pointer_type (throwable_type_node);
- tree exception_decl = build_decl (VAR_DECL, NULL_TREE, exception_type);
- struct jcf_handler *handler;
+ tree return_link, exception_type, exception_decl;
- finally_label->pc = PENDING_CLEANUP_PC;
- finally_label->next = state->labeled_blocks;
- state->labeled_blocks = finally_label;
- state->num_finalizers++;
+ /* If the finally clause happens to be empty, set a flag so we
+ remember to just skip it. */
+ if (BLOCK_EXPR_BODY (finally) == empty_stmt_node)
+ worthwhile_finally = 0;
+
+ if (worthwhile_finally)
+ {
+ return_link = build_decl (VAR_DECL, NULL_TREE,
+ return_address_type_node);
+ exception_type = build_pointer_type (throwable_type_node);
+ exception_decl = build_decl (VAR_DECL, NULL_TREE, exception_type);
+
+ finished_label = gen_jcf_label (state);
+ finally_label = gen_jcf_label (state);
+ start_label = get_jcf_label_here (state);
+ finally_label->pc = PENDING_CLEANUP_PC;
+ finally_label->next = state->labeled_blocks;
+ state->labeled_blocks = finally_label;
+ state->num_finalizers++;
+ }
generate_bytecode_insns (try_block, target, state);
- if (state->labeled_blocks != finally_label)
- abort();
- state->labeled_blocks = finally_label->next;
- emit_jsr (finally_label, state);
+
+ if (worthwhile_finally)
+ {
+ if (state->labeled_blocks != finally_label)
+ abort();
+ state->labeled_blocks = finally_label->next;
+ emit_jsr (finally_label, state);
+ }
+
if (CAN_COMPLETE_NORMALLY (try_block))
emit_goto (finished_label, state);
/* Handle exceptions. */
+
+ if (!worthwhile_finally)
+ break;
+
localvar_alloc (return_link, state);
handler = alloc_handler (start_label, NULL_PTR, state);
handler->end_label = handler->handler_label;
OpenPOWER on IntegriCloud