From 98f3eb12bf2a33c49712e093d5cc2aa713a93aa5 Mon Sep 17 00:00:00 2001 From: buzbee Date: Mon, 28 Feb 2011 16:38:50 -0800 Subject: [PATCH] Exception cleanup in the assembly interpreters Removed the last of the "exception as strings" calls from the assembly interpreters, replacing them with the helper functions. Change-Id: I4c44cde348ed7d2ea99f908bc22166afeb5e3d37 --- vm/mterp/armv5te/OP_FILLED_NEW_ARRAY.S | 7 +-- vm/mterp/armv5te/OP_FILLED_NEW_ARRAY_JUMBO.S | 5 +- vm/mterp/armv5te/OP_NEW_INSTANCE.S | 3 - vm/mterp/armv5te/footer.S | 38 +++--------- vm/mterp/armv5te/header.S | 2 +- vm/mterp/c/header.c | 8 +-- vm/mterp/out/InterpAsm-armv5te-vfp.S | 62 +++++--------------- vm/mterp/out/InterpAsm-armv5te.S | 62 +++++--------------- vm/mterp/out/InterpAsm-armv7-a-neon.S | 62 +++++--------------- vm/mterp/out/InterpAsm-armv7-a.S | 62 +++++--------------- vm/mterp/out/InterpAsm-x86.S | 87 +++++----------------------- vm/mterp/out/InterpC-allstubs.c | 8 +-- vm/mterp/out/InterpC-armv5te-vfp.c | 8 +-- vm/mterp/out/InterpC-armv5te.c | 8 +-- vm/mterp/out/InterpC-armv7-a-neon.c | 8 +-- vm/mterp/out/InterpC-armv7-a.c | 8 +-- vm/mterp/out/InterpC-portdbg.c | 8 +-- vm/mterp/out/InterpC-portstd.c | 8 +-- vm/mterp/out/InterpC-x86-atom.c | 8 +-- vm/mterp/out/InterpC-x86.c | 8 +-- vm/mterp/x86-atom/TODO.txt | 1 + vm/mterp/x86/OP_FILLED_NEW_ARRAY.S | 6 +- vm/mterp/x86/OP_FILLED_NEW_ARRAY_JUMBO.S | 6 +- vm/mterp/x86/OP_INVOKE_SUPER.S | 1 - vm/mterp/x86/OP_INVOKE_SUPER_JUMBO.S | 1 - vm/mterp/x86/OP_NEW_INSTANCE.S | 18 ------ vm/mterp/x86/OP_NEW_INSTANCE_JUMBO.S | 18 ------ vm/mterp/x86/footer.S | 28 ++------- vm/mterp/x86/header.S | 2 +- 29 files changed, 143 insertions(+), 408 deletions(-) diff --git a/vm/mterp/armv5te/OP_FILLED_NEW_ARRAY.S b/vm/mterp/armv5te/OP_FILLED_NEW_ARRAY.S index 41a62a25c..8c79cc1b1 100644 --- a/vm/mterp/armv5te/OP_FILLED_NEW_ARRAY.S +++ b/vm/mterp/armv5te/OP_FILLED_NEW_ARRAY.S @@ -95,14 +95,11 @@ * mode of filled-new-array. */ .L${opcode}_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!$isrange) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif diff --git a/vm/mterp/armv5te/OP_FILLED_NEW_ARRAY_JUMBO.S b/vm/mterp/armv5te/OP_FILLED_NEW_ARRAY_JUMBO.S index 0c43cc8bb..a3f1695f2 100644 --- a/vm/mterp/armv5te/OP_FILLED_NEW_ARRAY_JUMBO.S +++ b/vm/mterp/armv5te/OP_FILLED_NEW_ARRAY_JUMBO.S @@ -72,7 +72,6 @@ * mode of filled-new-array. */ .L${opcode}_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown diff --git a/vm/mterp/armv5te/OP_NEW_INSTANCE.S b/vm/mterp/armv5te/OP_NEW_INSTANCE.S index cb9ce6854..ce1f0c845 100644 --- a/vm/mterp/armv5te/OP_NEW_INSTANCE.S +++ b/vm/mterp/armv5te/OP_NEW_INSTANCE.S @@ -63,6 +63,3 @@ cmp r0, #0 @ got null? bne .L${opcode}_resolved @ no, continue b common_exceptionThrown @ yes, handle exception - -.LstrInstantiationErrorPtr: - .word .LstrInstantiationError diff --git a/vm/mterp/armv5te/footer.S b/vm/mterp/armv5te/footer.S index 3bfc15f23..0c6b0f4e1 100644 --- a/vm/mterp/armv5te/footer.S +++ b/vm/mterp/armv5te/footer.S @@ -1006,9 +1006,8 @@ common_errArrayIndex: */ common_errDivideByZero: EXPORT_PC() - ldr r0, strArithmeticException - ldr r1, strDivideByZero - bl dvmThrowException + ldr r0, strDivideByZero + bl dvmThrowArithmeticException b common_exceptionThrown /* @@ -1023,12 +1022,12 @@ common_errNegativeArraySize: /* * Invocation of a non-existent method. + * On entry: method name in r1 */ common_errNoSuchMethod: EXPORT_PC() - ldr r0, strNoSuchMethodError - mov r1, #0 - bl dvmThrowException + mov r0, r1 + bl dvmThrowNoSuchMethodError b common_exceptionThrown /* @@ -1038,9 +1037,8 @@ common_errNoSuchMethod: */ common_errNullObject: EXPORT_PC() - ldr r0, strNullPointerException - mov r1, #0 - bl dvmThrowException + mov r0, #0 + bl dvmThrowNullPointerException b common_exceptionThrown /* @@ -1176,15 +1174,8 @@ dvmConfigureFP: * String references, must be close to the code that uses them. */ .align 2 -strArithmeticException: - .word .LstrArithmeticException strDivideByZero: .word .LstrDivideByZero -strNoSuchMethodError: - .word .LstrNoSuchMethodError -strNullPointerException: - .word .LstrNullPointerException - strLogTag: .word .LstrLogTag strExceptionNotCaughtLocally: @@ -1212,21 +1203,10 @@ strPrintLong: .LstrBadEntryPoint: .asciz "Bad entry point %d\n" -.LstrArithmeticException: - .asciz "Ljava/lang/ArithmeticException;" -.LstrDivideByZero: - .asciz "divide by zero" .LstrFilledNewArrayNotImpl: .asciz "filled-new-array only implemented for objects and 'int'" -.LstrInternalError: - .asciz "Ljava/lang/InternalError;" -.LstrInstantiationError: - .asciz "Ljava/lang/InstantiationError;" -.LstrNoSuchMethodError: - .asciz "Ljava/lang/NoSuchMethodError;" -.LstrNullPointerException: - .asciz "Ljava/lang/NullPointerException;" - +.LstrDivideByZero: + .asciz "divide by zero" .LstrLogTag: .asciz "mterp" .LstrExceptionNotCaughtLocally: diff --git a/vm/mterp/armv5te/header.S b/vm/mterp/armv5te/header.S index 3d755a239..d40cab53a 100644 --- a/vm/mterp/armv5te/header.S +++ b/vm/mterp/armv5te/header.S @@ -82,7 +82,7 @@ unspecified registers or condition codes. /* * "export" the PC to the stack frame, f/b/o future exception objects. Must - * be done *before* something calls dvmThrowException. + * be done *before* something throws. * * In C this is "SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc", i.e. * fp - sizeof(StackSaveArea) + offsetof(SaveArea, xtra.currentPc) diff --git a/vm/mterp/c/header.c b/vm/mterp/c/header.c index bd8636253..4f2cabe87 100644 --- a/vm/mterp/c/header.c +++ b/vm/mterp/c/header.c @@ -310,10 +310,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpAsm-armv5te-vfp.S b/vm/mterp/out/InterpAsm-armv5te-vfp.S index cb2c4ae33..12e31a4f1 100644 --- a/vm/mterp/out/InterpAsm-armv5te-vfp.S +++ b/vm/mterp/out/InterpAsm-armv5te-vfp.S @@ -89,7 +89,7 @@ unspecified registers or condition codes. /* * "export" the PC to the stack frame, f/b/o future exception objects. Must - * be done *before* something calls dvmThrowException. + * be done *before* something throws. * * In C this is "SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc", i.e. * fp - sizeof(StackSaveArea) + offsetof(SaveArea, xtra.currentPc) @@ -10784,9 +10784,6 @@ dvmAsmSisterStart: bne .LOP_NEW_INSTANCE_resolved @ no, continue b common_exceptionThrown @ yes, handle exception -.LstrInstantiationErrorPtr: - .word .LstrInstantiationError - /* continuation for OP_NEW_ARRAY */ @@ -10898,16 +10895,13 @@ dvmAsmSisterStart: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!0) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif /* continuation for OP_FILLED_NEW_ARRAY_RANGE */ @@ -10982,16 +10976,13 @@ dvmAsmSisterStart: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_RANGE_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!1) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif /* continuation for OP_CMPL_FLOAT */ @@ -12442,9 +12433,8 @@ d2l_doconv: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_JUMBO_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown /* continuation for OP_IGET_JUMBO */ @@ -21338,9 +21328,8 @@ common_errArrayIndex: */ common_errDivideByZero: EXPORT_PC() - ldr r0, strArithmeticException - ldr r1, strDivideByZero - bl dvmThrowException + ldr r0, strDivideByZero + bl dvmThrowArithmeticException b common_exceptionThrown /* @@ -21355,12 +21344,12 @@ common_errNegativeArraySize: /* * Invocation of a non-existent method. + * On entry: method name in r1 */ common_errNoSuchMethod: EXPORT_PC() - ldr r0, strNoSuchMethodError - mov r1, #0 - bl dvmThrowException + mov r0, r1 + bl dvmThrowNoSuchMethodError b common_exceptionThrown /* @@ -21370,9 +21359,8 @@ common_errNoSuchMethod: */ common_errNullObject: EXPORT_PC() - ldr r0, strNullPointerException - mov r1, #0 - bl dvmThrowException + mov r0, #0 + bl dvmThrowNullPointerException b common_exceptionThrown /* @@ -21508,15 +21496,8 @@ dvmConfigureFP: * String references, must be close to the code that uses them. */ .align 2 -strArithmeticException: - .word .LstrArithmeticException strDivideByZero: .word .LstrDivideByZero -strNoSuchMethodError: - .word .LstrNoSuchMethodError -strNullPointerException: - .word .LstrNullPointerException - strLogTag: .word .LstrLogTag strExceptionNotCaughtLocally: @@ -21544,21 +21525,10 @@ strPrintLong: .LstrBadEntryPoint: .asciz "Bad entry point %d\n" -.LstrArithmeticException: - .asciz "Ljava/lang/ArithmeticException;" -.LstrDivideByZero: - .asciz "divide by zero" .LstrFilledNewArrayNotImpl: .asciz "filled-new-array only implemented for objects and 'int'" -.LstrInternalError: - .asciz "Ljava/lang/InternalError;" -.LstrInstantiationError: - .asciz "Ljava/lang/InstantiationError;" -.LstrNoSuchMethodError: - .asciz "Ljava/lang/NoSuchMethodError;" -.LstrNullPointerException: - .asciz "Ljava/lang/NullPointerException;" - +.LstrDivideByZero: + .asciz "divide by zero" .LstrLogTag: .asciz "mterp" .LstrExceptionNotCaughtLocally: diff --git a/vm/mterp/out/InterpAsm-armv5te.S b/vm/mterp/out/InterpAsm-armv5te.S index 90d8932a4..a36a75a12 100644 --- a/vm/mterp/out/InterpAsm-armv5te.S +++ b/vm/mterp/out/InterpAsm-armv5te.S @@ -89,7 +89,7 @@ unspecified registers or condition codes. /* * "export" the PC to the stack frame, f/b/o future exception objects. Must - * be done *before* something calls dvmThrowException. + * be done *before* something throws. * * In C this is "SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc", i.e. * fp - sizeof(StackSaveArea) + offsetof(SaveArea, xtra.currentPc) @@ -11106,9 +11106,6 @@ dvmAsmSisterStart: bne .LOP_NEW_INSTANCE_resolved @ no, continue b common_exceptionThrown @ yes, handle exception -.LstrInstantiationErrorPtr: - .word .LstrInstantiationError - /* continuation for OP_NEW_ARRAY */ @@ -11220,16 +11217,13 @@ dvmAsmSisterStart: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!0) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif /* continuation for OP_FILLED_NEW_ARRAY_RANGE */ @@ -11304,16 +11298,13 @@ dvmAsmSisterStart: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_RANGE_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!1) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif /* continuation for OP_CMPL_FLOAT */ @@ -12900,9 +12891,8 @@ d2l_doconv: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_JUMBO_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown /* continuation for OP_IGET_JUMBO */ @@ -21796,9 +21786,8 @@ common_errArrayIndex: */ common_errDivideByZero: EXPORT_PC() - ldr r0, strArithmeticException - ldr r1, strDivideByZero - bl dvmThrowException + ldr r0, strDivideByZero + bl dvmThrowArithmeticException b common_exceptionThrown /* @@ -21813,12 +21802,12 @@ common_errNegativeArraySize: /* * Invocation of a non-existent method. + * On entry: method name in r1 */ common_errNoSuchMethod: EXPORT_PC() - ldr r0, strNoSuchMethodError - mov r1, #0 - bl dvmThrowException + mov r0, r1 + bl dvmThrowNoSuchMethodError b common_exceptionThrown /* @@ -21828,9 +21817,8 @@ common_errNoSuchMethod: */ common_errNullObject: EXPORT_PC() - ldr r0, strNullPointerException - mov r1, #0 - bl dvmThrowException + mov r0, #0 + bl dvmThrowNullPointerException b common_exceptionThrown /* @@ -21966,15 +21954,8 @@ dvmConfigureFP: * String references, must be close to the code that uses them. */ .align 2 -strArithmeticException: - .word .LstrArithmeticException strDivideByZero: .word .LstrDivideByZero -strNoSuchMethodError: - .word .LstrNoSuchMethodError -strNullPointerException: - .word .LstrNullPointerException - strLogTag: .word .LstrLogTag strExceptionNotCaughtLocally: @@ -22002,21 +21983,10 @@ strPrintLong: .LstrBadEntryPoint: .asciz "Bad entry point %d\n" -.LstrArithmeticException: - .asciz "Ljava/lang/ArithmeticException;" -.LstrDivideByZero: - .asciz "divide by zero" .LstrFilledNewArrayNotImpl: .asciz "filled-new-array only implemented for objects and 'int'" -.LstrInternalError: - .asciz "Ljava/lang/InternalError;" -.LstrInstantiationError: - .asciz "Ljava/lang/InstantiationError;" -.LstrNoSuchMethodError: - .asciz "Ljava/lang/NoSuchMethodError;" -.LstrNullPointerException: - .asciz "Ljava/lang/NullPointerException;" - +.LstrDivideByZero: + .asciz "divide by zero" .LstrLogTag: .asciz "mterp" .LstrExceptionNotCaughtLocally: diff --git a/vm/mterp/out/InterpAsm-armv7-a-neon.S b/vm/mterp/out/InterpAsm-armv7-a-neon.S index 0f6904985..4ef5d0de6 100644 --- a/vm/mterp/out/InterpAsm-armv7-a-neon.S +++ b/vm/mterp/out/InterpAsm-armv7-a-neon.S @@ -89,7 +89,7 @@ unspecified registers or condition codes. /* * "export" the PC to the stack frame, f/b/o future exception objects. Must - * be done *before* something calls dvmThrowException. + * be done *before* something throws. * * In C this is "SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc", i.e. * fp - sizeof(StackSaveArea) + offsetof(SaveArea, xtra.currentPc) @@ -10738,9 +10738,6 @@ dvmAsmSisterStart: bne .LOP_NEW_INSTANCE_resolved @ no, continue b common_exceptionThrown @ yes, handle exception -.LstrInstantiationErrorPtr: - .word .LstrInstantiationError - /* continuation for OP_NEW_ARRAY */ @@ -10852,16 +10849,13 @@ dvmAsmSisterStart: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!0) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif /* continuation for OP_FILLED_NEW_ARRAY_RANGE */ @@ -10936,16 +10930,13 @@ dvmAsmSisterStart: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_RANGE_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!1) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif /* continuation for OP_CMPL_FLOAT */ @@ -12380,9 +12371,8 @@ d2l_doconv: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_JUMBO_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown /* continuation for OP_IGET_JUMBO */ @@ -21276,9 +21266,8 @@ common_errArrayIndex: */ common_errDivideByZero: EXPORT_PC() - ldr r0, strArithmeticException - ldr r1, strDivideByZero - bl dvmThrowException + ldr r0, strDivideByZero + bl dvmThrowArithmeticException b common_exceptionThrown /* @@ -21293,12 +21282,12 @@ common_errNegativeArraySize: /* * Invocation of a non-existent method. + * On entry: method name in r1 */ common_errNoSuchMethod: EXPORT_PC() - ldr r0, strNoSuchMethodError - mov r1, #0 - bl dvmThrowException + mov r0, r1 + bl dvmThrowNoSuchMethodError b common_exceptionThrown /* @@ -21308,9 +21297,8 @@ common_errNoSuchMethod: */ common_errNullObject: EXPORT_PC() - ldr r0, strNullPointerException - mov r1, #0 - bl dvmThrowException + mov r0, #0 + bl dvmThrowNullPointerException b common_exceptionThrown /* @@ -21446,15 +21434,8 @@ dvmConfigureFP: * String references, must be close to the code that uses them. */ .align 2 -strArithmeticException: - .word .LstrArithmeticException strDivideByZero: .word .LstrDivideByZero -strNoSuchMethodError: - .word .LstrNoSuchMethodError -strNullPointerException: - .word .LstrNullPointerException - strLogTag: .word .LstrLogTag strExceptionNotCaughtLocally: @@ -21482,21 +21463,10 @@ strPrintLong: .LstrBadEntryPoint: .asciz "Bad entry point %d\n" -.LstrArithmeticException: - .asciz "Ljava/lang/ArithmeticException;" -.LstrDivideByZero: - .asciz "divide by zero" .LstrFilledNewArrayNotImpl: .asciz "filled-new-array only implemented for objects and 'int'" -.LstrInternalError: - .asciz "Ljava/lang/InternalError;" -.LstrInstantiationError: - .asciz "Ljava/lang/InstantiationError;" -.LstrNoSuchMethodError: - .asciz "Ljava/lang/NoSuchMethodError;" -.LstrNullPointerException: - .asciz "Ljava/lang/NullPointerException;" - +.LstrDivideByZero: + .asciz "divide by zero" .LstrLogTag: .asciz "mterp" .LstrExceptionNotCaughtLocally: diff --git a/vm/mterp/out/InterpAsm-armv7-a.S b/vm/mterp/out/InterpAsm-armv7-a.S index fd218ead8..c1a790b50 100644 --- a/vm/mterp/out/InterpAsm-armv7-a.S +++ b/vm/mterp/out/InterpAsm-armv7-a.S @@ -89,7 +89,7 @@ unspecified registers or condition codes. /* * "export" the PC to the stack frame, f/b/o future exception objects. Must - * be done *before* something calls dvmThrowException. + * be done *before* something throws. * * In C this is "SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc", i.e. * fp - sizeof(StackSaveArea) + offsetof(SaveArea, xtra.currentPc) @@ -10738,9 +10738,6 @@ dvmAsmSisterStart: bne .LOP_NEW_INSTANCE_resolved @ no, continue b common_exceptionThrown @ yes, handle exception -.LstrInstantiationErrorPtr: - .word .LstrInstantiationError - /* continuation for OP_NEW_ARRAY */ @@ -10852,16 +10849,13 @@ dvmAsmSisterStart: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!0) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif /* continuation for OP_FILLED_NEW_ARRAY_RANGE */ @@ -10936,16 +10930,13 @@ dvmAsmSisterStart: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_RANGE_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown .if (!1) @ define in one or the other, not both .L_strFilledNewArrayNotImpl: .word .LstrFilledNewArrayNotImpl -.L_strInternalError: - .word .LstrInternalError .endif /* continuation for OP_CMPL_FLOAT */ @@ -12380,9 +12371,8 @@ d2l_doconv: * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_JUMBO_notimpl: - ldr r0, .L_strInternalError - ldr r1, .L_strFilledNewArrayNotImpl - bl dvmThrowException + ldr r0, .L_strFilledNewArrayNotImpl + bl dvmThrowInternalError b common_exceptionThrown /* continuation for OP_IGET_JUMBO */ @@ -21276,9 +21266,8 @@ common_errArrayIndex: */ common_errDivideByZero: EXPORT_PC() - ldr r0, strArithmeticException - ldr r1, strDivideByZero - bl dvmThrowException + ldr r0, strDivideByZero + bl dvmThrowArithmeticException b common_exceptionThrown /* @@ -21293,12 +21282,12 @@ common_errNegativeArraySize: /* * Invocation of a non-existent method. + * On entry: method name in r1 */ common_errNoSuchMethod: EXPORT_PC() - ldr r0, strNoSuchMethodError - mov r1, #0 - bl dvmThrowException + mov r0, r1 + bl dvmThrowNoSuchMethodError b common_exceptionThrown /* @@ -21308,9 +21297,8 @@ common_errNoSuchMethod: */ common_errNullObject: EXPORT_PC() - ldr r0, strNullPointerException - mov r1, #0 - bl dvmThrowException + mov r0, #0 + bl dvmThrowNullPointerException b common_exceptionThrown /* @@ -21446,15 +21434,8 @@ dvmConfigureFP: * String references, must be close to the code that uses them. */ .align 2 -strArithmeticException: - .word .LstrArithmeticException strDivideByZero: .word .LstrDivideByZero -strNoSuchMethodError: - .word .LstrNoSuchMethodError -strNullPointerException: - .word .LstrNullPointerException - strLogTag: .word .LstrLogTag strExceptionNotCaughtLocally: @@ -21482,21 +21463,10 @@ strPrintLong: .LstrBadEntryPoint: .asciz "Bad entry point %d\n" -.LstrArithmeticException: - .asciz "Ljava/lang/ArithmeticException;" -.LstrDivideByZero: - .asciz "divide by zero" .LstrFilledNewArrayNotImpl: .asciz "filled-new-array only implemented for objects and 'int'" -.LstrInternalError: - .asciz "Ljava/lang/InternalError;" -.LstrInstantiationError: - .asciz "Ljava/lang/InstantiationError;" -.LstrNoSuchMethodError: - .asciz "Ljava/lang/NoSuchMethodError;" -.LstrNullPointerException: - .asciz "Ljava/lang/NullPointerException;" - +.LstrDivideByZero: + .asciz "divide by zero" .LstrLogTag: .asciz "mterp" .LstrExceptionNotCaughtLocally: diff --git a/vm/mterp/out/InterpAsm-x86.S b/vm/mterp/out/InterpAsm-x86.S index 4f7a2f51c..669844721 100644 --- a/vm/mterp/out/InterpAsm-x86.S +++ b/vm/mterp/out/InterpAsm-x86.S @@ -147,7 +147,7 @@ Notes: /* * "export" the PC to the interpreted stack frame, f/b/o future exception - * objects. Must * be done *before* something calls dvmThrowException. + * objects. Must be done *before* something throws. * * In C this is "SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc", i.e. * fp - sizeof(StackSaveArea) + offsetof(SaveArea, xtra.currentPc) @@ -1028,11 +1028,7 @@ dvmAsmInstructionStartCode = .L_OP_NOP cmpb $CLASS_INITIALIZED,offClassObject_status(%ecx) jne .LOP_NEW_INSTANCE_needinit .LOP_NEW_INSTANCE_initialized: # on entry, ecx<- class - /* TODO: remove test for interface/abstract, now done in verifier */ - testl $(ACC_INTERFACE|ACC_ABSTRACT),offClassObject_accessFlags(%ecx) movl $ALLOC_DONT_TRACK,OUT_ARG1(%esp) - jne .LOP_NEW_INSTANCE_abstract -.LOP_NEW_INSTANCE_finish: # ecx=class movl %ecx,OUT_ARG0(%esp) call dvmAllocObject # eax<- new object FETCH_INST_OPCODE 2 %ecx @@ -1075,20 +1071,6 @@ dvmAsmInstructionStartCode = .L_OP_NOP jne .LOP_NEW_INSTANCE_resolved # good to go jmp common_exceptionThrown # no, handle exception - /* - * TODO: remove this - * We can't instantiate an abstract class or interface, so throw an - * InstantiationError with the class descriptor as the message. - * - * ecx holds class object - */ -.LOP_NEW_INSTANCE_abstract: - movl offClassObject_descriptor(%ecx),%eax - movl $.LstrInstantiationError,OUT_ARG0(%esp) - movl %eax,OUT_ARG1(%esp) - call dvmThrowExceptionWithClassMessage - jmp common_exceptionThrown - /* ------------------------------ */ .L_OP_NEW_ARRAY: /* 0x23 */ /* File: x86/OP_NEW_ARRAY.S */ @@ -1279,11 +1261,9 @@ dvmAsmInstructionStartCode = .L_OP_NOP * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_notimpl: - movl $.LstrInternalErrorA,%eax - movl %eax,OUT_ARG0(%esp) movl $.LstrFilledNewArrayNotImplA,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowInternalError jmp common_exceptionThrown /* ------------------------------ */ @@ -1412,11 +1392,9 @@ dvmAsmInstructionStartCode = .L_OP_NOP * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_RANGE_notimpl: - movl $.LstrInternalErrorA,%eax - movl %eax,OUT_ARG0(%esp) movl $.LstrFilledNewArrayNotImplA,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowInternalError jmp common_exceptionThrown @@ -4003,7 +3981,6 @@ dvmAsmInstructionStartCode = .L_OP_NOP */ .LOP_INVOKE_SUPER_nsm: movl offMethod_name(%ecx),%eax - mov %eax,OUT_ARG1(%esp) jmp common_errNoSuchMethod /* ------------------------------ */ @@ -4246,7 +4223,6 @@ dvmAsmInstructionStartCode = .L_OP_NOP */ .LOP_INVOKE_SUPER_RANGE_nsm: movl offMethod_name(%ecx),%eax - mov %eax,OUT_ARG1(%esp) jmp common_errNoSuchMethod @@ -8187,11 +8163,7 @@ dvmAsmInstructionStartCode = .L_OP_NOP cmpb $CLASS_INITIALIZED,offClassObject_status(%ecx) jne .LOP_NEW_INSTANCE_JUMBO_needinit .LOP_NEW_INSTANCE_JUMBO_initialized: # on entry, ecx<- class - /* TODO: remove test for interface/abstract, now done in verifier */ - testl $(ACC_INTERFACE|ACC_ABSTRACT),offClassObject_accessFlags(%ecx) movl $ALLOC_DONT_TRACK,OUT_ARG1(%esp) - jne .LOP_NEW_INSTANCE_JUMBO_abstract -.LOP_NEW_INSTANCE_JUMBO_finish: # ecx=class movl %ecx,OUT_ARG0(%esp) call dvmAllocObject # eax<- new object UNSPILL(rIBASE) @@ -8234,20 +8206,6 @@ dvmAsmInstructionStartCode = .L_OP_NOP jne .LOP_NEW_INSTANCE_JUMBO_resolved # good to go jmp common_exceptionThrown # no, handle exception - /* - * TODO: remove this - * We can't instantiate an abstract class or interface, so throw an - * InstantiationError with the class descriptor as the message. - * - * ecx holds class object - */ -.LOP_NEW_INSTANCE_JUMBO_abstract: - movl offClassObject_descriptor(%ecx),%eax - movl $.LstrInstantiationError,OUT_ARG0(%esp) - movl %eax,OUT_ARG1(%esp) - call dvmThrowExceptionWithClassMessage - jmp common_exceptionThrown - /* ------------------------------ */ .L_OP_NEW_ARRAY_JUMBO: /* 0x104 */ /* File: x86/OP_NEW_ARRAY_JUMBO.S */ @@ -8408,11 +8366,9 @@ dvmAsmInstructionStartCode = .L_OP_NOP * mode of filled-new-array. */ .LOP_FILLED_NEW_ARRAY_JUMBO_notimpl: - movl $.LstrInternalErrorA,%eax - movl %eax,OUT_ARG0(%esp) movl $.LstrFilledNewArrayNotImplA,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowInternalError jmp common_exceptionThrown /* ------------------------------ */ @@ -9846,7 +9802,6 @@ dvmAsmInstructionStartCode = .L_OP_NOP */ .LOP_INVOKE_SUPER_JUMBO_nsm: movl offMethod_name(%ecx),%eax - mov %eax,OUT_ARG1(%esp) jmp common_errNoSuchMethod /* ------------------------------ */ @@ -21916,11 +21871,9 @@ common_gotoBail: */ common_errDivideByZero: EXPORT_PC - movl $.LstrArithmeticException,%eax - movl %eax,OUT_ARG0(%esp) movl $.LstrDivideByZero,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowArithmeticException jmp common_exceptionThrown /* @@ -21935,15 +21888,13 @@ common_errNegativeArraySize: /* * Attempt to allocate an array with a negative size. + * On entry, method name in eax */ common_errNoSuchMethod: EXPORT_PC - movl $.LstrNoSuchMethodError,%eax movl %eax,OUT_ARG0(%esp) - xorl %eax,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + call dvmThrowNoSuchMethodError jmp common_exceptionThrown /* @@ -21952,11 +21903,9 @@ common_errNoSuchMethod: */ common_errNullObject: EXPORT_PC - movl $.LstrNullPointerException,%eax - movl %eax,OUT_ARG0(%esp) xorl %eax,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowNullPointerException jmp common_exceptionThrown /* @@ -22000,18 +21949,8 @@ common_abort: */ .section .rodata -.LstrNullPointerException: - .asciz "Ljava/lang/NullPointerException;" -.LstrArithmeticException: - .asciz "Ljava/lang/ArithmeticException;" .LstrDivideByZero: .asciz "divide by zero" -.LstrInstantiationError: - .asciz "Ljava/lang/InstantiationError;" -.LstrNoSuchMethodError: - .asciz "Ljava/lang/NoSuchMethodError;" -.LstrInternalErrorA: - .asciz "Ljava/lang/InternalError;" .LstrFilledNewArrayNotImplA: .asciz "filled-new-array only implemented for 'int'" diff --git a/vm/mterp/out/InterpC-allstubs.c b/vm/mterp/out/InterpC-allstubs.c index 248f37e03..6dc0fac54 100644 --- a/vm/mterp/out/InterpC-allstubs.c +++ b/vm/mterp/out/InterpC-allstubs.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpC-armv5te-vfp.c b/vm/mterp/out/InterpC-armv5te-vfp.c index bd8e838ea..0e1383548 100644 --- a/vm/mterp/out/InterpC-armv5te-vfp.c +++ b/vm/mterp/out/InterpC-armv5te-vfp.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpC-armv5te.c b/vm/mterp/out/InterpC-armv5te.c index c6123e525..5847600f3 100644 --- a/vm/mterp/out/InterpC-armv5te.c +++ b/vm/mterp/out/InterpC-armv5te.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpC-armv7-a-neon.c b/vm/mterp/out/InterpC-armv7-a-neon.c index 45c3135e7..0e87b82c6 100644 --- a/vm/mterp/out/InterpC-armv7-a-neon.c +++ b/vm/mterp/out/InterpC-armv7-a-neon.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpC-armv7-a.c b/vm/mterp/out/InterpC-armv7-a.c index 2fc1313e5..92aeff1b9 100644 --- a/vm/mterp/out/InterpC-armv7-a.c +++ b/vm/mterp/out/InterpC-armv7-a.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpC-portdbg.c b/vm/mterp/out/InterpC-portdbg.c index e00297319..0a644e67a 100644 --- a/vm/mterp/out/InterpC-portdbg.c +++ b/vm/mterp/out/InterpC-portdbg.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpC-portstd.c b/vm/mterp/out/InterpC-portstd.c index 94f182ed2..4c5c2cc64 100644 --- a/vm/mterp/out/InterpC-portstd.c +++ b/vm/mterp/out/InterpC-portstd.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpC-x86-atom.c b/vm/mterp/out/InterpC-x86-atom.c index 47ae3ca39..edaac5ae3 100644 --- a/vm/mterp/out/InterpC-x86-atom.c +++ b/vm/mterp/out/InterpC-x86-atom.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/out/InterpC-x86.c b/vm/mterp/out/InterpC-x86.c index c12b262aa..ce8d5801d 100644 --- a/vm/mterp/out/InterpC-x86.c +++ b/vm/mterp/out/InterpC-x86.c @@ -317,10 +317,10 @@ static inline void putDoubleToArray(u4* ptr, int idx, double dval) /* * The current PC must be available to Throwable constructors, e.g. - * those created by dvmThrowException(), so that the exception stack - * trace can be generated correctly. If we don't do this, the offset - * within the current method won't be shown correctly. See the notes - * in Exception.c. + * those created by the various exception throw routines, so that the + * exception stack trace can be generated correctly. If we don't do this, + * the offset within the current method won't be shown correctly. See the + * notes in Exception.c. * * This is also used to determine the address for precise GC. * diff --git a/vm/mterp/x86-atom/TODO.txt b/vm/mterp/x86-atom/TODO.txt index 0da4d717a..1c0acc824 100644 --- a/vm/mterp/x86-atom/TODO.txt +++ b/vm/mterp/x86-atom/TODO.txt @@ -24,6 +24,7 @@ Items requiring attention: (md) Use dvmThrowClassCastException(actual, desired) for class cast errors. (md) Use dvmThrowArrayStoreException(actual, desired) for array store errors. (md) Use dvmThrowNegativeArraySizeException(len) forarray alloc errors +(md) Replace any remaining use of dvmThrowException with proper helper function (lo) Implement OP_BREAKPOINT (lo) Implement OP_EXECUTE_INLINE_RANGE diff --git a/vm/mterp/x86/OP_FILLED_NEW_ARRAY.S b/vm/mterp/x86/OP_FILLED_NEW_ARRAY.S index 91a26b8d5..dde53aaad 100644 --- a/vm/mterp/x86/OP_FILLED_NEW_ARRAY.S +++ b/vm/mterp/x86/OP_FILLED_NEW_ARRAY.S @@ -123,9 +123,7 @@ * mode of filled-new-array. */ .L${opcode}_notimpl: - movl $$.LstrInternalErrorA,%eax - movl %eax,OUT_ARG0(%esp) movl $$.LstrFilledNewArrayNotImplA,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowInternalError jmp common_exceptionThrown diff --git a/vm/mterp/x86/OP_FILLED_NEW_ARRAY_JUMBO.S b/vm/mterp/x86/OP_FILLED_NEW_ARRAY_JUMBO.S index 1a285f1c1..80f2b38d6 100644 --- a/vm/mterp/x86/OP_FILLED_NEW_ARRAY_JUMBO.S +++ b/vm/mterp/x86/OP_FILLED_NEW_ARRAY_JUMBO.S @@ -94,9 +94,7 @@ * mode of filled-new-array. */ .L${opcode}_notimpl: - movl $$.LstrInternalErrorA,%eax - movl %eax,OUT_ARG0(%esp) movl $$.LstrFilledNewArrayNotImplA,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowInternalError jmp common_exceptionThrown diff --git a/vm/mterp/x86/OP_INVOKE_SUPER.S b/vm/mterp/x86/OP_INVOKE_SUPER.S index c8ca2e1a5..ecee028e8 100644 --- a/vm/mterp/x86/OP_INVOKE_SUPER.S +++ b/vm/mterp/x86/OP_INVOKE_SUPER.S @@ -63,5 +63,4 @@ */ .L${opcode}_nsm: movl offMethod_name(%ecx),%eax - mov %eax,OUT_ARG1(%esp) jmp common_errNoSuchMethod diff --git a/vm/mterp/x86/OP_INVOKE_SUPER_JUMBO.S b/vm/mterp/x86/OP_INVOKE_SUPER_JUMBO.S index b09096325..d98e14d10 100644 --- a/vm/mterp/x86/OP_INVOKE_SUPER_JUMBO.S +++ b/vm/mterp/x86/OP_INVOKE_SUPER_JUMBO.S @@ -56,5 +56,4 @@ */ .L${opcode}_nsm: movl offMethod_name(%ecx),%eax - mov %eax,OUT_ARG1(%esp) jmp common_errNoSuchMethod diff --git a/vm/mterp/x86/OP_NEW_INSTANCE.S b/vm/mterp/x86/OP_NEW_INSTANCE.S index 00a178b0a..3e268c40d 100644 --- a/vm/mterp/x86/OP_NEW_INSTANCE.S +++ b/vm/mterp/x86/OP_NEW_INSTANCE.S @@ -23,11 +23,7 @@ cmpb $$CLASS_INITIALIZED,offClassObject_status(%ecx) jne .L${opcode}_needinit .L${opcode}_initialized: # on entry, ecx<- class - /* TODO: remove test for interface/abstract, now done in verifier */ - testl $$(ACC_INTERFACE|ACC_ABSTRACT),offClassObject_accessFlags(%ecx) movl $$ALLOC_DONT_TRACK,OUT_ARG1(%esp) - jne .L${opcode}_abstract -.L${opcode}_finish: # ecx=class movl %ecx,OUT_ARG0(%esp) call dvmAllocObject # eax<- new object FETCH_INST_OPCODE 2 %ecx @@ -69,17 +65,3 @@ testl %ecx,%ecx # success? jne .L${opcode}_resolved # good to go jmp common_exceptionThrown # no, handle exception - - /* - * TODO: remove this - * We can't instantiate an abstract class or interface, so throw an - * InstantiationError with the class descriptor as the message. - * - * ecx holds class object - */ -.L${opcode}_abstract: - movl offClassObject_descriptor(%ecx),%eax - movl $$.LstrInstantiationError,OUT_ARG0(%esp) - movl %eax,OUT_ARG1(%esp) - call dvmThrowExceptionWithClassMessage - jmp common_exceptionThrown diff --git a/vm/mterp/x86/OP_NEW_INSTANCE_JUMBO.S b/vm/mterp/x86/OP_NEW_INSTANCE_JUMBO.S index 96ae85f73..aebb2d03a 100644 --- a/vm/mterp/x86/OP_NEW_INSTANCE_JUMBO.S +++ b/vm/mterp/x86/OP_NEW_INSTANCE_JUMBO.S @@ -23,11 +23,7 @@ cmpb $$CLASS_INITIALIZED,offClassObject_status(%ecx) jne .L${opcode}_needinit .L${opcode}_initialized: # on entry, ecx<- class - /* TODO: remove test for interface/abstract, now done in verifier */ - testl $$(ACC_INTERFACE|ACC_ABSTRACT),offClassObject_accessFlags(%ecx) movl $$ALLOC_DONT_TRACK,OUT_ARG1(%esp) - jne .L${opcode}_abstract -.L${opcode}_finish: # ecx=class movl %ecx,OUT_ARG0(%esp) call dvmAllocObject # eax<- new object UNSPILL(rIBASE) @@ -69,17 +65,3 @@ testl %ecx,%ecx # success? jne .L${opcode}_resolved # good to go jmp common_exceptionThrown # no, handle exception - - /* - * TODO: remove this - * We can't instantiate an abstract class or interface, so throw an - * InstantiationError with the class descriptor as the message. - * - * ecx holds class object - */ -.L${opcode}_abstract: - movl offClassObject_descriptor(%ecx),%eax - movl $$.LstrInstantiationError,OUT_ARG0(%esp) - movl %eax,OUT_ARG1(%esp) - call dvmThrowExceptionWithClassMessage - jmp common_exceptionThrown diff --git a/vm/mterp/x86/footer.S b/vm/mterp/x86/footer.S index 54dcbb4fe..a185096e6 100644 --- a/vm/mterp/x86/footer.S +++ b/vm/mterp/x86/footer.S @@ -577,11 +577,9 @@ common_gotoBail: */ common_errDivideByZero: EXPORT_PC - movl $$.LstrArithmeticException,%eax - movl %eax,OUT_ARG0(%esp) movl $$.LstrDivideByZero,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowArithmeticException jmp common_exceptionThrown /* @@ -596,15 +594,13 @@ common_errNegativeArraySize: /* * Attempt to allocate an array with a negative size. + * On entry, method name in eax */ common_errNoSuchMethod: EXPORT_PC - movl $$.LstrNoSuchMethodError,%eax movl %eax,OUT_ARG0(%esp) - xorl %eax,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + call dvmThrowNoSuchMethodError jmp common_exceptionThrown /* @@ -613,11 +609,9 @@ common_errNoSuchMethod: */ common_errNullObject: EXPORT_PC - movl $$.LstrNullPointerException,%eax - movl %eax,OUT_ARG0(%esp) xorl %eax,%eax - movl %eax,OUT_ARG1(%esp) - call dvmThrowException + movl %eax,OUT_ARG0(%esp) + call dvmThrowNullPointerException jmp common_exceptionThrown /* @@ -661,17 +655,7 @@ common_abort: */ .section .rodata -.LstrNullPointerException: - .asciz "Ljava/lang/NullPointerException;" -.LstrArithmeticException: - .asciz "Ljava/lang/ArithmeticException;" .LstrDivideByZero: .asciz "divide by zero" -.LstrInstantiationError: - .asciz "Ljava/lang/InstantiationError;" -.LstrNoSuchMethodError: - .asciz "Ljava/lang/NoSuchMethodError;" -.LstrInternalErrorA: - .asciz "Ljava/lang/InternalError;" .LstrFilledNewArrayNotImplA: .asciz "filled-new-array only implemented for 'int'" diff --git a/vm/mterp/x86/header.S b/vm/mterp/x86/header.S index 68b944157..0dd35b5cb 100644 --- a/vm/mterp/x86/header.S +++ b/vm/mterp/x86/header.S @@ -140,7 +140,7 @@ Notes: /* * "export" the PC to the interpreted stack frame, f/b/o future exception - * objects. Must * be done *before* something calls dvmThrowException. + * objects. Must be done *before* something throws. * * In C this is "SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc", i.e. * fp - sizeof(StackSaveArea) + offsetof(SaveArea, xtra.currentPc) -- 2.11.0