$PWD/classpath/native/jni/java-util/.libs:$PWD/classpath/native/jni/java-awt/.libs:$PWD/classpath/native/jni/gtk-peer/.libs:\
$PWD/classpath/native/jni/java-io/.libs:$PWD/classpath/native/jni/classpath/.libs:\
$PWD/classpath/native/jni/java-net/.libs:$LD_LIBRARY_PATH
-export CLASSPATH=.:$PWD/classpath/lib/glibj.zip:$CLASSPATH
+export CLASSPATH=.:$PWD/classpath/lib/glibj.zip:$PWD/classpath/lib/rt.jar:$CLASSPATH
export PATH=$PWD/cacao:$PATH
Changes: Joseph Wenninger
- $Id: VMSecurityManager.c 1680 2004-12-04 12:02:08Z jowenn $
+ $Id: VMSecurityManager.c 1683 2004-12-05 21:33:36Z jowenn $
*/
if (cacao_initializing)
return NULL;
-#ifdef __I386__
+#if defined(__I386__) || defined(__ALPHA__)
return cacao_currentClassLoader();
#else
return 0;
{
log_text("Java_java_lang_VMSecurityManager_getClassContext called");
if (cacao_initializing) return 0;
-#ifdef __I386__
+#if defined(__I386__) || defined(__ALPHA__)
return cacao_createClassContextArray();
#else
return 0;
Authors: Joseph Wenninger
- $Id: VMThrowable.c 1680 2004-12-04 12:02:08Z jowenn $
+ $Id: VMThrowable.c 1683 2004-12-05 21:33:36Z jowenn $
*/
if (vmthrow == NULL)
panic("Needed instance of class java.lang.VMThrowable could not be created");
-#ifdef __I386__
+#if defined(__I386__) || defined(__ALPHA__)
cacao_stacktrace_NormalTrace(&(vmthrow->vmData));
#endif
return vmthrow;
*/
JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMThrowable_getStackTrace(JNIEnv *env, java_lang_VMThrowable *this, java_lang_Throwable *par1)
{
-#ifdef __I386__
+#if defined(__I386__) || defined(__ALPHA__)
stackTraceBuffer *buf=(stackTraceBuffer*)this->vmData;
u8 size;
stacktraceelement *el;
Changes: Mark Probst
Philipp Tomsich
Edwin Steiner
+ Joseph Wenninger
- $Id: global.h 1680 2004-12-04 12:02:08Z jowenn $
+ $Id: global.h 1683 2004-12-05 21:33:36Z jowenn $
*/
void *oldThreadspecificHeadValue;
void **addressOfThreadspecificHead;
methodinfo *method;
+#ifdef __ALPHA__
+ void *savedpv;
+#endif
void *beginOfJavaStackframe; /*only used if != 0*/
void *returnToFromNative;
--- /dev/null
+/* vm/jit/alpha/asmoffsets.h - machine code generator for alpha
+
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Institut f. Computersprachen, TU Wien
+ R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+ S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+ J. Wenninger
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ Contact: cacao@complang.tuwien.ac.at
+
+ Authors: Joseph Wenninger
+
+ $Id: asmoffsets.h 1683 2004-12-05 21:33:36Z jowenn $
+
+*/
+
+#ifndef _ASM_OFFSETS_H_
+#define _ASM_OFFSETS_H_
+
+#define MethodPointer -8
+#define FrameSize -12
+#define IsSync -16
+#define IsLeaf -20
+#define IntSave -24
+#define FltSave -28
+#define LineNumberTableSize -40
+#define LineNumberTableStart -48
+/* DEFINE LINE NUMBER STUFF HERE */
+#define ExTableSize -56
+#define ExTableStart -56
+
+#define ExEntrySize -32
+#define ExStartPC -8
+#define ExEndPC -16
+#define ExHandlerPC -24
+#define ExCatchType -32
+
+#endif
Authors: Andreas Krall
Reinhard Grafl
- $Id: asmpart.S 1624 2004-11-30 14:49:45Z twisti $
+ Changes: Joseph Wenninger
+
+ $Id: asmpart.S 1683 2004-12-05 21:33:36Z jowenn $
*/
#include "config.h"
#include "vm/jit/alpha/offsets.h"
-
-
-#define MethodPointer -8
-#define FrameSize -12
-#define IsSync -16
-#define IsLeaf -20
-#define IntSave -24
-#define FltSave -28
-/* DEFINE LINE NUMBER STUFF HERE */
-#define ExTableSize -56
-#define ExTableStart -56
-
-#define ExEntrySize -32
-#define ExStartPC -8
-#define ExEndPC -16
-#define ExHandlerPC -24
-#define ExCatchType -32
-
+#include "vm/jit/alpha/asmoffsets.h"
#define v0 $0
.globl asm_calljavafunction2double
.globl asm_calljavafunction2long
.globl asm_call_jit_compiler
+ .globl asm_throw_and_handle_exception
+ .globl asm_throw_and_handle_nat_exception
+ .globl asm_throw_and_handle_arithmetic_exception
+ .globl asm_throw_and_handle_arrayindexoutofbounds_exception
.globl asm_handle_exception
.globl asm_handle_nat_exception
.globl asm_check_clinit
.globl asm_builtin_exittrace
.globl asm_criticalsections
.globl asm_getclassvalues_atomic
+ .globl asm_prepare_native_stackinfo
+ .globl asm_remove_native_stackinfo
+ .globl asm_refillin_and_handle_exception
/*************************** imported functions *******************************/
.end asm_call_jit_compiler
+/**************** function asm_refillin_and_handle_exception *******************
+* *
+* This function handles an exception. It does not use the usual calling *
+* conventions. The exception is passed in REG_ITMP1 and the *
+* pc from the exception raising position is passed in REG_ITMP2. *
+* a0 contains the PV of the function causing the problem *
+* *
+* void asm_handle_arithmetic_exception (exceptionclass, exceptionpc); *
+* *
+*******************************************************************************/
+ .ent asm_refillin_and_handle_exception
+asm_refillin_and_handle_exception:
+ ldgp gp,0(pv)
+ ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
+ sll t0,48,t0
+ sra t0,48,t0 /* isolate offset */
+ addq t0,ra,pv /* compute update address */
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ srl t0,16,t0 /* isolate instruction code */
+ lda t0,-0x177b(t0) /* test for LDAH */
+ bne t0, asm_refillin_and_handle_exception_cont
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ sll t0,16,t0 /* compute high offset */
+ addl t0,0,t0 /* sign extend high offset */
+ addq t0,pv,pv /* compute update address */
+
+asm_refillin_and_handle_exception_cont:
+
+ mov sp,t0
+ lda sp,-6*8(sp) /* prepare stackframe*/
+ stq pv,5*8(sp) /* store pv of caller */
+ stq xptr,4*8(sp) /*exception ptr*/
+ stq xpc,3*8(sp) /*address of failure*/
+ stq t0,2*8(sp) /*begin of java stack frame*/
+ stq pv,1*8(sp) /* store pv of caller */
+ stq zero,0*8(sp) /*builtin (invisible) function */
+ jsr ra,asm_prepare_native_stackinfo /* puts 2 additional quadwords on stack */
+ ldgp gp,0(ra)
+
+ ldq a2,utf_fillInStackTrace_desc
+ ldq a1,utf_fillInStackTrace_name
+ ldq t0,6*8(sp)
+ ldq t1,offobjvftbl(t0)
+ ldq a0,offclass(t1)
+ jsr ra,class_resolvemethod
+ ldgp gp,0(ra)
+ /* now we have the method */
+
+ /*refillin */
+ mov v0,a0
+ ldq a1,6*8(sp)
+ jsr ra,asm_calljavafunction
+ ldgp gp,0(ra)
+
+ /*remove frame*/
+ jsr ra,asm_remove_native_stackinfo
+ ldgp gp,0(ra)
+
+
+ /*finish*/
+ ldq xpc,0(sp)
+ ldq xptr,1*8(sp)
+ ldq pv,2*8(sp)
+ lda sp,3*8(sp)
+ br asm_handle_exception
+
+ .end asm_refillin_and_handle_exception
+
+/****** function asm_throw_and_handle_arrayindexoutofbounds_exception **********
+* *
+* This function handles an exception. It does not use the usual calling *
+* conventions. The integer parameter is passed in REG_ITMP1 and the *
+* pc from the exception raising position is passed in REG_ITMP2. *
+* *
+* void asm_handle_arithmetic_exception (exceptionclass, exceptionpc); *
+* *
+*******************************************************************************/
+
+ .ent asm_throw_and_handle_arrayindexoutofbounds_exception
+asm_throw_and_handle_arrayindexoutofbounds_exception:
+ ldgp gp,0(pv)
+ ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
+ sll t0,48,t0
+ sra t0,48,t0 /* isolate offset */
+ addq t0,ra,pv /* compute update address */
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ srl t0,16,t0 /* isolate instruction code */
+ lda t0,-0x177b(t0) /* test for LDAH */
+ bne t0,asm_throw_and_handle_arrayindexoutofbounds_exception_cont
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ sll t0,16,t0 /* compute high offset */
+ addl t0,0,t0 /* sign extend high offset */
+ addq t0,pv,pv /* compute update address */
+
+asm_throw_and_handle_arrayindexoutofbounds_exception_cont:
+ mov sp,t0
+ lda sp,-6*8(sp) /*prepare stackframe*/
+ stq pv,5*8(sp) /*pv of failure*/
+ stq itmp1,4*8(sp) /*int parameter of the exception*/
+ stq xpc,3*8(sp) /*address of failure */
+ stq t0,2*8(sp) /*store begin of java stack frame*/
+ stq pv,1*8(sp) /*store pv of caller in structure*/
+ stq zero,0*8(sp) /*builtin (invisible function)*/
+ jsr ra,asm_prepare_native_stackinfo /* puts 2 additional quadwords on stack */
+ ldgp gp,0(ra)
+
+ ldq a0,string_java_lang_ArrayIndexOutOfBoundsException
+ ldq a1,6*8(sp) /*int of exception*/
+ jsr ra,new_exception_int
+ ldgp gp,0(ra)
+
+ mov v0,itmp1 /*itmp1 is not touched in asm_remove_native_stackinfo*/
+
+ jsr ra,asm_remove_native_stackinfo
+ ldgp gp,0(ra)
+
+ ldq itmp2,0(sp)
+ ldq pv,2*8(sp)
+ lda sp,3*8(sp)
+ br asm_handle_exception
+
+ .end asm_throw_and_handle_arrayindexoutofbounds_exception
+
+/**************** function asm_throw_and_handle_arithmetic_exception ***********
+* *
+* This function handles an exception. It does not use the usual calling *
+* conventions. The exception string is passed in REG_ITMP1 and the *
+* pc from the exception raising position is passed in REG_ITMP2. *
+* *
+* void asm_handle_arithmetic_exception (exceptionclass, exceptionpc); *
+* *
+*******************************************************************************/
+
+ .ent asm_throw_and_handle_arithmetic_exception
+asm_throw_and_handle_arithmetic_exception:
+ ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
+ sll t0,48,t0
+ sra t0,48,t0 /* isolate offset */
+ addq t0,ra,pv /* compute update address */
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ srl t0,16,t0 /* isolate instruction code */
+ lda t0,-0x177b(t0) /* test for LDAH */
+ bne t0,asm_throw_and_handle_arithmetic_exception_cont
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ sll t0,16,t0 /* compute high offset */
+ addl t0,0,t0 /* sign extend high offset */
+ addq t0,pv,pv /* compute update address */
+
+asm_throw_and_handle_arithmetic_exception_cont:
+ mov sp,t0
+ lda sp,-6*8(sp) /*prepare stackframe*/
+ stq pv,5*8(sp) /*pv of failure*/
+ stq itmp1,4*8(sp) /*exception string of the exception*/
+ stq xpc,3*8(sp) /*address of failure */
+ stq t0,2*8(sp) /*store begin of java stack frame*/
+ stq pv,1*8(sp) /*store pv of caller in structure*/
+ stq zero,0*8(sp) /*builtin (invisible function)*/
+ jsr ra,asm_prepare_native_stackinfo /* puts 2 additional quadwords on stack */
+ ldgp gp,0(ra)
+
+ ldq a0,string_java_lang_ArithmeticException
+ ldq a1,6*8(sp) /*string of exception*/
+ jsr ra,new_exception_message
+ ldgp gp,0(ra)
+ mov v0,itmp1 /*itmp1 is not touched in asm_remove_native_stackinfo*/
+
+ jsr ra,asm_remove_native_stackinfo
+ ldgp gp,0(ra)
+
+ ldq itmp2,0(sp)
+ ldq pv,2*8(sp)
+ lda sp,3*8(sp)
+ br asm_handle_exception
+
+ .end asm_throw_and_handle_arithmetic_exception
+
+
+/**************** function asm_throw_and_handle_exception **********************
+* *
+* This function handles an exception. It does not use the usual calling *
+* conventions. The exception class name is passed in REG_ITMP1 and the *
+* pc from the exception raising position is passed in REG_ITMP2. *
+* *
+* void asm_handle_exception (exceptionclass, exceptionpc); *
+* *
+*******************************************************************************/
+ .ent asm_throw_and_handle_nat_exception
+asm_throw_and_handle_nat_exception:
+ ldgp gp,0(pv)
+ ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
+ sll t0,48,t0
+ sra t0,48,t0 /* isolate offset */
+ addq t0,ra,pv /* compute update address */
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ srl t0,16,t0 /* isolate instruction code */
+ lda t0,-0x177b(t0) /* test for LDAH */
+ bne t0,asm_throw_and_handle_exception
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ sll t0,16,t0 /* compute high offset */
+ addl t0,0,t0 /* sign extend high offset */
+ addq t0,pv,pv /* compute update address */
+
+ .aent asm_throw_and_handle_exception
+asm_throw_and_handle_exception:
+ mov sp,t0
+ lda sp,-6*8(sp) /*prepare stackframe*/
+ stq pv,5*8(sp) /*pv of failure*/
+ stq itmp1,4*8(sp) /*classname of the exception*/
+ stq xpc,3*8(sp) /*address of failure */
+ stq t0,2*8(sp) /*store begin of java stack frame*/
+ stq pv,1*8(sp) /*store pv of caller in structure*/
+ stq zero,0*8(sp) /*builtin (invisible function)*/
+ jsr ra,asm_prepare_native_stackinfo /* puts 2 additional quadwords on stack */
+ ldgp gp,0(ra)
+
+ ldq a0,6*8(sp) /*classname of exception*/
+ jsr ra,new_exception
+ ldgp gp,0(ra)
+
+ mov v0,itmp1 /*itmp1 is not touched in asm_remove_native_stackinfo*/
+
+ jsr ra,asm_remove_native_stackinfo
+ ldgp gp,0(ra)
+
+ ldq itmp2,0(sp)
+ ldq pv,2*8(sp)
+ lda sp,3*8(sp)
+ br asm_handle_exception
+ .end asm_throw_and_handle_nat_exception
+
+
/********************* function asm_handle_exception ***************************
* *
* This function handles an exception. It does not use the usual calling *
jmp zero,(pv) /* else call builtin_monitorenter */
nb_monitorenter:
+ lda xpc,-4(ra)
+ ldq xptr,string_java_lang_NullPointerException
+ jmp zero,asm_throw_and_handle_nat_exception
+#if 0
subq sp,8,sp
stq ra,0(sp)
ldq a0,string_java_lang_NullPointerException
lda xpc,-4(ra) /* faulting address is return adress - 4*/
br asm_handle_nat_exception
-
+#endif
.end asm_builtin_monitorenter
jmp zero,(pv) /* else call builtin_monitorexit */
nb_monitorexit:
+ lda xpc,-4(ra)
+ ldq xptr,string_java_lang_NullPointerException
+ jmp zero,asm_throw_and_handle_nat_exception
+#if 0
subq sp,8,sp
stq ra,0(sp)
ldq a0,string_java_lang_NullPointerException
lda xpc,-4(ra) /* faulting address is return adress - 4*/
br asm_handle_nat_exception
-
+#endif
.end asm_builtin_monitorexit
jmp zero,(pv) /* else call builtin_idiv */
nb_idiv:
- subq sp,8,sp
- stq ra,0(sp)
- ldq a0,string_java_lang_ArithmeticException
- ldq a1,string_java_lang_ArithmeticException_message
- jsr ra,new_exception_message
- ldgp gp,0(ra)
- mov v0,xptr
- ldq ra,0(sp)
- addq sp,8,sp
-
+ ldq xptr,string_java_lang_ArithmeticException_message
lda xpc,-4(ra) /* faulting address is return adress - 4*/
- br asm_handle_nat_exception
+ br asm_throw_and_handle_arithmetic_exception
.end asm_builtin_idiv
jmp zero,(pv) /* else call builtin_ldiv */
nb_ldiv:
- subq sp,8,sp
- stq ra,0(sp)
- ldq a0,string_java_lang_ArithmeticException
- ldq a1,string_java_lang_ArithmeticException_message
- jsr ra,new_exception_message
- ldgp gp,0(ra)
- mov v0,xptr
- ldq ra,0(sp)
- addq sp,8,sp
-
+ ldq xptr,string_java_lang_ArithmeticException_message
lda xpc,-4(ra) /* faulting address is return adress - 4*/
- br asm_handle_nat_exception
+ br asm_throw_and_handle_arithmetic_exception
.end asm_builtin_ldiv
jmp zero,(pv) /* else call builtin_irem */
nb_irem:
- subq sp,8,sp
- stq ra,0(sp)
- ldq a0,string_java_lang_ArithmeticException
- ldq a1,string_java_lang_ArithmeticException_message
- jsr ra,new_exception_message
- ldgp gp,0(ra)
- mov v0,xptr
- ldq ra,0(sp)
- addq sp,8,sp
-
+ ldq xptr,string_java_lang_ArithmeticException_message
lda xpc,-4(ra) /* faulting address is return adress - 4*/
- br asm_handle_nat_exception
+ br asm_throw_and_handle_arithmetic_exception
.end asm_builtin_irem
jmp zero,(pv) /* else call builtin_lrem */
nb_lrem:
- subq sp,8,sp
- stq ra,0(sp)
- ldq a0,string_java_lang_ArithmeticException
- ldq a1,string_java_lang_ArithmeticException_message
- jsr ra,new_exception_message
- ldgp gp,0(ra)
- mov v0,xptr
- ldq ra,0(sp)
- addq sp,8,sp
-
+ ldq xptr,string_java_lang_ArithmeticException_message
lda xpc,-4(ra) /* faulting address is return adress - 4*/
- br asm_handle_nat_exception
+ br asm_throw_and_handle_arithmetic_exception
.end asm_builtin_lrem
jmp zero,(ra)
nb_carray_throw:
+ ldq ra,0(sp)
+ lda sp,16(sp)
+ lda xpc,-4(ra)
+ ldq xptr,string_java_lang_ClassCastException
+ jmp zero,asm_throw_and_handle_nat_exception
+#if 0
ldq a0,string_java_lang_ClassCastException
jsr ra,new_exception
ldgp gp,0(ra)
lda sp,16(sp) /* free stack space */
lda xpc,-4(ra) /* faulting address is return adress - 4*/
br asm_handle_nat_exception
+#endif
.end asm_builtin_checkarraycast
stq a1,offobjarrdata(a0) /* store objectptr in array */
jmp zero,(ra)
-nb_aastore_null:
+nb_aastore_null:
+ ldq xptr,string_java_lang_NullPointerException
+ mov ra,xpc
+ jmp zero,asm_throw_and_handle_nat_exception
+#if 0
subq sp,8,sp /* allocate stack space */
stq ra,0(sp) /* save return address */
ldq a0,string_java_lang_NullPointerException
mov ra,xpc /* faulting address is return adress */
br asm_handle_nat_exception
-
+#endif
nb_aastore_bound:
+ ldq ra,0(sp)
+ lda sp,24(sp)
+ mov ra,xpc
+ mov a1,xptr
+ jmp zero,asm_throw_and_handle_arrayindexoutofbounds_exception
+#if 0
ldq a0,string_java_lang_ArrayIndexOutOfBoundsException
jsr ra,new_exception_int /* a1 already contains the index */
ldgp gp,0(ra)
lda sp,24(sp) /* free stack space */
mov ra,xpc /* faulting address is return adress */
br asm_handle_nat_exception
-
+#endif
nb_aastore_throw:
+ mov ra,xpc
+ ldq xptr,string_java_lang_ArrayStoreException
+ jmp zero,asm_throw_and_handle_nat_exception
+#if 0
subq sp,8,sp /* allocate stack space */
stq ra,0(sp) /* save return address */
ldq a0,string_java_lang_ArrayStoreException
mov ra,xpc /* faulting address is return adress */
br asm_handle_nat_exception
-
+#endif
.end asm_builtin_aastore
.quad 0
+ .ent asm_prepare_native_stackinfo
+asm_prepare_native_stackinfo:
+ lda sp,-24(sp)
+ stq ra,0(sp)
+ jsr ra,builtin_asm_get_stackframeinfo
+ stq v0,16(sp)
+ ldq t0,0(v0)
+ stq t0,8(sp)
+ ldq ra,0(sp)
+ lda sp,8(sp)
+ stq sp,0(v0)
+ ret
+ .end asm_prepare_native_stackinfo
+
+ .end asm_remove_native_stackinfo
+asm_remove_native_stackinfo:
+ ldq t0,0(sp)
+ ldq t1,8(sp)
+ stq t0,0(t1)
+ lda sp,40(sp)
+ ret
+ .end asm_prepare_native_stackinfo
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
Authors: Andreas Krall
Reinhard Grafl
- $Id: codegen.c 1641 2004-12-01 13:13:31Z christian $
+ Changes: Joseph Wenninger
+
+ $Id: codegen.c 1683 2004-12-05 21:33:36Z jowenn $
*/
#include <stdio.h>
#include <signal.h>
+#include "vm/jit/alpha/arch.h"
#include "native/native.h"
#include "vm/builtin.h"
#include "vm/global.h"
#include "vm/jit/parse.h"
#include "vm/jit/reg.h"
#include "vm/jit/alpha/codegen.h"
-#include "vm/jit/alpha/arch.h"
#include "vm/jit/alpha/types.h"
-
+#include "vm/jit/alpha/asmoffsets.h"
+#include "vm/jit/stacktrace.inc"
/* *****************************************************************************
sigaddset(&nsig, sig);
sigprocmask(SIG_UNBLOCK, &nsig, NULL); /* unblock signal */
- xptr = new_nullpointerexception();
+ /*xptr = new_nullpointerexception();
+ sigctx->sc_regs[REG_ITMP1_XPTR] = (u8) xptr;*/
- sigctx->sc_regs[REG_ITMP1_XPTR] = (u8) xptr;
+ sigctx->sc_regs[REG_ITMP1_XPTR]=string_java_lang_NullPointerException;
sigctx->sc_regs[REG_ITMP2_XPC] = sigctx->sc_pc;
- sigctx->sc_pc = (u8) asm_handle_exception;
+ /*sigctx->sc_pc = (u8) asm_handle_exception;*/
+ sigctx->sc_pc = (u8) asm_throw_and_handle_exception;
return;
} else {
basicblock *bptr;
instruction *iptr;
exceptiontable *ex;
-
+ u2 currentline=0;
{
s4 i, p, pa, t, l;
s4 savedregs_num;
len > 0;
src = iptr->dst, len--, iptr++) {
+ if (iptr->line!=currentline) {
+ dseg_addlinenumber(cd,iptr->line,mcodeptr);
+ currentline=iptr->line;
+ }
+
MCODECHECK(64); /* an instruction usually needs < 64 words */
switch (iptr->opc) {
} /* if (bptr -> flags >= BBREACHED) */
} /* for basic block */
+ codegen_createlinenumbertable(cd);
+
{
/* generate bound check stubs */
} else {
xcodeptr = mcodeptr;
- M_LSUB_IMM(REG_SP, 1 * 8, REG_SP);
- M_LST(REG_ITMP2_XPC, REG_SP, 0 * 8);
+ a = dseg_addaddress(cd, asm_throw_and_handle_arrayindexoutofbounds_exception);
+ M_ALD(REG_PV, REG_PV, a);
- a = dseg_addaddress(cd, string_java_lang_ArrayIndexOutOfBoundsException);
- M_ALD(rd->argintregs[0], REG_PV, a);
- M_MOV(REG_ITMP1, rd->argintregs[1]);
-
- a = dseg_addaddress(cd, new_exception_int);
- M_ALD(REG_PV, REG_PV, a);
- M_JSR(REG_RA, REG_PV);
+ M_JSR(REG_RA, REG_PV);
- /* recompute pv */
- s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LDA(REG_PV, REG_RA, ml);
- M_LDAH(REG_PV, REG_PV, mh);
- }
-
- M_MOV(REG_RESULT, REG_ITMP1_XPTR);
-
- M_LLD(REG_ITMP2_XPC, REG_SP, 0 * 8);
- M_LADD_IMM(REG_SP, 1 * 8, REG_SP);
-
- a = dseg_addaddress(cd, asm_handle_exception);
- M_ALD(REG_ITMP3, REG_PV, a);
-
- M_JMP(REG_ZERO, REG_ITMP3);
+ /* recompute pv */
+ s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
+ if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
+ else {
+ s4 ml = -s1, mh = 0;
+ while (ml < -32768) { ml += 65536; mh--; }
+ M_LDA(REG_PV, REG_RA, ml);
+ M_LDAH(REG_PV, REG_PV, mh);
+ }
}
}
} else {
xcodeptr = mcodeptr;
- M_LSUB_IMM(REG_SP, 1 * 8, REG_SP);
- M_LST(REG_ITMP2_XPC, REG_SP, 0 * 8);
-
+
a = dseg_addaddress(cd, string_java_lang_NegativeArraySizeException);
- M_ALD(rd->argintregs[0], REG_PV, a);
+ M_ALD(REG_ITMP1_XPTR,REG_PV,a);
- a = dseg_addaddress(cd, new_exception);
+ a = dseg_addaddress(cd, asm_throw_and_handle_nat_exception);
M_ALD(REG_PV, REG_PV, a);
- M_JSR(REG_RA, REG_PV);
+ M_JSR(REG_RA, REG_PV);
+
/* recompute pv */
s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
M_LDAH(REG_PV, REG_PV, mh);
}
- M_MOV(REG_RESULT, REG_ITMP1_XPTR);
- M_LLD(REG_ITMP2_XPC, REG_SP, 0 * 8);
- M_LADD_IMM(REG_SP, 1 * 8, REG_SP);
-
- a = dseg_addaddress(cd, asm_handle_exception);
- M_ALD(REG_ITMP3, REG_PV, a);
-
- M_JMP(REG_ZERO, REG_ITMP3);
}
}
} else {
xcodeptr = mcodeptr;
- M_LSUB_IMM(REG_SP, 1 * 8, REG_SP);
- M_LST(REG_ITMP2_XPC, REG_SP, 0 * 8);
-
a = dseg_addaddress(cd, string_java_lang_ClassCastException);
- M_ALD(rd->argintregs[0], REG_PV, a);
+ M_ALD(REG_ITMP1_XPTR,REG_PV,a);
- a = dseg_addaddress(cd, new_exception);
- M_ALD(REG_PV, REG_PV, a);
- M_JSR(REG_RA, REG_PV);
+ a = dseg_addaddress(cd, asm_throw_and_handle_nat_exception);
+ M_ALD(REG_PV, REG_PV, a);
- /* recompute pv */
- s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LDA(REG_PV, REG_RA, ml);
- M_LDAH(REG_PV, REG_PV, mh);
- }
+ M_JSR(REG_RA, REG_PV);
- M_MOV(REG_RESULT, REG_ITMP1_XPTR);
+ /* recompute pv */
+ s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
+ if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
+ else {
+ s4 ml = -s1, mh = 0;
+ while (ml < -32768) { ml += 65536; mh--; }
+ M_LDA(REG_PV, REG_RA, ml);
+ M_LDAH(REG_PV, REG_PV, mh);
+ }
- M_LLD(REG_ITMP2_XPC, REG_SP, 0 * 8);
- M_LADD_IMM(REG_SP, 1 * 8, REG_SP);
-
- a = dseg_addaddress(cd, asm_handle_exception);
- M_ALD(REG_ITMP3, REG_PV, a);
-
- M_JMP(REG_ZERO, REG_ITMP3);
}
}
M_AST(REG_ZERO, REG_ITMP3, 0);
#endif
- a = dseg_addaddress(cd, asm_handle_exception);
- M_ALD(REG_ITMP3, REG_PV, a);
+ a = dseg_addaddress(cd, asm_refillin_and_handle_exception);
+ M_ALD(REG_PV, REG_PV, a);
+
+ M_JMP(REG_RA, REG_PV);
+
+ /* recompute pv */
+ s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
+ if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
+ else {
+ s4 ml = -s1, mh = 0;
+ while (ml < -32768) { ml += 65536; mh--; }
+ M_LDA(REG_PV, REG_RA, ml);
+ M_LDAH(REG_PV, REG_PV, mh);
+ }
- M_JMP(REG_ZERO, REG_ITMP3);
}
}
} else {
xcodeptr = mcodeptr;
- M_LSUB_IMM(REG_SP, 1 * 8, REG_SP);
- M_LST(REG_ITMP2_XPC, REG_SP, 0 * 8);
-
a = dseg_addaddress(cd, string_java_lang_NullPointerException);
- M_ALD(rd->argintregs[0], REG_PV, a);
-
- a = dseg_addaddress(cd, new_exception);
- M_ALD(REG_PV, REG_PV, a);
- M_JSR(REG_RA, REG_PV);
-
- /* recompute pv */
- s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LDA(REG_PV, REG_RA, ml);
- M_LDAH(REG_PV, REG_PV, mh);
- }
+ M_ALD(REG_ITMP1_XPTR,REG_PV,a);
- M_MOV(REG_RESULT, REG_ITMP1_XPTR);
+ a = dseg_addaddress(cd, asm_throw_and_handle_nat_exception);
+ M_ALD(REG_PV, REG_PV, a);
- M_LLD(REG_ITMP2_XPC, REG_SP, 0 * 8);
- M_LADD_IMM(REG_SP, 1 * 8, REG_SP);
+ M_JSR(REG_RA, REG_PV);
- a = dseg_addaddress(cd, asm_handle_exception);
- M_ALD(REG_ITMP3, REG_PV, a);
+ /* recompute pv */
+ s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
+ if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
+ else {
+ s4 ml = -s1, mh = 0;
+ while (ml < -32768) { ml += 65536; mh--; }
+ M_LDA(REG_PV, REG_RA, ml);
+ M_LDAH(REG_PV, REG_PV, mh);
+ }
- M_JMP(REG_ZERO, REG_ITMP3);
}
}
*******************************************************************************/
+
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#define NATIVESTUB_STACK 8/*ra,native result, oldThreadspecificHeadValue, addressOfThreadspecificHead, method, 0,0,ra*/
+#define NATIVESTUB_THREAD_EXTRA (6 + 20) /*20 for additional frame creation*/
+#define NATIVESTUB_STACKTRACE_OFFSET 1
+#else
+#define NATIVESTUB_STACK 7/*ra,oldThreadspecificHeadValue, addressOfThreadspecificHead, method, 0,0,ra*/
+#define NATIVESTUB_THREAD_EXTRA (1 + 20) /*20 for additional frame creation*/
+#define NATIVESTUB_STACKTRACE_OFFSET 0
+#endif
+
+#define NATIVESTUB_SIZE (44 + NATIVESTUB_THREAD_EXTRA - 1)
+#define NATIVESTUB_STATIC_SIZE 5
+#define NATIVESTUB_VERBOSE_SIZE (39 + 13)
+#define NATIVESTUB_OFFSET 11
+
+#if 0
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
#define NATIVESTUB_STACK 2
#define NATIVESTUB_THREAD_EXTRA 6
#define NATIVESTUB_STATIC_SIZE 4
#define NATIVESTUB_VERBOSE_SIZE (39 + 13)
#define NATIVESTUB_OFFSET 10
+#endif
u1 *createnativestub(functionptr f, methodinfo *m)
{
*(cs-7) = (u8) builtin_displaymethodstop;
*(cs-8) = (u8) m->class;
*(cs-9) = (u8) asm_check_clinit;
- *(cs-10) = (u8) NULL; /* filled with machine code */
+ *(cs-10) = (u8) &builtin_asm_get_stackframeinfo;
+ *(cs-11) = (u8) NULL; /* filled with machine code */
M_LDA(REG_SP, REG_SP, -NATIVESTUB_STACK * 8); /* build up stackframe */
M_AST(REG_RA, REG_SP, 0 * 8); /* store return address */
+ M_AST(REG_RA, REG_SP, (6+NATIVESTUB_STACKTRACE_OFFSET) * 8); /* store return address in stackinfo helper*/
+
/* if function is static, check for initialized */
if (m->flags & ACC_STATIC) {
}
}
- /* max. 39 instructions */
- if (runverbose) {
+ /* max. 39 +9 instructions */
+ {
s4 p;
s4 t;
M_LDA(REG_SP, REG_SP, -((INT_ARG_CNT + FLT_ARG_CNT + 2) * 8));
}
}
- M_ALD(REG_ITMP1, REG_PV, -6 * 8);
- M_AST(REG_ITMP1, REG_SP, 0 * 8);
- M_ALD(REG_PV, REG_PV, -5 * 8);
- M_JSR(REG_RA, REG_PV);
- disp = -(s4) (mcodeptr - (s4 *) cs) * 4;
- M_LDA(REG_PV, REG_RA, disp);
+ if (runverbose) {
+ M_ALD(REG_ITMP1, REG_PV, -6 * 8);
+ M_AST(REG_ITMP1, REG_SP, 0 * 8);
+ M_ALD(REG_PV, REG_PV, -5 * 8);
+ M_JSR(REG_RA, REG_PV);
+ disp = -(s4) (mcodeptr - (s4 *) cs) * 4;
+ M_LDA(REG_PV, REG_RA, disp);
+ }
+
+
+/*stack info */
+ M_ALD(REG_PV, REG_PV, -10 * 8); /* builtin_asm_get_stackframeinfo */
+ M_JSR(REG_RA, REG_PV);
+ disp = -(s4) (mcodeptr - (s4 *) cs) * 4;
+ M_LDA(REG_PV, REG_RA, disp);
+
+#if 0
+ M_MOV(REG_RESULT,REG_ITMP3);
+ M_LST(REG_RESULT,REG_ITMP3,0);
+#endif
+ M_LST(REG_RESULT,REG_SP, ((INT_ARG_CNT + FLT_ARG_CNT + 2) * 8)+(2+NATIVESTUB_STACKTRACE_OFFSET)*8);/*save adress of pointer*/
+ M_LLD(REG_ITMP3,REG_RESULT,0); /* get pointer*/
+ M_LST(REG_ITMP3,REG_SP,(1+NATIVESTUB_STACKTRACE_OFFSET)*8+((INT_ARG_CNT + FLT_ARG_CNT + 2) * 8)); /*save old value*/
+ M_LDA(REG_ITMP3,REG_SP,(1+NATIVESTUB_STACKTRACE_OFFSET)*8+((INT_ARG_CNT + FLT_ARG_CNT + 2) * 8)); /*calculate new value*/
+ M_LLD(REG_ITMP2,REG_ITMP3,8);
+ M_LST(REG_ITMP3,REG_ITMP2,0); /*store new value*/
+ M_LLD(REG_ITMP2,REG_PV,-6*8);
+ M_LST(REG_ITMP2,REG_SP,(3+NATIVESTUB_STACKTRACE_OFFSET)*8+((INT_ARG_CNT + FLT_ARG_CNT + 2) * 8));
+ M_LST(REG_ZERO,REG_SP,(4+NATIVESTUB_STACKTRACE_OFFSET)*8+((INT_ARG_CNT + FLT_ARG_CNT + 2) * 8));
+ M_LST(REG_ZERO,REG_SP,(5+NATIVESTUB_STACKTRACE_OFFSET)*8+((INT_ARG_CNT + FLT_ARG_CNT + 2) * 8));
+/*stack info -end */
+
for (p = 0; p < m->paramcount && p < INT_ARG_CNT; p++) {
M_LLD(rd->argintregs[p], REG_SP, (2 + p) * 8);
M_LDA(REG_SP, REG_SP, 2 * 8);
}
+ M_LLD(REG_ITMP3,REG_SP,(2+NATIVESTUB_STACKTRACE_OFFSET)*8); /*get address of stacktrace helper pointer*/
+ M_LLD(REG_ITMP1,REG_SP,(1+NATIVESTUB_STACKTRACE_OFFSET)*8); /*get old value*/
+ M_LST(REG_ITMP1,REG_ITMP3,0); /*set old value*/
+
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
if (IS_FLT_DBL_TYPE(m->returntype))
M_DST(REG_FRESULT, REG_SP, 1 * 8);
/* Get machine code which is patched back in later. The call is */
/* 1 instruction word long. */
xcodeptr = (s4 *) (cd->mcodebase + cref->branchpos);
- *(cs-10) = (u4) *xcodeptr;
+ *(cs-11) = (u4) *xcodeptr;
/* patch in the call to call the following code (done at compile */
/* time) */
M_ALD(REG_ITMP1, REG_PV, -8 * 8); /* class */
/* move machine code into REG_ITMP3 */
- M_ILD(REG_ITMP3, REG_PV, -10 * 8); /* machine code */
+ M_ILD(REG_ITMP3, REG_PV, -11 * 8); /* machine code */
M_LSUB_IMM(REG_SP, 1 * 8, REG_SP);
M_IST(REG_ITMP3, REG_SP, 0);
Changes: Christian Thalinger
- $Id: asmpart.h 1680 2004-12-04 12:02:08Z jowenn $
+ $Id: asmpart.h 1683 2004-12-05 21:33:36Z jowenn $
*/
void asm_handle_builtin_exception(classinfo *);
void asm_throw_and_handle_exception();
+#ifdef __ALPHA__
+void asm_throw_and_handle_nat_exception();
+void asm_refillin_and_handle_exception();
+void asm_throw_and_handle_arrayindexoutofbounds_exception();
+#endif
void asm_throw_and_handle_hardware_arithmetic_exception();
java_objectarray* Java_java_lang_VMSecurityManager_getClassContext(JNIEnv *env, jclass clazz);
Andreas Krall
Changes: Christian Thalinger
+ Joseph Wenninger
All functions assume the following code area / data area layout:
memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen.inc 1680 2004-12-04 12:02:08Z jowenn $
+ $Id: codegen.inc 1683 2004-12-05 21:33:36Z jowenn $
*/
static void codegen_createlinenumbertable(codegendata *cd)
{
-#ifdef __I386__
+#if defined(__I386__) || defined(__ALPHA__)
linenumberref *lr;
for (lr = cd->linenumberreferences; lr != NULL; lr = lr->next) {
}
#endif
+#if defined(__ALPHA__)
+/*perhaps in the end I'll have to go for the tree version on alpha too, since this is insecure for eg segfault signals in native code,
+since it will still return an adress of a datasegment, but which will not be a valid one of a java method. This version is faster though (jowenn)*/
+void *codegen_findmethod(void *returnAdress)
+ {
+ void *result;
+ s8 d;
+ void *dataseg;
+ d=*((s4*)returnAdress);
+ d=d<<48;
+ d=d>>48;
+ dataseg=returnAdress+d;
+ d=*(((s4*)returnAdress)+1);
+ d=d>>16;
+ d=d-0x177b;
+ if (d==0) {
+ d=*(((s4*)returnAdress)+1);
+ d=d<<16;
+ dataseg=dataseg+d;
+ }
+ return dataseg;
+#if 0
+ ldl t0,0(ra) /* load instruction LDA PV,xxx(RA) */
+ sll t0,48,t0
+ sra t0,48,t0 /* isolate offset */
+ addq t0,ra,pv /* compute update address */
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(PV) */
+ srl t0,16,t0 /* isolate instruction code */
+ lda t0,-0x177b(t0) /* test for LDAH */
+ bne t0,ex_stack_loop
+ ldl t0,4(ra) /* load instruction LDAH PV,xxx(RA) */
+ sll t0,16,t0 /* compute high offset */
+ addl t0,0,t0 /* sign extend high offset */
+ addq t0,pv,pv /* compute update address */
+ br ex_stack_loop
+#endif
+}
+
+#endif
+
static void codegen_finish(methodinfo *m, codegendata *cd, s4 mcodelen)
{
jr = jr->next;
}
-#ifdef __I386__
+#if defined(__I386__) || defined(__ALPHA__)
/* line number table resolving */
{
linenumberref *lr;
Reinhard Grafl
Christian Thalinger
- $Id: asmpart.S 1680 2004-12-04 12:02:08Z jowenn $
+ Changes: Joseph Wenninger
+
+ $Id: asmpart.S 1683 2004-12-05 21:33:36Z jowenn $
*/
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1680 2004-12-04 12:02:08Z jowenn $
+ Changes: Joseph Wenninger
+
+ $Id: codegen.c 1683 2004-12-05 21:33:36Z jowenn $
*/
Changes: Carolyn Oates
Edwin Steiner
+ Joseph Wenninger
- $Id: parse.c 1630 2004-11-30 19:33:41Z carolyn $
+ $Id: parse.c 1683 2004-12-05 21:33:36Z jowenn $
*/
Authors: Joseph Wenninger
- $Id: stacktrace.c 1680 2004-12-04 12:02:08Z jowenn $
+ $Id: stacktrace.c 1683 2004-12-05 21:33:36Z jowenn $
*/
utf_display(currentMethod->name);*/
addEntry(&buffer,currentMethod,0);
}
+#ifdef __ALPHA__
+ if (info->savedpv!=0)
+ dataseg=info->savedpv;
+ else
+ dataseg=codegen_findmethod(returnAdress);
+#else
dataseg=codegen_findmethod(returnAdress);
+#endif
currentMethod=(*((methodinfo**)(dataseg+MethodPointer)));
if (info->beginOfJavaStackframe==0)
stackPtr=((char*)info)+sizeof(native_stackframeinfo);
else
+#ifdef __ALPHA__
+ stackPtr=(char*)(info->beginOfJavaStackframe);
+#else
stackPtr=(char*)(info->beginOfJavaStackframe)+sizeof(void*);
+#endif
info=info->oldThreadspecificHeadValue;
} else { /*method created by jit*/
u4 frameSize;
/*log_text("JIT");*/
- if (currentMethod->isleafmethod) panic("How could that happen ??? A leaf method in the middle of a stacktrace ??");
+ if (currentMethod->isleafmethod) {
+#ifdef JWDEBUG
+ printf("class.method:%s.%s\n",currentMethod->class->name->text,currentMethod->name->text);
+#endif
+ panic("How could that happen ??? A leaf method in the middle of a stacktrace ??");
+ }
/*utf_display(currentMethod->class->name);
utf_display(currentMethod->name);*/
fillInStackTrace_method(&buffer,currentMethod,dataseg,returnAdress);
if (msg == null || !msg.equals(String.valueOf(0xcafebabe))) {
pln("FAILED: wrong index: " + msg + ", should be: " + 0xcafebabe);
-
+ pstacktrace(e);
} else {
pln("OK");
pstacktrace(e);
if (msg == null || !msg.equals(String.valueOf(0xbabecafe))) {
pln("FAILED: wrong index: " + msg + ", should be: " + 0xbabecafe);
-
+ pstacktrace(e);
} else {
pln("OK");
pstacktrace(e);
if (msg == null || !msg.equals("/ by zero")) {
pln("FAILED: wrong message: " + msg + ", should be: / by zero");
-
+ pstacktrace(e);
} else {
pln("OK");
pstacktrace(e);