mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
snapshot
This commit is contained in:
parent
4a022147cd
commit
4a3be37c67
@ -165,9 +165,9 @@ class Assembler {
|
|||||||
virtual unsigned calculate(unsigned start) = 0;
|
virtual unsigned calculate(unsigned start) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~Assembler() { }
|
class Architecture {
|
||||||
|
public:
|
||||||
virtual void setClient(Client* client) = 0;
|
virtual ~Architecture() { }
|
||||||
|
|
||||||
virtual unsigned registerCount() = 0;
|
virtual unsigned registerCount() = 0;
|
||||||
|
|
||||||
@ -180,9 +180,11 @@ 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 updateCall(void* returnAddress, void* newTarget) = 0;
|
||||||
virtual void pushFrame(unsigned argumentCount, ...);
|
|
||||||
virtual void popFrame();
|
virtual unsigned alignFrameSize(unsigned sizeInWords) = 0;
|
||||||
|
|
||||||
|
virtual void* ipForFrame(void* stack, void* base);
|
||||||
|
|
||||||
virtual void plan
|
virtual void plan
|
||||||
(UnaryOperation op,
|
(UnaryOperation op,
|
||||||
@ -202,6 +204,17 @@ class Assembler {
|
|||||||
unsigned cSize, uint8_t* cTypeMask, uint64_t* cRegisterMask,
|
unsigned cSize, uint8_t* cTypeMask, uint64_t* cRegisterMask,
|
||||||
bool* thunk) = 0;
|
bool* thunk) = 0;
|
||||||
|
|
||||||
|
virtual void dispose() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual ~Assembler() { }
|
||||||
|
|
||||||
|
virtual void setClient(Client* client) = 0;
|
||||||
|
|
||||||
|
virtual void saveFrame(unsigned stackOffset, unsigned baseOffset);
|
||||||
|
virtual void pushFrame(unsigned argumentCount, ...);
|
||||||
|
virtual void popFrame();
|
||||||
|
|
||||||
virtual void apply(Operation op) = 0;
|
virtual void apply(Operation op) = 0;
|
||||||
|
|
||||||
virtual void apply(UnaryOperation op,
|
virtual void apply(UnaryOperation op,
|
||||||
@ -220,16 +233,15 @@ class Assembler {
|
|||||||
|
|
||||||
virtual unsigned length() = 0;
|
virtual unsigned length() = 0;
|
||||||
|
|
||||||
virtual void updateCall(void* returnAddress, void* newTarget) = 0;
|
|
||||||
|
|
||||||
virtual void dispose() = 0;
|
virtual void dispose() = 0;
|
||||||
|
|
||||||
static unsigned alignFrameSize(unsigned sizeInWords);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Assembler*
|
Assembler*
|
||||||
makeAssembler(System* system, Allocator* allocator, Zone* zone);
|
makeAssembler(System* system, Allocator* allocator, Zone* zone);
|
||||||
|
|
||||||
|
Assembler::Architecture*
|
||||||
|
makeArchitecture(System* system);
|
||||||
|
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
#endif//ASSEMBLER_H
|
#endif//ASSEMBLER_H
|
||||||
|
@ -208,8 +208,8 @@ class MyStackWalker: public Processor::StackWalker {
|
|||||||
// fprintf(stderr, "state: %d\n", state);
|
// fprintf(stderr, "state: %d\n", state);
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Start:
|
case Start:
|
||||||
if (ip_ == 0 and stack) {
|
if (ip_ == 0) {
|
||||||
ip_ = *static_cast<void**>(stack);
|
ip_ = t->arch->ipForFrame(stack, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trace and trace->nativeMethod) {
|
if (trace and trace->nativeMethod) {
|
||||||
@ -226,9 +226,9 @@ class MyStackWalker: public Processor::StackWalker {
|
|||||||
if (method_) {
|
if (method_) {
|
||||||
state = Method;
|
state = Method;
|
||||||
} else if (trace) {
|
} else if (trace) {
|
||||||
stack = static_cast<void**>(trace->stack);
|
stack = trace->stack;
|
||||||
ip_ = (stack ? *static_cast<void**>(stack) : 0);
|
|
||||||
base = trace->base;
|
base = trace->base;
|
||||||
|
ip_ = t->arch->ipForFrame(stack, base);
|
||||||
trace = trace->next;
|
trace = trace->next;
|
||||||
|
|
||||||
if (trace and trace->nativeMethod) {
|
if (trace and trace->nativeMethod) {
|
||||||
@ -259,9 +259,8 @@ class MyStackWalker: public Processor::StackWalker {
|
|||||||
void next() {
|
void next() {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Method:
|
case Method:
|
||||||
stack = static_cast<void**>(base) + 1;
|
t->arch->nextFrame(&stack, &base);
|
||||||
ip_ = (stack ? *static_cast<void**>(stack) : 0);
|
ip_ = t->arch->ipForFrame(stack, base);
|
||||||
base = *static_cast<void**>(base);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NativeMethod:
|
case NativeMethod:
|
||||||
@ -1152,9 +1151,9 @@ findUnwindTarget(MyThread* t, void** targetIp, void** targetBase,
|
|||||||
{
|
{
|
||||||
void* ip = t->ip;
|
void* ip = t->ip;
|
||||||
void* base = t->base;
|
void* base = t->base;
|
||||||
void** stack = static_cast<void**>(t->stack);
|
void* stack = t->stack;
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
ip = *stack;
|
ip = t->arch->ipForFrame(stack, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
*targetIp = 0;
|
*targetIp = 0;
|
||||||
@ -1169,12 +1168,17 @@ findUnwindTarget(MyThread* t, void** targetIp, void** targetBase,
|
|||||||
unsigned parameterFootprint = methodParameterFootprint(t, method);
|
unsigned parameterFootprint = methodParameterFootprint(t, method);
|
||||||
unsigned localFootprint = localSize(t, method);
|
unsigned localFootprint = localSize(t, method);
|
||||||
|
|
||||||
stack = static_cast<void**>(base)
|
t->arch->copyIntoFrame
|
||||||
- (localFootprint - parameterFootprint);
|
(stack, base, localFootprint - parameterFootprint,
|
||||||
|
BytesPerWord, &(t->exception));
|
||||||
*(--stack) = t->exception;
|
|
||||||
t->exception = 0;
|
t->exception = 0;
|
||||||
|
|
||||||
|
stack = t->arch->pushFrame
|
||||||
|
(stack, base,
|
||||||
|
localFootprint
|
||||||
|
- parameterFootprint
|
||||||
|
+ codeMaxStack(t, methodCode(t, method)));
|
||||||
|
|
||||||
*targetIp = handler;
|
*targetIp = handler;
|
||||||
*targetBase = base;
|
*targetBase = base;
|
||||||
*targetStack = stack;
|
*targetStack = stack;
|
||||||
@ -1190,9 +1194,8 @@ findUnwindTarget(MyThread* t, void** targetIp, void** targetBase,
|
|||||||
release(t, lock);
|
release(t, lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
stack = static_cast<void**>(base) + 1;
|
t->arch->nextFrame(&stack, &base);
|
||||||
ip = *stack;
|
ip_ = t->arch->ipForFrame(stack, base);
|
||||||
base = *static_cast<void**>(base);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*targetIp = ip;
|
*targetIp = ip;
|
||||||
@ -3944,7 +3947,7 @@ compile(MyThread* t, object method);
|
|||||||
void*
|
void*
|
||||||
compileMethod2(MyThread* t)
|
compileMethod2(MyThread* t)
|
||||||
{
|
{
|
||||||
object node = findCallNode(t, *static_cast<void**>(t->stack));
|
object node = findCallNode(t, t->arch->ipForFrame(t->stack, t->base));
|
||||||
PROTECT(t, node);
|
PROTECT(t, node);
|
||||||
|
|
||||||
object target = callNodeTarget(t, node);
|
object target = callNodeTarget(t, node);
|
||||||
@ -4174,7 +4177,7 @@ uint64_t
|
|||||||
invokeNative(MyThread* t)
|
invokeNative(MyThread* t)
|
||||||
{
|
{
|
||||||
if (t->trace->nativeMethod == 0) {
|
if (t->trace->nativeMethod == 0) {
|
||||||
object node = findCallNode(t, *static_cast<void**>(t->stack));
|
object node = findCallNode(t, t->arch->ipForFrame(t->stack, t->base));
|
||||||
object target = callNodeTarget(t, node);
|
object target = callNodeTarget(t, node);
|
||||||
if (callNodeVirtualCall(t, node)) {
|
if (callNodeVirtualCall(t, node)) {
|
||||||
target = resolveTarget(t, t->stack, target);
|
target = resolveTarget(t, t->stack, target);
|
||||||
@ -4259,9 +4262,9 @@ visitStack(MyThread* t, Heap::Visitor* v)
|
|||||||
{
|
{
|
||||||
void* ip = t->ip;
|
void* ip = t->ip;
|
||||||
void* base = t->base;
|
void* base = t->base;
|
||||||
void** stack = static_cast<void**>(t->stack);
|
void* stack = t->stack;
|
||||||
if (ip == 0 and stack) {
|
if (ip == 0) {
|
||||||
ip = *stack;
|
ip = t->arch->ipForFrame(stack, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyThread::CallTrace* trace = t->trace;
|
MyThread::CallTrace* trace = t->trace;
|
||||||
@ -4279,19 +4282,14 @@ visitStack(MyThread* t, Heap::Visitor* v)
|
|||||||
calleeBase = base;
|
calleeBase = base;
|
||||||
argumentFootprint = methodParameterFootprint(t, method);
|
argumentFootprint = methodParameterFootprint(t, method);
|
||||||
|
|
||||||
stack = static_cast<void**>(base) + 1;
|
t->arch->nextFrame(&stack, &base);
|
||||||
if (stack) {
|
ip_ = t->arch->ipForFrame(stack, base);
|
||||||
ip = *stack;
|
|
||||||
}
|
|
||||||
base = *static_cast<void**>(base);
|
|
||||||
} else if (trace) {
|
} else if (trace) {
|
||||||
calleeBase = 0;
|
calleeBase = 0;
|
||||||
argumentFootprint = 0;
|
argumentFootprint = 0;
|
||||||
|
stack = trace->stack;
|
||||||
base = trace->base;
|
base = trace->base;
|
||||||
stack = static_cast<void**>(trace->stack);
|
ip_ = t->arch->ipForFrame(stack, base);
|
||||||
if (stack) {
|
|
||||||
ip = *stack;
|
|
||||||
}
|
|
||||||
trace = trace->next;
|
trace = trace->next;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user