[kaffe] Kaffe's Machine Stack and Slots

Michael Franz mvfranz at gmail.com
Sat Jan 22 21:14:10 PST 2005


Hi,

I have been going over the internals of Kaffe's execution code,
specifically the way the interpreter's internal stack operates.  What
I understand so far, Kaffe is a stack based interpreter.  The stack is
a stack of 'slots' (defined in slots.h).  A slot is big enough to
store the largest data type in Java.  We push and pop this data
to/from the stack.  Easy enough, what I don't understand is why we
treat doubles and longs differently.

Extract from kaffe.def
define_insn_alias(LCONST_1)
{
	/*
	 * ... -> ..., 0, [0 .. 1]
	 */
	trace_jcode ("lconst %d\n", getopcode() - LCONST_0);	

	push(2);
	move_long_const(stack_long(0), getopcode() - LCONST_0);
}

The push(2) allocates 2 slots on the stack, and then we move the local
constant to the top of the stack.  Easy enough.  What I don't
understand is since a slot is big enough to hold the long, why are we
allocating 2 slots?  Since we only operate on a slot and not 2
concatenated slots, this would imply that we are putting a hole in the
stack when ever we have a long or double operand.  Is there something
that I am missing on this?

Thanks

Michael



More information about the kaffe mailing list