mirror of
https://github.com/corda/corda.git
synced 2025-02-03 01:31:24 +00:00
fix some issues with 64-bit moves on 32-bit machines
This commit is contained in:
parent
6b4cafd962
commit
571bffde09
@ -15,8 +15,8 @@ using namespace vm;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const bool DebugAppend = false;
|
const bool DebugAppend = true;
|
||||||
const bool DebugCompile = false;
|
const bool DebugCompile = true;
|
||||||
const bool DebugStack = false;
|
const bool DebugStack = false;
|
||||||
const bool DebugRegisters = false;
|
const bool DebugRegisters = false;
|
||||||
|
|
||||||
@ -824,8 +824,6 @@ bool
|
|||||||
tryAcquire(Context* c, int r, Stack* stack, unsigned newSize, Value* newValue,
|
tryAcquire(Context* c, int r, Stack* stack, unsigned newSize, Value* newValue,
|
||||||
Site* newSite)
|
Site* newSite)
|
||||||
{
|
{
|
||||||
assert(c, newSize);
|
|
||||||
|
|
||||||
if (c->registers[r].reserved) return true;
|
if (c->registers[r].reserved) return true;
|
||||||
|
|
||||||
if (DebugRegisters) {
|
if (DebugRegisters) {
|
||||||
@ -2213,7 +2211,7 @@ class MyCompiler: public Compiler {
|
|||||||
|
|
||||||
virtual Operand* load4To8(Operand* src) {
|
virtual Operand* load4To8(Operand* src) {
|
||||||
Value* dst = value(&c);
|
Value* dst = value(&c);
|
||||||
appendMove(&c, Move4To8, 0, static_cast<Value*>(src), dst);
|
appendMove(&c, Move4To8, 8, static_cast<Value*>(src), dst);
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
43
src/x86.cpp
43
src/x86.cpp
@ -643,11 +643,25 @@ void
|
|||||||
move4To8RR(Context* c, unsigned size UNUSED, Assembler::Register* a,
|
move4To8RR(Context* c, unsigned size UNUSED, Assembler::Register* a,
|
||||||
Assembler::Register* b)
|
Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, BytesPerWord == 8);
|
if (BytesPerWord == 8) {
|
||||||
|
|
||||||
rex(c);
|
rex(c);
|
||||||
c->code.append(0x63);
|
c->code.append(0x63);
|
||||||
c->code.append(0xc0 | (a->low << 3) | b->low);
|
c->code.append(0xc0 | (a->low << 3) | b->low);
|
||||||
|
} else {
|
||||||
|
if (a->low == rax and b->low == rax and b->high == rdx) {
|
||||||
|
c->code.append(0x99); // cdq
|
||||||
|
} else {
|
||||||
|
Assembler::Register axdx(c->client->acquireTemporary(rax),
|
||||||
|
c->client->acquireTemporary(rdx));
|
||||||
|
|
||||||
|
moveRR(c, 4, a, &axdx);
|
||||||
|
move4To8RR(c, 0, &axdx, &axdx);
|
||||||
|
moveRR(c, 8, &axdx, b);
|
||||||
|
|
||||||
|
c->client->releaseTemporary(axdx.low);
|
||||||
|
c->client->releaseTemporary(axdx.high);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -710,20 +724,37 @@ void
|
|||||||
moveMM(Context* c, unsigned size, Assembler::Memory* a,
|
moveMM(Context* c, unsigned size, Assembler::Memory* a,
|
||||||
Assembler::Memory* b)
|
Assembler::Memory* b)
|
||||||
{
|
{
|
||||||
assert(c, BytesPerWord == 8 or size <= 4); // todo
|
if (BytesPerWord == 8 or size <= 4) {
|
||||||
|
|
||||||
Assembler::Register tmp(c->client->acquireTemporary());
|
Assembler::Register tmp(c->client->acquireTemporary());
|
||||||
moveMR(c, size, a, &tmp);
|
moveMR(c, size, a, &tmp);
|
||||||
moveRM(c, size, &tmp, b);
|
moveRM(c, size, &tmp, b);
|
||||||
c->client->releaseTemporary(tmp.low);
|
c->client->releaseTemporary(tmp.low);
|
||||||
|
} else {
|
||||||
|
Assembler::Register tmp(c->client->acquireTemporary(),
|
||||||
|
c->client->acquireTemporary());
|
||||||
|
moveMR(c, size, a, &tmp);
|
||||||
|
moveRM(c, size, &tmp, b);
|
||||||
|
c->client->releaseTemporary(tmp.low);
|
||||||
|
c->client->releaseTemporary(tmp.high);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
move4To8MR(Context* c, unsigned, Assembler::Memory* a, Assembler::Register* b)
|
move4To8MR(Context* c, unsigned, Assembler::Memory* a, Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, BytesPerWord == 8); // todo
|
if (BytesPerWord == 8) {
|
||||||
|
|
||||||
encode(c, 0x63, b->low, a, true);
|
encode(c, 0x63, b->low, a, true);
|
||||||
|
} else {
|
||||||
|
Assembler::Register axdx(c->client->acquireTemporary(rax),
|
||||||
|
c->client->acquireTemporary(rdx));
|
||||||
|
|
||||||
|
moveMR(c, 4, a, &axdx);
|
||||||
|
move4To8RR(c, 0, &axdx, &axdx);
|
||||||
|
moveRR(c, 8, &axdx, b);
|
||||||
|
|
||||||
|
c->client->releaseTemporary(axdx.low);
|
||||||
|
c->client->releaseTemporary(axdx.high);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user