From: Richard Henderson Date: Sun, 13 May 2001 04:59:33 +0000 (-0700) Subject: java-tree.def (JAVA_EXC_OBJ_EXPR): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f17f18980bc8654557f02a3a6b29ca2fb88c54aa;p=gcc.git java-tree.def (JAVA_EXC_OBJ_EXPR): New. * 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. From-SVN: r42030 --- diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 01f513bc44c..1c8e207595f 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,15 @@ +2001-05-12 Richard Henderson + + * 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. + 2001-05-07 Alexandre Petit-Bianco * parse.y (build_unresolved_array_type): Set diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c index c34822084ec..19764439e0e 100644 --- a/gcc/java/check-init.c +++ b/gcc/java/check-init.c @@ -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: diff --git a/gcc/java/expr.c b/gcc/java/expr.c index cb9ae160931..861069d95bc 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -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, tmode, modifier) 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, length) 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++]) diff --git a/gcc/java/java-tree.def b/gcc/java/java-tree.def index 930979b5b24..c2e926f910b 100644 --- a/gcc/java/java-tree.def +++ b/gcc/java/java-tree.def @@ -93,6 +93,10 @@ DEFTREECODE (CLASS_LITERAL, "class_literal", '1', 1) 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 diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 750030aed16..9a4eb5b21c6 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -2451,7 +2451,7 @@ generate_bytecode_insns (exp, target, state) } } break; - case EXC_PTR_EXPR: + case JAVA_EXC_OBJ_EXPR: NOTE_PUSH (1); /* Pushed by exception system. */ break; case NEW_CLASS_EXPR: diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 9985c736e01..10283b50562 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -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;