diff options
author | Andrew Haley <aph@redhat.com> | 2007-02-02 16:34:17 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2007-02-02 16:34:17 +0000 |
commit | b4e18eee4b56ed8d4003d1fb92acb5f7dbf43748 (patch) | |
tree | 825931419e51fa7cc806a34c9dce994cb91d820f /gcc/java/expr.c | |
parent | ad12460bed01fc26b69eaa8292986d19f6e24cb5 (diff) | |
download | gcc-b4e18eee4b56ed8d4003d1fb92acb5f7dbf43748.zip gcc-b4e18eee4b56ed8d4003d1fb92acb5f7dbf43748.tar.gz gcc-b4e18eee4b56ed8d4003d1fb92acb5f7dbf43748.tar.bz2 |
expr.c (expand_byte_code): Call cache_this_class_ref() and cache_cpool_data_ref().
2007-02-02 Andrew Haley <aph@redhat.com>
* expr.c (expand_byte_code): Call cache_this_class_ref() and
cache_cpool_data_ref().
Set TYPE_CPOOL_DATA_REF.
(cache_cpool_data_ref): New function.
* constants.c (build_ref_from_constant_pool): Remove special-case
code for flag_indirect_classes.
(build_constant_data_ref): Move special-case code for
flag_indirect_classes here from build_ref_from_constant_pool.
* decl.c (finish_method): Move class initialization from here to
cache_this_class_ref.
* class.c (cache_this_class_ref): New function.
(build_class_ref): Use this_classdollar for the ouput class.
From-SVN: r121508
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r-- | gcc/java/expr.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c index c51b5cd..f7d35c6 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -83,6 +83,7 @@ static tree build_java_throw_out_of_bounds_exception (tree); static tree build_java_check_indexed_type (tree, tree); static unsigned char peek_opcode_at_pc (struct JCF *, int, int); static void promote_arguments (void); +static void cache_cpool_data_ref (void); static GTY(()) tree operand_type[59]; @@ -3151,6 +3152,8 @@ expand_byte_code (JCF *jcf, tree method) return; promote_arguments (); + cache_this_class_ref (method); + cache_cpool_data_ref (); /* Translate bytecodes. */ linenumber_pointer = linenumber_table; @@ -3223,7 +3226,7 @@ expand_byte_code (JCF *jcf, tree method) PC = process_jvm_instruction (PC, byte_ops, length); maybe_poplevels (PC); } /* for */ - + if (dead_code_index != -1) { /* We've just reached the end of a region of dead code. */ @@ -3791,4 +3794,27 @@ promote_arguments (void) } } +/* Create a local variable that points to the constant pool. */ + +static void +cache_cpool_data_ref (void) +{ + if (optimize) + { + tree cpool; + tree d = build_constant_data_ref (flag_indirect_classes); + tree cpool_ptr = build_decl (VAR_DECL, NULL_TREE, + build_pointer_type (TREE_TYPE (d))); + java_add_local_var (cpool_ptr); + TREE_INVARIANT (cpool_ptr) = 1; + TREE_CONSTANT (cpool_ptr) = 1; + + java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (cpool_ptr), + cpool_ptr, build_address_of (d))); + cpool = build1 (INDIRECT_REF, TREE_TYPE (d), cpool_ptr); + TREE_THIS_NOTRAP (cpool) = 1; + TYPE_CPOOL_DATA_REF (output_class) = cpool; + } +} + #include "gt-java-expr.h" |