#include <stdint.h>
#include "md-abi.h"
- #include "md-os.h"
#include "vm/types.h"
#include "vm/jit/m68k/codegen.h"
#include "vm/jit/reg.h"
#include "vm/jit/replace.h"
#include "vm/jit/stacktrace.h"
+ #include "vm/jit/trap.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
M_ALD(REG_ATMP1, REG_SP, cd->stackframesize + 4);
M_ATST(REG_ATMP1);
M_BNE(2);
- M_TRAP(M68K_EXCEPTION_HARDWARE_NULLPOINTER);
+ M_TRAP(TRAP_NullPointerException);
}
M_AST(REG_ATMP1, REG_SP, rd->memuse * 8);
(void) dseg_add_unique_s4(cd, 0); /* IntSave */
(void) dseg_add_unique_s4(cd, 0); /* FltSave */
- /* print call trace */
-#if 0
-#if !defined(NDEBUG)
- if (JITDATA_HAS_FLAG_VERBOSECALL(jd)) {
- emit_verbosecall_enter(jd);
- }
-#endif
-#endif
-
/* generate code */
M_AADD_IMM(-(cd->stackframesize*8), REG_SP);
- /* get function address (this must happen before the stackframeinfo) */
- if (f == NULL) {
- patcher_add_patch_ref(jd, PATCHER_resolve_native_function, m, 0);
- }
-
- M_AMOV_IMM(f, REG_ATMP2); /* do not move this line, the patcher is needed */
-
- M_AST(REG_ATMP2, REG_SP, 4 * 4);
-
/* put arguments for codegen_start_native_call onto stack */
/* void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra) */
if (m->flags & ACC_STATIC)
M_INT2ADRMOVE(REG_RESULT, REG_ATMP3);
- /* load function pointer */
- M_ALD(REG_ATMP2, REG_SP, 4 * 4);
-
/* copy arguments into stackframe */
for (i = md->paramcount -1, j = i + skipparams; i >= 0; --i, --j) {
t = md->paramtypes[i].type;
}
/* call the native function */
+ M_AMOV_IMM(f, REG_ATMP2);
M_JSR(REG_ATMP2);
/* save return value */
default: assert(0);
}
-#if 0
- /* print call trace */
-#if ! defined(NDEBUG)
- if (JITDATA_HAS_FLAG_VERBOSECALL(jd)) {
- emit_verbosecall_exit(jd);
- }
-#endif
-#endif
+
/* remove native stackframe info */
/* therefore we call: java_objectheader *codegen_finish_native_call(u1 *datasp) */
/* should never be reached from within jit code*/
M_JSR_IMM(0);
-
- /* generate patcher stub call code */
- emit_patcher_traps(jd);
}
#include "vm/jit/asmpart.h"
#include "vm/jit/stacktrace.h"
+ #include "vm/jit/trap.h"
/* md_init *********************************************************************
sp = (u1 *) (ptrint) _gregs[REG_SP];
ra = (u1 *) (ptrint) _gregs[REG_RA]; /* this is correct for leafs */
-#if !defined(__UCLIBC__) && ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 5))
+#if !defined(__UCLIBC__)
+# if ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 5))
/* NOTE: We only need this for pre glibc-2.5. */
xpc = (u1 *) (ptrint) _mc->pc;
xpc = xpc - 4;
break;
}
+# else
+ xpc = (u1 *) (ptrint) _mc->pc;
+# endif
#else
xpc = (u1 *) (ptrint) _gregs[CTX_EPC];
#endif
type = disp;
val = _gregs[d];
- if (type == EXCEPTION_HARDWARE_COMPILER) {
+ if (type == TRAP_COMPILER) {
/* The XPC is the RA minus 4, because the RA points to the
instruction after the call. */
define is 0. */
addr = _gregs[s1];
- type = (s4) addr;
+ type = (int) addr;
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);
/* Set registers. */
switch (type) {
- case EXCEPTION_HARDWARE_COMPILER:
+ case TRAP_COMPILER:
if (p != NULL) {
_gregs[REG_PV] = (uintptr_t) p;
#if defined(__UCLIBC__)
/* fall-through */
- case EXCEPTION_HARDWARE_PATCHER:
+ case TRAP_PATCHER:
if (p == NULL) {
/* We set the PC again because the cause may have changed
the XPC. */
# include "vm/jit/python.h"
#endif
+ #include "vm/jit/trap.h"
+
#include "vmcore/classcache.h"
#include "vmcore/options.h"
#include "vmcore/statistics.h"
primitive_postinit();
method_init();
- exceptions_init();
+ #if defined(ENABLE_JIT)
+ trap_init();
+ #endif
if (!builtin_init())
vm_abort("vm_create: builtin_init failed");
o = vm_call_method(m, o, s);
if (o == NULL) {
- exceptions_print_stacktrace();
+ fprintf(stderr, "Failed to load Main-Class manifest attribute from\n");
+ fprintf(stderr, "%s\n", mainstring);
return NULL;
}