* src/vm/jit/s390/codegen.c: Use new trap stuff.
* src/vm/jit/s390/emit.c: Likewise.
* src/vm/jit/s390/md-trap.h: New file.
* src/vm/jit/s390/md.c: Use new trap stuff.
--HG--
branch : twisti
\
md-abi.c \
md-abi.h \
+ md-trap.h \
md.c \
md.h
#include <stdint.h>
#include <stdio.h>
+#include "vm/jit/s390/arch.h"
+#include "vm/jit/s390/codegen.h"
+#include "vm/jit/s390/emit.h"
+#include "vm/jit/s390/md-abi.h"
+
#include "native/jni.h"
#include "native/localref.h"
#include "native/native.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
#include "vmcore/statistics.h"
+
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/global.h"
+#include "vm/types.h"
+#include "vm/stringlocal.h"
+#include "vm/vm.h"
+
#include "vm/jit/abi.h"
#if defined(ENABLE_LSRA)
# include "vm/jit/allocator/lsra.h"
#include "vm/jit/patcher-common.h"
#include "vm/jit/reg.h"
#include "vm/jit/replace.h"
-#include "vm/jit/s390/arch.h"
-#include "vm/jit/s390/codegen.h"
-#include "vm/jit/s390/emit.h"
-#include "vm/jit/s390/md-abi.h"
#include "vm/jit/stacktrace.h"
-#include "vm/types.h"
-#include "vm/stringlocal.h"
-#include "vm/vm.h"
+#include "vm/jit/trap.h"
+
/* DO__LOG generates a call to do__log. No registers are destroyed,
* so you may use it anywhere. regs is an array containing all general
else {
M_TEST(REG_A0);
M_BNE(SZ_BRC + SZ_ILL);
- M_ILL(EXCEPTION_HARDWARE_NULLPOINTER);
+ M_ILL(TRAP_NullPointerException);
}
disp = dseg_add_functionptr(cd, LOCK_monitor_enter);
#include <assert.h>
#include <stdint.h>
+#include "vm/jit/s390/codegen.h"
+#include "vm/jit/s390/emit.h"
+#include "vm/jit/s390/md-abi.h"
+
#include "mm/memory.h"
#include "threads/lock-common.h"
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/global.h"
+#include "vm/types.h"
+
#include "vm/jit/abi.h"
#include "vm/jit/abi-asm.h"
#include "vm/jit/asmpart.h"
#include "vm/jit/patcher-common.h"
#include "vm/jit/replace.h"
#include "vm/jit/trace.h"
-#include "vm/jit/s390/codegen.h"
-#include "vm/jit/s390/emit.h"
-#include "vm/jit/s390/md-abi.h"
-#include "vm/types.h"
+#include "vm/jit/trap.h"
+
#include "vmcore/options.h"
+
/* emit_load *******************************************************************
Emits a possible load of an operand.
mcode = *((u2 *) cd->mcodeptr);
- M_ILL(EXCEPTION_HARDWARE_PATCHER);
+ M_ILL(TRAP_PATCHER);
return mcode;
}
}
}
-void emit_arithmetic_check(codegendata *cd, instruction *iptr, s4 reg) {
+void emit_arithmetic_check(codegendata *cd, instruction *iptr, s4 reg)
+{
if (INSTRUCTION_MUST_CHECK(iptr)) {
M_TEST(reg);
M_BNE(SZ_BRC + SZ_ILL);
- M_ILL(EXCEPTION_HARDWARE_ARITHMETIC);
+ M_ILL(TRAP_ArithmeticException);
}
}
*/
N_CL(s2, OFFSET(java_array_t, size), RN, s1);
M_BLT(SZ_BRC + SZ_ILL);
- M_ILL2(s2, EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS);
+ M_ILL2(s2, TRAP_ArrayIndexOutOfBoundsException);
}
}
if (INSTRUCTION_MUST_CHECK(iptr)) {
M_TEST(REG_RESULT);
M_BNE(SZ_BRC + SZ_ILL);
- M_ILL(EXCEPTION_HARDWARE_ARRAYSTORE);
+ M_ILL(TRAP_ArrayStoreException);
}
}
default:
vm_abort("emit_classcast_check: unknown condition %d", condition);
}
- M_ILL2(s1, EXCEPTION_HARDWARE_CLASSCAST);
+ M_ILL2(s1, TRAP_ClassCastException);
}
}
-void emit_nullpointer_check(codegendata *cd, instruction *iptr, s4 reg) {
+void emit_nullpointer_check(codegendata *cd, instruction *iptr, s4 reg)
+{
if (INSTRUCTION_MUST_CHECK(iptr)) {
M_TEST(reg);
M_BNE(SZ_BRC + SZ_ILL);
- M_ILL(EXCEPTION_HARDWARE_NULLPOINTER);
+ M_ILL(TRAP_NullPointerException);
}
}
-void emit_exception_check(codegendata *cd, instruction *iptr) {
+void emit_exception_check(codegendata *cd, instruction *iptr)
+{
if (INSTRUCTION_MUST_CHECK(iptr)) {
M_TEST(REG_RESULT);
M_BNE(SZ_BRC + SZ_ILL);
- M_ILL(EXCEPTION_HARDWARE_EXCEPTION);
+ M_ILL(TRAP_CHECK_EXCEPTION);
}
}
void emit_trap_compiler(codegendata *cd)
{
- M_ILL2(REG_METHODPTR, EXCEPTION_HARDWARE_COMPILER);
+ M_ILL2(REG_METHODPTR, TRAP_COMPILER);
}
/*
--- /dev/null
+/* src/vm/jit/s390/md-trap.h - s390 hardware traps
+
+ Copyright (C) 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_TRAP_H
+#define _MD_TRAP_H
+
+#include "config.h"
+
+
+/**
+ * Trap number defines.
+ *
+ * On this architecture (s390) we use illegal instructions as trap
+ * instructions.
+ */
+
+#define TRAP_INSTRUCTION_IS_LOAD 0
+
+enum {
+ TRAP_NullPointerException = 0,
+ TRAP_ArithmeticException = 1,
+ TRAP_ArrayIndexOutOfBoundsException = 2,
+ TRAP_ArrayStoreException = 3,
+ TRAP_ClassCastException = 4,
+ TRAP_CHECK_EXCEPTION = 5,
+ TRAP_PATCHER = 6,
+ TRAP_COMPILER = 7
+};
+
+#endif /* _MD_TRAP_H */
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
#include "vm/jit/methodheader.h"
#include "vm/jit/methodtree.h"
#include "vm/jit/stacktrace.h"
+#include "vm/jit/trap.h"
#if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
#include "vmcore/options.h" /* XXX debug */
pv = (u1 *)_mc->gregs[REG_PV] - N_PV_OFFSET;
sp = (u1 *)_mc->gregs[REG_SP];
ra = xpc;
- type = EXCEPTION_HARDWARE_NULLPOINTER;
+ type = TRAP_NullPointerException;
val = 0;
- /* Handle the type. */
+ /* Handle the trap. */
- p = signal_handle(type, val, pv, sp, ra, xpc, _p);
+ p = trap_handle(type, val, pv, sp, ra, xpc, _p);
if (p != NULL) {
- _mc->gregs[REG_ITMP3_XPTR] = (intptr_t) p;
- _mc->gregs[REG_ITMP1_XPC] = (intptr_t) xpc;
- _mc->psw.addr = (intptr_t) asm_handle_exception;
+ _mc->gregs[REG_ITMP3_XPTR] = (uintptr_t) p;
+ _mc->gregs[REG_ITMP1_XPC] = (uintptr_t) xpc;
+ _mc->psw.addr = (uintptr_t) asm_handle_exception;
}
else {
- _mc->psw.addr = (intptr_t) xpc;
+ _mc->psw.addr = (uintptr_t) xpc;
}
}
sp = (u1 *)_mc->gregs[REG_SP];
val = (ptrint)_mc->gregs[reg];
- if (EXCEPTION_HARDWARE_COMPILER == type) {
+ if (TRAP_COMPILER == type) {
/* The PV from the compiler stub is equal to the XPC. */
pv = xpc;
xpc = ra - 2;
}
- /* Handle the type. */
+ /* Handle the trap. */
- p = signal_handle(type, val, pv, sp, ra, xpc, _p);
+ p = trap_handle(type, val, pv, sp, ra, xpc, _p);
- if (EXCEPTION_HARDWARE_COMPILER == type) {
+ if (TRAP_COMPILER == type) {
if (NULL == p) {
- _mc->gregs[REG_ITMP3_XPTR] = (intptr_t) builtin_retrieve_exception();
- _mc->gregs[REG_ITMP1_XPC] = (intptr_t) ra - 2;
- _mc->gregs[REG_PV] = (intptr_t) md_codegen_get_pv_from_pc(ra);
- _mc->psw.addr = (intptr_t) asm_handle_exception;
+ _mc->gregs[REG_ITMP3_XPTR] = (uintptr_t) builtin_retrieve_exception();
+ _mc->gregs[REG_ITMP1_XPC] = (uintptr_t) ra - 2;
+ _mc->gregs[REG_PV] = (uintptr_t) md_codegen_get_pv_from_pc(ra);
+ _mc->psw.addr = (uintptr_t) asm_handle_exception;
} else {
- _mc->gregs[REG_PV] = (intptr_t) p;
- _mc->psw.addr = (intptr_t) p;
+ _mc->gregs[REG_PV] = (uintptr_t) p;
+ _mc->psw.addr = (uintptr_t) p;
}
} else {
if (p != NULL) {
- _mc->gregs[REG_ITMP3_XPTR] = (intptr_t) p;
- _mc->gregs[REG_ITMP1_XPC] = (intptr_t) xpc;
- _mc->psw.addr = (intptr_t) asm_handle_exception;
+ _mc->gregs[REG_ITMP3_XPTR] = (uintptr_t) p;
+ _mc->gregs[REG_ITMP1_XPC] = (uintptr_t) xpc;
+ _mc->psw.addr = (uintptr_t) asm_handle_exception;
}
else {
- _mc->psw.addr = (intptr_t) xpc;
+ _mc->psw.addr = (uintptr_t) xpc;
}
}
} else {
sp = (u1 *)_mc->gregs[REG_SP];
ra = xpc;
- type = EXCEPTION_HARDWARE_ARITHMETIC;
+ type = TRAP_ArithmeticException;
val = 0;
- /* Handle the type. */
+ /* Handle the trap. */
- p = signal_handle(type, val, pv, sp, ra, xpc, _p);
+ p = trap_handle(type, val, pv, sp, ra, xpc, _p);
- _mc->gregs[REG_ITMP3_XPTR] = (intptr_t) p;
- _mc->gregs[REG_ITMP1_XPC] = (intptr_t) xpc;
- _mc->psw.addr = (intptr_t) asm_handle_exception;
+ _mc->gregs[REG_ITMP3_XPTR] = (uintptr_t) p;
+ _mc->gregs[REG_ITMP1_XPC] = (uintptr_t) xpc;
+ _mc->psw.addr = (uintptr_t) asm_handle_exception;
return;
}