mirror of
https://github.com/corda/corda.git
synced 2025-05-31 22:50:53 +00:00
more bugfixes; all tests pass on amd64
This commit is contained in:
parent
cae5202be0
commit
5fc9ad058b
@ -1531,14 +1531,14 @@ releaseMonitorForObject(MyThread* t, object o)
|
|||||||
}
|
}
|
||||||
|
|
||||||
object
|
object
|
||||||
makeMultidimensionalArray2(MyThread* t, object class_, uintptr_t* stack,
|
makeMultidimensionalArray2(MyThread* t, object class_, uintptr_t* countStack,
|
||||||
int32_t dimensions)
|
int32_t dimensions)
|
||||||
{
|
{
|
||||||
PROTECT(t, class_);
|
PROTECT(t, class_);
|
||||||
|
|
||||||
int32_t counts[dimensions];
|
int32_t counts[dimensions];
|
||||||
for (int i = dimensions - 1; i >= 0; --i) {
|
for (int i = dimensions - 1; i >= 0; --i) {
|
||||||
counts[i] = stack[dimensions - i - 1];
|
counts[i] = countStack[dimensions - i - 1];
|
||||||
if (UNLIKELY(counts[i] < 0)) {
|
if (UNLIKELY(counts[i] < 0)) {
|
||||||
object message = makeString(t, "%d", counts[i]);
|
object message = makeString(t, "%d", counts[i]);
|
||||||
t->exception = makeNegativeArraySizeException(t, message);
|
t->exception = makeNegativeArraySizeException(t, message);
|
||||||
@ -1557,9 +1557,11 @@ makeMultidimensionalArray2(MyThread* t, object class_, uintptr_t* stack,
|
|||||||
|
|
||||||
object
|
object
|
||||||
makeMultidimensionalArray(MyThread* t, object class_, int32_t dimensions,
|
makeMultidimensionalArray(MyThread* t, object class_, int32_t dimensions,
|
||||||
uintptr_t* stack)
|
int32_t offset)
|
||||||
{
|
{
|
||||||
object r = makeMultidimensionalArray2(t, class_, stack, dimensions);
|
object r = makeMultidimensionalArray2
|
||||||
|
(t, class_, static_cast<uintptr_t*>(t->stack) + offset, dimensions);
|
||||||
|
|
||||||
if (UNLIKELY(t->exception)) {
|
if (UNLIKELY(t->exception)) {
|
||||||
unwind(t);
|
unwind(t);
|
||||||
} else {
|
} else {
|
||||||
@ -3118,13 +3120,21 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
|||||||
if (UNLIKELY(t->exception)) return;
|
if (UNLIKELY(t->exception)) return;
|
||||||
PROTECT(t, class_);
|
PROTECT(t, class_);
|
||||||
|
|
||||||
|
unsigned offset = alignedFrameSize(t, context->method)
|
||||||
|
- t->arch->frameHeaderSize()
|
||||||
|
- (localSize(t, context->method)
|
||||||
|
- methodParameterFootprint(t, context->method)
|
||||||
|
- 1)
|
||||||
|
+ t->arch->frameReturnAddressSize()
|
||||||
|
- c->index(c->top());
|
||||||
|
|
||||||
Compiler::Operand* result = c->call
|
Compiler::Operand* result = c->call
|
||||||
(c->constant(getThunk(t, makeMultidimensionalArrayThunk)),
|
(c->constant(getThunk(t, makeMultidimensionalArrayThunk)),
|
||||||
0,
|
0,
|
||||||
frame->trace(0, false),
|
frame->trace(0, false),
|
||||||
BytesPerWord,
|
BytesPerWord,
|
||||||
4, c->thread(), frame->append(class_), c->constant(dimensions),
|
4, c->thread(), frame->append(class_), c->constant(dimensions),
|
||||||
c->stackTop());
|
c->constant(offset));
|
||||||
|
|
||||||
frame->pop(dimensions);
|
frame->pop(dimensions);
|
||||||
frame->pushObject(result);
|
frame->pushObject(result);
|
||||||
@ -3867,7 +3877,7 @@ finish(MyThread* t, Context* context)
|
|||||||
strcmp
|
strcmp
|
||||||
(reinterpret_cast<const char*>
|
(reinterpret_cast<const char*>
|
||||||
(&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)),
|
(&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)),
|
||||||
"NullPointer") == 0 and
|
"Longs") == 0 and
|
||||||
strcmp
|
strcmp
|
||||||
(reinterpret_cast<const char*>
|
(reinterpret_cast<const char*>
|
||||||
(&byteArrayBody(t, methodName(t, context->method), 0)),
|
(&byteArrayBody(t, methodName(t, context->method), 0)),
|
||||||
|
@ -1780,9 +1780,6 @@ trySteal(Context* c, Site* site, Value* v, unsigned size, Stack* stack,
|
|||||||
|
|
||||||
if (index == NoFrameIndex) {
|
if (index == NoFrameIndex) {
|
||||||
for (Stack* s = stack; s; s = s->next) {
|
for (Stack* s = stack; s; s = s->next) {
|
||||||
fprintf(stderr, "%p belongs at %d\n", s->value, frameIndex
|
|
||||||
(c, s->index + c->localFootprint, s->footprint));
|
|
||||||
|
|
||||||
if (find(v, s->value)) {
|
if (find(v, s->value)) {
|
||||||
uint8_t typeMask;
|
uint8_t typeMask;
|
||||||
uint64_t registerMask;
|
uint64_t registerMask;
|
||||||
@ -2667,7 +2664,6 @@ class CombineEvent: public Event {
|
|||||||
if (c->arch->condensedAddressing()) {
|
if (c->arch->condensedAddressing()) {
|
||||||
maybePreserve(c, stackBefore, localsBefore, secondSize, second,
|
maybePreserve(c, stackBefore, localsBefore, secondSize, second,
|
||||||
second->source);
|
second->source);
|
||||||
removeSite(c, second, second->source);
|
|
||||||
target = second->source;
|
target = second->source;
|
||||||
} else {
|
} else {
|
||||||
target = resultRead->allocateSite(c);
|
target = resultRead->allocateSite(c);
|
||||||
@ -2681,8 +2677,11 @@ class CombineEvent: public Event {
|
|||||||
nextRead(c, this, first);
|
nextRead(c, this, first);
|
||||||
nextRead(c, this, second);
|
nextRead(c, this, second);
|
||||||
|
|
||||||
if (c->arch->condensedAddressing() and live(result)) {
|
if (c->arch->condensedAddressing()) {
|
||||||
addSite(c, 0, 0, resultSize, result, target);
|
removeSite(c, second, second->source);
|
||||||
|
if (live(result)) {
|
||||||
|
addSite(c, 0, 0, resultSize, result, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2904,7 +2903,6 @@ class TranslateEvent: public Event {
|
|||||||
Site* target;
|
Site* target;
|
||||||
if (c->arch->condensedAddressing()) {
|
if (c->arch->condensedAddressing()) {
|
||||||
maybePreserve(c, stackBefore, localsBefore, size, value, value->source);
|
maybePreserve(c, stackBefore, localsBefore, size, value, value->source);
|
||||||
removeSite(c, value, value->source);
|
|
||||||
target = value->source;
|
target = value->source;
|
||||||
} else {
|
} else {
|
||||||
target = resultRead->allocateSite(c);
|
target = resultRead->allocateSite(c);
|
||||||
@ -2915,8 +2913,11 @@ class TranslateEvent: public Event {
|
|||||||
|
|
||||||
nextRead(c, this, value);
|
nextRead(c, this, value);
|
||||||
|
|
||||||
if (c->arch->condensedAddressing() and live(result)) {
|
if (c->arch->condensedAddressing()) {
|
||||||
addSite(c, 0, 0, size, result, target);
|
removeSite(c, value, value->source);
|
||||||
|
if (live(result)) {
|
||||||
|
addSite(c, 0, 0, size, result, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3445,8 +3446,8 @@ resolveJunctionSite(Context* c, Event* e, Value* v,
|
|||||||
|
|
||||||
if (DebugControl) {
|
if (DebugControl) {
|
||||||
char buffer[256]; target->toString(c, buffer, 256);
|
char buffer[256]; target->toString(c, buffer, 256);
|
||||||
fprintf(stderr, "resolved junction site %d %s %p\n",
|
fprintf(stderr, "resolved junction site local %d frame %d %s %p\n",
|
||||||
frameIndex, buffer, v);
|
siteIndex, frameIndex, buffer, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4136,13 +4137,6 @@ class MyCompiler: public Compiler {
|
|||||||
return value(&c, s, s);
|
return value(&c, s, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Operand* stackTop() {
|
|
||||||
Site* s = frameSite
|
|
||||||
(&c, frameIndex
|
|
||||||
(&c, c.stack->index + c.localFootprint, c.stack->footprint));
|
|
||||||
return value(&c, s, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
Promise* machineIp() {
|
Promise* machineIp() {
|
||||||
return codePromise(&c, c.logicalCode[c.logicalIp]->lastEvent);
|
return codePromise(&c, c.logicalCode[c.logicalIp]->lastEvent);
|
||||||
}
|
}
|
||||||
@ -4186,6 +4180,10 @@ class MyCompiler: public Compiler {
|
|||||||
return static_cast<Stack*>(e)->footprint;
|
return static_cast<Stack*>(e)->footprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual unsigned index(StackElement* e) {
|
||||||
|
return static_cast<Stack*>(e)->index;
|
||||||
|
}
|
||||||
|
|
||||||
virtual Operand* peek(unsigned footprint UNUSED, unsigned index) {
|
virtual Operand* peek(unsigned footprint UNUSED, unsigned index) {
|
||||||
Stack* s = c.stack;
|
Stack* s = c.stack;
|
||||||
for (unsigned i = index; i > 0;) {
|
for (unsigned i = index; i > 0;) {
|
||||||
@ -4312,6 +4310,12 @@ class MyCompiler: public Compiler {
|
|||||||
local->value = maybeBuddy
|
local->value = maybeBuddy
|
||||||
(&c, static_cast<Value*>(src), footprintSizeInBytes(footprint));
|
(&c, static_cast<Value*>(src), footprintSizeInBytes(footprint));
|
||||||
|
|
||||||
|
if (footprint == 2) {
|
||||||
|
Local* clobber = local + 1;
|
||||||
|
clobber->value = 0;
|
||||||
|
clobber->footprint = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (DebugFrame) {
|
if (DebugFrame) {
|
||||||
fprintf(stderr, "store local %p of footprint %d at %d\n",
|
fprintf(stderr, "store local %p of footprint %d at %d\n",
|
||||||
local->value, footprint, index);
|
local->value, footprint, index);
|
||||||
|
@ -61,8 +61,6 @@ class Compiler {
|
|||||||
virtual Operand* stack() = 0;
|
virtual Operand* stack() = 0;
|
||||||
virtual Operand* thread() = 0;
|
virtual Operand* thread() = 0;
|
||||||
|
|
||||||
virtual Operand* stackTop() = 0;
|
|
||||||
|
|
||||||
virtual void push(unsigned footprint) = 0;
|
virtual void push(unsigned footprint) = 0;
|
||||||
virtual void push(unsigned footprint, Operand* value) = 0;
|
virtual void push(unsigned footprint, Operand* value) = 0;
|
||||||
virtual void save(unsigned footprint, Operand* value) = 0;
|
virtual void save(unsigned footprint, Operand* value) = 0;
|
||||||
@ -71,6 +69,7 @@ class Compiler {
|
|||||||
virtual void popped() = 0;
|
virtual void popped() = 0;
|
||||||
virtual StackElement* top() = 0;
|
virtual StackElement* top() = 0;
|
||||||
virtual unsigned footprint(StackElement*) = 0;
|
virtual unsigned footprint(StackElement*) = 0;
|
||||||
|
virtual unsigned index(StackElement*) = 0;
|
||||||
virtual Operand* peek(unsigned footprint, unsigned index) = 0;
|
virtual Operand* peek(unsigned footprint, unsigned index) = 0;
|
||||||
|
|
||||||
virtual Operand* call(Operand* address,
|
virtual Operand* call(Operand* address,
|
||||||
|
13
src/x86.cpp
13
src/x86.cpp
@ -844,12 +844,10 @@ moveAR(Context* c, unsigned aSize, Assembler::Address* a,
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
void
|
void
|
||||||
moveCR(Context* c, unsigned aSize, Assembler::Constant* a,
|
moveCR(Context* c, unsigned, Assembler::Constant* a,
|
||||||
unsigned bSize UNUSED, Assembler::Register* b)
|
unsigned bSize, Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, aSize == bSize);
|
if (BytesPerWord == 4 and bSize == 8) {
|
||||||
|
|
||||||
if (BytesPerWord == 4 and aSize == 8) {
|
|
||||||
int64_t v = a->value->value();
|
int64_t v = a->value->value();
|
||||||
|
|
||||||
ResolvedPromise high((v >> 32) & 0xFFFFFFFF);
|
ResolvedPromise high((v >> 32) & 0xFFFFFFFF);
|
||||||
@ -2059,6 +2057,11 @@ class MyArchitecture: public Assembler::Architecture {
|
|||||||
*bTypeMask = (1 << RegisterOperand);
|
*bTypeMask = (1 << RegisterOperand);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Negate:
|
||||||
|
*aTypeMask = (1 << RegisterOperand);
|
||||||
|
*bTypeMask = (1 << RegisterOperand);
|
||||||
|
break;
|
||||||
|
|
||||||
case Move:
|
case Move:
|
||||||
if (BytesPerWord == 4) {
|
if (BytesPerWord == 4) {
|
||||||
if (aSize == 4 and bSize == 8) {
|
if (aSize == 4 and bSize == 8) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user