From 99bfd71ed695483dadd14478ffb4743ad0bbd566 Mon Sep 17 00:00:00 2001 From: twisti Date: Tue, 11 Apr 2006 10:20:18 +0000 Subject: [PATCH] * src/vm/builtin.c (builtin_throw_exception): Changed return type and return NULL. This is less error-prone in asm_vm_call_method. * src/vm/builtin.h: Likewise. * src/vm/jit/alpha/asmpart.S (asm_vm_call_method_exception_handler): Don't set v0 to NULL. This is now done in builtin_throw_exception. * src/vm/jit/i386/asmpart.S: Likewise. * src/vm/jit/mips/asmpart.S: Likewise. * src/vm/jit/powerpc/asmpart.S: Likewise. * src/vm/jit/x86_64/asmpart.S: Likewise. --- src/vm/builtin.c | 18 +++++++++++++----- src/vm/builtin.h | 4 ++-- src/vm/jit/alpha/asmpart.S | 3 +-- src/vm/jit/i386/asmpart.S | 3 +-- src/vm/jit/mips/asmpart.S | 3 +-- src/vm/jit/powerpc/asmpart.S | 3 +-- src/vm/jit/x86_64/asmpart.S | 3 +-- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/vm/builtin.c b/src/vm/builtin.c index 0fd75d68e..8f946ed7e 100644 --- a/src/vm/builtin.c +++ b/src/vm/builtin.c @@ -37,7 +37,7 @@ calls instead of machine instructions, using the C calling convention. - $Id: builtin.c 4732 2006-04-04 21:31:52Z edwin $ + $Id: builtin.c 4749 2006-04-11 10:20:18Z twisti $ */ @@ -500,11 +500,14 @@ s4 builtin_arrayinstanceof(java_objectheader *o, classinfo *targetclass) } -/************************** exception functions ******************************* +/* builtin_throw_exception ***************************************************** -******************************************************************************/ + Sets the exceptionptr with the thrown exception and prints some + debugging information. Called from asm_vm_call_method. + +*******************************************************************************/ -java_objectheader *builtin_throw_exception(java_objectheader *xptr) +void *builtin_throw_exception(java_objectheader *xptr) { #if !defined(NDEBUG) java_lang_Throwable *t; @@ -561,9 +564,14 @@ java_objectheader *builtin_throw_exception(java_objectheader *xptr) } #endif /* !defined(NDEBUG) */ + /* actually set the exception */ + *exceptionptr = xptr; - return xptr; + /* Return a NULL pointer. This is required for vm_call_method to + check for an exception. This is for convenience. */ + + return NULL; } diff --git a/src/vm/builtin.h b/src/vm/builtin.h index 32c0bc834..b4f57694c 100644 --- a/src/vm/builtin.h +++ b/src/vm/builtin.h @@ -29,7 +29,7 @@ Changes: Edwin Steiner Christian Thalinger - $Id: builtin.h 4357 2006-01-22 23:33:38Z twisti $ + $Id: builtin.h 4749 2006-04-11 10:20:18Z twisti $ */ @@ -133,7 +133,7 @@ s4 builtin_arrayinstanceof(java_objectheader *o, classinfo *targetclass); s4 builtin_arraycheckcast(java_objectheader *o, classinfo *targetclass); #define BUILTIN_arraycheckcast (functionptr) builtin_arraycheckcast -java_objectheader *builtin_throw_exception(java_objectheader *exception); +void *builtin_throw_exception(java_objectheader *exception); /* NOT AN OP */ java_objectheader *builtin_trace_exception(java_objectheader *xptr, methodinfo *m, diff --git a/src/vm/jit/alpha/asmpart.S b/src/vm/jit/alpha/asmpart.S index e08037a89..3bba189a2 100644 --- a/src/vm/jit/alpha/asmpart.S +++ b/src/vm/jit/alpha/asmpart.S @@ -31,7 +31,7 @@ Christian Thalinger Edwin Steiner - $Id: asmpart.S 4735 2006-04-05 10:02:14Z twisti $ + $Id: asmpart.S 4749 2006-04-11 10:20:18Z twisti $ */ @@ -203,7 +203,6 @@ asm_vm_call_method_exception_handler: ldq ra,0*8(sp) /* restore return address */ ldq s6,3*8(sp) lda sp,5*8(sp) /* free stack space */ - mov zero,v0 /* return NULL */ jmp zero,(ra) .end asm_vm_call_method diff --git a/src/vm/jit/i386/asmpart.S b/src/vm/jit/i386/asmpart.S index 2b7c68b52..eb563e5a5 100644 --- a/src/vm/jit/i386/asmpart.S +++ b/src/vm/jit/i386/asmpart.S @@ -31,7 +31,7 @@ Changes: Joseph Wenninger Edwin Steiner - $Id: asmpart.S 4732 2006-04-04 21:31:52Z edwin $ + $Id: asmpart.S 4749 2006-04-11 10:20:18Z twisti $ */ @@ -225,7 +225,6 @@ asm_vm_call_method_exception_handler: push xptr /* pass exception pointer */ call builtin_throw_exception add $4,sp - xor v0,v0 /* return NULL */ jmp L_asm_vm_call_method_return diff --git a/src/vm/jit/mips/asmpart.S b/src/vm/jit/mips/asmpart.S index 062fd643a..d92418f99 100644 --- a/src/vm/jit/mips/asmpart.S +++ b/src/vm/jit/mips/asmpart.S @@ -29,7 +29,7 @@ Changes: Christian Thalinger Edwin Steiner - $Id: asmpart.S 4735 2006-04-05 10:02:14Z twisti $ + $Id: asmpart.S 4749 2006-04-11 10:20:18Z twisti $ */ @@ -244,7 +244,6 @@ asm_vm_call_method_exception_handler: aaddu sp,s7,sp move a0,itmp1 jal builtin_throw_exception - move v0,zero /* clear return value for exception */ b calljava_return2 .end asm_vm_call_method diff --git a/src/vm/jit/powerpc/asmpart.S b/src/vm/jit/powerpc/asmpart.S index 14bf6e2c2..8af4da150 100644 --- a/src/vm/jit/powerpc/asmpart.S +++ b/src/vm/jit/powerpc/asmpart.S @@ -31,7 +31,7 @@ Changes: Christian Thalinger Edwin Steiner - $Id: asmpart.S 4735 2006-04-05 10:02:14Z twisti $ + $Id: asmpart.S 4749 2006-04-11 10:20:18Z twisti $ */ @@ -279,7 +279,6 @@ L_asm_vm_call_method_return: asm_vm_call_method_exception_handler: mr r3,itmp1 bl builtin_throw_exception - li v0,0 /* return NULL */ b L_asm_vm_call_method_return diff --git a/src/vm/jit/x86_64/asmpart.S b/src/vm/jit/x86_64/asmpart.S index 2297e8b5f..a502aaaa8 100644 --- a/src/vm/jit/x86_64/asmpart.S +++ b/src/vm/jit/x86_64/asmpart.S @@ -30,7 +30,7 @@ Changes: Edwin Steiner - $Id: asmpart.S 4735 2006-04-05 10:02:14Z twisti $ + $Id: asmpart.S 4749 2006-04-11 10:20:18Z twisti $ */ @@ -220,7 +220,6 @@ L_asm_vm_call_method_return: asm_vm_call_method_exception_handler: mov xptr,a0 /* pass exception pointer */ call builtin_throw_exception@PLT - xor v0,v0 /* return NULL */ jmp L_asm_vm_call_method_return -- 2.25.1