mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
add Frame::referenceStackCall
This commit is contained in:
parent
3aa85f2494
commit
4e00a1e304
100
src/compile.cpp
100
src/compile.cpp
@ -1383,6 +1383,33 @@ ir::Type operandTypeForFieldCode(Thread* t, unsigned code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned methodReferenceParameterFootprint(Thread* t,
|
||||||
|
object reference,
|
||||||
|
bool isStatic)
|
||||||
|
{
|
||||||
|
return parameterFootprint(
|
||||||
|
t,
|
||||||
|
reinterpret_cast<const char*>(
|
||||||
|
&byteArrayBody(t, referenceSpec(t, reference), 0)),
|
||||||
|
isStatic);
|
||||||
|
}
|
||||||
|
|
||||||
|
int methodReferenceReturnCode(Thread* t, object reference)
|
||||||
|
{
|
||||||
|
unsigned parameterCount;
|
||||||
|
unsigned parameterFootprint;
|
||||||
|
unsigned returnCode;
|
||||||
|
scanMethodSpec(t,
|
||||||
|
reinterpret_cast<const char*>(
|
||||||
|
&byteArrayBody(t, referenceSpec(t, reference), 0)),
|
||||||
|
true,
|
||||||
|
¶meterCount,
|
||||||
|
¶meterFootprint,
|
||||||
|
&returnCode);
|
||||||
|
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
class Frame {
|
class Frame {
|
||||||
public:
|
public:
|
||||||
enum StackType {
|
enum StackType {
|
||||||
@ -2017,6 +2044,28 @@ class Frame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void referenceStackCall(bool isStatic,
|
||||||
|
ir::Value* methodValue,
|
||||||
|
object methodReference,
|
||||||
|
unsigned flags,
|
||||||
|
TraceElement* trace)
|
||||||
|
{
|
||||||
|
unsigned footprint
|
||||||
|
= methodReferenceParameterFootprint(t, methodReference, isStatic);
|
||||||
|
unsigned returnCode = methodReferenceReturnCode(t, methodReference);
|
||||||
|
ir::Value* result = c->stackCall(methodValue,
|
||||||
|
flags,
|
||||||
|
trace,
|
||||||
|
operandTypeForFieldCode(t, returnCode),
|
||||||
|
footprint);
|
||||||
|
|
||||||
|
pop(footprint);
|
||||||
|
|
||||||
|
if (returnCode != VoidField) {
|
||||||
|
pushReturnValue(returnCode, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned startSubroutine(unsigned ip, avian::codegen::Promise* returnAddress) {
|
unsigned startSubroutine(unsigned ip, avian::codegen::Promise* returnAddress) {
|
||||||
pushAddress(absoluteAddressOperand(returnAddress));
|
pushAddress(absoluteAddressOperand(returnAddress));
|
||||||
|
|
||||||
@ -3311,54 +3360,17 @@ compileDirectInvoke(MyThread* t, Frame* frame, object target, bool tailCall)
|
|||||||
return tailCall;
|
return tailCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
void compileReferenceInvoke(Frame* frame,
|
||||||
methodReferenceParameterFootprint(Thread* t, object reference, bool isStatic)
|
|
||||||
{
|
|
||||||
return parameterFootprint
|
|
||||||
(t, reinterpret_cast<const char*>
|
|
||||||
(&byteArrayBody(t, referenceSpec(t, reference), 0)), isStatic);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
methodReferenceReturnCode(Thread* t, object reference)
|
|
||||||
{
|
|
||||||
unsigned parameterCount;
|
|
||||||
unsigned parameterFootprint;
|
|
||||||
unsigned returnCode;
|
|
||||||
scanMethodSpec
|
|
||||||
(t, reinterpret_cast<const char*>
|
|
||||||
(&byteArrayBody(t, referenceSpec(t, reference), 0)), true,
|
|
||||||
¶meterCount, ¶meterFootprint, &returnCode);
|
|
||||||
|
|
||||||
return returnCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void compileReferenceInvoke(MyThread* t,
|
|
||||||
Frame* frame,
|
|
||||||
ir::Value* method,
|
ir::Value* method,
|
||||||
object reference,
|
object reference,
|
||||||
bool isStatic,
|
bool isStatic,
|
||||||
bool tailCall)
|
bool tailCall)
|
||||||
{
|
{
|
||||||
unsigned parameterFootprint
|
frame->referenceStackCall(isStatic,
|
||||||
= methodReferenceParameterFootprint(t, reference, isStatic);
|
method,
|
||||||
|
reference,
|
||||||
int returnCode = methodReferenceReturnCode(t, reference);
|
|
||||||
|
|
||||||
unsigned rSize = resultSize(t, returnCode);
|
|
||||||
|
|
||||||
ir::Value* result
|
|
||||||
= frame->c->stackCall(method,
|
|
||||||
tailCall ? Compiler::TailJump : 0,
|
tailCall ? Compiler::TailJump : 0,
|
||||||
frame->trace(0, 0),
|
frame->trace(0, 0));
|
||||||
operandTypeForFieldCode(t, returnCode),
|
|
||||||
parameterFootprint);
|
|
||||||
|
|
||||||
frame->pop(parameterFootprint);
|
|
||||||
|
|
||||||
if (rSize) {
|
|
||||||
frame->pushReturnValue(returnCode, result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3372,8 +3384,7 @@ compileDirectReferenceInvoke(MyThread* t, Frame* frame, Thunk thunk,
|
|||||||
|
|
||||||
object pair = makePair(t, frame->context->method, reference);
|
object pair = makePair(t, frame->context->method, reference);
|
||||||
|
|
||||||
compileReferenceInvoke(t,
|
compileReferenceInvoke(frame,
|
||||||
frame,
|
|
||||||
c->call(c->constant(getThunk(t, thunk), types.address),
|
c->call(c->constant(getThunk(t, thunk), types.address),
|
||||||
0,
|
0,
|
||||||
frame->trace(0, 0),
|
frame->trace(0, 0),
|
||||||
@ -5196,7 +5207,6 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
object pair = makePair(t, context->method, reference);
|
object pair = makePair(t, context->method, reference);
|
||||||
|
|
||||||
compileReferenceInvoke(
|
compileReferenceInvoke(
|
||||||
t,
|
|
||||||
frame,
|
frame,
|
||||||
c->call(
|
c->call(
|
||||||
c->constant(getThunk(t, findVirtualMethodFromReferenceThunk),
|
c->constant(getThunk(t, findVirtualMethodFromReferenceThunk),
|
||||||
|
Loading…
Reference in New Issue
Block a user