mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
don't call prologue and epilogue from compileDefault, since we want the original rbp and rsp values
This commit is contained in:
parent
33b2a4a1e8
commit
fab77e4d96
@ -3158,13 +3158,9 @@ visitStack(MyThread* t, Heap::Visitor* v)
|
|||||||
object
|
object
|
||||||
compileDefault(MyThread* t, Compiler* c)
|
compileDefault(MyThread* t, Compiler* c)
|
||||||
{
|
{
|
||||||
c->prologue();
|
|
||||||
|
|
||||||
c->mov(c->base(), c->memory(c->thread(), difference(&(t->base), t)));
|
c->mov(c->base(), c->memory(c->thread(), difference(&(t->base), t)));
|
||||||
c->mov(c->stack(), c->memory(c->thread(), difference(&(t->stack), t)));
|
c->mov(c->stack(), c->memory(c->thread(), difference(&(t->stack), t)));
|
||||||
|
|
||||||
c->epilogue();
|
|
||||||
|
|
||||||
c->jmp
|
c->jmp
|
||||||
(c->directCall
|
(c->directCall
|
||||||
(c->constant(reinterpret_cast<intptr_t>(compileMethod)),
|
(c->constant(reinterpret_cast<intptr_t>(compileMethod)),
|
||||||
@ -3693,6 +3689,10 @@ compile(MyThread* t, object method)
|
|||||||
object
|
object
|
||||||
findTraceNode(MyThread* t, void* address)
|
findTraceNode(MyThread* t, void* address)
|
||||||
{
|
{
|
||||||
|
if (Verbose) {
|
||||||
|
fprintf(stderr, "find trace node %p\n", address);
|
||||||
|
}
|
||||||
|
|
||||||
MyProcessor* p = processor(t);
|
MyProcessor* p = processor(t);
|
||||||
ACQUIRE(t, t->m->classLock);
|
ACQUIRE(t, t->m->classLock);
|
||||||
|
|
||||||
@ -3739,6 +3739,11 @@ resizeTable(MyThread* t, object oldTable, unsigned newLength)
|
|||||||
void
|
void
|
||||||
insertTraceNode(MyThread* t, object node)
|
insertTraceNode(MyThread* t, object node)
|
||||||
{
|
{
|
||||||
|
if (Verbose) {
|
||||||
|
fprintf(stderr, "insert trace node %p\n",
|
||||||
|
reinterpret_cast<void*>(traceNodeAddress(t, node)));
|
||||||
|
}
|
||||||
|
|
||||||
MyProcessor* p = processor(t);
|
MyProcessor* p = processor(t);
|
||||||
PROTECT(t, node);
|
PROTECT(t, node);
|
||||||
ACQUIRE(t, t->m->classLock);
|
ACQUIRE(t, t->m->classLock);
|
||||||
|
@ -285,7 +285,10 @@ class MemoryOperand: public MyOperand {
|
|||||||
displacement(displacement),
|
displacement(displacement),
|
||||||
index(index),
|
index(index),
|
||||||
scale(scale)
|
scale(scale)
|
||||||
{ }
|
{
|
||||||
|
assert(static_cast<System*>(0), index == 0); // todo
|
||||||
|
assert(static_cast<System*>(0), scale == 1); // todo
|
||||||
|
}
|
||||||
|
|
||||||
virtual StackOperand* logicalPush(Context* c);
|
virtual StackOperand* logicalPush(Context* c);
|
||||||
|
|
||||||
@ -347,6 +350,10 @@ class StackOperand: public MyOperand {
|
|||||||
return base->logicalPush(c);
|
return base->logicalPush(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual Register asRegister(Context* c) {
|
||||||
|
return base->asRegister(c);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void accept(Context* c, Operation operation,
|
virtual void accept(Context* c, Operation operation,
|
||||||
RegisterOperand* operand)
|
RegisterOperand* operand)
|
||||||
{
|
{
|
||||||
@ -677,12 +684,9 @@ void
|
|||||||
RegisterOperand::apply(Context* c, Operation operation)
|
RegisterOperand::apply(Context* c, Operation operation)
|
||||||
{
|
{
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case push:
|
case call:
|
||||||
c->code.append(0x50 | value);
|
c->code.append(0xff);
|
||||||
break;
|
c->code.append(0xd0 | value);
|
||||||
|
|
||||||
case pop:
|
|
||||||
c->code.append(0x58 | value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case jmp:
|
case jmp:
|
||||||
@ -690,9 +694,12 @@ RegisterOperand::apply(Context* c, Operation operation)
|
|||||||
c->code.append(0xe0 | value);
|
c->code.append(0xe0 | value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case call:
|
case pop:
|
||||||
c->code.append(0xff);
|
c->code.append(0x58 | value);
|
||||||
c->code.append(0xd0 | value);
|
break;
|
||||||
|
|
||||||
|
case push:
|
||||||
|
c->code.append(0x50 | value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: abort(c);
|
default: abort(c);
|
||||||
@ -704,6 +711,12 @@ RegisterOperand::accept(Context* c, Operation operation,
|
|||||||
RegisterOperand* operand)
|
RegisterOperand* operand)
|
||||||
{
|
{
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
|
case add:
|
||||||
|
rex(c);
|
||||||
|
c->code.append(0x01);
|
||||||
|
c->code.append(0xc0 | (operand->value << 3) | value);
|
||||||
|
break;
|
||||||
|
|
||||||
case mov:
|
case mov:
|
||||||
if (value != operand->value) {
|
if (value != operand->value) {
|
||||||
rex(c);
|
rex(c);
|
||||||
@ -712,12 +725,6 @@ RegisterOperand::accept(Context* c, Operation operation,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case add:
|
|
||||||
rex(c);
|
|
||||||
c->code.append(0x01);
|
|
||||||
c->code.append(0xc0 | (operand->value << 3) | value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: abort(c);
|
default: abort(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -727,6 +734,23 @@ RegisterOperand::accept(Context* c, Operation operation,
|
|||||||
ImmediateOperand* operand)
|
ImmediateOperand* operand)
|
||||||
{
|
{
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
|
case and_:
|
||||||
|
if (operand->value) {
|
||||||
|
rex(c);
|
||||||
|
if (isInt8(operand->value)) {
|
||||||
|
c->code.append(0x83);
|
||||||
|
c->code.append(0xe0 | value);
|
||||||
|
c->code.append(operand->value);
|
||||||
|
} else {
|
||||||
|
assert(c, isInt32(operand->value));
|
||||||
|
|
||||||
|
c->code.append(0x81);
|
||||||
|
c->code.append(0xe0 | value);
|
||||||
|
c->code.append(operand->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case mov:
|
case mov:
|
||||||
rex(c);
|
rex(c);
|
||||||
c->code.append(0xb8 | value);
|
c->code.append(0xb8 | value);
|
||||||
@ -811,7 +835,7 @@ class DirectCallTask: public IpTask {
|
|||||||
uint8_t* instruction = code + offset + (this->start - start);
|
uint8_t* instruction = code + offset + (this->start - start);
|
||||||
assert(c, *instruction == 0xe8);
|
assert(c, *instruction == 0xe8);
|
||||||
|
|
||||||
intptr_t v = address - instruction;
|
intptr_t v = address - instruction - 5;
|
||||||
assert(c, isInt32(v));
|
assert(c, isInt32(v));
|
||||||
|
|
||||||
int32_t v32 = v;
|
int32_t v32 = v;
|
||||||
@ -833,6 +857,13 @@ void
|
|||||||
ImmediateOperand::apply(Context* c, Operation operation)
|
ImmediateOperand::apply(Context* c, Operation operation)
|
||||||
{
|
{
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
|
case alignedCall: {
|
||||||
|
while ((c->code.length() + 1) % 4) {
|
||||||
|
c->code.append(0x90);
|
||||||
|
}
|
||||||
|
apply(c, call);
|
||||||
|
} break;
|
||||||
|
|
||||||
case call: {
|
case call: {
|
||||||
IpMapping* mapping = currentMapping(c);
|
IpMapping* mapping = currentMapping(c);
|
||||||
mapping->task = new (c->zone.allocate(sizeof(DirectCallTask)))
|
mapping->task = new (c->zone.allocate(sizeof(DirectCallTask)))
|
||||||
@ -842,13 +873,6 @@ ImmediateOperand::apply(Context* c, Operation operation)
|
|||||||
c->code.append(0xE8);
|
c->code.append(0xE8);
|
||||||
c->code.append4(0);
|
c->code.append4(0);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case alignedCall: {
|
|
||||||
while ((c->code.length() + 1) % 4) {
|
|
||||||
c->code.append(0x90);
|
|
||||||
}
|
|
||||||
apply(c, call);
|
|
||||||
} break;
|
|
||||||
|
|
||||||
default: abort(c);
|
default: abort(c);
|
||||||
}
|
}
|
||||||
@ -884,6 +908,10 @@ void
|
|||||||
MemoryOperand::apply(Context* c, Operation operation)
|
MemoryOperand::apply(Context* c, Operation operation)
|
||||||
{
|
{
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
|
case call:
|
||||||
|
encode(c, 0xff, 0x10, 0x50, 0x90, rax, base->asRegister(c), displacement);
|
||||||
|
break;
|
||||||
|
|
||||||
case pop:
|
case pop:
|
||||||
encode(c, 0x8f, 0, 0x40, 0x80, rax, base->asRegister(c), displacement);
|
encode(c, 0x8f, 0, 0x40, 0x80, rax, base->asRegister(c), displacement);
|
||||||
break;
|
break;
|
||||||
|
@ -25,9 +25,9 @@ public class Misc {
|
|||||||
|
|
||||||
Misc m = new Misc();
|
Misc m = new Misc();
|
||||||
String s = "hello";
|
String s = "hello";
|
||||||
// m.foo(s);
|
m.foo(s);
|
||||||
// m.bar(s);
|
m.bar(s);
|
||||||
// baz(s);
|
baz(s);
|
||||||
|
|
||||||
// int d = alpha;
|
// int d = alpha;
|
||||||
// beta = 42;
|
// beta = 42;
|
||||||
|
Loading…
Reference in New Issue
Block a user