aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2001-07-12 17:06:40 +0000
committerTom Tromey <tromey@gcc.gnu.org>2001-07-12 17:06:40 +0000
commita3cb5122ec0765cc4d4764d4ab59d113e6c09459 (patch)
tree64e18cbc4658d24afea6fb22c62c5c3b3747a653 /gcc/java/expr.c
parentb9aaec62b7c3838fc80744a99a98792870a1e204 (diff)
downloadgcc-a3cb5122ec0765cc4d4764d4ab59d113e6c09459.zip
gcc-a3cb5122ec0765cc4d4764d4ab59d113e6c09459.tar.gz
gcc-a3cb5122ec0765cc4d4764d4ab59d113e6c09459.tar.bz2
expr.c (expand_load_internal): New function.
* expr.c (expand_load_internal): New function. (LOAD_INTERNAL): Use it. From-SVN: r43969
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index e9af7fc..c9b4a3c 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -57,6 +57,7 @@ static void expand_java_array_length PARAMS ((void));
static tree build_java_monitor PARAMS ((tree, tree));
static void expand_java_pushc PARAMS ((int, tree));
static void expand_java_return PARAMS ((tree));
+static void expand_load_internal PARAMS ((int, tree, int));
static void expand_java_NEW PARAMS ((tree));
static void expand_java_INSTANCEOF PARAMS ((tree));
static void expand_java_CHECKCAST PARAMS ((tree));
@@ -1086,6 +1087,32 @@ expand_java_return (type)
}
}
+static void
+expand_load_internal (index, type, pc)
+ int index;
+ tree type;
+ int pc;
+{
+ tree copy;
+ tree var = find_local_variable (index, type, pc);
+
+ /* Now VAR is the VAR_DECL (or PARM_DECL) that we are going to push
+ on the stack. If there is an assignment to this VAR_DECL between
+ the stack push and the use, then the wrong code could be
+ generated. To avoid this we create a new local and copy our
+ value into it. Then we push this new local on the stack.
+ Hopefully this all gets optimized out. */
+ copy = build_decl (VAR_DECL, NULL_TREE, type);
+ DECL_CONTEXT (copy) = current_function_decl;
+ layout_decl (copy, 0);
+ DECL_REGISTER (copy) = 1;
+ expand_decl (copy);
+ MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (copy);
+ DECL_INITIAL (copy) = var;
+ expand_decl_init (copy);
+ push_value (copy);
+}
+
tree
build_address_of (value)
tree value;
@@ -2841,7 +2868,7 @@ process_jvm_instruction (PC, byte_ops, length)
/* internal macro added for use by the WIDE case */
#define LOAD_INTERNAL(OPTYPE, OPVALUE) \
- push_value (find_local_variable (OPVALUE, type_map[OPVALUE], oldpc));
+ expand_load_internal (OPVALUE, type_map[OPVALUE], oldpc);
/* Push local variable onto the opcode stack. */
#define LOAD(OPERAND_TYPE, OPERAND_VALUE) \