/* src/vm/jit/s390/codegen.c - machine code generator for s390
- 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 "mm/memory.h"
-#if defined(ENABLE_THREADS)
-# include "threads/lock-common.h"
-# include "threads/native/lock.h"
-#endif
+#include "threads/lock-common.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
/* decide which monitor enter function to call */
if (m->flags & ACC_STATIC) {
- disp = dseg_add_address(cd, &m->class->object.header);
+ disp = dseg_add_address(cd, &m->clazz->object.header);
M_ALD_DSEG(REG_A0, disp);
}
else {
}
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
- ((patchref_t *)list_first_unsynced(jd->code->patchers))->disp = (cd->mcodeptr - ref);
+ ((patchref_t *)list_first(jd->code->patchers))->disp = (cd->mcodeptr - ref);
}
switch (fieldtype) {
}
else {
s1 = OFFSET(vftbl_t, interfacetable[0]) -
- sizeof(methodptr*) * lm->class->index;
+ sizeof(methodptr*) * lm->clazz->index;
- s2 = sizeof(methodptr) * (lm - lm->class->methods);
+ s2 = sizeof(methodptr) * (lm - lm->clazz->methods);
}
/* Implicit null-pointer check */
return true;
}
-
-/* codegen_emit_stub_compiler **************************************************
-
- Emits a stub routine which calls the compiler.
-
-*******************************************************************************/
-
-void codegen_emit_stub_compiler(jitdata *jd)
-{
- methodinfo *m;
- codegendata *cd;
-
- /* get required compiler data */
-
- m = jd->m;
- cd = jd->cd;
-
- /* code for the stub */
-
- /* don't touch ITMP2 as it cointains the return address */
-
- M_AADD_IMM(N_PV_OFFSET, REG_PV); /* suppress negative displacements */
-
- /* REG_METHODPTR (REG_ITMP1) already used */
- M_ILD_DSEG(REG_ITMP3, -2 * SIZEOF_VOID_P); /* methodinfo */
- M_ILD_DSEG(REG_PV, -3 * SIZEOF_VOID_P); /* compiler pointer */
- N_BR(REG_PV);
-}
-
-
/* codegen_emit_stub_native ****************************************************
Emits a stub routine which calls a native method.
codeinfo *code;
codegendata *cd;
methoddesc *md;
- s4 i, j; /* count variables */
- s4 t;
- s4 s1, s2, disp;
- s4 funcdisp;
+ int i, j;
+ int t;
+ int s1, s2;
+ int disp;
/* get required compiler data */
M_AST(REG_RA, REG_SP, (cd->stackframesize - 1) * 8);
- /* get function address (this must happen before the stackframeinfo) */
-
- funcdisp = dseg_add_functionptr(cd, f);
-
- if (f == NULL)
- patcher_add_patch_ref(jd, PATCHER_resolve_native_function, m, funcdisp);
-
#if defined(ENABLE_GC_CACAO)
/* Save callee saved integer registers in stackframeinfo (GC may
need to recover them during a collection). */
M_ALD_DSEG(REG_A0, disp);
}
- /* generate the actual native call */
+ /* Call native function. */
- M_ALD_DSEG(REG_ITMP2, funcdisp);
+ disp = dseg_add_functionptr(cd, f);
+ M_ALD_DSEG(REG_ITMP2, disp);
M_CALL(REG_ITMP2);
/* save return value */
/* handle exception */
M_MOV(REG_RA, REG_ITMP1_XPC);
+ M_ASUB_IMM(2, REG_ITMP1_XPC);
disp = dseg_add_functionptr(cd, asm_handle_nat_exception);
M_ALD_DSEG(REG_ITMP2, disp);
M_JMP(RN, REG_ITMP2);
-
- /* generate patcher traps */
-
- emit_patcher_traps(jd);
}
/*