From 6de5f432f1e671c985b02a29bea02eb15e7553cc Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Fri, 23 Jun 2006 12:14:44 +0000 Subject: [PATCH] java-tree.h (update_aliases): Remove 2006-06-21 Andrew Haley * java-tree.h (update_aliases): Remove * expr.c (expand_iinc): Remove call to update_aliases(). (STORE_INTERNAL): Likewise. * decl.c (update_aliases, initialize_local_variable) (maybe_pushlevels): Set DECL_VALUE_EXPR for debugging decls. From-SVN: r114931 --- gcc/java/ChangeLog | 8 ++++ gcc/java/decl.c | 97 ++++---------------------------------------- gcc/java/expr.c | 2 - gcc/java/java-tree.h | 1 - 4 files changed, 17 insertions(+), 91 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 45fd0128a65..9a116078bc6 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2006-06-21 Andrew Haley + + * java-tree.h (update_aliases): Remove + * expr.c (expand_iinc): Remove call to update_aliases(). + (STORE_INTERNAL): Likewise. + * decl.c (update_aliases, initialize_local_variable) + (maybe_pushlevels): Set DECL_VALUE_EXPR for debugging decls. + 2006-06-19 Andrew Haley PR java/1305 diff --git a/gcc/java/decl.c b/gcc/java/decl.c index d4bd01cab89..8497fbf787b 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -160,46 +160,6 @@ debug_variable_p (tree decl) return true; } -/* Copy the value in decl into every live alias in the same local - variable slot. Some of these will be dead stores removed by the - optimizer. */ - -void -update_aliases (tree decl, int index, int pc) -{ - tree decl_type = TREE_TYPE (decl); - tree tmp; - - gcc_assert (! debug_variable_p (decl)); - - for (tmp = TREE_VEC_ELT (decl_map, index); - tmp != NULL_TREE; - tmp = DECL_LOCAL_SLOT_CHAIN (tmp)) - { - tree tmp_type = TREE_TYPE (tmp); - if (tmp != decl - && LOCAL_SLOT_P (tmp) == 0 - && (pc == -1 - || (pc >= DECL_LOCAL_START_PC (tmp) - && pc < DECL_LOCAL_END_PC (tmp))) - /* This test is < (rather than <=) because there's no point - updating an alias that's about to die at the end of this - instruction. */ - && (tmp_type == decl_type - || (INTEGRAL_TYPE_P (tmp_type) - && INTEGRAL_TYPE_P (decl_type) - && TYPE_PRECISION (decl_type) <= 32 - && TYPE_PRECISION (tmp_type) <= 32) - || (TREE_CODE (tmp_type) == POINTER_TYPE - && TREE_CODE (decl_type) == POINTER_TYPE))) - { - tree src = build1 (NOP_EXPR, tmp_type, decl); - gcc_assert (! LOCAL_VAR_OUT_OF_SCOPE_P (tmp)); - java_add_stmt (build2 (MODIFY_EXPR, tmp_type, tmp, src)); - } - } -} - static tree push_jvm_slot (int index, tree decl) { @@ -220,52 +180,6 @@ push_jvm_slot (int index, tree decl) return decl; } -/* At the point of its creation a local variable decl inherits - whatever is already in the same slot. In the case of a local - variable that is declared but unused, we won't find anything. */ - -static void -initialize_local_variable (tree decl, int index) -{ - tree decl_type = TREE_TYPE (decl); - if (TREE_CODE (decl_type) == POINTER_TYPE) - { - tree tmp = TREE_VEC_ELT (base_decl_map, index); - - if (tmp) - { - /* At the point of its creation this decl inherits whatever - is in the slot. */ - tree src = build1 (NOP_EXPR, decl_type, tmp); - java_add_stmt (build2 (MODIFY_EXPR, decl_type, decl, src)); - } - } - else - { - tree tmp; - - for (tmp = TREE_VEC_ELT (decl_map, index); - tmp != NULL_TREE; - tmp = DECL_LOCAL_SLOT_CHAIN (tmp)) - { - tree tmp_type = TREE_TYPE (tmp); - if (tmp != decl - && ! debug_variable_p (tmp) - && (tmp_type == decl_type - || (INTEGRAL_TYPE_P (tmp_type) - && INTEGRAL_TYPE_P (decl_type) - && TYPE_PRECISION (decl_type) <= 32 - && TYPE_PRECISION (tmp_type) <= 32 - && TYPE_PRECISION (tmp_type) - >= TYPE_PRECISION (decl_type)))) - { - java_add_stmt (build2 (MODIFY_EXPR, decl_type, decl, tmp)); - return; - } - } - } -} - /* Find the best declaration based upon type. If 'decl' fits 'type' better than 'best', return 'decl'. Otherwise return 'best'. */ @@ -1800,10 +1714,17 @@ maybe_pushlevels (int pc) current_binding_level->names = NULL; for ( ; decl != NULL_TREE; decl = next) { + int index = DECL_LOCAL_SLOT_NUMBER (decl); + tree base_decl; next = TREE_CHAIN (decl); - push_jvm_slot (DECL_LOCAL_SLOT_NUMBER (decl), decl); + push_jvm_slot (index, decl); pushdecl (decl); - initialize_local_variable (decl, DECL_LOCAL_SLOT_NUMBER (decl)); + base_decl + = find_local_variable (index, TREE_TYPE (decl), pc); + if (TREE_CODE (TREE_TYPE (base_decl)) == POINTER_TYPE) + base_decl = TREE_VEC_ELT (base_decl_map, index); + SET_DECL_VALUE_EXPR (decl, base_decl); + DECL_HAS_VALUE_EXPR_P (decl) = 1; } } diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 329e363db33..a64bda8ff02 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1451,7 +1451,6 @@ expand_iinc (unsigned int local_var_index, int ival, int pc) constant_value = build_int_cst (NULL_TREE, ival); res = fold_build2 (PLUS_EXPR, int_type_node, local_var, constant_value); java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (local_var), local_var, res)); - update_aliases (local_var, local_var_index, pc); } @@ -3413,7 +3412,6 @@ process_jvm_instruction (int PC, const unsigned char* byte_ops, decl = find_local_variable (index, type, oldpc); \ set_local_type (index, type); \ java_add_stmt (build2 (MODIFY_EXPR, type, decl, value)); \ - update_aliases (decl, index, PC); \ } #define STORE(OPERAND_TYPE, OPERAND_VALUE) \ diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 98aca58daf6..f3478692d70 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -1221,7 +1221,6 @@ extern void set_java_signature (tree, tree); extern tree build_static_field_ref (tree); extern tree build_address_of (tree); extern tree find_local_variable (int index, tree type, int pc); -extern void update_aliases (tree decl, int index, int pc); extern tree find_stack_slot (int index, tree type); extern tree build_prim_array_type (tree, HOST_WIDE_INT); extern tree build_java_array_type (tree, HOST_WIDE_INT); -- 2.30.2