This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
fix java bytecode compilation errors
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Subject: fix java bytecode compilation errors
- From: Richard Henderson <rth at twiddle dot net>
- Date: Sat, 12 May 2001 22:04:48 -0700
Fixes all of
FAIL: ArrayClass compilation from bytecode
FAIL: ArrayClass -O compilation from bytecode
FAIL: BlankFinal compilation from bytecode
FAIL: BlankFinal -O compilation from bytecode
FAIL: G19990217_01 -O compilation from bytecode
FAIL: PR232 -O compilation from bytecode
FAIL: assignment compilation from bytecode
FAIL: assignment -O compilation from bytecode
etc.
This was a problem with how I'd converted the Java front end for the
new eh interface. I'd discussed this solution with Alex some weeks
ago; sorry for taking so long to get to it.
Tested on i686 linux. Applied to mainline. I'll put it on the branch
once the merge is complete.
r~
* java-tree.def (JAVA_EXC_OBJ_EXPR): New.
* expr.c (java_lang_expand_expr): Expand it.
(process_jvm_instruction): Build JAVA_EXC_OBJ_EXPR instead of
calling build_exception_object_ref.
* parse.y (catch_clause_parameter): Likewise.
(build_dot_class_method): Likewise.
(try_reference_assignconv): Likewise.
* check-init.c (check_init): Check JAVA_EXC_OBJ_EXPR not EXC_PTR_EXPR.
* jcf-write.c (generate_bytecode_insns): Likewise.
Index: check-init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/check-init.c,v
retrieving revision 1.29
diff -u -p -r1.29 check-init.c
--- check-init.c 2001/03/28 11:01:47 1.29
+++ check-init.c 2001/05/13 04:55:53
@@ -681,7 +681,7 @@ check_init (exp, before)
case INTEGER_CST:
case REAL_CST:
case STRING_CST:
- case EXC_PTR_EXPR:
+ case JAVA_EXC_OBJ_EXPR:
break;
case NEW_CLASS_EXPR:
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.109
diff -u -p -r1.109 expr.c
--- expr.c 2001/04/03 01:01:41 1.109
+++ expr.c 2001/05/13 04:55:53
@@ -2351,9 +2351,9 @@ get_primitive_array_vtable (tree elt)
struct rtx_def *
java_lang_expand_expr (exp, target, tmode, modifier)
register tree exp;
- rtx target ATTRIBUTE_UNUSED;
- enum machine_mode tmode ATTRIBUTE_UNUSED;
- enum expand_modifier modifier ATTRIBUTE_UNUSED;
+ rtx target;
+ enum machine_mode tmode;
+ enum expand_modifier modifier;
{
tree current;
@@ -2506,6 +2506,10 @@ java_lang_expand_expr (exp, target, tmod
expand_end_all_catch ();
return const0_rtx;
+ case JAVA_EXC_OBJ_EXPR:
+ return expand_expr (build_exception_object_ref (TREE_TYPE (exp)),
+ target, tmode, modifier);
+
default:
internal_error ("Can't expand %s", tree_code_name [TREE_CODE (exp)]);
}
@@ -2803,7 +2807,7 @@ process_jvm_instruction (PC, byte_ops, l
if (instruction_bits [PC] & BCODE_EXCEPTION_TARGET)
{
tree type = pop_type (ptr_type_node);
- push_value (build_exception_object_ref (type));
+ push_value (build (JAVA_EXC_OBJ_EXPR, type));
}
switch (byte_ops[PC++])
Index: java-tree.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.def,v
retrieving revision 1.15
diff -u -p -r1.15 java-tree.def
--- java-tree.def 2000/06/22 05:17:33 1.15
+++ java-tree.def 2001/05/13 04:55:53
@@ -93,6 +93,10 @@ DEFTREECODE (CLASS_LITERAL, "class_liter
is used for context detection, so that special rules can be
enforced. */
DEFTREECODE (INSTANCE_INITIALIZERS_EXPR, "instance_initializers_expr", '1', 1)
+
+/* The Java object within the exception object from the runtime. */
+DEFTREECODE (JAVA_EXC_OBJ_EXPR, "java_exc_obj_expr", 'e', 0)
+
/*
Local variables:
mode:c
Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.80
diff -u -p -r1.80 jcf-write.c
--- jcf-write.c 2001/05/02 14:38:35 1.80
+++ jcf-write.c 2001/05/13 04:55:54
@@ -2451,7 +2451,7 @@ generate_bytecode_insns (exp, target, st
}
}
break;
- case EXC_PTR_EXPR:
+ case JAVA_EXC_OBJ_EXPR:
NOTE_PUSH (1); /* Pushed by exception system. */
break;
case NEW_CLASS_EXPR:
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.284
diff -u -p -r1.284 parse.y
--- parse.y 2001/05/08 08:11:24 1.284
+++ parse.y 2001/05/13 04:55:57
@@ -1888,7 +1888,7 @@ catch_clause_parameter:
tree ccpb = enter_block ();
tree init = build_assignment
(ASSIGN_TK, $2.location, TREE_PURPOSE ($3),
- build_exception_object_ref (ptr_type_node));
+ build (JAVA_EXC_OBJ_EXPR, ptr_type_node));
declare_local_variables (0, TREE_VALUE ($3),
build_tree_list (TREE_PURPOSE ($3),
init));
@@ -8415,7 +8415,7 @@ build_dot_class_method (class)
/* We initialize the variable with the exception handler. */
catch = build (MODIFY_EXPR, NULL_TREE, catch_clause_param,
- build_exception_object_ref (ptr_type_node));
+ build (JAVA_EXC_OBJ_EXPR, ptr_type_node));
add_stmt_to_block (catch_block, NULL_TREE, catch);
/* We add the statement throwing the new exception */
@@ -12624,7 +12624,7 @@ try_reference_assignconv (lhs_type, rhs)
else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
new_rhs = rhs;
/* This is a magic assignment that we process differently */
- else if (TREE_CODE (rhs) == EXC_PTR_EXPR)
+ else if (TREE_CODE (rhs) == JAVA_EXC_OBJ_EXPR)
new_rhs = rhs;
}
return new_rhs;