mirror of
https://github.com/corda/corda.git
synced 2025-02-08 03:50:34 +00:00
various bugfixes
This commit is contained in:
parent
329009ae97
commit
44b3a7c36d
@ -3810,6 +3810,14 @@ finish(MyThread* t, Context* context)
|
|||||||
set(t, methodCode(t, context->method), CodePool, map);
|
set(t, methodCode(t, context->method), CodePool, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (PoolElement* p = context->objectPool; p; p = p->next) {
|
||||||
|
intptr_t offset = p->address->value() - reinterpret_cast<intptr_t>(start);
|
||||||
|
|
||||||
|
singletonMarkObject(t, result, offset / BytesPerWord);
|
||||||
|
|
||||||
|
set(t, result, SingletonBody + offset, p->value);
|
||||||
|
}
|
||||||
|
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
logCompile
|
logCompile
|
||||||
(start, codeSize,
|
(start, codeSize,
|
||||||
@ -3822,15 +3830,15 @@ finish(MyThread* t, Context* context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for debugging:
|
// for debugging:
|
||||||
if (false and
|
if (true or//false and
|
||||||
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)),
|
||||||
"java/lang/System") == 0 and
|
"Misc") == 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)),
|
||||||
"getProperty") == 0)
|
"main") == 0)
|
||||||
{
|
{
|
||||||
asm("int3");
|
asm("int3");
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,10 @@ acquire(Context* c, int r, Stack* stack, unsigned newSize, Value* newValue,
|
|||||||
Site* newSite)
|
Site* newSite)
|
||||||
{
|
{
|
||||||
Value* oldValue = c->registers[r].value;
|
Value* oldValue = c->registers[r].value;
|
||||||
if (oldValue and findSite(c, oldValue, c->registers[r].site)) {
|
if (oldValue
|
||||||
|
and oldValue != newValue
|
||||||
|
and findSite(c, oldValue, c->registers[r].site))
|
||||||
|
{
|
||||||
if (oldValue->pushCount == 0
|
if (oldValue->pushCount == 0
|
||||||
and oldValue->sites->next == 0
|
and oldValue->sites->next == 0
|
||||||
and oldValue->reads)
|
and oldValue->reads)
|
||||||
@ -714,7 +717,7 @@ push(Context* c, unsigned size, Value* v);
|
|||||||
class CallEvent: public Event {
|
class CallEvent: public Event {
|
||||||
public:
|
public:
|
||||||
CallEvent(Context* c, Value* address, void* indirection, unsigned flags,
|
CallEvent(Context* c, Value* address, void* indirection, unsigned flags,
|
||||||
TraceHandler* traceHandler, Value* result,
|
TraceHandler* traceHandler, Value* result, unsigned resultSize,
|
||||||
unsigned argumentFootprint):
|
unsigned argumentFootprint):
|
||||||
Event(c),
|
Event(c),
|
||||||
address(address),
|
address(address),
|
||||||
@ -722,6 +725,7 @@ class CallEvent: public Event {
|
|||||||
traceHandler(traceHandler),
|
traceHandler(traceHandler),
|
||||||
result(result),
|
result(result),
|
||||||
flags(flags),
|
flags(flags),
|
||||||
|
resultSize(resultSize),
|
||||||
argumentFootprint(argumentFootprint)
|
argumentFootprint(argumentFootprint)
|
||||||
{
|
{
|
||||||
addRead(c, address, BytesPerWord,
|
addRead(c, address, BytesPerWord,
|
||||||
@ -740,7 +744,9 @@ class CallEvent: public Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addSite(c, 0, 0, result, registerSite
|
addSite(c, 0, 0, result, registerSite
|
||||||
(c, c->assembler->returnLow(), c->assembler->returnHigh()));
|
(c, c->assembler->returnLow(),
|
||||||
|
resultSize > BytesPerWord ?
|
||||||
|
c->assembler->returnHigh() : NoRegister));
|
||||||
|
|
||||||
if (traceHandler) {
|
if (traceHandler) {
|
||||||
traceHandler->handleTrace
|
traceHandler->handleTrace
|
||||||
@ -762,19 +768,20 @@ class CallEvent: public Event {
|
|||||||
TraceHandler* traceHandler;
|
TraceHandler* traceHandler;
|
||||||
Value* result;
|
Value* result;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
unsigned resultSize;
|
||||||
unsigned argumentFootprint;
|
unsigned argumentFootprint;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
appendCall(Context* c, Value* address, void* indirection, unsigned flags,
|
appendCall(Context* c, Value* address, void* indirection, unsigned flags,
|
||||||
TraceHandler* traceHandler, Value* result,
|
TraceHandler* traceHandler, Value* result, unsigned resultSize,
|
||||||
unsigned argumentFootprint)
|
unsigned argumentFootprint)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "appendCall\n");
|
fprintf(stderr, "appendCall\n");
|
||||||
|
|
||||||
new (c->zone->allocate(sizeof(CallEvent)))
|
new (c->zone->allocate(sizeof(CallEvent)))
|
||||||
CallEvent(c, address, indirection, flags, traceHandler, result,
|
CallEvent(c, address, indirection, flags, traceHandler, result,
|
||||||
argumentFootprint);
|
resultSize, argumentFootprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReturnEvent: public Event {
|
class ReturnEvent: public Event {
|
||||||
@ -1319,20 +1326,31 @@ updateJunctions(Context* c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
used(Context* c, int r)
|
||||||
|
{
|
||||||
|
Value* v = c->registers[r].value;
|
||||||
|
return v
|
||||||
|
and findSite(c, v, c->registers[r].site)
|
||||||
|
and v->pushCount == 0
|
||||||
|
and v->sites->next == 0
|
||||||
|
and v->reads;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
freeRegisterExcept(Context* c, int except, bool allowAcquired)
|
freeRegisterExcept(Context* c, int except, bool allowAcquired)
|
||||||
{
|
{
|
||||||
for (int i = c->assembler->registerCount(); i >= 0; --i) {
|
for (int i = c->assembler->registerCount() - 1; i >= 0; --i) {
|
||||||
if (i != except
|
if (i != except
|
||||||
and (not c->registers[i].reserved)
|
and (not c->registers[i].reserved)
|
||||||
and c->registers[i].value == 0)
|
and (not used(c, i)))
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowAcquired) {
|
if (allowAcquired) {
|
||||||
for (int i = c->assembler->registerCount(); i >= 0; --i) {
|
for (int i = c->assembler->registerCount() - 1; i >= 0; --i) {
|
||||||
if (i != except
|
if (i != except
|
||||||
and (not c->registers[i].reserved))
|
and (not c->registers[i].reserved))
|
||||||
{
|
{
|
||||||
@ -1562,7 +1580,7 @@ class MyCompiler: public Compiler {
|
|||||||
void* indirection,
|
void* indirection,
|
||||||
unsigned flags,
|
unsigned flags,
|
||||||
TraceHandler* traceHandler,
|
TraceHandler* traceHandler,
|
||||||
unsigned,
|
unsigned resultSize,
|
||||||
unsigned argumentCount,
|
unsigned argumentCount,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
@ -1617,7 +1635,7 @@ class MyCompiler: public Compiler {
|
|||||||
|
|
||||||
Value* result = value(&c);
|
Value* result = value(&c);
|
||||||
appendCall(&c, static_cast<Value*>(address), indirection, flags,
|
appendCall(&c, static_cast<Value*>(address), indirection, flags,
|
||||||
traceHandler, result, footprint);
|
traceHandler, result, resultSize, footprint);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user