aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-03-12 23:25:30 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-03-23 06:53:10 +0100
commita5e1a7d70b5eb23af4a5f819dc08b6c15aa723f1 (patch)
tree40ec05f88f96fd085c0add8eb702304dcce8fa61 /src/qml/jit
parent4333dded89ce2e49f9ef3ef50ff474ec04e284dd (diff)
Optimize stack frame setup for AOT compiled functions
When called via the metaobject system, parameters and return values are passed as void*, with accompanying type information in the form of QMetaType. The same format is expected when calling an AOT compiled function. Previously, we would first convert all the parameters to QV4::Value, just to convert them back the moment we notice that there is an AOT compiled function. This is wasteful. This change provides a second call infrastructure that accepts void* and QMetaType as parameter and return value format, and passes them as-is all the way to any AOT compiled functions. If there is no AOT compiled function, the conversion is done when detecting this, rather than when initiating the call. This also passes the information "ignore return value" all the way down to the actual function call. If the caller is not interested in the return value, we don't have to marshal it back at all. For now, we only add the extra "callWithMetaTypes" vtable entry to ArrowFunction. However, other callables could also receive variants optimized for calling with void*/int rather than V4 values. This required changing the way how function arguments are stored in the property cache. We squeeze the return type into QQmlPropertyCacheMethodArguments now, and we use QMetaType instead of integers. In turn, we remove some unused bits. Change-Id: I946e603e623d9d985c54d3a15f6f4b7c7b7d8c60 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jit')
-rw-r--r--src/qml/jit/qv4assemblercommon.cpp2
-rw-r--r--src/qml/jit/qv4assemblercommon_p.h5
-rw-r--r--src/qml/jit/qv4baselineassembler.cpp12
3 files changed, 10 insertions, 9 deletions
diff --git a/src/qml/jit/qv4assemblercommon.cpp b/src/qml/jit/qv4assemblercommon.cpp
index 9cf118e04b..a55c7d3851 100644
--- a/src/qml/jit/qv4assemblercommon.cpp
+++ b/src/qml/jit/qv4assemblercommon.cpp
@@ -179,7 +179,7 @@ void PlatformAssemblerCommon::prepareCallWithArgCount(int argc)
void PlatformAssemblerCommon::storeInstructionPointer(int instructionOffset)
{
- Address addr(CppStackFrameRegister, offsetof(QV4::CppStackFrame, instructionPointer));
+ Address addr(CppStackFrameRegister, offsetof(QV4::JSTypesStackFrame, instructionPointer));
store32(TrustedImm32(instructionOffset), addr);
}
diff --git a/src/qml/jit/qv4assemblercommon_p.h b/src/qml/jit/qv4assemblercommon_p.h
index ead1e757de..8f0b9fb83d 100644
--- a/src/qml/jit/qv4assemblercommon_p.h
+++ b/src/qml/jit/qv4assemblercommon_p.h
@@ -579,7 +579,7 @@ public:
Address loadFunctionPtr(RegisterID target)
{
- Address addr(CppStackFrameRegister, offsetof(CppStackFrame, v4Function));
+ Address addr(CppStackFrameRegister, offsetof(JSTypesStackFrame, v4Function));
loadPtr(addr, target);
return Address(target);
}
@@ -653,7 +653,8 @@ public:
void generateFunctionEntry()
{
generatePlatformFunctionEntry();
- loadPtr(Address(CppStackFrameRegister, offsetof(CppStackFrame, jsFrame)), JSStackFrameRegister);
+ loadPtr(Address(CppStackFrameRegister, offsetof(JSTypesStackFrame, jsFrame)),
+ JSStackFrameRegister);
allocateStackSpace();
}
diff --git a/src/qml/jit/qv4baselineassembler.cpp b/src/qml/jit/qv4baselineassembler.cpp
index 69670e1773..ff80445be5 100644
--- a/src/qml/jit/qv4baselineassembler.cpp
+++ b/src/qml/jit/qv4baselineassembler.cpp
@@ -1475,7 +1475,7 @@ void BaselineAssembler::loadAccumulatorFromFrame()
offsetof(CallData, accumulator)));
}
-static ReturnedValue TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing(CppStackFrame *frame, ExecutionEngine *engine)
+static ReturnedValue TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing(JSTypesStackFrame *frame, ExecutionEngine *engine)
{
return Runtime::TailCall::call(frame, engine);
}
@@ -1557,15 +1557,15 @@ void BaselineAssembler::clearUnwindHandler()
void JIT::BaselineAssembler::unwindDispatch()
{
checkException();
- pasm()->load32(Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLevel)), PlatformAssembler::ScratchRegister);
+ pasm()->load32(Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLevel)), PlatformAssembler::ScratchRegister);
auto noUnwind = pasm()->branch32(PlatformAssembler::Equal, PlatformAssembler::ScratchRegister, TrustedImm32(0));
pasm()->sub32(TrustedImm32(1), PlatformAssembler::ScratchRegister);
- pasm()->store32(PlatformAssembler::ScratchRegister, Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLevel)));
+ pasm()->store32(PlatformAssembler::ScratchRegister, Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLevel)));
auto jump = pasm()->branch32(PlatformAssembler::Equal, PlatformAssembler::ScratchRegister, TrustedImm32(0));
gotoCatchException();
jump.link(pasm());
- pasm()->loadPtr(Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLabel)), PlatformAssembler::ScratchRegister);
+ pasm()->loadPtr(Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLabel)), PlatformAssembler::ScratchRegister);
pasm()->jump(PlatformAssembler::ScratchRegister);
noUnwind.link(pasm());
@@ -1573,9 +1573,9 @@ void JIT::BaselineAssembler::unwindDispatch()
int JIT::BaselineAssembler::unwindToLabel(int level, int offset)
{
- auto l = pasm()->storePtrWithPatch(TrustedImmPtr(nullptr), Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLabel)));
+ auto l = pasm()->storePtrWithPatch(TrustedImmPtr(nullptr), Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLabel)));
pasm()->addEHTarget(l, offset);
- pasm()->store32(TrustedImm32(level), Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLevel)));
+ pasm()->store32(TrustedImm32(level), Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLevel)));
gotoCatchException();
return offset;
}