dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 7601 2007-03-28 23:02:50Z michi $
+dnl $Id: configure.ac 7650 2007-04-03 13:48:10Z twisti $
dnl Process this file with autoconf to produce a configure script.
ARCH_CFLAGS="-mieee -D__ALPHA__"
;;
-arm | armv4tl | armv5b | armv5l )
+arm | armv4 | armv4tl | armv5b | armv5l )
ARCH_DIR="arm"
ARCH_CFLAGS="-D__ARM__"
;;
/* sourcestate of the current thread, assuming we are in the native world */
GC_LOG( dolog("GC: Stackwalking current thread ..."); );
- GC_LOG( stacktrace_dump_trace(THREADOBJECT); );
+ GC_LOG( threads_print_stacktrace(THREADOBJECT); );
/* TODO: GC_ASSERT(thread flags say in-native-world) */
replace_gc_from_native(THREADOBJECT, NULL, NULL);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: native.c 7667 2007-04-05 00:16:05Z michi $
*/
#include "native/include/java_lang_reflect_Method.h"
#include "native/include/java_lang_reflect_VMProxy.h"
#include "native/include/java_security_VMAccessController.h"
+#include "native/include/sun_misc_Unsafe.h"
#if defined(ENABLE_JVMTI)
#include "native/include/gnu_classpath_jdwp_event_EventRequest.h"
(functionptr) Java_java_security_VMAccessController_getStack,
+ (functionptr) Java_sun_misc_Unsafe_objectFieldOffset,
+ (functionptr) Java_sun_misc_Unsafe_compareAndSwapInt,
+
#if defined(ENABLE_JVMTI)
(functionptr) Java_gnu_classpath_jdwp_VMVirtualMachine_suspendThread,
(functionptr) Java_gnu_classpath_jdwp_VMVirtualMachine_resumeThread,
-/* src/native/vm/sun_misc_Unsafe.c - sun/misc/Unsafe
+/* src/native/vm/gnu/sun_misc_Unsafe.c - sun/misc/Unsafe
- Copyright (C) 2006 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+ Copyright (C) 2006, 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates,
R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
$Id: java_lang_VMObject.c 5153 2006-07-18 08:19:24Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: threads.c 7667 2007-04-05 00:16:05Z michi $
*/
}
-/* threads_dump ****************************************************************
-
- Dumps info for all threads running in the JVM. This function is
- called when SIGQUIT (<ctrl>-\) is sent to CACAO.
-
-*******************************************************************************/
-
-void threads_dump(void)
-{
- threadobject *thread;
- java_lang_Thread *t;
- utf *name;
-
- thread = mainthreadobj;
-
- /* XXX we should stop the world here */
-
- printf("Full thread dump CACAO "VERSION":\n");
-
- /* iterate over all started threads */
-
- do {
- /* get thread object */
-
- t = thread->object;
-
- /* the thread may be currently in initalization, don't print it */
-
- if (t != NULL) {
- /* get thread name */
-
-#if defined(ENABLE_JAVASE)
- name = javastring_toutf(t->name, false);
-#elif defined(ENABLE_JAVAME_CLDC1_1)
- name = t->name;
-#endif
-
- printf("\n\"");
- utf_display_printable_ascii(name);
- printf("\" ");
-
- if (thread->suspended)
- printf("SUSPENDED(%d) ", thread->suspend_reason);
-
- if (thread->flags & THREAD_FLAG_JAVA)
- printf("java ");
-
- if (thread->flags & THREAD_FLAG_INTERNAL)
- printf("internal ");
-
- if (thread->flags & THREAD_FLAG_DAEMON)
- printf("daemon ");
-
-#if defined(ENABLE_GC_CACAO)
- if (thread->flags & THREAD_FLAG_IN_NATIVE)
- printf("in-native ");
-
- if (thread->gc_critical)
- printf("GC-CRITICAL");
-#endif
-
-#if SIZEOF_VOID_P == 8
- printf("prio=%d tid=0x%016lx\n", t->priority, (ptrint) thread->tid);
-#else
- printf("prio=%d tid=0x%08lx\n", t->priority, (ptrint) thread->tid);
-#endif
-
- /* dump trace of thread */
-
- stacktrace_dump_trace(thread);
- }
-
- thread = thread->next;
- } while ((thread != NULL) && (thread != mainthreadobj));
-}
-
-
/* threads_table_dump *********************************************************
Dump the threads table for debugging purposes.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads.h 7496 2007-03-12 00:19:05Z michi $
+ $Id: threads.h 7667 2007-04-05 00:16:05Z michi $
*/
/* stackframeinfo *************************************************************/
-#define STACKFRAMEINFO (&(THREADOBJECT->_stackframeinfo))
+#define STACKFRAMEINFO (THREADOBJECT->_stackframeinfo)
/* variables ******************************************************************/
void threads_startworld(void);
#endif
-void threads_dump(void);
-
#endif /* _THREADS_H */
/* stackframeinfo *************************************************************/
+
struct stackframeinfo;
extern struct stackframeinfo *_no_threads_stackframeinfo;
-#define STACKFRAMEINFO (&_no_threads_stackframeinfo)
+#define STACKFRAMEINFO (_no_threads_stackframeinfo)
#endif /* _THREADS_H */
#include "vm/builtin.h"
#include "vm/stringlocal.h"
+#include "vm/jit/stacktrace.h"
+
#include "vmcore/class.h"
#include "vmcore/utf8.h"
}
+/* threads_dump ****************************************************************
+
+ Dumps info for all threads running in the JVM. This function is
+ called when SIGQUIT (<ctrl>-\) is sent to CACAO.
+
+*******************************************************************************/
+
+void threads_dump(void)
+{
+ threadobject *thread;
+ java_lang_Thread *t;
+ utf *name;
+
+ thread = mainthreadobj;
+
+ /* XXX we should stop the world here */
+
+ printf("Full thread dump CACAO "VERSION":\n");
+
+ /* iterate over all started threads */
+
+ do {
+ /* get thread object */
+
+ t = thread->object;
+
+ /* the thread may be currently in initalization, don't print it */
+
+ if (t != NULL) {
+ /* get thread name */
+
+#if defined(ENABLE_JAVASE)
+ name = javastring_toutf(t->name, false);
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+ name = t->name;
+#endif
+
+ printf("\n\"");
+ utf_display_printable_ascii(name);
+ printf("\" ");
+
+ if (thread->flags & THREAD_FLAG_DAEMON)
+ printf("daemon ");
+
+#if SIZEOF_VOID_P == 8
+ printf("prio=%d tid=0x%016lx\n", t->priority, (ptrint) thread->tid);
+#else
+ printf("prio=%d tid=0x%08lx\n", t->priority, (ptrint) thread->tid);
+#endif
+
+ /* print trace of thread */
+
+ threads_print_stacktrace(thread);
+ }
+
+ thread = thread->next;
+ } while ((thread != NULL) && (thread != mainthreadobj));
+}
+
+
+/* threads_print_stacktrace ****************************************************
+
+ Print the current stacktrace of the given thread.
+
+*******************************************************************************/
+
+void threads_print_stacktrace(threadobject *thread)
+{
+ stackframeinfo *sfi;
+ stacktracebuffer *stb;
+ s4 dumpsize;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* create a stacktrace for the current thread */
+
+#if defined(ENABLE_THREADS)
+ sfi = thread->_stackframeinfo;
+#else
+ sfi = _no_threads_stackframeinfo;
+#endif
+
+ stb = stacktrace_create(sfi);
+
+ /* print stacktrace */
+
+ if (stb != NULL)
+ stacktrace_print_trace_from_buffer(stb);
+ else {
+ puts("\t<<No stacktrace available>>");
+ fflush(stdout);
+ }
+
+ dump_release(dumpsize);
+}
+
+
/*
* 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
threadobject *threads_create_thread(utf *name);
ptrint threads_get_current_tid(void);
+void threads_dump(void);
+void threads_print_stacktrace(threadobject *thread);
#endif /* _THREADS_COMMON_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: exceptions.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: exceptions.c 7654 2007-04-03 15:22:21Z twisti $
*/
java_objectheader *exceptions_fillinstacktrace(void)
{
- java_objectheader *e;
+ java_objectheader *o;
methodinfo *m;
/* get exception */
- e = *exceptionptr;
- assert(e);
+ o = *exceptionptr;
+ assert(o);
/* clear exception */
/* resolve methodinfo pointer from exception object */
- m = class_resolvemethod(e->vftbl->class,
+#if defined(ENABLE_JAVASE)
+ m = class_resolvemethod(o->vftbl->class,
utf_fillInStackTrace,
utf_void__java_lang_Throwable);
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+ m = class_resolvemethod(o->vftbl->class,
+ utf_fillInStackTrace,
+ utf_void__void);
+#else
+#error IMPLEMENT ME!
+#endif
/* call function */
- (void) vm_call_method(m, e);
+ (void) vm_call_method(m, o);
/* return exception object */
- return e;
+ return o;
}
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
- $Id: simplereg.c 7483 2007-03-08 13:17:40Z michi $
+ $Id: simplereg.c 7645 2007-04-03 11:46:50Z twisti $
*/
methodinfo *m;
codegendata *cd;
registerdata *rd;
- int i,type;
+ int i;
s4 len;
+#if 0
stackptr src, src_old;
stackptr dst;
instruction *iptr;
+#endif
basicblock *bptr;
int size_interface; /* == maximum size of in/out stack at basic block boundaries */
bool in_register;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
*/
.end asm_cacheflush
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
*/
mov pc, lr
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
}
-/* emit_exception_stubs ********************************************************
-
- Generates the code for the exception stubs.
-
-*******************************************************************************/
-
-#if 0
-void emit_exception_stubs(jitdata *jd)
-{
- codegendata *cd;
- registerdata *rd;
- exceptionref *er;
- s4 branchmpc;
- s4 targetmpc;
- s4 targetdisp;
- s4 disp;
-
- /* get required compiler data */
-
- cd = jd->cd;
- rd = jd->rd;
-
- /* generate exception stubs */
-
- targetdisp = 0;
-
- for (er = cd->exceptionrefs; er != NULL; er = er->next) {
- /* back-patch the branch to this exception code */
-
- branchmpc = er->branchmpc;
- targetmpc = cd->mcodeptr - cd->mcodebase;
-
- md_codegen_patch_branch(cd, branchmpc, targetmpc);
-
- MCODECHECK(100);
-
- /* Check if the exception is an
- ArrayIndexOutOfBoundsException. If so, move index register
- into REG_ITMP1. */
-
- if (er->reg != -1)
- M_MOV(REG_ITMP1, er->reg);
-
- /* calcuate exception address */
-
- assert((er->branchmpc - 4) % 4 == 0);
- M_ADD_IMM_EXT_MUL4(REG_ITMP2_XPC, REG_PV, (er->branchmpc - 4) / 4);
-
- /* move function to call into REG_ITMP3 */
-
- disp = dseg_add_functionptr(cd, er->function);
- M_DSEG_LOAD(REG_ITMP3, disp);
-
- if (targetdisp == 0) {
- targetdisp = ((u4 *) cd->mcodeptr) - ((u4 *) cd->mcodebase);
-
- M_MOV(rd->argintregs[0], REG_PV);
- M_MOV(rd->argintregs[1], REG_SP);
-
- if (jd->isleafmethod)
- M_MOV(rd->argintregs[2], REG_LR);
- else
- M_LDR(rd->argintregs[2], REG_SP,
- cd->stackframesize * 4 - SIZEOF_VOID_P);
-
- M_MOV(rd->argintregs[3], REG_ITMP2_XPC);
-
- /* save registers */
- /* TODO: we only need to save LR in leaf methods */
-
- M_STMFD(BITMASK_ARGS | 1<<REG_PV | 1<<REG_LR, REG_SP);
-
- /* move a3 to stack */
-
- M_STR_UPDATE(REG_ITMP1, REG_SP, -4);
-
- /* do the exception call */
-
- M_MOV(REG_LR, REG_PC);
- M_MOV(REG_PC, REG_ITMP3);
-
- M_ADD_IMM(REG_SP, REG_SP, 4);
-
- /* result of stacktrace is our XPTR */
-
- M_MOV(REG_ITMP1_XPTR, REG_RESULT);
-
- /* restore registers */
-
- M_LDMFD(BITMASK_ARGS | 1<<REG_PV | 1<<REG_LR, REG_SP);
-
- disp = dseg_add_functionptr(cd, asm_handle_exception);
- M_DSEG_LOAD(REG_ITMP3, disp);
- M_MOV(REG_PC, REG_ITMP3);
- }
- else {
- disp = (((u4 *) cd->mcodebase) + targetdisp) -
- (((u4 *) cd->mcodeptr) + 2);
-
- M_B(disp);
- }
- }
-}
-#endif
-
-
/* emit_patcher_stubs **********************************************************
Generates the code for the patcher stubs.
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
- ucontext_t *_uc;
- /*mcontext_t *_mc;*/
- scontext_t *_sc;
- u4 instr;
- ptrint addr;
- ptrint base;
- u1 *pv;
- u1 *sp;
- u1 *ra;
- u1 *xpc;
+ ucontext_t *_uc;
+ scontext_t *_sc;
+ u1 *pv;
+ u1 *sp;
+ u1 *ra;
+ u1 *xpc;
+ u4 mcode;
+ ptrint addr;
+ s4 type;
+ ptrint val;
+ java_objectheader *o;
_uc = (ucontext_t*) _p;
_sc = &_uc->uc_mcontext;
- /* ATTENTION: glibc included messed up kernel headers */
- /* we needed a workaround for the ucontext structure */
+ /* ATTENTION: glibc included messed up kernel headers we needed a
+ workaround for the ucontext structure. */
+
+ pv = (u1 *) _sc->arm_ip;
+ sp = (u1 *) _sc->arm_sp;
+ ra = (u1 *) _sc->arm_lr; /* this is correct for leafs */
+ xpc = (u1 *) _sc->arm_pc;
+
+ /* get exception-throwing instruction */
+
+ mcode = *((s4 *) xpc);
- addr = (ptrint) siginfo->si_addr;
- /*xpc = (u1*) _mc->gregs[REG_PC];*/
- xpc = (u1*) _sc->arm_pc;
+ /* this is a NullPointerException */
- instr = *((s4*) xpc);
- base = *((s4*) _sc + OFFSET(scontext_t, arm_r0)/4 + ((instr >> 16) & 0x0f));
+/* addr = _mc->gregs[s1]; */
+ addr = *((s4 *) _sc + OFFSET(scontext_t, arm_r0)/4 + ((mcode >> 16) & 0x0f));
+ type = EXCEPTION_HARDWARE_NULLPOINTER;
+ val = 0;
- if (base == 0) {
- pv = (u1*) _sc->arm_ip;
- sp = (u1*) _sc->arm_sp;
- ra = (u1*) _sc->arm_lr; /* this is correct for leafs */
+ if (addr != 0)
+ vm_abort("md_signal_handler_sigsegv: faulting address is not NULL: addr=%p", addr);
- _sc->arm_r10 = (ptrint) stacktrace_hardware_nullpointerexception(pv, sp, ra, xpc);
- _sc->arm_fp = (ptrint) xpc;
- _sc->arm_pc = (ptrint) asm_handle_exception;
- }
- else {
- codegen_get_pv_from_pc(xpc);
+ /* generate appropriate exception */
+
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
- /* this should not happen */
+ /* set registers */
- assert(0);
- }
+ _sc->arm_r10 = (ptrint) o;
+ _sc->arm_fp = (ptrint) xpc;
+ _sc->arm_pc = (ptrint) asm_handle_exception;
}
/* ATTENTION: glibc included messed up kernel headers we needed a
workaround for the ucontext structure. */
- pv = (u1*) _sc->arm_ip;
- sp = (u1*) _sc->arm_sp;
- ra = (u1*) _sc->arm_lr; /* this is correct for leafs */
- xpc = (u1*) _sc->arm_pc;
+ pv = (u1 *) _sc->arm_ip;
+ sp = (u1 *) _sc->arm_sp;
+ ra = (u1 *) _sc->arm_lr; /* this is correct for leafs */
+ xpc = (u1 *) _sc->arm_pc;
/* get exception-throwing instruction */
}
+/* md_signal_handler_sigusr2 ***************************************************
+
+ Signal handler for profiling sampling.
+
+*******************************************************************************/
+
+#if defined(ENABLE_THREADS)
+void md_signal_handler_sigusr2(int sig, siginfo_t *siginfo, void *_p)
+{
+ threadobject *thread;
+ ucontext_t *_uc;
+ scontext_t *_sc;
+ u1 *pc;
+
+ thread = THREADOBJECT;
+
+ _uc = (ucontext_t*) _p;
+ _sc = &_uc->uc_mcontext;
+
+ pc = (u1 *) _sc->arm_pc;
+
+ thread->pc = pc;
+}
+#endif
+
+
/* thread_restartcriticalsection ***********************************************
TODO: document me
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: md.c 7653 2007-04-03 14:34:23Z twisti $
*/
}
-/* md_codegen_patch_branch *****************************************************
-
- Back-patches a branch instruction.
-
-*******************************************************************************/
-
-void md_codegen_patch_branch(codegendata *cd, s4 branchmpc, s4 targetmpc)
-{
- s4 *mcodeptr;
- s4 disp; /* branch displacement */
-
- /* calculate the patch position */
-
- mcodeptr = (s4 *) (cd->mcodebase + branchmpc);
-
- /* Calculate the branch displacement. */
-
- disp = (targetmpc - branchmpc - 4) >> 2;
-
- if ((disp < (s4) 0xff000000) || (disp > (s4) 0x00ffffff))
- vm_abort("md_codegen_patch_branch: branch displacement out of range: %d > +/-%d", disp, 0x00ffffff);
-
- /* sanity check: are we really patching a branch instruction */
-
- assert((mcodeptr[-1] & 0x0e000000) == 0x0a000000);
-
- /* patch the branch instruction before the mcodeptr */
-
- mcodeptr[-1] |= (disp & 0x00ffffff);
-}
-
-
/* md_stacktrace_get_returnaddress *********************************************
Returns the return address of the current stackframe, specified by
{
u1 *ra;
- /*printf("md_stacktrace_get_returnaddress(): called (sp=%x, framesize=%d)\n", sp, framesize);*/
+ /* On ARM the return address is located on the top of the
+ stackframe. */
+ /* ATTENTION: This is only true for non-leaf methods!!! */
- /* on ARM the return address is located on the top of the stackframe */
- /* ATTENTION: this is only true for non-leaf methods !!! */
ra = *((u1 **) (sp + framesize - SIZEOF_VOID_P));
- /*printf("md_stacktrace_get_returnaddress(): result (ra=%x)\n", ra);*/
-
return ra;
}
memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen-common.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: codegen-common.c 7667 2007-04-05 00:16:05Z michi $
*/
#include "native/jni.h"
#include "native/native.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#endif
+#include "threads/threads-common.h"
#include "vm/exceptions.h"
#include "vm/stringlocal.h"
log_println("");
log_println("Dumping the current stacktrace:");
- stacktrace_dump_trace(THREADOBJECT);
+ threads_print_stacktrace(THREADOBJECT);
vm_abort("Exiting...");
}
/* remove current stackframeinfo from chain */
- psfi = STACKFRAMEINFO;
+ psfi = &STACKFRAMEINFO;
*psfi = sfi->prev;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
*/
.long 0
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: md-os.c 7667 2007-04-05 00:16:05Z michi $
*/
# include "mm/cacao-gc/gc.h"
#endif
+#include "vm/jit/i386/codegen.h"
+
+#include "threads/threads-common.h"
+
#include "vm/exceptions.h"
#include "vm/signallocal.h"
#include "vm/stringlocal.h"
#include "vm/jit/asmpart.h"
#include "vm/jit/stacktrace.h"
-#include "vm/jit/i386/codegen.h"
-
/* md_signal_handler_sigsegv ***************************************************
s4 disp;
ptrint val;
s4 type;
- java_objectheader *e;
+ java_objectheader *o;
_uc = (ucontext_t *) _p;
_mc = &_uc->uc_mcontext;
/* generate appropriate exception */
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
/* set registers */
- _mc->gregs[REG_EAX] = (ptrint) e;
+ _mc->gregs[REG_EAX] = (ptrint) o;
_mc->gregs[REG_ECX] = (ptrint) xpc; /* REG_ITMP2_XPC */
_mc->gregs[REG_EIP] = (ptrint) asm_handle_exception;
}
void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
{
- ucontext_t *_uc;
- mcontext_t *_mc;
- u1 *sp;
- u1 *ra;
- u1 *xpc;
+ ucontext_t *_uc;
+ mcontext_t *_mc;
+ u1 *pv;
+ u1 *sp;
+ u1 *ra;
+ u1 *xpc;
+ s4 type;
+ ptrint val;
+ java_objectheader *o;
_uc = (ucontext_t *) _p;
_mc = &_uc->uc_mcontext;
+ pv = NULL; /* is resolved during stackframeinfo creation */
sp = (u1 *) _mc->gregs[REG_ESP];
xpc = (u1 *) _mc->gregs[REG_EIP];
ra = xpc; /* return address is equal to xpc */
- _mc->gregs[REG_EAX] =
- (ptrint) stacktrace_hardware_arithmeticexception(NULL, sp, ra, xpc);
+ /* this is an ArithmeticException */
+
+ type = EXCEPTION_HARDWARE_ARITHMETIC;
+ val = 0;
+
+ /* generate appropriate exception */
+
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ _mc->gregs[REG_EAX] = (ptrint) o;
_mc->gregs[REG_ECX] = (ptrint) xpc; /* REG_ITMP2_XPC */
_mc->gregs[REG_EIP] = (ptrint) asm_handle_exception;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jit.h 7628 2007-04-02 19:09:52Z michi $
+ $Id: jit.h 7663 2007-04-04 22:14:42Z twisti $
*/
#include "toolbox/chain.h"
#include "vm/global.h"
+#include "vm/resolve.h"
#include "vm/jit/codegen-common.h"
#include "vm/jit/reg.h"
#include "vmcore/method.h"
#include "vmcore/references.h"
-#include "vm/resolve.h"
#if defined(ENABLE_STATISTICS)
# include "vmcore/statistics.h"
instruction *instructions; /* ICMDs, valid between parse and stack */
basicblock *basicblocks; /* start of basic block list */
- s4 *basicblockindex; /* block index for each JavaPC */
- /* valid between parse and stack */
stackelement *stack; /* XXX should become stack.c internal */
s4 instructioncount;/* XXX remove this? */
s4 basicblockcount; /* number of basic blocks */
/* branch_target_t: used in TABLESWITCH tables */
typedef union {
- s4 insindex; /* used between parse and stack */
- basicblock *block; /* used from stack analysis onwards */
+ s4 insindex; /* used in parse */
+ basicblock *block; /* valid after parse */
} branch_target_t;
/* lookup_target_t: used in LOOKUPSWITCH tables */
typedef union {
s4 varindex;
- basicblock *block; /* valid after stack analysis */
+ basicblock *block; /* valid after parse */
branch_target_t *table; /* for TABLESWITCH */
lookup_target_t *lookup; /* for LOOKUPSWITCH */
- s4 insindex; /* used between parse and stack */
+ s4 insindex; /* used in parse */
} dst_operand_t;
/*** flags (32 bits) ***/
/* src/vm/jit/mips/asmpart.S - Java-C interface functions for MIPS
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Andreas Krall
-
- Changes: Christian Thalinger
- Edwin Steiner
-
- $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
*/
.end compare_and_swap
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.h 7350 2007-02-13 21:30:13Z twisti $
+ $Id: md-abi.h 7659 2007-04-03 18:02:48Z twisti $
*/
/* floating point registers */
-#define REG_FRESULT 0 /* to deliver floating point method results */
+#define REG_FRESULT 0 /* to deliver floating point method results */
-#define REG_IFTMP 1 /* temporary integer and floating point register */
+#define REG_IFTMP 1 /* temporary integer and floating point register */
#if SIZEOF_VOID_P == 8
/* MIPS64 defines */
-#define REG_FTMP1 1 /* temporary floating point register */
-#define REG_FTMP2 2 /* temporary floating point register */
-#define REG_FTMP3 3 /* temporary floating point register */
+#define REG_FTMP1 1 /* temporary floating point register */
+#define REG_FTMP2 2 /* temporary floating point register */
+#define REG_FTMP3 3 /* temporary floating point register */
+
+#define REG_FA0 12 /* define some argument registers */
+#define REG_FA1 13
+#define REG_FA2 14
#define INT_REG_CNT 32 /* number of integer registers */
-#define INT_SAV_CNT 8 /* number of int callee saved registers */
-#define INT_ARG_CNT 8 /* number of int argument registers */
-#define INT_TMP_CNT 5 /* number of integer temporary registers */
-#define INT_RES_CNT 10 /* number of integer reserved registers */
+#define INT_SAV_CNT 8 /* number of int callee saved registers */
+#define INT_ARG_CNT 8 /* number of int argument registers */
+#define INT_TMP_CNT 5 /* number of integer temporary registers */
+#define INT_RES_CNT 10 /* number of integer reserved registers */
/* + 1 REG_RET totals to 32 */
#define FLT_REG_CNT 32 /* number of float registers */
-#define FLT_SAV_CNT 4 /* number of flt callee saved registers */
-#define FLT_ARG_CNT 8 /* number of flt argument registers */
+#define FLT_SAV_CNT 4 /* number of flt callee saved registers */
+#define FLT_ARG_CNT 8 /* number of flt argument registers */
#define FLT_TMP_CNT 16 /* number of float temporary registers */
-#define FLT_RES_CNT 3 /* number of float reserved registers */
+#define FLT_RES_CNT 3 /* number of float reserved registers */
/* + 1 REG_RET totals to 32 */
#define TRACE_ARGS_NUM 8
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: parse.c 7632 2007-04-02 20:05:05Z michi $
+ $Id: parse.c 7663 2007-04-04 22:14:42Z twisti $
*/
/* allocate if space runs out */
+/* local macros ***************************************************************/
+
+#define BYTECODEINDEX_TO_BASICBLOCK(dst) \
+ do { \
+ (dst).block = \
+ parse_bytecodeindex_to_basicblock(jd, &pd, (dst).insindex); \
+ } while (0)
+
+
/* parserdata_t ***************************************************************/
typedef struct parsedata_t parsedata_t;
struct parsedata_t {
+ u1 *bytecodestart; /* start of bytecode instructions */
+ u1 *basicblockstart; /* start of bytecode basic-blocks */
+
+ s4 *bytecodemap; /* bytecode to IR mapping */
+
instruction *instructions; /* instruction array */
s4 instructionslength; /* length of the instruction array */
- u1 *instructionstart;
+
+ s4 *instructionmap; /* IR to basic-block mapping */
};
m = jd->m;
- /* Allocate instruction array and block index table (1 additional
- for end ipc). */
+ /* bytecode start array */
- jd->basicblockindex = DMNEW(s4, m->jcodelength + 1);
- pd->instructionstart = DMNEW(u1, m->jcodelength + 1);
+ pd->bytecodestart = DMNEW(u1, m->jcodelength + 1);
+ MZERO(pd->bytecodestart, u1, m->jcodelength + 1);
- MZERO(jd->basicblockindex, s4, m->jcodelength + 1);
- MZERO(pd->instructionstart, u1, m->jcodelength + 1);
+ /* bytecode basic-block start array */
- /* Set the length of the instruction array. We simply add 5 more
- instruction, as this seems to be a reasonable value. */
+ pd->basicblockstart = DMNEW(u1, m->jcodelength + 1);
+ MZERO(pd->basicblockstart, u1, m->jcodelength + 1);
- pd->instructionslength = m->jcodelength + 1;
+ /* bytecode instruction index to IR instruction mapping */
+
+ pd->bytecodemap = DMNEW(s4, m->jcodelength + 1);
+ MSET(pd->bytecodemap, -1, s4, m->jcodelength + 1);
/* allocate the instruction array */
+ pd->instructionslength = m->jcodelength + 1;
pd->instructions = DMNEW(instruction, pd->instructionslength);
/* Zero the intermediate instructions array so we don't have any
invalid pointers in it if we cannot finish stack_analyse(). */
MZERO(pd->instructions, instruction, pd->instructionslength);
+
+ /* The instructionmap is allocated later when we know the count of
+ instructions. */
+
+ pd->instructionmap = NULL;
}
}
+/* parse_bytecodeindex_to_basicblock *******************************************
+
+ Resolves a bytecode index to the corresponding basic block.
+
+*******************************************************************************/
+
+static basicblock *parse_bytecodeindex_to_basicblock(jitdata *jd,
+ parsedata_t *pd,
+ s4 bcindex)
+{
+ s4 irindex;
+ basicblock *bb;
+
+ irindex = pd->bytecodemap[bcindex];
+ bb = jd->basicblocks + pd->instructionmap[irindex];
+
+ return bb;
+}
+
+
/* parse_mark_exception_boundaries *********************************************
Mark exception handlers and the boundaries of the handled regions as
jd...............current jitdata
RETURN VALUE:
- >= 0.............the number of new basic blocks marked
- -1...............an exception has been thrown
+ true.............everything ok
+ false............an exception has been thrown
*******************************************************************************/
-static int parse_mark_exception_boundaries(jitdata *jd)
+static bool parse_mark_exception_boundaries(jitdata *jd, parsedata_t *pd)
{
- s4 b_count;
- s4 pc;
+ s4 bcindex;
s4 i;
s4 len;
raw_exception_entry *rex;
len = m->rawexceptiontablelength;
if (len == 0)
- return 0;
+ return true;
- b_count = 0;
rex = m->rawexceptiontable;
for (i = 0; i < len; ++i, ++rex) {
/* the start of the handled region becomes a basic block start */
- pc = rex->startpc;
- CHECK_BYTECODE_INDEX(pc);
- MARK_BASICBLOCK(pc);
+ bcindex = rex->startpc;
+ CHECK_BYTECODE_INDEX(bcindex);
+ MARK_BASICBLOCK(pd, bcindex);
- pc = rex->endpc; /* see JVM Spec 4.7.3 */
- CHECK_BYTECODE_INDEX_EXCLUSIVE(pc);
+ bcindex = rex->endpc; /* see JVM Spec 4.7.3 */
+ CHECK_BYTECODE_INDEX_EXCLUSIVE(bcindex);
/* check that the range is valid */
#if defined(ENABLE_VERIFIER)
- if (pc <= rex->startpc) {
- exceptions_throw_verifyerror(m,
- "Invalid exception handler range");
- return -1;
+ if (bcindex <= rex->startpc) {
+ exceptions_throw_verifyerror(m, "Invalid exception handler range");
+ return false;
}
#endif
- /* end of handled region becomes a basic block boundary */
- /* (If it is the bytecode end, we'll use the special */
- /* end block that is created anyway.) */
+ /* End of handled region becomes a basic block boundary (if it
+ is the bytecode end, we'll use the special end block that
+ is created anyway). */
- if (pc < m->jcodelength)
- MARK_BASICBLOCK(pc);
+ if (bcindex < m->jcodelength)
+ MARK_BASICBLOCK(pd, bcindex);
else
jd->branchtoend = true;
/* the start of the handler becomes a basic block start */
- pc = rex->handlerpc;
- CHECK_BYTECODE_INDEX(pc);
- MARK_BASICBLOCK(pc);
+ bcindex = rex->handlerpc;
+ CHECK_BYTECODE_INDEX(bcindex);
+ MARK_BASICBLOCK(pd, bcindex);
}
/* everything ok */
- return b_count;
+ return true;
#if defined(ENABLE_VERIFIER)
throw_invalid_bytecode_index:
exceptions_throw_verifyerror(m,
"Illegal bytecode index in exception table");
- return -1;
+ return false;
#endif
}
*******************************************************************************/
-static bool parse_resolve_exception_table(jitdata *jd)
+static bool parse_resolve_exception_table(jitdata *jd, parsedata_t *pd)
{
methodinfo *m;
raw_exception_entry *rex;
for (i = 0; i < len; ++i, ++rex, ++ex) {
/* resolve instruction indices to basic blocks */
- ex->start = BLOCK_OF(rex->startpc);
- ex->end = BLOCK_OF(rex->endpc);
- ex->handler = BLOCK_OF(rex->handlerpc);
+ ex->start = parse_bytecodeindex_to_basicblock(jd, pd, rex->startpc);
+ ex->end = parse_bytecodeindex_to_basicblock(jd, pd, rex->endpc);
+ ex->handler = parse_bytecodeindex_to_basicblock(jd, pd, rex->handlerpc);
/* lazily resolve the catchtype */
methodinfo *m; /* method being parsed */
parsedata_t pd;
instruction *iptr; /* current ptr into instruction array */
- s4 icount; /* intermediate instruction counter */
- s4 p; /* java instruction counter */
- s4 nextp; /* start of next java instruction */
- s4 opcode; /* java opcode */
- s4 i;
- s4 j;
- int b_count; /* basic block counter */
- int s_count = 0; /* stack element counter */
- bool blockend = false; /* true if basic block end has been reached */
- bool iswide = false; /* true if last instruction was a wide */
+
+ s4 bcindex; /* bytecode instruction index */
+ s4 nextbc; /* start of next bytecode instruction */
+ s4 opcode; /* bytecode instruction opcode */
+
+ s4 irindex; /* IR instruction index */
+ s4 ircount; /* IR instruction count */
+
+ s4 bbcount; /* basic block count */
+
+ int s_count = 0; /* stack element counter */
+ bool blockend; /* true if basic block end has been reached */
+ bool iswide; /* true if last instruction was a wide */
+
constant_classref *cr;
constant_classref *compr;
classinfo *c;
builtintable_entry *bte;
- constant_FMIref *mr;
+ constant_FMIref *fmi;
methoddesc *md;
unresolved_method *um;
+ unresolved_field *uf;
+
resolve_result_t result;
u2 lineindex = 0;
u2 currentline = 0;
int *local_map; /* local pointer to renaming structore */
/* is assigned to rd->local_map at the end */
+ branch_target_t *table;
+ lookup_target_t *lookup;
+ s4 i;
+ s4 j;
+
/* get required compiler data */
- m = jd->m;
+ m = jd->m;
/* allocate buffers for local variable renaming */
+
local_map = DMNEW(int, m->maxlocals * 5);
+
for (i = 0; i < m->maxlocals; i++) {
local_map[i * 5 + 0] = 0;
local_map[i * 5 + 1] = 0;
/* initialize local variables */
- iptr = pd.instructions;
- icount = 0;
-
+ iptr = pd.instructions;
+ ircount = 0;
+ bbcount = 0;
+ blockend = false;
+ iswide = false;
+
/* mark basic block boundaries for exception table */
- b_count = parse_mark_exception_boundaries(jd);
- if (b_count < 0)
+ if (!parse_mark_exception_boundaries(jd, &pd))
return false;
/* initialize stack element counter */
/*** LOOP OVER ALL BYTECODE INSTRUCTIONS **********************************/
- for (p = 0; p < m->jcodelength; p = nextp) {
+ for (bcindex = 0; bcindex < m->jcodelength; bcindex = nextbc) {
- /* mark this position as a valid instruction start */
+ /* mark this position as a valid bytecode instruction start */
- pd.instructionstart[p] = 1;
+ pd.bytecodestart[bcindex] = 1;
/* change the current line number, if necessary */
/* XXX rewrite this using pointer arithmetic */
- if (linepcchange == p) {
+ if (linepcchange == bcindex) {
if (m->linenumbercount > lineindex) {
next_linenumber:
currentline = m->linenumbers[lineindex].line_number;
lineindex++;
if (lineindex < m->linenumbercount) {
linepcchange = m->linenumbers[lineindex].start_pc;
- if (linepcchange == p)
+ if (linepcchange == bcindex)
goto next_linenumber;
}
}
fetch_opcode:
/* fetch next opcode */
- opcode = SUCK_BE_U1(m->jcode + p);
+ opcode = SUCK_BE_U1(m->jcode + bcindex);
- /* some compilers put a JAVA_NOP after a blockend instruction */
+ /* If the previous instruction was a block-end instruction,
+ mark the current bytecode instruction as basic-block
+ starting instruction. */
- if (blockend && (opcode != JAVA_NOP)) {
- /* start new block */
+ /* NOTE: Some compilers put a JAVA_NOP after a blockend
+ instruction. */
- MARK_BASICBLOCK(p);
+ if (blockend && (opcode != JAVA_NOP)) {
+ MARK_BASICBLOCK(&pd, bcindex);
blockend = false;
}
- /* We need a NOP as last instruction in each basic block
- for basic block reordering (may be replaced with a GOTO
- later). */
+ /* If the current bytecode instruction was marked as
+ basic-block starting instruction before (e.g. blockend,
+ forward-branch target), mark the current IR instruction
+ too. */
+
+ if (pd.basicblockstart[bcindex] != 0) {
+ /* We need a NOP as last instruction in each basic block
+ for basic block reordering (may be replaced with a GOTO
+ later). */
- if (jd->basicblockindex[p] & 1) {
INSTRUCTIONS_CHECK(1);
OP(ICMD_NOP);
}
/* store intermediate instruction count (bit 0 mark block starts) */
- jd->basicblockindex[p] |= (icount << 1);
+ pd.bytecodemap[bcindex] = ircount;
/* compute next instruction start */
- nextp = p + jcommandsize[opcode];
+ nextbc = bcindex + jcommandsize[opcode];
- CHECK_END_OF_BYTECODE(nextp);
+ CHECK_END_OF_BYTECODE(nextbc);
/* add stack elements produced by this instruction */
/* pushing constants onto the stack ***********************************/
case JAVA_BIPUSH:
- OP_LOADCONST_I(SUCK_BE_S1(m->jcode + p + 1));
+ OP_LOADCONST_I(SUCK_BE_S1(m->jcode + bcindex + 1));
break;
case JAVA_SIPUSH:
- OP_LOADCONST_I(SUCK_BE_S2(m->jcode + p + 1));
+ OP_LOADCONST_I(SUCK_BE_S2(m->jcode + bcindex + 1));
break;
case JAVA_LDC1:
- i = SUCK_BE_U1(m->jcode + p + 1);
+ i = SUCK_BE_U1(m->jcode + bcindex + 1);
goto pushconstantitem;
case JAVA_LDC2:
case JAVA_LDC2W:
- i = SUCK_BE_U2(m->jcode + p + 1);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
pushconstantitem:
case JAVA_FLOAD:
case JAVA_ALOAD:
if (iswide == false) {
- i = SUCK_BE_U1(m->jcode + p + 1);
+ i = SUCK_BE_U1(m->jcode + bcindex + 1);
}
else {
- i = SUCK_BE_U2(m->jcode + p + 1);
- nextp = p + 3;
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ nextbc = bcindex + 3;
iswide = false;
}
OP_LOAD_ONEWORD(opcode, i, opcode - JAVA_ILOAD);
case JAVA_LLOAD:
case JAVA_DLOAD:
if (iswide == false) {
- i = SUCK_BE_U1(m->jcode + p + 1);
+ i = SUCK_BE_U1(m->jcode + bcindex + 1);
}
else {
- i = SUCK_BE_U2(m->jcode + p + 1);
- nextp = p + 3;
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ nextbc = bcindex + 3;
iswide = false;
}
OP_LOAD_TWOWORD(opcode, i, opcode - JAVA_ILOAD);
case JAVA_FSTORE:
case JAVA_ASTORE:
if (iswide == false) {
- i = SUCK_BE_U1(m->jcode + p + 1);
+ i = SUCK_BE_U1(m->jcode + bcindex + 1);
}
else {
- i = SUCK_BE_U2(m->jcode + p + 1);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ nextbc = bcindex + 3;
iswide = false;
- nextp = p + 3;
}
OP_STORE_ONEWORD(opcode, i, opcode - JAVA_ISTORE);
break;
case JAVA_LSTORE:
case JAVA_DSTORE:
if (iswide == false) {
- i = SUCK_BE_U1(m->jcode + p + 1);
+ i = SUCK_BE_U1(m->jcode + bcindex + 1);
}
else {
- i = SUCK_BE_U2(m->jcode + p + 1);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ nextbc = bcindex + 3;
iswide = false;
- nextp = p + 3;
}
OP_STORE_TWOWORD(opcode, i, opcode - JAVA_ISTORE);
break;
int v;
if (iswide == false) {
- i = SUCK_BE_U1(m->jcode + p + 1);
- v = SUCK_BE_S1(m->jcode + p + 2);
+ i = SUCK_BE_U1(m->jcode + bcindex + 1);
+ v = SUCK_BE_S1(m->jcode + bcindex + 2);
}
else {
- i = SUCK_BE_U2(m->jcode + p + 1);
- v = SUCK_BE_S2(m->jcode + p + 3);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ v = SUCK_BE_S2(m->jcode + bcindex + 3);
+ nextbc = bcindex + 5;
iswide = false;
- nextp = p + 5;
}
INDEX_ONEWORD(i);
LOCALTYPE_USED(i, TYPE_INT);
/* wider index for loading, storing and incrementing ******************/
case JAVA_WIDE:
+ bcindex++;
iswide = true;
- p++;
goto fetch_opcode;
/* managing arrays ****************************************************/
case JAVA_NEWARRAY:
- switch (SUCK_BE_S1(m->jcode + p + 1)) {
+ switch (SUCK_BE_S1(m->jcode + bcindex + 1)) {
case 4:
bte = builtintable_get_internal(BUILTIN_newarray_boolean);
break;
break;
case JAVA_ANEWARRAY:
- i = SUCK_BE_U2(m->jcode + p + 1);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
compr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
- if (!compr)
+ if (compr == NULL)
return false;
if (!(cr = class_get_classref_multiarray_of(1, compr)))
case JAVA_MULTIANEWARRAY:
jd->isleafmethod = false;
- i = SUCK_BE_U2(m->jcode + p + 1);
- j = SUCK_BE_U1(m->jcode + p + 3);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ j = SUCK_BE_U1(m->jcode + bcindex + 3);
cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
if (cr == NULL)
case JAVA_IF_ACMPEQ:
case JAVA_IF_ACMPNE:
case JAVA_GOTO:
- i = p + SUCK_BE_S2(m->jcode + p + 1);
+ i = bcindex + SUCK_BE_S2(m->jcode + bcindex + 1);
CHECK_BYTECODE_INDEX(i);
- MARK_BASICBLOCK(i);
+ MARK_BASICBLOCK(&pd, i);
blockend = true;
OP_INSINDEX(opcode, i);
break;
case JAVA_GOTO_W:
- i = p + SUCK_BE_S4(m->jcode + p + 1);
+ i = bcindex + SUCK_BE_S4(m->jcode + bcindex + 1);
CHECK_BYTECODE_INDEX(i);
- MARK_BASICBLOCK(i);
+ MARK_BASICBLOCK(&pd, i);
blockend = true;
OP_INSINDEX(ICMD_GOTO, i);
break;
case JAVA_JSR:
- i = p + SUCK_BE_S2(m->jcode + p + 1);
+ i = bcindex + SUCK_BE_S2(m->jcode + bcindex + 1);
jsr_tail:
CHECK_BYTECODE_INDEX(i);
- MARK_BASICBLOCK(i);
+ MARK_BASICBLOCK(&pd, i);
blockend = true;
OP_PREPARE_ZEROFLAGS(JAVA_JSR);
iptr->sx.s23.s3.jsrtarget.insindex = i;
break;
case JAVA_JSR_W:
- i = p + SUCK_BE_S4(m->jcode + p + 1);
+ i = bcindex + SUCK_BE_S4(m->jcode + bcindex + 1);
goto jsr_tail;
case JAVA_RET:
if (iswide == false) {
- i = SUCK_BE_U1(m->jcode + p + 1);
+ i = SUCK_BE_U1(m->jcode + bcindex + 1);
}
else {
- i = SUCK_BE_U2(m->jcode + p + 1);
- nextp = p + 3;
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ nextbc = bcindex + 3;
iswide = false;
}
blockend = true;
s4 prevvalue = 0;
#endif
blockend = true;
- nextp = MEMORY_ALIGN((p + 1), 4);
+ nextbc = MEMORY_ALIGN((bcindex + 1), 4);
- CHECK_END_OF_BYTECODE(nextp + 8);
+ CHECK_END_OF_BYTECODE(nextbc + 8);
OP_PREPARE_ZEROFLAGS(opcode);
/* default target */
- j = p + SUCK_BE_S4(m->jcode + nextp);
+ j = bcindex + SUCK_BE_S4(m->jcode + nextbc);
iptr->sx.s23.s3.lookupdefault.insindex = j;
- nextp += 4;
+ nextbc += 4;
CHECK_BYTECODE_INDEX(j);
- MARK_BASICBLOCK(j);
+ MARK_BASICBLOCK(&pd, j);
/* number of pairs */
- num = SUCK_BE_U4(m->jcode + nextp);
+ num = SUCK_BE_U4(m->jcode + nextbc);
iptr->sx.s23.s2.lookupcount = num;
- nextp += 4;
+ nextbc += 4;
/* allocate the intermediate code table */
/* iterate over the lookup table */
- CHECK_END_OF_BYTECODE(nextp + 8 * num);
+ CHECK_END_OF_BYTECODE(nextbc + 8 * num);
for (i = 0; i < num; i++) {
/* value */
- j = SUCK_BE_S4(m->jcode + nextp);
+ j = SUCK_BE_S4(m->jcode + nextbc);
lookup->value = j;
- nextp += 4;
+ nextbc += 4;
#if defined(ENABLE_VERIFIER)
/* check if the lookup table is sorted correctly */
#endif
/* target */
- j = p + SUCK_BE_S4(m->jcode + nextp);
+ j = bcindex + SUCK_BE_S4(m->jcode + nextbc);
lookup->target.insindex = j;
lookup++;
- nextp += 4;
+ nextbc += 4;
CHECK_BYTECODE_INDEX(j);
- MARK_BASICBLOCK(j);
+ MARK_BASICBLOCK(&pd, j);
}
PINC;
branch_target_t *table;
blockend = true;
- nextp = MEMORY_ALIGN((p + 1), 4);
+ nextbc = MEMORY_ALIGN((bcindex + 1), 4);
- CHECK_END_OF_BYTECODE(nextp + 12);
+ CHECK_END_OF_BYTECODE(nextbc + 12);
OP_PREPARE_ZEROFLAGS(opcode);
/* default target */
- deftarget = p + SUCK_BE_S4(m->jcode + nextp);
- nextp += 4;
+ deftarget = bcindex + SUCK_BE_S4(m->jcode + nextbc);
+ nextbc += 4;
CHECK_BYTECODE_INDEX(deftarget);
- MARK_BASICBLOCK(deftarget);
+ MARK_BASICBLOCK(&pd, deftarget);
/* lower bound */
- j = SUCK_BE_S4(m->jcode + nextp);
+ j = SUCK_BE_S4(m->jcode + nextbc);
iptr->sx.s23.s2.tablelow = j;
- nextp += 4;
+ nextbc += 4;
/* upper bound */
- num = SUCK_BE_S4(m->jcode + nextp);
+ num = SUCK_BE_S4(m->jcode + nextbc);
iptr->sx.s23.s3.tablehigh = num;
- nextp += 4;
+ nextbc += 4;
/* calculate the number of table entries */
/* iterate over the target table */
- CHECK_END_OF_BYTECODE(nextp + 4 * num);
+ CHECK_END_OF_BYTECODE(nextbc + 4 * num);
for (i = 0; i < num; i++) {
- j = p + SUCK_BE_S4(m->jcode + nextp);
+ j = bcindex + SUCK_BE_S4(m->jcode + nextbc);
(table++)->insindex = j;
- nextp += 4;
+ nextbc += 4;
CHECK_BYTECODE_INDEX(j);
- MARK_BASICBLOCK(j);
+ MARK_BASICBLOCK(&pd, j);
}
PINC;
case JAVA_PUTSTATIC:
case JAVA_GETFIELD:
case JAVA_PUTFIELD:
- {
- constant_FMIref *fr;
- unresolved_field *uf;
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ fmi = class_getconstant(m->class, i, CONSTANT_Fieldref);
- i = SUCK_BE_U2(m->jcode + p + 1);
- fr = class_getconstant(m->class, i, CONSTANT_Fieldref);
- if (!fr)
- return false;
+ if (fmi == NULL)
+ return false;
- OP_PREPARE_ZEROFLAGS(opcode);
- iptr->sx.s23.s3.fmiref = fr;
+ OP_PREPARE_ZEROFLAGS(opcode);
+ iptr->sx.s23.s3.fmiref = fmi;
- /* only with -noverify, otherwise the typechecker does this */
+ /* only with -noverify, otherwise the typechecker does this */
#if defined(ENABLE_VERIFIER)
- if (!JITDATA_HAS_FLAG_VERIFY(jd)) {
+ if (!JITDATA_HAS_FLAG_VERIFY(jd)) {
#endif
- result = resolve_field_lazy(m, fr);
- if (result == resolveFailed)
- return false;
+ result = resolve_field_lazy(m, fmi);
+
+ if (result == resolveFailed)
+ return false;
- if (result != resolveSucceeded) {
- uf = resolve_create_unresolved_field(m->class, m, iptr);
+ if (result != resolveSucceeded) {
+ uf = resolve_create_unresolved_field(m->class, m, iptr);
- if (uf == NULL)
- return false;
+ if (uf == NULL)
+ return false;
- /* store the unresolved_field pointer */
+ /* store the unresolved_field pointer */
- iptr->sx.s23.s3.uf = uf;
- iptr->flags.bits |= INS_FLAG_UNRESOLVED;
- }
-#if defined(ENABLE_VERIFIER)
+ iptr->sx.s23.s3.uf = uf;
+ iptr->flags.bits |= INS_FLAG_UNRESOLVED;
}
-#endif
- PINC;
+#if defined(ENABLE_VERIFIER)
}
+#endif
+ PINC;
break;
case JAVA_INVOKESTATIC:
OP_PREPARE_ZEROFLAGS(opcode);
- i = SUCK_BE_U2(m->jcode + p + 1);
- mr = class_getconstant(m->class, i, CONSTANT_Methodref);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
- if (mr == NULL)
+ if (fmi == NULL)
return false;
- md = mr->parseddesc.md;
+ md = fmi->parseddesc.md;
if (md->params == NULL)
if (!descriptor_params_from_paramtypes(md, ACC_STATIC))
case JAVA_INVOKESPECIAL:
OP_PREPARE_FLAGS(opcode, INS_FLAG_CHECK);
- i = SUCK_BE_U2(m->jcode + p + 1);
- mr = class_getconstant(m->class, i, CONSTANT_Methodref);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
goto invoke_nonstatic_method;
case JAVA_INVOKEINTERFACE:
OP_PREPARE_ZEROFLAGS(opcode);
- i = SUCK_BE_U2(m->jcode + p + 1);
- mr = class_getconstant(m->class, i, CONSTANT_InterfaceMethodref);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ fmi = class_getconstant(m->class, i, CONSTANT_InterfaceMethodref);
goto invoke_nonstatic_method;
case JAVA_INVOKEVIRTUAL:
OP_PREPARE_ZEROFLAGS(opcode);
- i = SUCK_BE_U2(m->jcode + p + 1);
- mr = class_getconstant(m->class, i, CONSTANT_Methodref);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
invoke_nonstatic_method:
- if (mr == NULL)
+ if (fmi == NULL)
return false;
- md = mr->parseddesc.md;
+ md = fmi->parseddesc.md;
if (md->params == NULL)
if (!descriptor_params_from_paramtypes(md, 0))
invoke_method:
jd->isleafmethod = false;
- iptr->sx.s23.s3.fmiref = mr;
+ iptr->sx.s23.s3.fmiref = fmi;
/* only with -noverify, otherwise the typechecker does this */
#if defined(ENABLE_VERIFIER)
if (!JITDATA_HAS_FLAG_VERIFY(jd)) {
#endif
- result = resolve_method_lazy(m, mr,
- (opcode == JAVA_INVOKESPECIAL));
+ result = resolve_method_lazy(m, fmi,
+ (opcode == JAVA_INVOKESPECIAL));
+
if (result == resolveFailed)
return false;
}
}
else {
- um = resolve_create_unresolved_method(m->class, m, mr,
+ um = resolve_create_unresolved_method(m->class, m, fmi,
(opcode == JAVA_INVOKESTATIC),
(opcode == JAVA_INVOKESPECIAL));
- if (!um)
+ if (um == NULL)
return false;
/* store the unresolved_method pointer */
/* instructions taking class arguments ********************************/
case JAVA_NEW:
- i = SUCK_BE_U2(m->jcode + p + 1);
- cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
- if (!cr)
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ cr = class_getconstant(m->class, i, CONSTANT_Class);
+
+ if (cr == NULL)
return false;
if (!resolve_classref(m, cr, resolveLazy, true, true, &c))
break;
case JAVA_CHECKCAST:
- i = SUCK_BE_U2(m->jcode + p + 1);
- cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ cr = class_getconstant(m->class, i, CONSTANT_Class);
+
if (cr == NULL)
return false;
break;
case JAVA_INSTANCEOF:
- i = SUCK_BE_U2(m->jcode + p + 1);
- cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
+ i = SUCK_BE_U2(m->jcode + bcindex + 1);
+ cr = class_getconstant(m->class, i, CONSTANT_Class);
+
if (cr == NULL)
return false;
case 254:
case 255:
exceptions_throw_verifyerror(m, "Illegal opcode %d at instr %d\n",
- opcode, icount);
+ opcode, ircount);
return false;
break;
#endif /* defined(ENABLE_VERIFIER) */
/* assert that we did not write more ICMDs than allocated */
- assert(icount <= pd.instructionslength);
- assert(icount == (iptr - pd.instructions));
+ assert(ircount <= pd.instructionslength);
+ assert(ircount == (iptr - pd.instructions));
/*** verifier checks ******************************************************/
#if defined(ENABLE_VERIFIER)
- if (p != m->jcodelength) {
+ if (bcindex != m->jcodelength) {
exceptions_throw_verifyerror(m,
"Command-sequence crosses code-boundary");
return false;
/* identify basic blocks */
- /* First instruction always starts a basic block, but check if it
- is already a branch target. */
-
- if ((jd->basicblockindex[0] == 0) || (jd->basicblockindex[0] > 1)) {
- iptr = pd.instructions;
-
- iptr->flags.bits |= INS_FLAG_BASICBLOCK;
-
- /* This is the first basic block. */
+ /* check if first instruction is a branch target */
- b_count = 1;
+ if (pd.basicblockstart[0] == 1) {
+ jd->branchtoentry = true;
}
else {
- jd->branchtoentry = true;
+ /* first instruction always starts a basic block */
- /* In this case the loop below counts the first basic
- block. */
+ iptr = pd.instructions;
- b_count = 0;
+ iptr->flags.bits |= INS_FLAG_BASICBLOCK;
}
- /* Iterate over all bytecode instructions and mark the
- corresponding IR instruction as basic block starting
- instruction. */
+ /* Iterate over all bytecode instructions and set missing
+ basic-block starts in IR instructions. */
+
+ for (bcindex = 0; bcindex < m->jcodelength; bcindex++) {
+ /* Does the current bytecode instruction start a basic
+ block? */
- for (i = 0; i < m->jcodelength; i++) {
- if (jd->basicblockindex[i] & 0x1) {
+ if (pd.basicblockstart[bcindex] == 1) {
#if defined(ENABLE_VERIFIER)
- /* Check if this block starts at the beginning of an
- instruction. */
+ /* Check if this bytecode basic-block start at the
+ beginning of a bytecode instruction. */
- if (pd.instructionstart[i] == 0) {
+ if (pd.bytecodestart[bcindex] == 0) {
exceptions_throw_verifyerror(m,
- "Branch into middle of instruction");
+ "Branch into middle of instruction");
return false;
}
#endif
- /* Mark the IR instruction as basic block starting
- instruction. */
+ /* Get the IR instruction mapped to the bytecode
+ instruction and set the basic block flag. */
- iptr = pd.instructions + (jd->basicblockindex[i] >> 1);
+ irindex = pd.bytecodemap[bcindex];
+ iptr = pd.instructions + irindex;
iptr->flags.bits |= INS_FLAG_BASICBLOCK;
-
- /* Store te basic block number in the array. We need this
- information during stack analysis. */
-
- jd->basicblockindex[i] = b_count;
-
- /* basic block indices of course start with 0 */
-
- b_count++;
}
}
+ /* IR instruction index to basic-block index mapping */
+
+ pd.instructionmap = DMNEW(s4, ircount);
+ MZERO(pd.instructionmap, s4, ircount);
+
/* Iterate over all IR instructions and count the basic blocks. */
iptr = pd.instructions;
- b_count = 0;
+ bbcount = 0;
- for (i = 0; i < icount; i++, iptr++) {
+ for (i = 0; i < ircount; i++, iptr++) {
if (INSTRUCTION_STARTS_BASICBLOCK(iptr)) {
- b_count++;
+ /* store the basic-block number in the IR instruction
+ map */
+
+ pd.instructionmap[i] = bbcount;
+
+ /* post-increment the basic-block count */
+
+ bbcount++;
}
}
/* Allocate basic block array (one more for end ipc). */
- jd->basicblocks = DMNEW(basicblock, b_count + 1);
-
- /* zero out all basic block structures */
-
- MZERO(jd->basicblocks, basicblock, b_count + 1);
+ jd->basicblocks = DMNEW(basicblock, bbcount + 1);
+ MZERO(jd->basicblocks, basicblock, bbcount + 1);
/* Now iterate again over all IR instructions and initialize the
- basic block structures. */
+ basic block structures and, in the same loop, resolve the
+ branch-target instruction indices to basic blocks. */
iptr = pd.instructions;
bptr = jd->basicblocks;
- b_count = 0;
+ bbcount = 0;
+
+ for (i = 0; i < ircount; i++, iptr++) {
+ /* check for basic block */
- for (i = 0; i < icount; i++, iptr++) {
if (INSTRUCTION_STARTS_BASICBLOCK(iptr)) {
/* intialize the basic block */
bptr->iinstr = iptr;
- if (b_count > 0) {
+ if (bbcount > 0) {
bptr[-1].icount = bptr->iinstr - bptr[-1].iinstr;
}
/* bptr->icount is set when the next block is allocated */
- bptr->nr = b_count++;
+ bptr->nr = bbcount++;
bptr++;
bptr[-1].next = bptr;
}
+
+ /* resolve instruction indices to basic blocks */
+
+ switch (iptr->opc) {
+ case JAVA_IFEQ:
+ case JAVA_IFLT:
+ case JAVA_IFLE:
+ case JAVA_IFNE:
+ case JAVA_IFGT:
+ case JAVA_IFGE:
+ case JAVA_IFNULL:
+ case JAVA_IFNONNULL:
+ case JAVA_IF_ICMPEQ:
+ case JAVA_IF_ICMPNE:
+ case JAVA_IF_ICMPLT:
+ case JAVA_IF_ICMPGT:
+ case JAVA_IF_ICMPLE:
+ case JAVA_IF_ICMPGE:
+ case JAVA_IF_ACMPEQ:
+ case JAVA_IF_ACMPNE:
+ case JAVA_GOTO:
+ BYTECODEINDEX_TO_BASICBLOCK(iptr->dst);
+ break;
+
+ case ICMD_JSR:
+ BYTECODEINDEX_TO_BASICBLOCK(iptr->sx.s23.s3.jsrtarget);
+ break;
+
+ case ICMD_TABLESWITCH:
+ table = iptr->dst.table;
+
+ BYTECODEINDEX_TO_BASICBLOCK(*table);
+ table++;
+
+ j = iptr->sx.s23.s3.tablehigh - iptr->sx.s23.s2.tablelow + 1;
+
+ while (--j >= 0) {
+ BYTECODEINDEX_TO_BASICBLOCK(*table);
+ table++;
+ }
+ break;
+
+ case ICMD_LOOKUPSWITCH:
+ BYTECODEINDEX_TO_BASICBLOCK(iptr->sx.s23.s3.lookupdefault);
+
+ lookup = iptr->dst.lookup;
+
+ j = iptr->sx.s23.s2.lookupcount;
+
+ while (--j >= 0) {
+ BYTECODEINDEX_TO_BASICBLOCK(lookup->target);
+ lookup++;
+ }
+ break;
+ }
}
/* set instruction count of last real block */
- if (b_count > 0) {
- bptr[-1].icount = (pd.instructions + icount) - bptr[-1].iinstr;
+ if (bbcount > 0) {
+ bptr[-1].icount = (pd.instructions + ircount) - bptr[-1].iinstr;
}
/* allocate additional block at end */
BASICBLOCK_INIT(bptr, m);
- bptr->nr = b_count;
-
- jd->basicblockindex[m->jcodelength] = b_count;
+ bptr->nr = bbcount;
/* set basicblock pointers in exception table */
- if (!parse_resolve_exception_table(jd))
+ if (!parse_resolve_exception_table(jd, &pd))
return false;
/* store the local map */
jd->varcount =
nlocals /* local variables */
- + b_count * m->maxstack /* invars */
+ + bbcount * m->maxstack /* invars */
+ s_count; /* variables created within blocks (non-invar) */
/* reserve the first indices for local variables */
/* assign local variables to method variables */
jd->instructions = pd.instructions;
- jd->instructioncount = icount;
- jd->basicblockcount = b_count;
- jd->stackcount = s_count + b_count * m->maxstack; /* in-stacks */
+ jd->instructioncount = ircount;
+ jd->basicblockcount = bbcount;
+ jd->stackcount = s_count + bbcount * m->maxstack; /* in-stacks */
/* allocate stack table */
Author: Christian Thalinger
Edwin Steiner
- $Id: parse.h 7628 2007-04-02 19:09:52Z michi $
+ $Id: parse.h 7663 2007-04-04 22:14:42Z twisti $
*/
/* basic block generating macro ***********************************************/
-#define MARK_BASICBLOCK(i) \
+#define MARK_BASICBLOCK(pd, i) \
do { \
- if (!(jd->basicblockindex[(i)] & 1)) { \
- b_count++; \
- jd->basicblockindex[(i)] |= 1; \
- } \
+ (pd)->basicblockstart[(i)] = 1; \
} while (0)
#define INSTRUCTIONS_CHECK(i) \
- if ((icount + (i)) > pd.instructionslength) \
- iptr = parse_realloc_instructions(&pd, icount, (i))
+ if ((ircount + (i)) > pd.instructionslength) \
+ iptr = parse_realloc_instructions(&pd, ircount, (i))
/* intermediate code generating macros ****************************************/
/* afterwards. */
#define PINC \
- iptr++; icount++
+ iptr++; ircount++
#define OP_PREPARE_FLAGS(o, f) \
- iptr->opc = (o); \
- iptr->line = currentline; \
- iptr->flags.bits = (f) | (icount << INS_FLAG_ID_SHIFT);
+ iptr->opc = (o); \
+ iptr->line = currentline; \
+ iptr->flags.bits |= (f) | (ircount << INS_FLAG_ID_SHIFT);
#define OP_PREPARE_ZEROFLAGS(o) \
OP_PREPARE_FLAGS(o, 0)
iptr->sx.s23.s3.fmiref = (fmiref);
-/* external macros ************************************************************/
-
-#define BLOCK_OF(index) \
- (jd->basicblocks + jd->basicblockindex[index])
-
-
/* function prototypes ********************************************************/
bool parse(jitdata *jd);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
*/
#endif /* defined(__DARWIN__) */
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
-/* src/vm/jit/powerpc64/asmpart.S - Java-C interface functions for PowerPC
+/* src/vm/jit/powerpc64/asmpart.S - Java-C interface functions for PowerPC64
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Roland Lezuo
-
- Changes: Christian Thalinger
- Edwin Steiner
-
- $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
*/
#endif /* defined(__DARWIN__) */
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
-/* vm/jit/replace.c - on-stack replacement of methods
+/* src/vm/jit/replace.c - on-stack replacement of methods
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Edwin Steiner
-
$Id$
*/
#endif
#include "mm/memory.h"
+
+#include "threads/threads-common.h"
+
#include "toolbox/logging.h"
+
#include "vm/stringlocal.h"
+
#include "vm/jit/abi.h"
-#include "vm/jit/jit.h"
-#include "vm/jit/replace.h"
-#include "vm/jit/stack.h"
#include "vm/jit/asmpart.h"
#include "vm/jit/disass.h"
-#include "vm/jit/show.h"
-#include "vm/jit/methodheader.h"
+#include "vm/jit/jit.h"
#include "vm/jit/md.h"
+#include "vm/jit/methodheader.h"
+#include "vm/jit/replace.h"
+#include "vm/jit/show.h"
+#include "vm/jit/stack.h"
+
#include "vmcore/options.h"
#include "vmcore/classcache.h"
-#include "native/include/java_lang_String.h"
#define REPLACE_PATCH_DYNAMIC_CALL
/*#define REPLACE_PATCH_ALL*/
s4 dumpsize;
rplpoint *origrp;
replace_safestack_t *safestack;
-#if defined(ENABLE_GC_CACAO)
+#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
threadobject *thread;
#endif
/* get the stackframeinfo for the current thread */
- sfi = *(STACKFRAMEINFO);
+ sfi = STACKFRAMEINFO;
/* recover source state */
/* get the stackframeinfo of this thread */
assert(thread == THREADOBJECT);
- sfi = *( STACKFRAMEINFO );
+ sfi = STACKFRAMEINFO;
/* create the execution state */
es = DNEW(executionstate_t);
if (obj->vftbl->class == class_java_lang_String) {
printf(" \"");
- u = javastring_toutf((java_lang_String *)obj, false);
+ u = javastring_toutf(obj, false);
utf_display_printable_ascii(u);
printf("\"");
}
-/* vm/jit/replace.h - on-stack replacement of methods
+/* src/vm/jit/replace.h - on-stack replacement of methods
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Edwin Steiner
-
- Changes:
-
$Id$
*/
#include "config.h"
#include "vm/types.h"
-#if defined(ENABLE_REPLACEMENT)
+#if !defined(ENABLE_REPLACEMENT)
+
+/*** macros for the codegens (disabled version) ************************/
+
+#define REPLACEMENT_POINTS_INIT(cd, jd)
+#define REPLACEMENT_POINTS_RESET(cd, jd)
+#define REPLACEMENT_POINT_BLOCK_START(cd, bptr)
+#define REPLACEMENT_POINT_INLINE_START(cd, iptr)
+#define REPLACEMENT_POINT_INLINE_BODY(cd, iptr)
+#define REPLACEMENT_POINT_RETURN(cd, iptr)
+#define REPLACEMENT_POINT_INVOKE(cd, iptr)
+#define REPLACEMENT_POINT_INVOKE_RETURN(cd, iptr)
+#define REPLACEMENT_EMIT_STUBS(jd)
+
+#else /* defined(ENABLE_REPLACEMENT) */
/* forward typedefs ***********************************************************/
u1 *savedmcode);
#endif
-#else /* !defined(ENABLE_REPLACEMENT) */
-
-/*** macros for the codegens (disabled version) ************************/
-
-#define REPLACEMENT_POINTS_INIT(cd, jd)
-#define REPLACEMENT_POINTS_RESET(cd, jd)
-#define REPLACEMENT_POINT_BLOCK_START(cd, bptr)
-#define REPLACEMENT_POINT_INLINE_START(cd, iptr)
-#define REPLACEMENT_POINT_INLINE_BODY(cd, iptr)
-#define REPLACEMENT_POINT_RETURN(cd, iptr)
-#define REPLACEMENT_POINT_INVOKE(cd, iptr)
-#define REPLACEMENT_POINT_INVOKE_RETURN(cd, iptr)
-#define REPLACEMENT_EMIT_STUBS(jd)
-
#endif /* defined(ENABLE_REPLACEMENT) */
-#endif
+#endif /* _REPLACE_H */
+
/*
* These are local overrides for various environment variables in Emacs.
-/* src/vm/jit/x86_64/asmpart.S - Java-C interface functions for x86_64
+/* src/vm/jit/s390/asmpart.S - Java-C interface functions for s390
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Andreas Krall
- Reinhard Grafl
- Christian Thalinger
-
- Changes: Edwin Steiner
-
- $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
*/
.long 0
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
#if 0
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
#if !defined(NDEBUG)
#define SHOW_TARGET(target) \
- if (stage >= SHOW_STACK) { \
+ if (stage >= SHOW_PARSE) { \
printf("--> L%03d ", (target).block->nr); \
} \
- else if (stage >= SHOW_PARSE) { \
- printf("--> insindex %d (L%03d) ", (target).insindex, \
- jd->basicblocks[jd->basicblockindex[ \
- (target).insindex]].nr); \
- } \
else { \
printf("--> insindex %d ", (target).insindex); \
}
printf("high=%d low=%d count=%d\n", iptr->sx.s23.s3.tablehigh, iptr->sx.s23.s2.tablelow, i);
while (--i >= 0) {
printf("\t\t%d --> ", (int) (table - iptr->dst.table));
- if (stage >= SHOW_STACK) {
- printf("L%03d\n", table->block->nr);
- }
- else {
- printf("insindex %d (L%03d)\n", table->insindex, BLOCK_OF(table->insindex)->nr);
- }
+ printf("L%03d\n", table->block->nr);
table++;
}
case ICMD_LOOKUPSWITCH:
SHOW_S1(iptr);
- printf("count=%d, default=", iptr->sx.s23.s2.lookupcount);
- if (stage >= SHOW_STACK) {
- printf("L%03d\n", iptr->sx.s23.s3.lookupdefault.block->nr);
- }
- else {
- printf("insindex %d (L%03d)\n", iptr->sx.s23.s3.lookupdefault.insindex, BLOCK_OF(iptr->sx.s23.s3.lookupdefault.insindex)->nr);
- }
+ printf("count=%d, default=L%03d\n",
+ iptr->sx.s23.s2.lookupcount,
+ iptr->sx.s23.s3.lookupdefault.block->nr);
lookup = iptr->dst.lookup;
i = iptr->sx.s23.s2.lookupcount;
+
while (--i >= 0) {
- printf("\t\t%d --> ", lookup->value);
- if (stage >= SHOW_STACK) {
- printf("L%03d\n", lookup->target.block->nr);
- }
- else {
- printf("insindex %d (L%03d)\n", lookup->target.insindex, BLOCK_OF(lookup->target.insindex)->nr);
- }
+ printf("\t\t%d --> L%03d\n",
+ lookup->value,
+ lookup->target.block->nr);
lookup++;
}
break;
-/* src/vm/jit/sparc64/asmpart.S - Java-C interface functions for Sparc
+/* src/vm/jit/sparc64/asmpart.S - Java-C interface functions for Sparc64
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Andreas Krall
- Reinhard Grafl
- Alexander Jordan
-
- Changes:
-
$Id: asmpart.S 4749 2006-04-11 10:20:18Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stack.c 7628 2007-04-02 19:09:52Z michi $
+ $Id: stack.c 7663 2007-04-04 22:14:42Z twisti $
*/
#define BRANCH_TARGET(bt, tempbptr) \
do { \
- tempbptr = BLOCK_OF((bt).insindex); \
+ tempbptr = (bt).block; \
tempbptr = stack_mark_reached(&sd, tempbptr, curstack, \
stackdepth); \
if (tempbptr == NULL) \
icmd_lconst_lcmp_tail:
/* convert LCONST, LCMP, IFXX to IF_LXX */
- iptr->dst.insindex = iptr[2].dst.insindex;
+ iptr->dst.block = iptr[2].dst.block;
iptr[1].opc = ICMD_NOP;
iptr[2].opc = ICMD_NOP;
case ICMD_IFEQ:
iptr->opc = ICMD_IF_LCMPEQ;
icmd_lcmp_if_tail:
- iptr->dst.insindex = iptr[1].dst.insindex;
+ iptr->dst.block = iptr[1].dst.block;
iptr[1].opc = ICMD_NOP;
OP2_BRANCH(TYPE_LNG, TYPE_LNG);
case ICMD_IFEQ:
iptr->opc = ICMD_IF_FCMPEQ;
icmd_if_fcmpl_tail:
- iptr->dst.insindex = iptr[1].dst.insindex;
+ iptr->dst.block = iptr[1].dst.block;
iptr[1].opc = ICMD_NOP;
OP2_BRANCH(TYPE_FLT, TYPE_FLT);
case ICMD_IFEQ:
iptr->opc = ICMD_IF_FCMPEQ;
icmd_if_fcmpg_tail:
- iptr->dst.insindex = iptr[1].dst.insindex;
+ iptr->dst.block = iptr[1].dst.block;
iptr[1].opc = ICMD_NOP;
OP2_BRANCH(TYPE_FLT, TYPE_FLT);
case ICMD_IFEQ:
iptr->opc = ICMD_IF_DCMPEQ;
icmd_if_dcmpl_tail:
- iptr->dst.insindex = iptr[1].dst.insindex;
+ iptr->dst.block = iptr[1].dst.block;
iptr[1].opc = ICMD_NOP;
OP2_BRANCH(TYPE_DBL, TYPE_DBL);
case ICMD_IFEQ:
iptr->opc = ICMD_IF_DCMPEQ;
icmd_if_dcmpg_tail:
- iptr->dst.insindex = iptr[1].dst.insindex;
+ iptr->dst.block = iptr[1].dst.block;
iptr[1].opc = ICMD_NOP;
OP2_BRANCH(TYPE_DBL, TYPE_DBL);
case ICMD_JSR:
OP0_1(TYPE_RET);
- tbptr = BLOCK_OF(iptr->sx.s23.s3.jsrtarget.insindex);
+ tbptr = iptr->sx.s23.s3.jsrtarget.block;
tbptr->type = BBTYPE_SBR;
assert(sd.bptr->next); /* XXX exception */
#endif
tbptr = stack_mark_reached(&sd, tbptr, curstack, stackdepth);
- if (!tbptr)
+ if (tbptr == NULL)
return false;
iptr->sx.s23.s3.jsrtarget.block = tbptr;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stacktrace.c 7632 2007-04-02 20:05:05Z michi $
+ $Id: stacktrace.c 7657 2007-04-03 15:51:52Z twisti $
*/
/* get current stackframe info pointer */
- psfi = STACKFRAMEINFO;
+ psfi = &STACKFRAMEINFO;
/* if we don't have pv handy */
#endif /* defined(ENABLE_INTRP) */
-/* stacktrace_create_inline_stackframeinfo *************************************
-
- Creates an stackframe info structure for an inline exception stub.
-
-*******************************************************************************/
-
-void stacktrace_create_inline_stackframeinfo(stackframeinfo *sfi, u1 *pv,
- u1 *sp, u1 *ra, u1 *xpc)
-{
- stackframeinfo **psfi;
-
- /* get current stackframe info pointer */
-
- psfi = STACKFRAMEINFO;
-
-#if defined(ENABLE_INTRP)
- if (opt_intrp) {
- /* if we don't have pv handy */
-
- if (pv == NULL)
- pv = codegen_get_pv_from_pc(ra);
-
- }
-#endif
-
- /* fill new stackframe info structure */
-
- sfi->prev = *psfi;
- sfi->method = NULL;
- sfi->pv = pv;
- sfi->sp = sp;
- sfi->ra = ra;
- sfi->xpc = xpc;
-
- /* store new stackframe info pointer */
-
- *psfi = sfi;
-}
-
-
/* stacktrace_create_extern_stackframeinfo *************************************
Creates an stackframe info structure for an extern exception
/* get current stackframe info pointer */
- psfi = STACKFRAMEINFO;
+ psfi = &STACKFRAMEINFO;
/* sometimes we don't have pv handy (e.g. in asmpart.S:
L_asm_call_jit_compiler_exception or in the interpreter). */
/* get current stackframe info pointer */
- psfi = STACKFRAMEINFO;
+ psfi = &STACKFRAMEINFO;
/* fill new stackframe info structure */
/* get current stackframe info pointer */
- psfi = STACKFRAMEINFO;
+ psfi = &STACKFRAMEINFO;
/* restore the old pointer */
}
-/* stacktrace_inline_arithmeticexception ***************************************
-
- Creates an ArithemticException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_arithmeticexception(u1 *pv, u1 *sp,
- u1 *ra, u1 *xpc)
-{
- stackframeinfo sfi;
- java_objectheader *o;
-
- /* create stackframeinfo */
-
- stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- /* create exception */
-
- o = exceptions_new_arithmeticexception();
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- return o;
-}
-
-
-/* stacktrace_inline_arrayindexoutofboundsexception ****************************
-
- Creates an ArrayIndexOutOfBoundsException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_arrayindexoutofboundsexception(u1 *pv,
- u1 *sp,
- u1 *ra,
- u1 *xpc,
- s4 index)
-{
- stackframeinfo sfi;
- java_objectheader *o;
-
- /* create stackframeinfo */
-
- stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- /* create exception */
-
- o = exceptions_new_arrayindexoutofboundsexception(index);
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- return o;
-}
-
-
-/* stacktrace_inline_arraystoreexception ***************************************
-
- Creates an ArrayStoreException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_arraystoreexception(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc)
-{
- stackframeinfo sfi;
- java_objectheader *o;
-
- /* create stackframeinfo */
-
- stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- /* create exception */
-
- o = exceptions_new_arraystoreexception();
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- return o;
-}
-
-
-/* stacktrace_inline_classcastexception ****************************************
-
- Creates an ClassCastException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_classcastexception(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc,
- java_objectheader *o)
-{
- stackframeinfo sfi;
- java_objectheader *e;
-
- /* create stackframeinfo */
-
- stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- /* create exception */
-
- e = exceptions_new_classcastexception(o);
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- return e;
-}
-
-
-/* stacktrace_inline_nullpointerexception **************************************
-
- Creates an NullPointerException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_nullpointerexception(u1 *pv, u1 *sp,
- u1 *ra, u1 *xpc)
-{
- stackframeinfo sfi;
- java_objectheader *o;
-
- /* create stackframeinfo */
-
- stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- /* create exception */
-
- o = exceptions_new_nullpointerexception();
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- return o;
-}
-
-
-/* stacktrace_inline_fillInStackTrace ******************************************
-
- Fills in the correct stacktrace into an existing exception object
- (this one is for inline exception stubs).
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_fillInStackTrace(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc)
-{
- stackframeinfo sfi;
- java_objectheader *o;
- methodinfo *m;
-
- /* create stackframeinfo */
-
- stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- /* get exception */
-
- o = *exceptionptr;
- assert(o);
-
- /* clear exception */
-
- *exceptionptr = NULL;
-
- /* resolve methodinfo pointer from exception object */
-
-#if defined(ENABLE_JAVASE)
- m = class_resolvemethod(o->vftbl->class,
- utf_fillInStackTrace,
- utf_void__java_lang_Throwable);
-#elif defined(ENABLE_JAVAME_CLDC1_1)
- m = class_resolvemethod(o->vftbl->class,
- utf_fillInStackTrace,
- utf_void__void);
-#else
-#error IMPLEMENT ME!
-#endif
-
- /* call function */
-
- (void) vm_call_method(m, o);
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- return o;
-}
-
-
-/* stacktrace_hardware_arithmeticexception *************************************
-
- Creates an ArithemticException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_hardware_arithmeticexception(u1 *pv, u1 *sp,
- u1 *ra, u1 *xpc)
-{
- stackframeinfo sfi;
- java_objectheader *o;
-
- /* create stackframeinfo */
-
- stacktrace_create_extern_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- /* create exception */
-
- o = exceptions_new_arithmeticexception();
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- return o;
-}
-
-
-/* stacktrace_hardware_nullpointerexception ************************************
-
- Creates an NullPointerException for the SIGSEGV signal handler.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_hardware_nullpointerexception(u1 *pv, u1 *sp,
- u1 *ra, u1 *xpc)
-{
- stackframeinfo sfi;
- java_objectheader *o;
-
- /* create stackframeinfo */
-
- stacktrace_create_extern_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- /* create exception */
-
- o = exceptions_new_nullpointerexception();
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- return o;
-}
-
-
/* stacktrace_add_entry ********************************************************
Adds a new entry to the stacktrace buffer.
Generates a stacktrace from the thread passed into a
stacktracebuffer. The stacktracebuffer is allocated on the
dump memory.
+
+ NOTE: The first element in the stackframe chain must always be a
+ native stackframeinfo (e.g. VMThrowable.fillInStackTrace() is
+ a native function).
RETURN VALUE:
pointer to the stacktracebuffer, or
*******************************************************************************/
-stacktracebuffer *stacktrace_create(threadobject* thread)
+stacktracebuffer *stacktrace_create(stackframeinfo *sfi)
{
stacktracebuffer *stb;
- stackframeinfo *sfi;
methodinfo *m;
codeinfo *code;
u1 *pv;
stb->used = 0;
stb->entries = DMNEW(stacktrace_entry, STACKTRACE_CAPACITY_DEFAULT);
- /* The first element in the stackframe chain must always be a
- native stackframeinfo (VMThrowable.fillInStackTrace is a native
- function). */
-
- /* We don't use the STACKFRAMEINFO macro here, as we have to use
- the passed thread. */
-
-#if defined(ENABLE_THREADS)
- sfi = thread->_stackframeinfo;
-#else
- sfi = _no_threads_stackframeinfo;
-#endif
-
#define PRINTMETHODS 0
#if PRINTMETHODS
/* create a stacktrace from the current thread */
- stb = stacktrace_create(THREADOBJECT);
- if (!stb)
+ stb = stacktrace_create(STACKFRAMEINFO);
+
+ if (stb == NULL)
goto return_NULL;
/* allocate memory from the GC heap and copy the stacktrace buffer */
/* create a stacktrace for the current thread */
- stb = stacktrace_create(THREADOBJECT);
- if (!stb)
+ stb = stacktrace_create(STACKFRAMEINFO);
+
+ if (stb == NULL)
goto return_NULL;
/* calculate the size of the Class array */
/* create a stacktrace for the current thread */
- stb = stacktrace_create(THREADOBJECT);
- if (!stb)
+ stb = stacktrace_create(STACKFRAMEINFO);
+
+ if (stb == NULL)
goto return_NULL; /* XXX exception: how to distinguish from normal NULL return? */
/* iterate over all stacktrace entries and find the first suitable
/* create a stacktrace for the current thread */
- stb = stacktrace_create(THREADOBJECT);
+ stb = stacktrace_create(STACKFRAMEINFO);
if (stb == NULL)
goto return_NULL;
}
-/* stacktrace_dump_trace *******************************************************
-
- This method is call from signal_handler_sigusr1 to dump the
- stacktrace of the current thread to stdout.
-
-*******************************************************************************/
-
-void stacktrace_dump_trace(threadobject *thread)
-{
- stacktracebuffer *stb;
- s4 dumpsize;
-
- /* mark start of dump memory area */
-
- dumpsize = dump_size();
-
- /* create a stacktrace for the current thread */
-
- stb = stacktrace_create(thread);
-
- /* print stacktrace */
-
- if (stb != NULL)
- stacktrace_print_trace_from_buffer(stb);
- else {
- puts("\t<<No stacktrace available>>");
- fflush(stdout);
- }
-
- dump_release(dumpsize);
-}
-
-
/* stacktrace_print_trace ******************************************************
Print the stacktrace of a given exception. More or less a wrapper
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stacktrace.h 7483 2007-03-08 13:17:40Z michi $
+ $Id: stacktrace.h 7667 2007-04-05 00:16:05Z michi $
*/
#include "md-abi.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#else
-# include "threads/none/threads.h"
-#endif
-
#include "vmcore/class.h"
#include "vmcore/method.h"
u1 *ra);
#endif
-void stacktrace_create_inline_stackframeinfo(stackframeinfo *sfi, u1 *pv,
- u1 *sp, u1 *ra, u1 *xpc);
-
void stacktrace_create_extern_stackframeinfo(stackframeinfo *sfi, u1 *pv,
u1 *sp, u1 *ra, u1 *xpc);
void stacktrace_remove_stackframeinfo(stackframeinfo *sfi);
-/* inline exception creating functions */
-java_objectheader *stacktrace_inline_arithmeticexception(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc);
-#define STACKTRACE_inline_arithmeticexception \
- (functionptr) stacktrace_inline_arithmeticexception
-
-
-java_objectheader *stacktrace_inline_arrayindexoutofboundsexception(u1 *pv,
- u1 *sp,
- u1 *ra,
- u1 *xpc,
- s4 index);
-#define STACKTRACE_inline_arrayindexoutofboundsexception \
- (functionptr) stacktrace_inline_arrayindexoutofboundsexception
-
-java_objectheader *stacktrace_inline_arraystoreexception(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc);
-#define STACKTRACE_inline_arraystoreexception \
- (functionptr) stacktrace_inline_arraystoreexception
-
-java_objectheader *stacktrace_inline_classcastexception(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc,
- java_objectheader *o);
-#define STACKTRACE_inline_classcastexception \
- (functionptr) stacktrace_inline_classcastexception
-
-java_objectheader *stacktrace_inline_nullpointerexception(u1 *pv, u1 *sp,
- u1 *ra, u1 *xpc);
-#define STACKTRACE_inline_nullpointerexception \
- (functionptr) stacktrace_inline_nullpointerexception
-
-/* refill the stacktrace of an existing exception */
-java_objectheader *stacktrace_inline_fillInStackTrace(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc);
-#define STACKTRACE_inline_fillInStackTrace \
- (functionptr) stacktrace_inline_fillInStackTrace
-
-
-/* hardware exception creating functions */
-java_objectheader *stacktrace_hardware_arithmeticexception(u1 *pv, u1 *sp,
- u1 *ra, u1 *xpc);
-
-java_objectheader *stacktrace_hardware_nullpointerexception(u1 *pv, u1 *sp,
- u1 *ra, u1 *xpc);
+stacktracebuffer *stacktrace_create(stackframeinfo *sfi);
stacktracecontainer *stacktrace_fillInStackTrace(void);
java_objectarray *stacktrace_getStack(void);
#endif
-void stacktrace_dump_trace(threadobject *thread);
+void stacktrace_print_trace_from_buffer(stacktracebuffer *stb);
void stacktrace_print_trace(java_objectheader *xptr);
-
/* machine dependent functions (code in ARCH_DIR/md.c) */
#if defined(ENABLE_JIT)
/* src/vm/jit/verify/icmds.c - ICMD-specific type checking code
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Edwin Steiner
-
- Changes:
-
$Id$
*/
case ICMD_JSR: /* {STACKBASED} */
/* {RESULTNOW} */
- tbptr = BLOCK_OF(IPTR->sx.s23.s3.jsrtarget.insindex);
+ tbptr = IPTR->sx.s23.s3.jsrtarget.block;
TYPEINFO_INIT_RETURNADDRESS(stack[0].typeinfo, tbptr);
REACH_BLOCK(tbptr);
GENERATED /* may use stack[1] ... stack[1] */
GENERATED
GENERATED
-# line 355 "src/vm/jit/verify/icmds.c"
+# line 349 "src/vm/jit/verify/icmds.c"
GENERATED if (IPTR->flags.bits & INS_FLAG_CLASS) {
GENERATED /* a java.lang.Class reference */
GENERATED TYPEINFO_INIT_JAVA_LANG_CLASS(DST->typeinfo,IPTR->sx.val.c);
GENERATED /* may use stack[1] ... stack[1] */
GENERATED
GENERATED
-# line 99 "src/vm/jit/verify/icmds.c"
+# line 93 "src/vm/jit/verify/icmds.c"
GENERATED TYPECHECK_COUNT(stat_ins_aload);
GENERATED
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 266 "src/vm/jit/verify/icmds.c"
+# line 260 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_INT))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 276 "src/vm/jit/verify/icmds.c"
+# line 270 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_LONG))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 261 "src/vm/jit/verify/icmds.c"
+# line 255 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_FLOAT))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 256 "src/vm/jit/verify/icmds.c"
+# line 250 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_DOUBLE))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 121 "src/vm/jit/verify/icmds.c"
+# line 115 "src/vm/jit/verify/icmds.c"
GENERATED
# if !defined(TYPECHECK_TYPEINFERER)
GENERATED if (!TYPEINFO_MAYBE_ARRAY_OF_REFS(OP1->typeinfo))
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 245 "src/vm/jit/verify/icmds.c"
+# line 239 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_BOOLEAN)
GENERATED && !TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_BYTE))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 251 "src/vm/jit/verify/icmds.c"
+# line 245 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_CHAR))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 271 "src/vm/jit/verify/icmds.c"
+# line 265 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_SHORT))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 114 "src/vm/jit/verify/icmds.c"
+# line 108 "src/vm/jit/verify/icmds.c"
GENERATED TYPEINFO_COPY(OP1->typeinfo, DST->typeinfo);
GENERATED
# line 479 "src/vm/jit/verify/typecheck-stackbased-gen.inc"
GENERATED /* may use stack[-2] ... stack[0] */
GENERATED
GENERATED
-# line 302 "src/vm/jit/verify/icmds.c"
+# line 296 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_INT))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-3] ... stack[0] */
GENERATED
GENERATED
-# line 312 "src/vm/jit/verify/icmds.c"
+# line 306 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_LONG))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-2] ... stack[0] */
GENERATED
GENERATED
-# line 297 "src/vm/jit/verify/icmds.c"
+# line 291 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_FLOAT))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-3] ... stack[0] */
GENERATED
GENERATED
-# line 292 "src/vm/jit/verify/icmds.c"
+# line 286 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_DOUBLE))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-2] ... stack[0] */
GENERATED
GENERATED
-# line 317 "src/vm/jit/verify/icmds.c"
+# line 311 "src/vm/jit/verify/icmds.c"
GENERATED /* we just check the basic input types and that the */
GENERATED /* destination is an array of references. Assignability to */
GENERATED /* the actual array must be checked at runtime, each time the */
GENERATED /* may use stack[-2] ... stack[0] */
GENERATED
GENERATED
-# line 281 "src/vm/jit/verify/icmds.c"
+# line 275 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_BOOLEAN)
GENERATED && !TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_BYTE))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED /* may use stack[-2] ... stack[0] */
GENERATED
GENERATED
-# line 287 "src/vm/jit/verify/icmds.c"
+# line 281 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_CHAR))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[-2] ... stack[0] */
GENERATED
GENERATED
-# line 307 "src/vm/jit/verify/icmds.c"
+# line 301 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_SHORT))
GENERATED VERIFY_ERROR("Array type mismatch");
GENERATED
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 710 "src/vm/jit/verify/icmds.c"
+# line 704 "src/vm/jit/verify/icmds.c"
GENERATED /* we pop 1 */
GENERATED CHECK_CAT1(stack[0]);
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 715 "src/vm/jit/verify/icmds.c"
+# line 709 "src/vm/jit/verify/icmds.c"
GENERATED /* we pop either 11 or 2 */
GENERATED if (IS_CAT1(stack[0]))
GENERATED CHECK_CAT1(stack[-1]);
GENERATED /* may use stack[0] ... stack[1] */
GENERATED
GENERATED
-# line 730 "src/vm/jit/verify/icmds.c"
+# line 724 "src/vm/jit/verify/icmds.c"
GENERATED /* we dup 1 */
GENERATED CHECK_CAT1(stack[0]);
GENERATED
GENERATED /* may use stack[-1] ... stack[1] */
GENERATED
GENERATED
-# line 737 "src/vm/jit/verify/icmds.c"
+# line 731 "src/vm/jit/verify/icmds.c"
GENERATED /* we dup 1 */
GENERATED CHECK_CAT1(stack[0]);
GENERATED /* we skip 1 */
GENERATED /* may use stack[-2] ... stack[1] */
GENERATED
GENERATED
-# line 748 "src/vm/jit/verify/icmds.c"
+# line 742 "src/vm/jit/verify/icmds.c"
GENERATED /* we dup 1 */
GENERATED CHECK_CAT1(stack[0]);
GENERATED /* we skip either 11 or 2 */
GENERATED /* may use stack[-1] ... stack[2] */
GENERATED
GENERATED
-# line 761 "src/vm/jit/verify/icmds.c"
+# line 755 "src/vm/jit/verify/icmds.c"
GENERATED /* we dup either 11 or 2 */
GENERATED if (IS_CAT1(stack[0]))
GENERATED CHECK_CAT1(stack[-1]);
GENERATED /* may use stack[-2] ... stack[2] */
GENERATED
GENERATED
-# line 770 "src/vm/jit/verify/icmds.c"
+# line 764 "src/vm/jit/verify/icmds.c"
GENERATED /* we dup either 11 or 2 */
GENERATED if (IS_CAT1(stack[0]))
GENERATED CHECK_CAT1(stack[-1]);
GENERATED /* may use stack[-3] ... stack[2] */
GENERATED
GENERATED
-# line 784 "src/vm/jit/verify/icmds.c"
+# line 778 "src/vm/jit/verify/icmds.c"
GENERATED /* we dup either 11 or 2 */
GENERATED if (IS_CAT1(stack[0]))
GENERATED CHECK_CAT1(stack[-1]);
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 721 "src/vm/jit/verify/icmds.c"
+# line 715 "src/vm/jit/verify/icmds.c"
GENERATED CHECK_CAT1(stack[0]);
GENERATED CHECK_CAT1(stack[-1]);
GENERATED
GENERATED /* may use stack[1] ... stack[1] */
GENERATED
GENERATED
-# line 399 "src/vm/jit/verify/icmds.c"
+# line 393 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
GENERATED TYPECHECK_COUNT(stat_ins_branch);
GENERATED
GENERATED /* may use stack[1] ... stack[2] */
GENERATED
GENERATED
-# line 405 "src/vm/jit/verify/icmds.c"
+# line 399 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
GENERATED TYPECHECK_COUNT(stat_ins_branch);
GENERATED
GENERATED /* may use stack[1] ... stack[2] */
GENERATED
GENERATED
-# line 411 "src/vm/jit/verify/icmds.c"
+# line 405 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
GENERATED TYPECHECK_COUNT(stat_ins_branch);
GENERATED
GENERATED superblockend = true;
GENERATED
GENERATED
-# line 396 "src/vm/jit/verify/icmds.c"
+# line 390 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
GENERATED TYPECHECK_COUNT(stat_ins_branch);
GENERATED
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 592 "src/vm/jit/verify/icmds.c"
+# line 586 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
- GENERATED tbptr = BLOCK_OF(IPTR->sx.s23.s3.jsrtarget.insindex);
+ GENERATED tbptr = IPTR->sx.s23.s3.jsrtarget.block;
GENERATED
GENERATED TYPEINFO_INIT_RETURNADDRESS(stack[0].typeinfo, tbptr);
GENERATED REACH_BLOCK(tbptr);
GENERATED superblockend = true;
GENERATED
GENERATED
-# line 613 "src/vm/jit/verify/icmds.c"
+# line 607 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
GENERATED CHECK_LOCAL_TYPE(IPTR->s1.varindex, TYPE_RET);
GENERATED if (!TYPEINFO_IS_PRIMITIVE(STATE->locals[IPTR->s1.varindex].typeinfo))
GENERATED /* may use stack[1] ... stack[1] */
GENERATED
GENERATED
-# line 463 "src/vm/jit/verify/icmds.c"
+# line 457 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
GENERATED TYPECHECK_COUNT(stat_ins_switch);
GENERATED
GENERATED /* may use stack[1] ... stack[1] */
GENERATED
GENERATED
-# line 479 "src/vm/jit/verify/icmds.c"
+# line 473 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
GENERATED TYPECHECK_COUNT(stat_ins_switch);
GENERATED
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 545 "src/vm/jit/verify/icmds.c"
+# line 539 "src/vm/jit/verify/icmds.c"
GENERATED if (STATE->returntype.type != TYPE_INT)
GENERATED VERIFY_ERROR("Return type mismatch");
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 550 "src/vm/jit/verify/icmds.c"
+# line 544 "src/vm/jit/verify/icmds.c"
GENERATED if (STATE->returntype.type != TYPE_LNG)
GENERATED VERIFY_ERROR("Return type mismatch");
GENERATED
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 555 "src/vm/jit/verify/icmds.c"
+# line 549 "src/vm/jit/verify/icmds.c"
GENERATED if (STATE->returntype.type != TYPE_FLT)
GENERATED VERIFY_ERROR("Return type mismatch");
GENERATED
GENERATED /* may use stack[-1] ... stack[0] */
GENERATED
GENERATED
-# line 560 "src/vm/jit/verify/icmds.c"
+# line 554 "src/vm/jit/verify/icmds.c"
GENERATED if (STATE->returntype.type != TYPE_DBL)
GENERATED VERIFY_ERROR("Return type mismatch");
GENERATED
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 520 "src/vm/jit/verify/icmds.c"
+# line 514 "src/vm/jit/verify/icmds.c"
GENERATED TYPECHECK_COUNT(stat_ins_areturn);
GENERATED if (!TYPEINFO_IS_REFERENCE(OP1->typeinfo))
GENERATED VERIFY_ERROR("illegal instruction: ARETURN on non-reference");
GENERATED superblockend = true;
GENERATED
GENERATED
-# line 565 "src/vm/jit/verify/icmds.c"
+# line 559 "src/vm/jit/verify/icmds.c"
GENERATED if (STATE->returntype.type != TYPE_VOID)
GENERATED VERIFY_ERROR("Return type mismatch");
GENERATED
GENERATED /* variable number of outslots! */
GENERATED
GENERATED
-# line 164 "src/vm/jit/verify/icmds.c"
+# line 158 "src/vm/jit/verify/icmds.c"
GENERATED stack = typecheck_stackbased_verify_fieldaccess(STATE, NULL, NULL, stack);
GENERATED if (stack == NULL)
GENERATED EXCEPTION;
GENERATED /* variable number of inslots! */
GENERATED
GENERATED
-# line 146 "src/vm/jit/verify/icmds.c"
+# line 140 "src/vm/jit/verify/icmds.c"
GENERATED CHECK_STACK_DEPTH(1);
GENERATED if (!IS_CAT1(stack[0])) {
GENERATED /* (stack depth >= 2 is guaranteed) */
GENERATED /* variable number of outslots! */
GENERATED
GENERATED
-# line 157 "src/vm/jit/verify/icmds.c"
+# line 151 "src/vm/jit/verify/icmds.c"
GENERATED CHECK_STACK_TYPE(stack[0], TYPE_ADR);
GENERATED stack = typecheck_stackbased_verify_fieldaccess(STATE, stack, NULL, stack-1);
GENERATED if (stack == NULL)
GENERATED /* variable number of inslots! */
GENERATED
GENERATED
-# line 134 "src/vm/jit/verify/icmds.c"
+# line 128 "src/vm/jit/verify/icmds.c"
GENERATED CHECK_STACK_DEPTH(2);
GENERATED if (!IS_CAT1(stack[0])) {
GENERATED CHECK_STACK_DEPTH(3);
GENERATED /* variable number of outslots! */
GENERATED
GENERATED
-# line 636 "src/vm/jit/verify/icmds.c"
+# line 630 "src/vm/jit/verify/icmds.c"
GENERATED TYPECHECK_COUNT(stat_ins_invoke);
GENERATED
GENERATED INSTRUCTION_GET_METHODDESC(IPTR, md);
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 239 "src/vm/jit/verify/icmds.c"
+# line 233 "src/vm/jit/verify/icmds.c"
GENERATED if (!TYPEINFO_MAYBE_ARRAY(OP1->typeinfo)
GENERATED && OP1->typeinfo.typeclass.cls != pseudo_class_Arraystub)
GENERATED VERIFY_ERROR("illegal instruction: ARRAYLENGTH on non-array");
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 499 "src/vm/jit/verify/icmds.c"
+# line 493 "src/vm/jit/verify/icmds.c"
GENERATED TYPECHECK_COUNT(stat_ins_athrow);
GENERATED r = typeinfo_is_assignable_to_class(&OP1->typeinfo,
GENERATED CLASSREF_OR_CLASSINFO(class_java_lang_Throwable));
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 373 "src/vm/jit/verify/icmds.c"
+# line 367 "src/vm/jit/verify/icmds.c"
GENERATED
# if !defined(TYPECHECK_TYPEINFERER)
GENERATED /* returnAddress is not allowed */
GENERATED /* may use stack[0] ... stack[0] */
GENERATED
GENERATED
-# line 385 "src/vm/jit/verify/icmds.c"
+# line 379 "src/vm/jit/verify/icmds.c"
GENERATED /* returnAddress is not allowed */
GENERATED if (!TYPEINFO_IS_REFERENCE(OP1->typeinfo))
GENERATED VERIFY_ERROR("Illegal instruction: INSTANCEOF on non-reference");
GENERATED /* variable number of inslots! */
GENERATED
GENERATED
-# line 674 "src/vm/jit/verify/icmds.c"
+# line 668 "src/vm/jit/verify/icmds.c"
GENERATED if (!typecheck_stackbased_multianewarray(STATE, stack, stackfloor))
GENERATED EXCEPTION;
GENERATED stack -= (IPTR->s1.argcount - 1);
GENERATED /* may use stack[1] ... stack[1] */
GENERATED
GENERATED
-# line 397 "src/vm/jit/verify/icmds.c"
+# line 391 "src/vm/jit/verify/icmds.c"
GENERATED /* {RESULTNOW} */
GENERATED TYPECHECK_COUNT(stat_ins_branch);
GENERATED
GENERATED /* variable number of outslots! */
GENERATED
GENERATED
-# line 690 "src/vm/jit/verify/icmds.c"
+# line 684 "src/vm/jit/verify/icmds.c"
GENERATED TYPECHECK_COUNT(stat_ins_builtin);
GENERATED if (!typecheck_stackbased_verify_builtin(STATE, stack, stackfloor))
GENERATED EXCEPTION;
#define REACH(target) \
do { \
- tbptr = BLOCK_OF((target).insindex); \
- REACH_BLOCK(tbptr); \
+ REACH_BLOCK((target).block); \
} while (0)
#undef TYPECHECK_INT
jd = state->jd;
- tbptr = BLOCK_OF(state->iptr->sx.s23.s3.jsrtarget.insindex);
+ tbptr = state->iptr->sx.s23.s3.jsrtarget.block;
jsr = state->jsrinfos[tbptr->nr];
if (jsr && tbptr->flags == BBFINISHED) {
jsr->next = state->topjsr;
state->topjsr = jsr;
- /* XXX ugly */
- assert(BLOCK_OF(state->iptr->sx.s23.s3.jsrtarget.insindex)->flags == BBTYPECHECK_REACHED);
+ assert(state->iptr->sx.s23.s3.jsrtarget.block->flags == BBTYPECHECK_REACHED);
+
tbptr->flags = BBFINISHED;
+
for (tbptr = state->basicblocks; tbptr != NULL; tbptr = tbptr->next) {
jsr->blockflags[tbptr->nr] = tbptr->flags;
+
if (tbptr->flags == BBTYPECHECK_REACHED)
tbptr->flags = BBFINISHED;
}
- BLOCK_OF(state->iptr->sx.s23.s3.jsrtarget.insindex)->flags = BBTYPECHECK_REACHED;
+
+ state->iptr->sx.s23.s3.jsrtarget.block->flags = BBTYPECHECK_REACHED;
}
/* register this block as a caller, if not already done */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
*/
.quad 0
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: emit.c 7644 2007-04-03 11:37:30Z twisti $
*/
codegendata *cd;
codeinfo *code;
rplpoint *rplp;
- s4 disp;
s4 i;
#if !defined(NDEBUG)
u1 *savedmcodeptr;
u1 rm;
s4 d;
s4 disp;
- ptrint val;
s4 type;
+ ptrint val;
java_objectheader *o;
_uc = (ucontext_t *) _p;
void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
{
- ucontext_t *_uc;
- mcontext_t *_mc;
- u1 *sp;
- u1 *ra;
- u1 *xpc;
+ ucontext_t *_uc;
+ mcontext_t *_mc;
+ u1 *pv;
+ u1 *sp;
+ u1 *ra;
+ u1 *xpc;
+ s4 type;
+ ptrint val;
+ java_objectheader *o;
_uc = (ucontext_t *) _p;
_mc = &_uc->uc_mcontext;
/* ATTENTION: Don't use CACAO's internal REG_* defines as they are
different to the ones in <ucontext.h>. */
+ pv = NULL;
sp = (u1 *) _mc->gregs[REG_RSP];
xpc = (u1 *) _mc->gregs[REG_RIP];
ra = xpc; /* return address is equal to xpc */
- _mc->gregs[REG_RAX] =
- (ptrint) stacktrace_hardware_arithmeticexception(NULL, sp, ra, xpc);
+ /* this is an ArithmeticException */
+
+ type = EXCEPTION_HARDWARE_ARITHMETIC;
+ val = 0;
+
+ /* generate appropriate exception */
+
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+
+ /* set registers */
+ _mc->gregs[REG_RAX] = (ptrint) o;
_mc->gregs[REG_R10] = (ptrint) xpc; /* REG_ITMP2_XPC */
_mc->gregs[REG_RIP] = (ptrint) asm_handle_exception;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: statistics.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: statistics.c 7643 2007-04-03 11:35:40Z twisti $
*/
printf(" %10d\n", sum);
printf("\n");
- printf("classinfo (%3d B): %10d\n", sizeof(classinfo), size_classinfo);
- printf("fieldinfo (%3d B): %10d\n", sizeof(fieldinfo), size_fieldinfo);
- printf("methodinfo (%3d B): %10d\n", sizeof(methodinfo), size_methodinfo);
- printf("lineinfo (%3d B): %10d\n", sizeof(lineinfo), size_lineinfo);
- printf("codeinfo (%3d B): %10d\n", sizeof(codeinfo), size_codeinfo);
+ printf("classinfo (%3d B): %10d\n", (int) sizeof(classinfo), size_classinfo);
+ printf("fieldinfo (%3d B): %10d\n", (int) sizeof(fieldinfo), size_fieldinfo);
+ printf("methodinfo (%3d B): %10d\n", (int) sizeof(methodinfo), size_methodinfo);
+ printf("lineinfo (%3d B): %10d\n", (int) sizeof(lineinfo), size_lineinfo);
+ printf("codeinfo (%3d B): %10d\n", (int) sizeof(codeinfo), size_codeinfo);
printf(" ----------\n");
sum =