diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-01-12 00:19:05 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-01-12 00:19:05 +0000 |
commit | ea7f40600b3be0b8e1ab7a9cb92b2c79373d7151 (patch) | |
tree | 2cfdf898457ddc7727902d4e65c193a35fe8803a /libjava | |
parent | 4e69e33be0cf8281859b7aa0ad6f08e87e719e05 (diff) | |
download | gcc-ea7f40600b3be0b8e1ab7a9cb92b2c79373d7151.tar.gz |
2002-01-11 Chris Sears <cbsears_sf@yahoo.com>
* interpret.cc (NULLARRAYCHECK): New macro.
(SAVE_PC): Just store `pc'.
(find_exception): Subtract one from `pc' here.
(continue1) [insn_iaload, insn_laload, insn_faload, insn_daload,
insn_aaload, insn_baload, insn_caload, insn_saload, insn_iastore,
insn_lastore, insn_fastore, insn_dastore, insn_aastore,
insn_bastore, insn_castore, insn_sastore]: Use NULLARRAYCHECK, and
don't call SAVE_PC.
(continue1) [insn_fdiv, insn_ddiv, insn_frem, insn_drem]: Don't
call SAVE_PC.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48787 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 13 | ||||
-rw-r--r-- | libjava/interpret.cc | 66 |
2 files changed, 38 insertions, 41 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index a08810f5692..9a1d3c44c7f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,16 @@ +2002-01-11 Chris Sears <cbsears_sf@yahoo.com> + + * interpret.cc (NULLARRAYCHECK): New macro. + (SAVE_PC): Just store `pc'. + (find_exception): Subtract one from `pc' here. + (continue1) [insn_iaload, insn_laload, insn_faload, insn_daload, + insn_aaload, insn_baload, insn_caload, insn_saload, insn_iastore, + insn_lastore, insn_fastore, insn_dastore, insn_aastore, + insn_bastore, insn_castore, insn_sastore]: Use NULLARRAYCHECK, and + don't call SAVE_PC. + (continue1) [insn_fdiv, insn_ddiv, insn_frem, insn_drem]: Don't + call SAVE_PC. + 2002-01-11 Tom Tromey <tromey@redhat.com> * java/lang/natSystem.cc (init_properties): Only look for default diff --git a/libjava/interpret.cc b/libjava/interpret.cc index 8075e5b6c64..7a847c5c363 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -182,9 +182,12 @@ static jint get4(unsigned char* loc) { #ifdef HANDLE_SEGV #define NULLCHECK(X) +#define NULLARRAYCHECK(X) do { SAVE_PC; } while (0) #else #define NULLCHECK(X) \ do { if ((X)==NULL) throw_null_pointer_exception (); } while (0) +#define NULLARRAYCHECK(X) \ + do { if ((X)==NULL) { SAVE_PC; throw_null_pointer_exception (); } } while (0) #endif #define ARRAYBOUNDSCHECK(array, index) \ @@ -298,10 +301,14 @@ _Jv_InterpMethod::run (ffi_cif* cif, return ex; } +#define SAVE_PC inv->pc = pc + bool _Jv_InterpMethod::find_exception (jobject ex, _Jv_InterpMethodInvocation *inv) { - int logical_pc = inv->pc - bytecode (); + // We subtract one because the PC was incremented before it was + // saved. + int logical_pc = inv->pc - 1 - bytecode (); _Jv_InterpException *exc = exceptions (); jclass exc_class = ex->getClass (); @@ -622,8 +629,6 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) INSN_LABEL(jsr_w), }; -#define SAVE_PC inv->pc = pc-1 - /* If the macro INLINE_SWITCH is not defined, then the main loop operates as one big (normal) switch statement. If it is defined, then the case selection is performed `inline' in the end of the @@ -960,88 +965,80 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) NEXT_INSN; insn_iaload: - SAVE_PC; { jint index = POPI(); jintArray arr = (jintArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); PUSHI( elements(arr)[index] ); } NEXT_INSN; insn_laload: - SAVE_PC; { jint index = POPI(); jlongArray arr = (jlongArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); PUSHL( elements(arr)[index] ); } NEXT_INSN; insn_faload: - SAVE_PC; { jint index = POPI(); jfloatArray arr = (jfloatArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); PUSHF( elements(arr)[index] ); } NEXT_INSN; insn_daload: - SAVE_PC; { jint index = POPI(); jdoubleArray arr = (jdoubleArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); PUSHD( elements(arr)[index] ); } NEXT_INSN; insn_aaload: - SAVE_PC; { jint index = POPI(); jobjectArray arr = (jobjectArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); PUSHA( elements(arr)[index] ); } NEXT_INSN; insn_baload: - SAVE_PC; { jint index = POPI(); jbyteArray arr = (jbyteArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); PUSHI( elements(arr)[index] ); } NEXT_INSN; insn_caload: - SAVE_PC; { jint index = POPI(); jcharArray arr = (jcharArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); PUSHI( elements(arr)[index] ); } NEXT_INSN; insn_saload: - SAVE_PC; { jint index = POPI(); jshortArray arr = (jshortArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); PUSHI( elements(arr)[index] ); } @@ -1148,60 +1145,55 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) NEXT_INSN; insn_iastore: - SAVE_PC; { jint value = POPI(); jint index = POPI(); jintArray arr = (jintArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); elements(arr)[index] = value; } NEXT_INSN; insn_lastore: - SAVE_PC; { jlong value = POPL(); jint index = POPI(); jlongArray arr = (jlongArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); elements(arr)[index] = value; } NEXT_INSN; insn_fastore: - SAVE_PC; { jfloat value = POPF(); jint index = POPI(); jfloatArray arr = (jfloatArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); elements(arr)[index] = value; } NEXT_INSN; insn_dastore: - SAVE_PC; { jdouble value = POPD(); jint index = POPI(); jdoubleArray arr = (jdoubleArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); elements(arr)[index] = value; } NEXT_INSN; insn_aastore: - SAVE_PC; { jobject value = POPA(); jint index = POPI(); jobjectArray arr = (jobjectArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); _Jv_CheckArrayStore (arr, value); elements(arr)[index] = value; @@ -1209,36 +1201,33 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) NEXT_INSN; insn_bastore: - SAVE_PC; { jbyte value = (jbyte) POPI(); jint index = POPI(); jbyteArray arr = (jbyteArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); elements(arr)[index] = value; } NEXT_INSN; insn_castore: - SAVE_PC; { jchar value = (jchar) POPI(); jint index = POPI(); jcharArray arr = (jcharArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); elements(arr)[index] = value; } NEXT_INSN; insn_sastore: - SAVE_PC; { jshort value = (jshort) POPI(); jint index = POPI(); jshortArray arr = (jshortArray) POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); ARRAYBOUNDSCHECK (arr, index); elements(arr)[index] = value; } @@ -1357,7 +1346,6 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) NEXT_INSN; insn_fdiv: - SAVE_PC; { jfloat value2 = POPF(); jfloat value1 = POPF(); @@ -1367,7 +1355,6 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) NEXT_INSN; insn_ddiv: - SAVE_PC; { jdouble value2 = POPD(); jdouble value1 = POPD(); @@ -1397,7 +1384,6 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) NEXT_INSN; insn_frem: - SAVE_PC; { jfloat value2 = POPF(); jfloat value1 = POPF(); @@ -1407,7 +1393,6 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) NEXT_INSN; insn_drem: - SAVE_PC; { jdouble value2 = POPD(); jdouble value1 = POPD(); @@ -2185,10 +2170,9 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) NEXT_INSN; insn_arraylength: - SAVE_PC; { __JArray *arr = (__JArray*)POPA(); - NULLCHECK (arr); + NULLARRAYCHECK (arr); PUSHI (arr->length); } NEXT_INSN; |