mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
various bugfixes
This commit is contained in:
parent
2bb310981d
commit
b6b84af123
@ -625,9 +625,13 @@ freeRegisterSite(Context* c, uint64_t mask = ~static_cast<uint64_t>(0))
|
||||
RegisterSite*
|
||||
fixedRegisterSite(Context* c, int low, int high = NoRegister)
|
||||
{
|
||||
uint64_t mask = static_cast<uint64_t>(1) << low;
|
||||
if (high != NoRegister) {
|
||||
mask |= static_cast<uint64_t>(1) << (high + 32);
|
||||
uint64_t mask;
|
||||
if (high == NoRegister) {
|
||||
mask = (~static_cast<uint64_t>(0) << 32)
|
||||
| (static_cast<uint64_t>(1) << low);
|
||||
} else {
|
||||
mask = (static_cast<uint64_t>(1) << (high + 32))
|
||||
| (static_cast<uint64_t>(1) << low);
|
||||
}
|
||||
|
||||
return new (c->zone->allocate(sizeof(RegisterSite)))
|
||||
|
11
src/x86.cpp
11
src/x86.cpp
@ -1081,7 +1081,7 @@ multiplyRR(Context* c, unsigned size, Assembler::Register* a,
|
||||
|
||||
// mul a->low,%eax%edx
|
||||
c->code.append(0xf7);
|
||||
c->code.append(0xe8 | a->low);
|
||||
c->code.append(0xe0 | a->low);
|
||||
|
||||
addRR(c, 4, b, &bh);
|
||||
moveRR(c, 4, &axdx, b);
|
||||
@ -1099,8 +1099,6 @@ void
|
||||
multiplyCR(Context* c, unsigned size, Assembler::Constant* a,
|
||||
Assembler::Register* b)
|
||||
{
|
||||
assert(c, BytesPerWord == 8 or size == 4);
|
||||
|
||||
if (BytesPerWord == 4 and size == 8) {
|
||||
const uint32_t mask = ~((1 << rax) | (1 << rdx));
|
||||
Assembler::Register tmp(c->client->acquireTemporary(mask),
|
||||
@ -1517,9 +1515,9 @@ unsignedShiftRightRR(Context* c, unsigned size, Assembler::Register* a,
|
||||
assert(c, a->low == rcx);
|
||||
|
||||
if (BytesPerWord == 4 and size == 8) {
|
||||
// shld
|
||||
// shrd
|
||||
c->code.append(0x0f);
|
||||
c->code.append(0xa5);
|
||||
c->code.append(0xad);
|
||||
c->code.append(0xc0 | (b->high << 3) | b->low);
|
||||
|
||||
// shr
|
||||
@ -1963,7 +1961,8 @@ class MyAssembler: public Assembler {
|
||||
case ShiftRight:
|
||||
case UnsignedShiftRight: {
|
||||
*aTypeMask = (1 << RegisterOperand);
|
||||
*aRegisterMask = static_cast<uint64_t>(1) << rcx;
|
||||
*aRegisterMask = (~static_cast<uint64_t>(0) << 32)
|
||||
| (static_cast<uint64_t>(1) << rcx);
|
||||
const uint32_t mask = ~(1 << rcx);
|
||||
*bRegisterMask = (static_cast<uint64_t>(mask) << 32) | mask;
|
||||
} break;
|
||||
|
@ -125,6 +125,35 @@ public class Misc {
|
||||
expect(~a == ~5);
|
||||
}
|
||||
|
||||
{ long a = -5;
|
||||
long b = 2;
|
||||
expect(a >> b == -5L >> 2);
|
||||
expect(a >>> b == -5L >>> 2);
|
||||
expect(a << b == -5L << 2);
|
||||
expect(a * b == -5L * 2L);
|
||||
expect(a / b == -5L / 2L);
|
||||
expect(a % b == -5L % 2L);
|
||||
expect((a & b) == (-5L & 2L));
|
||||
expect((a | b) == (-5L | 2L));
|
||||
expect((a ^ b) == (-5L ^ 2L));
|
||||
expect(-a == 5L);
|
||||
expect(~a == ~-5L);
|
||||
|
||||
a = 5;
|
||||
b = 2;
|
||||
expect(a >> b == 5L >> 2);
|
||||
expect(a >>> b == 5L >>> 2);
|
||||
expect(a << b == 5L << 2);
|
||||
expect(a * b == 5L * 2L);
|
||||
expect(a / b == 5L / 2L);
|
||||
expect(a % b == 5L % 2L);
|
||||
expect((a & b) == (5L & 2L));
|
||||
expect((a | b) == (5L | 2L));
|
||||
expect((a ^ b) == (5L ^ 2L));
|
||||
expect(-a == -5L);
|
||||
expect(~a == ~5L);
|
||||
}
|
||||
|
||||
byte2 = 0;
|
||||
expect(byte2 == 0);
|
||||
|
||||
@ -174,6 +203,10 @@ public class Misc {
|
||||
{ Misc m = new Misc();
|
||||
m.toString();
|
||||
|
||||
expect(m.time == 0xffffffffffffffffL);
|
||||
long t = m.time;
|
||||
expect(t == 0xffffffffffffffffL);
|
||||
|
||||
String s = "hello";
|
||||
m.foo(s);
|
||||
m.bar(s);
|
||||
|
Loading…
Reference in New Issue
Block a user