more JIT bugfixes; implement mul instruction

This commit is contained in:
Joel Dice 2007-12-16 16:52:38 -07:00
parent e4fbadd051
commit 56a8ce8fb1
3 changed files with 36 additions and 17 deletions

View File

@ -28,7 +28,7 @@ src = src
classpath = classpath
test = test
input = $(test-build)/GC.class
input = $(test-build)/List.class
build-cxx = g++
build-cc = gcc

View File

@ -872,10 +872,12 @@ unwind(MyThread* t)
}
}
object
void*
findInterfaceMethodFromInstance(Thread* t, object method, object instance)
{
return findInterfaceMethod(t, method, objectClass(t, instance));
return &singletonValue
(t, methodCompiled
(t, findInterfaceMethod(t, method, objectClass(t, instance))), 0);
}
intptr_t
@ -2157,16 +2159,13 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip)
unsigned instance = parameterFootprint - 1;
Operand* found = c->directCall
(c->constant
(reinterpret_cast<intptr_t>(findInterfaceMethodFromInstance)),
3, c->thread(), frame->append(target),
c->stack(frame->stack, instance));
c->mov(c->memory(found, MethodCompiled), found);
Operand* result = c->call(c->memory(found, SingletonBody));
Operand* result = c->call
(c->directCall
(c->constant
(reinterpret_cast<intptr_t>(findInterfaceMethodFromInstance)),
3, c->thread(), frame->append(target),
c->stack(frame->stack, instance)));
frame->trace(target, true);
frame->pop(parameterFootprint);
@ -3009,13 +3008,13 @@ finish(MyThread* t, Compiler* c, object method, Vector* objectPool,
}
// for debugging:
if (false and
if (//false and
strcmp(reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, methodClass(t, method)), 0)),
"java/lang/Long") == 0 and
"java/util/Collections$ArrayListIterator") == 0 and
strcmp(reinterpret_cast<const char*>
(&byteArrayBody(t, methodName(t, method), 0)),
"toString") == 0)
"<init>") == 0)
{
asm("int3");
}

View File

@ -1165,6 +1165,13 @@ RegisterOperand::accept(Context* c, Operation operation,
}
break;
case mul:
rex(c);
c->code.append(0x0f);
c->code.append(0xaf);
c->code.append(0xc0 | (value << 3) | operand->value);
break;
default: abort(c);
}
}
@ -1578,7 +1585,10 @@ MemoryOperand::accept(Context* c, Operation operation,
} else {
switch (selection) {
case S1Selection:
encode(c, 0x88, operand->value, this, true);
if (operand->value > rbx) {
c->code.append(0x40);
}
encode(c, 0x88, operand->value, this, false);
break;
case S2Selection:
@ -1596,6 +1606,16 @@ MemoryOperand::accept(Context* c, Operation operation,
}
} break;
case mul: {
RegisterOperand* tmp = temporary(c);
tmp->accept(c, mov, this);
tmp->accept(c, mul, operand);
accept(c, mov, tmp);
tmp->release(c);
} break;
case rem: {
RegisterOperand* ax = temporary(c, rax);
RegisterOperand* dx = temporary(c, rdx);