mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
fix sign extension from constant to register on x86
scalac may generate a ldc followed by an l2i, whereas javac always seems to condense this into a single ldc_w. The former exposed a bug in the JIT compiler which we never hit with javac-generated bytecode.
This commit is contained in:
parent
e6b6edfc25
commit
9918ea6cdd
@ -330,6 +330,10 @@ void moveCR2(Context* c, UNUSED unsigned aSize, lir::Constant* a,
|
||||
if (vm::TargetBytesPerWord == 4 and bSize == 8) {
|
||||
int64_t v = a->value->value();
|
||||
|
||||
if (aSize == 4) {
|
||||
v = static_cast<int32_t>(v);
|
||||
}
|
||||
|
||||
ResolvedPromise high((v >> 32) & 0xFFFFFFFF);
|
||||
lir::Constant ah(&high);
|
||||
|
||||
@ -344,8 +348,16 @@ void moveCR2(Context* c, UNUSED unsigned aSize, lir::Constant* a,
|
||||
maybeRex(c, vm::TargetBytesPerWord, b);
|
||||
opcode(c, 0xb8 + regCode(b));
|
||||
if (a->value->resolved()) {
|
||||
c->code.appendTargetAddress(a->value->value());
|
||||
int64_t v = a->value->value();
|
||||
|
||||
if (aSize == 4 and bSize == 8) {
|
||||
v = static_cast<int32_t>(v);
|
||||
}
|
||||
|
||||
c->code.appendTargetAddress(v);
|
||||
} else {
|
||||
expect(c, aSize == vm::TargetBytesPerWord);
|
||||
|
||||
appendImmediateTask
|
||||
(c, a->value, offsetPromise(c), vm::TargetBytesPerWord, promiseOffset);
|
||||
c->code.appendTargetAddress(static_cast<vm::target_uintptr_t>(0));
|
||||
|
Loading…
Reference in New Issue
Block a user