From be74aeb457df67355ce7c16721ecc436c8fd770a Mon Sep 17 00:00:00 2001 From: Bill Buzbee Date: Tue, 28 Jul 2009 15:02:22 -0700 Subject: [PATCH] Fix for 1857865: Need x86 implementation for OP_THROW_VERIFICATION_ERROR --- vm/mterp/config-x86 | 1 - vm/mterp/out/InterpAsm-x86.S | 30 ++++++++++++++++++++---------- vm/mterp/out/InterpC-x86.c | 9 --------- vm/mterp/x86/OP_THROW_VERIFICATION_ERROR.S | 20 ++++++++++++++++++-- 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/vm/mterp/config-x86 b/vm/mterp/config-x86 index d315a1c47..b7139cad3 100644 --- a/vm/mterp/config-x86 +++ b/vm/mterp/config-x86 @@ -33,7 +33,6 @@ import c/opcommon.c # opcode list; argument to op-start is default directory op-start x86 - op OP_THROW_VERIFICATION_ERROR c op-end # arch-specific entry point to interpreter diff --git a/vm/mterp/out/InterpAsm-x86.S b/vm/mterp/out/InterpAsm-x86.S index 2df6c2071..52007b0bd 100644 --- a/vm/mterp/out/InterpAsm-x86.S +++ b/vm/mterp/out/InterpAsm-x86.S @@ -5806,17 +5806,27 @@ dvmAsmInstructionStart = .L_OP_NOP /* ------------------------------ */ .balign 64 .L_OP_THROW_VERIFICATION_ERROR: /* 0xed */ - /* (stub) */ - GET_GLUE(%ecx) - SAVE_PC_TO_GLUE(%ecx) # only need to export these two - SAVE_FP_TO_GLUE(%ecx) # only need to export these two - movl %ecx,OUT_ARG0(%esp) # glue is first arg to function - call dvmMterp_OP_THROW_VERIFICATION_ERROR # do the real work +/* File: x86/OP_THROW_VERIFICATION_ERROR.S */ + /* + * Handle a throw-verification-error instruction. This throws an + * exception for an error discovered during verification. The + * exception is indicated by AA, with some detail provided by BBBB. + */ + /* op AA, ref@BBBB */ GET_GLUE(%ecx) - LOAD_PC_FROM_GLUE(%ecx) # retrieve updated values - LOAD_FP_FROM_GLUE(%ecx) # retrieve updated values - FETCH_INST() - GOTO_NEXT + movzwl 2(rPC),%eax # eax<- BBBB + movl offGlue_method(%ecx),%ecx # ecx<- glue->method + EXPORT_PC() + movzbl rINST_HI,rINST_FULL # rINST_FULL<- AA + movl %eax,OUT_ARG2(%esp) # arg2<- BBBB + movl rINST_FULL,OUT_ARG1(%esp) # arg1<- AA + movl %ecx,OUT_ARG0(%esp) # arg0<- method + SPILL(rPC) + call dvmThrowVerificationError # call(method, kind, ref) + UNSPILL(rPC) + jmp common_exceptionThrown # handle exception + + /* ------------------------------ */ .balign 64 .L_OP_EXECUTE_INLINE: /* 0xee */ diff --git a/vm/mterp/out/InterpC-x86.c b/vm/mterp/out/InterpC-x86.c index b17e53021..9de3324b9 100644 --- a/vm/mterp/out/InterpC-x86.c +++ b/vm/mterp/out/InterpC-x86.c @@ -1185,15 +1185,6 @@ GOTO_TARGET_DECL(exceptionThrown); FINISH(2); -/* File: c/OP_THROW_VERIFICATION_ERROR.c */ -HANDLE_OPCODE(OP_THROW_VERIFICATION_ERROR) - EXPORT_PC(); - vsrc1 = INST_AA(inst); - ref = FETCH(1); /* class/field/method ref */ - dvmThrowVerificationError(curMethod, vsrc1, ref); - GOTO_exceptionThrown(); -OP_END - /* File: c/gotoTargets.c */ /* * C footer. This has some common code shared by the various targets. diff --git a/vm/mterp/x86/OP_THROW_VERIFICATION_ERROR.S b/vm/mterp/x86/OP_THROW_VERIFICATION_ERROR.S index d59eb1a6e..c3b5063f9 100644 --- a/vm/mterp/x86/OP_THROW_VERIFICATION_ERROR.S +++ b/vm/mterp/x86/OP_THROW_VERIFICATION_ERROR.S @@ -1,4 +1,20 @@ %verify executed - /* TODO */ - call dvmAbort + /* + * Handle a throw-verification-error instruction. This throws an + * exception for an error discovered during verification. The + * exception is indicated by AA, with some detail provided by BBBB. + */ + /* op AA, ref@BBBB */ + GET_GLUE(%ecx) + movzwl 2(rPC),%eax # eax<- BBBB + movl offGlue_method(%ecx),%ecx # ecx<- glue->method + EXPORT_PC() + movzbl rINST_HI,rINST_FULL # rINST_FULL<- AA + movl %eax,OUT_ARG2(%esp) # arg2<- BBBB + movl rINST_FULL,OUT_ARG1(%esp) # arg1<- AA + movl %ecx,OUT_ARG0(%esp) # arg0<- method + SPILL(rPC) + call dvmThrowVerificationError # call(method, kind, ref) + UNSPILL(rPC) + jmp common_exceptionThrown # handle exception -- 2.11.0