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