mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
snapshot
This commit is contained in:
parent
9efe6f1f05
commit
5dc0959294
@ -17,7 +17,6 @@
|
|||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
enum Operation {
|
enum Operation {
|
||||||
PopFrame,
|
|
||||||
Return
|
Return
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -172,7 +171,8 @@ class Assembler {
|
|||||||
|
|
||||||
virtual unsigned registerCount() = 0;
|
virtual unsigned registerCount() = 0;
|
||||||
|
|
||||||
virtual int frame() = 0;
|
virtual int stack() = 0;
|
||||||
|
virtual int base() = 0;
|
||||||
virtual int thread() = 0;
|
virtual int thread() = 0;
|
||||||
virtual int returnLow() = 0;
|
virtual int returnLow() = 0;
|
||||||
virtual int returnHigh() = 0;
|
virtual int returnHigh() = 0;
|
||||||
@ -180,6 +180,10 @@ class Assembler {
|
|||||||
virtual unsigned argumentRegisterCount() = 0;
|
virtual unsigned argumentRegisterCount() = 0;
|
||||||
virtual int argumentRegister(unsigned index) = 0;
|
virtual int argumentRegister(unsigned index) = 0;
|
||||||
|
|
||||||
|
virtual void saveFrame(unsigned stackOffset, unsigned baseOffset);
|
||||||
|
virtual void pushFrame(unsigned argumentCount, ...);
|
||||||
|
virtual void popFrame();
|
||||||
|
|
||||||
virtual void plan
|
virtual void plan
|
||||||
(UnaryOperation op,
|
(UnaryOperation op,
|
||||||
unsigned aSize, uint8_t* aTypeMask, uint64_t* aRegisterMask,
|
unsigned aSize, uint8_t* aTypeMask, uint64_t* aRegisterMask,
|
||||||
|
@ -41,22 +41,26 @@ class MyThread: public Thread {
|
|||||||
public:
|
public:
|
||||||
CallTrace(MyThread* t):
|
CallTrace(MyThread* t):
|
||||||
t(t),
|
t(t),
|
||||||
frame(t->frame),
|
base(t->base),
|
||||||
|
stack(t->stack),
|
||||||
nativeMethod(0),
|
nativeMethod(0),
|
||||||
next(t->trace)
|
next(t->trace)
|
||||||
{
|
{
|
||||||
t->trace = this;
|
t->trace = this;
|
||||||
t->frame = 0;
|
t->base = 0;
|
||||||
|
t->stack = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
~CallTrace() {
|
~CallTrace() {
|
||||||
t->frame = frame;
|
t->stack = stack;
|
||||||
|
t->base = base;
|
||||||
t->trace = next;
|
t->trace = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyThread* t;
|
MyThread* t;
|
||||||
void* ip;
|
void* ip;
|
||||||
void* frame;
|
void* base;
|
||||||
|
void* stack;
|
||||||
object nativeMethod;
|
object nativeMethod;
|
||||||
CallTrace* next;
|
CallTrace* next;
|
||||||
};
|
};
|
||||||
@ -64,13 +68,15 @@ class MyThread: public Thread {
|
|||||||
MyThread(Machine* m, object javaThread, Thread* parent):
|
MyThread(Machine* m, object javaThread, Thread* parent):
|
||||||
Thread(m, javaThread, parent),
|
Thread(m, javaThread, parent),
|
||||||
ip(0),
|
ip(0),
|
||||||
frame(0),
|
base(0),
|
||||||
|
stack(0),
|
||||||
trace(0),
|
trace(0),
|
||||||
reference(0)
|
reference(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void* ip;
|
void* ip;
|
||||||
void* frame;
|
void* base;
|
||||||
|
void* stack;
|
||||||
CallTrace* trace;
|
CallTrace* trace;
|
||||||
Reference* reference;
|
Reference* reference;
|
||||||
};
|
};
|
||||||
@ -4304,38 +4310,6 @@ visitStack(MyThread* t, Heap::Visitor* v)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
saveFrame(MyThread* t, Assembler* a)
|
|
||||||
{
|
|
||||||
Assembler::Register frame(a->frame());
|
|
||||||
Assembler::Memory frameDst(a->thread(), difference(&(t->frame), t));
|
|
||||||
a->apply(Move, BytesPerWord, RegisterOperand, &frame,
|
|
||||||
BytesPerWord, MemoryOperand, &frameDst);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
pushFrame(MyThread* t, Assembler* a, unsigned size)
|
|
||||||
{
|
|
||||||
Assembler::Constant offset(resolved(c, Assembler::alignFrameSize(size)));
|
|
||||||
a->apply(PushFrame, BytesPerWord, ConstantOperand, &offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
setThreadArgument(MyThread*, Assembler* a)
|
|
||||||
{
|
|
||||||
Assembler::Register thread(a->thread());
|
|
||||||
|
|
||||||
if (a->argumentRegisterCount()) {
|
|
||||||
Assembler::Register arg(a->argumentRegister(0));
|
|
||||||
a->apply(Move, BytesPerWord, RegisterOperand, &thread,
|
|
||||||
BytesPerWord, RegisterOperand, &arg);
|
|
||||||
} else {
|
|
||||||
Assembler::Memory arg(a->frame(), a->argumentPosition(0));
|
|
||||||
a->apply(Move, BytesPerWord, RegisterOperand, &thread,
|
|
||||||
BytesPerWord, MemoryOperand, &arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ArgumentList {
|
class ArgumentList {
|
||||||
public:
|
public:
|
||||||
ArgumentList(Thread* t, uintptr_t* array, bool* objectMask, object this_,
|
ArgumentList(Thread* t, uintptr_t* array, bool* objectMask, object this_,
|
||||||
@ -4970,9 +4944,10 @@ compileThunks(MyThread* t, MyProcessor* p)
|
|||||||
|
|
||||||
{ Assembler* a = defaultContext.context.assembler;
|
{ Assembler* a = defaultContext.context.assembler;
|
||||||
|
|
||||||
saveFrame(t, a);
|
a->saveFrame(difference(&(t->stack), t), difference(&(t->base), t));
|
||||||
pushFrame(t, a, 1);
|
|
||||||
setThreadArgument(t, a);
|
Assembler::Register thread(a->thread());
|
||||||
|
a->pushFrame(1, BytesPerWord, RegisterOperand, &thread);
|
||||||
|
|
||||||
defaultContext.promise.resolved_ = true;
|
defaultContext.promise.resolved_ = true;
|
||||||
defaultContext.promise.value_ = reinterpret_cast<intptr_t>(compileMethod);
|
defaultContext.promise.value_ = reinterpret_cast<intptr_t>(compileMethod);
|
||||||
@ -4980,7 +4955,7 @@ compileThunks(MyThread* t, MyProcessor* p)
|
|||||||
Assembler::Constant proc(&(defaultContext.promise));
|
Assembler::Constant proc(&(defaultContext.promise));
|
||||||
a->apply(LongCall, BytesPerWord, ConstantOperand, &proc);
|
a->apply(LongCall, BytesPerWord, ConstantOperand, &proc);
|
||||||
|
|
||||||
a->apply(PopFrame);
|
a->popFrame();
|
||||||
|
|
||||||
Assembler::Register result(a->returnLow());
|
Assembler::Register result(a->returnLow());
|
||||||
a->apply(Jump, BytesPerWord, RegisterOperand, &result);
|
a->apply(Jump, BytesPerWord, RegisterOperand, &result);
|
||||||
@ -4990,9 +4965,10 @@ compileThunks(MyThread* t, MyProcessor* p)
|
|||||||
|
|
||||||
{ Assembler* a = nativeContext.context.assembler;
|
{ Assembler* a = nativeContext.context.assembler;
|
||||||
|
|
||||||
saveFrame(t, a);
|
a->saveFrame(difference(&(t->stack), t), difference(&(t->base), t));
|
||||||
pushFrame(t, a, 1);
|
|
||||||
setThreadArgument(t, a);
|
Assembler::Register thread(a->thread());
|
||||||
|
a->pushFrame(1, BytesPerWord, RegisterOperand, &thread);
|
||||||
|
|
||||||
nativeContext.promise.resolved_ = true;
|
nativeContext.promise.resolved_ = true;
|
||||||
nativeContext.promise.value_ = reinterpret_cast<intptr_t>(invokeNative);
|
nativeContext.promise.value_ = reinterpret_cast<intptr_t>(invokeNative);
|
||||||
@ -5000,7 +4976,7 @@ compileThunks(MyThread* t, MyProcessor* p)
|
|||||||
Assembler::Constant proc(&(nativeContext.promise));
|
Assembler::Constant proc(&(nativeContext.promise));
|
||||||
a->apply(LongCall, BytesPerWord, ConstantOperand, &proc);
|
a->apply(LongCall, BytesPerWord, ConstantOperand, &proc);
|
||||||
|
|
||||||
a->apply(PopFrame);
|
a->popFrame();
|
||||||
|
|
||||||
a->apply(Return);
|
a->apply(Return);
|
||||||
}
|
}
|
||||||
@ -5009,9 +4985,10 @@ compileThunks(MyThread* t, MyProcessor* p)
|
|||||||
|
|
||||||
{ Assembler* a = aioobContext.context.assembler;
|
{ Assembler* a = aioobContext.context.assembler;
|
||||||
|
|
||||||
saveFrame(t, a);
|
a->saveFrame(difference(&(t->stack), t), difference(&(t->base), t));
|
||||||
pushFrame(t, a, 1);
|
|
||||||
setThreadArgument(t, a);
|
Assembler::Register thread(a->thread());
|
||||||
|
a->pushFrame(1, BytesPerWord, RegisterOperand, &thread);
|
||||||
|
|
||||||
aioobContext.promise.resolved_ = true;
|
aioobContext.promise.resolved_ = true;
|
||||||
aioobContext.promise.value_ = reinterpret_cast<intptr_t>
|
aioobContext.promise.value_ = reinterpret_cast<intptr_t>
|
||||||
@ -5025,7 +5002,7 @@ compileThunks(MyThread* t, MyProcessor* p)
|
|||||||
|
|
||||||
{ Assembler* a = tableContext.context.assembler;
|
{ Assembler* a = tableContext.context.assembler;
|
||||||
|
|
||||||
saveFrame(t, a);
|
a->saveFrame(difference(&(t->stack), t), difference(&(t->base), t));
|
||||||
|
|
||||||
Assembler::Constant proc(&(tableContext.promise));
|
Assembler::Constant proc(&(tableContext.promise));
|
||||||
a->apply(LongJump, BytesPerWord, ConstantOperand, &proc);
|
a->apply(LongJump, BytesPerWord, ConstantOperand, &proc);
|
||||||
|
Loading…
Reference in New Issue
Block a user