* src/vm/jit/alpha/codegen.c: Use new trap stuff.
* src/vm/jit/alpha/emit.c: Likewise.
* src/vm/jit/alpha/linux/md-os.c: Likewise.
* src/vm/jit/alpha/md-trap.h: New file.
* src/vm/jit/alpha/md.c: Use new trap stuff.
--HG--
branch : twisti
## src/vm/jit/alpha/Makefile.am
##
-## 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
+## Copyright (C) 1996-2005, 2006, 2007, 2008
+## CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
##
## This file is part of CACAO.
##
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
-##
-##
+
+
DIST_SUBDIRS = \
freebsd \
linux
\
md-abi.c \
md-abi.h \
+ md-trap.h \
md.c \
md.h
#include "vm/jit/reg.h"
#include "vm/jit/replace.h"
#include "vm/jit/stacktrace.h"
+#include "vm/jit/trap.h"
#if defined(ENABLE_SSA)
# include "vm/jit/optimizing/lsra.h"
}
else {
M_BNEZ(REG_A0, 1);
- M_ALD_INTERN(REG_ZERO, REG_ZERO, EXCEPTION_HARDWARE_NULLPOINTER);
+ M_ALD_INTERN(REG_ZERO, REG_ZERO, TRAP_NullPointerException);
}
M_AST(REG_A0, REG_SP, s1 * 8);
/* src/vm/jit/alpha/emit.c - Alpha code emitter functions
- 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
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
#include "threads/lock-common.h"
-#include "vm/exceptions.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/trap.h"
#include "vmcore/options.h"
M_BNEZ(reg, 1);
/* Destination register must not be REG_ZERO, because then no
SIGSEGV is thrown. */
- M_ALD_INTERN(reg, REG_ZERO, EXCEPTION_HARDWARE_ARITHMETIC);
+ M_ALD_INTERN(reg, REG_ZERO, TRAP_ArithmeticException);
}
}
M_ILD(REG_ITMP3, s1, OFFSET(java_array_t, size));
M_CMPULT(s2, REG_ITMP3, REG_ITMP3);
M_BNEZ(REG_ITMP3, 1);
- M_ALD_INTERN(s2, REG_ZERO, EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS);
+ M_ALD_INTERN(s2, REG_ZERO, TRAP_ArrayIndexOutOfBoundsException);
}
}
M_BNEZ(REG_RESULT, 1);
/* Destination register must not be REG_ZERO, because then no
SIGSEGV is thrown. */
- M_ALD_INTERN(REG_RESULT, REG_ZERO, EXCEPTION_HARDWARE_ARRAYSTORE);
+ M_ALD_INTERN(REG_RESULT, REG_ZERO, TRAP_ArrayStoreException);
}
}
default:
vm_abort("emit_classcast_check: unknown condition %d", condition);
}
- M_ALD_INTERN(s1, REG_ZERO, EXCEPTION_HARDWARE_CLASSCAST);
+ M_ALD_INTERN(s1, REG_ZERO, TRAP_ClassCastException);
}
}
M_BNEZ(reg, 1);
/* Destination register must not be REG_ZERO, because then no
SIGSEGV is thrown. */
- M_ALD_INTERN(reg, REG_ZERO, EXCEPTION_HARDWARE_NULLPOINTER);
+ M_ALD_INTERN(reg, REG_ZERO, TRAP_NullPointerException);
}
}
M_BNEZ(REG_RESULT, 1);
/* Destination register must not be REG_ZERO, because then no
SIGSEGV is thrown. */
- M_ALD_INTERN(REG_RESULT, REG_ZERO, EXCEPTION_HARDWARE_EXCEPTION);
+ M_ALD_INTERN(REG_RESULT, REG_ZERO, TRAP_CHECK_EXCEPTION);
}
}
void emit_trap_compiler(codegendata *cd)
{
- M_ALD_INTERN(REG_METHODPTR, REG_ZERO, EXCEPTION_HARDWARE_COMPILER);
+ M_ALD_INTERN(REG_METHODPTR, REG_ZERO, TRAP_COMPILER);
}
/* Get machine code which is patched back in later. The
trap is 1 instruction word long. */
- mcode = *((u4 *) cd->mcodeptr);
+ mcode = *((uint32_t *) cd->mcodeptr);
/* Destination register must not be REG_ZERO, because then no
SIGSEGV is thrown. */
- M_ALD_INTERN(REG_RESULT, REG_ZERO, EXCEPTION_HARDWARE_PATCHER);
+ M_ALD_INTERN(REG_RESULT, REG_ZERO, TRAP_PATCHER);
return mcode;
}
#include "threads/thread.h"
#include "vm/builtin.h"
-#include "vm/exceptions.h"
#include "vm/signallocal.h"
#include "vm/jit/asmpart.h"
#include "vm/jit/executionstate.h"
#include "vm/jit/stacktrace.h"
+#include "vm/jit/trap.h"
#include "vmcore/system.h"
type = disp;
- if (type == EXCEPTION_HARDWARE_COMPILER) {
+ if (type == TRAP_COMPILER) {
/* The XPC is the RA minus 1, because the RA points to the
instruction after the call. */
type = (int) addr;
}
- /* 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);
/* Set registers. */
switch (type) {
- case EXCEPTION_HARDWARE_COMPILER:
+ case TRAP_COMPILER:
if (p != NULL) {
_mc->sc_regs[REG_PV] = (uintptr_t) p;
_mc->sc_pc = (uintptr_t) p;
/* fall-through */
- case EXCEPTION_HARDWARE_PATCHER:
+ case TRAP_PATCHER:
if (p == NULL)
break;
--- /dev/null
+/* src/vm/jit/alpha/md-trap.h - Alpha 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 (alpha) the trap numbers are used as load
+ * displacements and thus must not be 4- or 8-byte aligned.
+ *
+ * NOTE: In trap_init() we have a check whether the offset of
+ * java_arrayheader.data[0] is greater than the largest displacement
+ * defined below. Otherwise normal array loads/stores could trigger
+ * an exception.
+ */
+
+#define TRAP_INSTRUCTION_IS_LOAD 1
+
+enum {
+ TRAP_NullPointerException = 0,
+ TRAP_ArithmeticException = 1,
+ TRAP_ArrayIndexOutOfBoundsException = 2,
+ TRAP_ArrayStoreException = 3,
+
+ /* Don't use 4 (could be a normal load offset). */
+
+ TRAP_ClassCastException = 5,
+ TRAP_CHECK_EXCEPTION = 6,
+ TRAP_PATCHER = 7,
+
+ /* Don't use 8 (could be a normal load offset). */
+
+ TRAP_COMPILER = 9,
+ TRAP_END
+};
+
+#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:
+ */
/* src/vm/jit/alpha/md.c - machine dependent Alpha functions
- 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
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
#include "config.h"
-#include <assert.h>
#include <stdint.h>
#include <ucontext.h>
#include "vm/jit/alpha/codegen.h"
#include "vm/jit/alpha/md.h"
-#include "vm/exceptions.h"
-
#include "vm/jit/asmpart.h"
#include "vm/jit/jit.h"
+#include "vm/jit/trap.h"
/* global variables ***********************************************************/
*(u4*)(savedmcode) = *(u4*)(pc);
/* build the machine code for the patch */
- mcode = (0xa41f0000 | (EXCEPTION_HARDWARE_PATCHER));
+ mcode = (0xa41f0000 | (TRAP_PATCHER));
/* write the new machine code */
*(u4*)(pc) = mcode;