mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
JIT bugfixes; implement or and xor
This commit is contained in:
parent
5c807a4ddc
commit
b2cb8e0a69
@ -2165,6 +2165,9 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip)
|
||||
|
||||
object class_ = methodClass(t, target);
|
||||
if (isSpecialMethod(t, target, class_)) {
|
||||
initClass(t, classSuper(t, class_));
|
||||
if (UNLIKELY(t->exception)) return;
|
||||
|
||||
target = findMethod(t, target, classSuper(t, class_));
|
||||
}
|
||||
|
||||
@ -2996,10 +2999,10 @@ finish(MyThread* t, Compiler* c, object method, Vector* objectPool,
|
||||
if (false and
|
||||
strcmp(reinterpret_cast<const char*>
|
||||
(&byteArrayBody(t, className(t, methodClass(t, method)), 0)),
|
||||
"java/lang/String") == 0 and
|
||||
"org/eclipse/swt/widgets/Display") == 0 and
|
||||
strcmp(reinterpret_cast<const char*>
|
||||
(&byteArrayBody(t, methodName(t, method), 0)),
|
||||
"getChars") == 0)
|
||||
"init") == 0)
|
||||
{
|
||||
asm("int3");
|
||||
}
|
||||
@ -3066,9 +3069,13 @@ compileMethod2(MyThread* t)
|
||||
object node = findTraceNode(t, *static_cast<void**>(t->stack));
|
||||
PROTECT(t, node);
|
||||
|
||||
object target = resolveTarget(t, t->stack, traceNodeTarget(t, node));
|
||||
object target = traceNodeTarget(t, node);
|
||||
PROTECT(t, target);
|
||||
|
||||
if (traceNodeVirtualCall(t, node)) {
|
||||
target = resolveTarget(t, t->stack, traceNodeTarget(t, node));
|
||||
}
|
||||
|
||||
if (LIKELY(t->exception == 0)) {
|
||||
compile(t, target);
|
||||
}
|
||||
@ -3167,15 +3174,14 @@ invokeNative2(MyThread* t, object method)
|
||||
memcpy(args + argOffset, sp, 8);
|
||||
if (BytesPerWord == 8) {
|
||||
++argOffset;
|
||||
--sp;
|
||||
} else {
|
||||
argOffset += 2;
|
||||
sp -= 2;
|
||||
}
|
||||
sp -= 2;
|
||||
} break;
|
||||
|
||||
case POINTER_TYPE: {
|
||||
args[argOffset++] = reinterpret_cast<uintptr_t>(sp--);
|
||||
args[argOffset++] = *sp ? reinterpret_cast<uintptr_t>(sp--) : 0;
|
||||
} break;
|
||||
|
||||
default: abort(t);
|
||||
|
@ -963,10 +963,10 @@ rex(Context* c)
|
||||
}
|
||||
|
||||
void
|
||||
encode(Context* c, uint8_t instruction, int a, Register b,
|
||||
encode(Context* c, uint8_t* instruction, unsigned length, int a, Register b,
|
||||
int32_t displacement, int index, unsigned scale)
|
||||
{
|
||||
c->code.append(instruction);
|
||||
c->code.append(instruction, length);
|
||||
|
||||
uint8_t width;
|
||||
if (displacement == 0 and b != rbp) {
|
||||
@ -1005,7 +1005,19 @@ encode(Context* c, uint8_t instruction, int a, MemoryOperand* b, bool rex)
|
||||
if (rex) {
|
||||
::rex(c);
|
||||
}
|
||||
encode(c, instruction, a, r, b->displacement, index, b->scale);
|
||||
encode(c, &instruction, 1, a, r, b->displacement, index, b->scale);
|
||||
}
|
||||
|
||||
void
|
||||
encode2(Context* c, uint16_t instruction, int a, MemoryOperand* b, bool rex)
|
||||
{
|
||||
Register r = b->base->asRegister(c);
|
||||
int index = b->index ? b->index->asRegister(c) : -1;
|
||||
if (rex) {
|
||||
::rex(c);
|
||||
}
|
||||
uint8_t i[2] = { instruction >> 8, instruction & 0xff };
|
||||
encode(c, i, 2, a, r, b->displacement, index, b->scale);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1221,21 +1233,15 @@ RegisterOperand::accept(Context* c, Operation operation,
|
||||
} else {
|
||||
switch (operand->selection) {
|
||||
case S1Selection:
|
||||
rex(c);
|
||||
c->code.append(0x0f);
|
||||
encode(c, 0xbe, value, operand, false);
|
||||
encode2(c, 0x0fbe, value, operand, true);
|
||||
break;
|
||||
|
||||
case S2Selection:
|
||||
rex(c);
|
||||
c->code.append(0x0f);
|
||||
encode(c, 0xbf, value, operand, false);
|
||||
encode2(c, 0x0fbf, value, operand, true);
|
||||
break;
|
||||
|
||||
case Z2Selection:
|
||||
rex(c);
|
||||
c->code.append(0x0f);
|
||||
encode(c, 0xb7, value, operand, false);
|
||||
encode2(c, 0x0fb7, value, operand, true);
|
||||
break;
|
||||
|
||||
case S4Selection:
|
||||
@ -1582,6 +1588,10 @@ MemoryOperand::accept(Context* c, Operation operation,
|
||||
tmp->release(c);
|
||||
} break;
|
||||
|
||||
case or_: {
|
||||
encode(c, 0x09, operand->value, this, true);
|
||||
} break;
|
||||
|
||||
case rem: {
|
||||
RegisterOperand* ax = temporary(c, rax);
|
||||
RegisterOperand* dx = temporary(c, rdx);
|
||||
@ -1610,6 +1620,10 @@ MemoryOperand::accept(Context* c, Operation operation,
|
||||
encode(c, 0x29, operand->value, this, true);
|
||||
} break;
|
||||
|
||||
case xor_: {
|
||||
encode(c, 0x31, operand->value, this, true);
|
||||
} break;
|
||||
|
||||
default: abort(c);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user