-/* src/vm/jit/x86_64/md-abi.c - functions for x86_64 Linux ABI
+/* src/vm/jit/s390/md-abi.c - s390 Linux ABI
- Copyright (C) 1996-2005, 2006 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, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
- $Id: md-abi.c 8115 2007-06-20 19:14:05Z michi $
-
*/
#include "config.h"
+
+#include "vm/descriptor.hpp"
+#include "vm/global.h"
#include "vm/types.h"
+#include "vm/jit/jit.hpp"
+#include "vm/jit/stack.h"
+
#include "vm/jit/s390/md-abi.h"
-#include "vmcore/descriptor.h"
-#include "vm/global.h"
-#include "vm/jit/jit.h"
+#include <assert.h>
/* register descripton array **************************************************/
s4 nregdescint[] = {
- /* r0, itmp1, a0, a1, a2, a3, a4, s0, */
- REG_TMP, REG_RES, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_SAV,
- /* s1, s2, s3, s4, itmp2, pv, ra/itmp3, sp */
- REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_RES, REG_RES, REG_RES, REG_RES,
+ /*itmp3, itmp1, a0, a1, a2, a3, a4, s0, */
+ REG_RES, REG_RES, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_SAV,
+ /* s1, s2, s3, s4, s5, pv, ra/itmp2, sp */
+ REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_RES, REG_RES, REG_RES,
REG_END
};
8, /* r8/s1 */
9, /* r9/s2 */
10, /* r10/s3 */
- 11 /* r11/s4 */
+ 11, /* r11/s4 */
+ 12 /* r12/s5 */
};
const s4 abi_registers_integer_temporary[] = {
- 0, /* r0 */
+ -1 /* none */
};
s4 nregdescfloat[] = {
};
const s4 abi_registers_float_saved[] = {
- /* nothing */
- -1
+ -1 /* none */
};
const s4 abi_registers_float_temporary[] = {
15 /* f15/ft11 */
};
-/* md_param_alloc **************************************************************
+/* md_param_alloc_intern *******************************************************
- XXX
+ Allocates parameters to registers or stackslots for both native and java
+ methods.
+
+ --- in:
+ slot: size in bytes of a stack slot
+ slots1w: number of stack slots used by a 1 word type parameter
+ slots2w: number of stack slots used by a 2 word type parameter
+ stackoff: offset on stack frame where to start placing arguments
*******************************************************************************/
-void md_param_alloc(methoddesc *md)
+static void md_param_alloc_intern(methoddesc *md, s4 slot, s4 slots1w, s4 slots2w, s4 stackoff)
{
paramdesc *pd;
s4 i;
if (iarg < INT_ARG_CNT) {
pd->inmemory = false;
pd->regoff = abi_registers_integer_argument[iarg];
+ pd->index = iarg;
iarg++;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize * 4;
- stacksize++;
+ pd->regoff = (stacksize * slot) + stackoff;
+ pd->index = stacksize;
+ stacksize += slots1w;
}
break;
pd->regoff =
PACK_REGS(abi_registers_integer_argument[iarg + 1],
abi_registers_integer_argument[iarg]);
+ pd->index = PACK_REGS(iarg + 1, iarg);
iarg += 2;
}
else {
/* _ALIGN(stacksize); */
pd->inmemory = true;
- pd->regoff = stacksize * 4;
+ pd->regoff = (stacksize * slot) + stackoff;
+ pd->index = stacksize;
iarg = INT_ARG_CNT;
- stacksize += 2;
+ stacksize += slots2w;
}
break;
if (farg < FLT_ARG_CNT) {
pd->inmemory = false;
pd->regoff = abi_registers_float_argument[farg];
+ pd->index = farg;
farg++;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize * 4;
- stacksize++;
+ pd->regoff = (stacksize * slot) + stackoff;
+ pd->index = stacksize;
+ stacksize += slots1w;
}
break;
if (farg < FLT_ARG_CNT) {
pd->inmemory = false;
pd->regoff = abi_registers_float_argument[farg];
+ pd->index = farg;
farg++;
}
else {
/* _ALIGN(stacksize); */
pd->inmemory = true;
- pd->regoff = stacksize * 4;
- stacksize += 2;
+ pd->regoff = (stacksize * slot) + stackoff;
+ pd->index = stacksize;
+ stacksize += slots2w;
}
break;
md->memuse = stacksize;
}
-void md_param_alloc_native(methoddesc *md)
+void md_param_alloc(methoddesc *md)
{
- /* On PowerPC we use the same ABI for JIT method calls as for
- * native method calls. */
+ md_param_alloc_intern(md, 8, 1, 1, 0);
+}
- md_param_alloc(md);
+void md_param_alloc_native(methoddesc *md)
+{
+ md_param_alloc_intern(md, 4, 1, 2, 96);
}
*******************************************************************************/
-void md_return_alloc(jitdata *jd, stackptr stackslot)
+void md_return_alloc(jitdata *jd, stackelement_t* stackslot)
{
methodinfo *m;
+ codeinfo *code;
registerdata *rd;
methoddesc *md;
/* get required compiler data */
- m = jd->m;
- rd = jd->rd;
+ m = jd->m;
+ code = jd->code;
+ rd = jd->rd;
md = m->parseddesc;
their argument register -> so leafmethods with paramcount > 0
could already use R3 == a00! */
- if (!jd->isleafmethod || (md->paramcount == 0)) {
+ if (!code_is_leafmethod(code) || (md->paramcount == 0)) {
/* Only precolor the stackslot, if it is not a SAVEDVAR <->
has not to survive method invokations. */
* c-basic-offset: 4
* tab-width: 4
* End:
+ * vim:noexpandtab:sw=4:ts=4:
*/