diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-15 22:02:13 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-15 22:02:13 +0000 |
commit | 9981c44b92386c6d642ef71245fab27974f08dbf (patch) | |
tree | 9f425c2996ae0b146771dcc668979c48675ee708 /libjava/interpret.cc | |
parent | 966073719a045032562f6bbfd595456b85b28e24 (diff) | |
download | gcc-9981c44b92386c6d642ef71245fab27974f08dbf.tar.gz |
PR libgcj/16032:
* interpret.cc (AVAL1U): Resolve pool entry when not direct
threaded.
(AVAL2U): Likewise.
(compile): Handle 'ldc class' specially.
(_Jv_InterpMethod::run): Added special 'ldc class' instruction.
* verify.cc (check_constant): Handle 'ldc class' for 1.5 classes.
* defineclass.cc (handleCodeAttribute): Set new field.
(MAJOR_1_1, MINOR_1_1, MAJOR_1_2, MINOR_1_2, MAJOR_1_3, MINOR_1_3,
MAJOR_1_4, MINOR_1_4, MAJOR_1_5, MINOR_1_5): New defines.
(parse): Check version numbers.
(_Jv_ClassReader::is_15): New field.
(_Jv_ClassReader): Initialize it.
* include/java-interp.h (_Jv_InterpMethod::is_15): New field.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104325 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/interpret.cc')
-rw-r--r-- | libjava/interpret.cc | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/libjava/interpret.cc b/libjava/interpret.cc index dcda95e64de..dacf19dfb12 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -507,7 +507,16 @@ _Jv_InterpMethod::compile (const void * const *insn_targets) { int index = get1u (pc); ++pc; - SET_DATUM (pool_data[index].o); + // For an unresolved class we want to delay resolution + // until execution. + if (defining_class->constants.tags[index] == JV_CONSTANT_Class) + { + --next; + SET_INSN (insn_targets[int (op_jsr_w) + 1]); + SET_INT (index); + } + else + SET_DATUM (pool_data[index].o); } break; @@ -537,7 +546,16 @@ _Jv_InterpMethod::compile (const void * const *insn_targets) { int index = get2u (pc); pc += 2; - SET_DATUM (pool_data[index].o); + // For an unresolved class we want to delay resolution + // until execution. + if (defining_class->constants.tags[index] == JV_CONSTANT_Class) + { + --next; + SET_INSN (insn_targets[int (op_jsr_w) + 1]); + SET_INT (index); + } + else + SET_DATUM (pool_data[index].o); } break; @@ -1017,7 +1035,11 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth) INSN_LABEL(ifnonnull), INSN_LABEL(goto_w), INSN_LABEL(jsr_w), +#ifdef DIRECT_THREADED + INSN_LABEL (ldc_class) +#else 0 +#endif }; pc_t pc; @@ -1058,8 +1080,16 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth) #define GET2S() (pc += 2, get2s (pc- 2)) #define GET1U() get1u (pc++) #define GET2U() (pc += 2, get2u (pc - 2)) -#define AVAL1U() ({ int index = get1u (pc++); pool_data[index].o; }) -#define AVAL2U() ({ int index = get2u (pc); pc += 2; pool_data[index].o; }) + // Note that these could be more efficient when not handling 'ldc + // class'. +#define AVAL1U() \ + ({ int index = get1u (pc++); \ + resolve_pool_entry (meth->defining_class, index).o; }) +#define AVAL2U() \ + ({ int index = get2u (pc); pc += 2; \ + resolve_pool_entry (meth->defining_class, index).o; }) + // Note that we don't need to resolve the pool entry here as class + // constants are never wide. #define AVAL2UP() ({ int index = get2u (pc); pc += 2; &pool_data[index]; }) #define SKIP_GOTO pc += 2 #define GOTO_VAL() pc - 1 + get2s (pc) @@ -1320,6 +1350,19 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth) PUSHA ((jobject) AVAL2U ()); NEXT_INSN; +#ifdef DIRECT_THREADED + // For direct threaded we have a separate 'ldc class' operation. + insn_ldc_class: + { + // We could rewrite the instruction at this point. + int index = INTVAL (); + jobject k = (_Jv_Linker::resolve_pool_entry (meth->defining_class, + index)).o; + PUSHA (k); + } + NEXT_INSN; +#endif /* DIRECT_THREADED */ + insn_ldc2_w: { void *where = AVAL2UP (); |