diff --git a/makefile b/makefile index 9754eb923e..9104e7bdfd 100644 --- a/makefile +++ b/makefile @@ -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 diff --git a/src/compile.cpp b/src/compile.cpp index f25651c16d..79600a2bad 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -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(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(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 (&byteArrayBody(t, className(t, methodClass(t, method)), 0)), - "java/lang/Long") == 0 and + "java/util/Collections$ArrayListIterator") == 0 and strcmp(reinterpret_cast (&byteArrayBody(t, methodName(t, method), 0)), - "toString") == 0) + "") == 0) { asm("int3"); } diff --git a/src/compiler.cpp b/src/compiler.cpp index 670ba54b22..9fb095f0a8 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -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);