aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/common/qv4compileddata_p.h6
-rw-r--r--src/qml/jsruntime/qv4engine_p.h3
-rw-r--r--src/qml/jsruntime/qv4executablecompilationunit.cpp4
-rw-r--r--src/qml/jsruntime/qv4function.cpp13
-rw-r--r--src/qml/jsruntime/qv4function_p.h9
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp7
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4jscall_p.h2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp14
-rw-r--r--src/qml/qml/qqmlbinding.cpp4
-rw-r--r--src/qml/qml/qqmlprivate.h9
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp4
-rw-r--r--src/qmlcompiler/qqmljsloadergenerator.cpp2
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp2
15 files changed, 46 insertions, 37 deletions
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h
index 73f4060d0f..45ce45934e 100644
--- a/src/qml/common/qv4compileddata_p.h
+++ b/src/qml/common/qv4compileddata_p.h
@@ -51,7 +51,7 @@ class QQmlType;
class QQmlEngine;
namespace QQmlPrivate {
-struct AOTCompiledFunction;
+struct TypedFunction;
}
namespace QmlIR {
@@ -1396,7 +1396,7 @@ struct CompilationUnit : public CompilationUnitBase
const Unit *data = nullptr;
const QmlUnit *qmlData = nullptr;
QStringList dynamicStrings;
- const QQmlPrivate::AOTCompiledFunction *aotCompiledFunctions = nullptr;
+ const QQmlPrivate::TypedFunction *aotCompiledFunctions = nullptr;
public:
using CompiledObject = CompiledData::Object;
@@ -1406,7 +1406,7 @@ public:
setUnitData(unitData, nullptr, fileName, finalUrlString);
}
- explicit CompilationUnit(const Unit *unitData, const QQmlPrivate::AOTCompiledFunction *aotCompiledFunctions,
+ explicit CompilationUnit(const Unit *unitData, const QQmlPrivate::TypedFunction *aotCompiledFunctions,
const QString &fileName = QString(), const QString &finalUrlString = QString())
: CompilationUnit(unitData, fileName, finalUrlString)
{
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 1bca525584..8d27d1b719 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -657,7 +657,8 @@ public:
if (!m_canAllocateExecutableMemory)
return false;
if (f) {
- return !f->aotFunction && !f->isGenerator()
+ return f->kind != Function::AotCompiled
+ && !f->isGenerator()
&& f->interpreterCallCount >= s_jitCallCountThreshold;
}
return true;
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp
index 81716d2f0f..0a3033a567 100644
--- a/src/qml/jsruntime/qv4executablecompilationunit.cpp
+++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp
@@ -179,10 +179,10 @@ QV4::Function *ExecutableCompilationUnit::linkToEngine(ExecutionEngine *engine)
runtimeFunctions.resize(data->functionTableSize);
static bool forceInterpreter = qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER");
- const QQmlPrivate::AOTCompiledFunction *aotFunction
+ const QQmlPrivate::TypedFunction *aotFunction
= forceInterpreter ? nullptr : aotCompiledFunctions;
- auto advanceAotFunction = [&](int i) -> const QQmlPrivate::AOTCompiledFunction * {
+ auto advanceAotFunction = [&](int i) -> const QQmlPrivate::TypedFunction * {
if (aotFunction) {
if (aotFunction->functionPtr) {
if (aotFunction->extraData == i)
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index e9cececbdd..666bd3a0de 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -22,7 +22,7 @@ using namespace QV4;
bool Function::call(QObject *thisObject, void **a, const QMetaType *types, int argc,
ExecutionContext *context)
{
- if (!aotFunction) {
+ if (kind != AotCompiled) {
return QV4::convertAndCall(
context->engine(), thisObject, a, types, argc,
[this, context](const Value *thisObject, const Value *argv, int argc) {
@@ -41,9 +41,9 @@ bool Function::call(QObject *thisObject, void **a, const QMetaType *types, int a
ReturnedValue Function::call(
const Value *thisObject, const Value *argv, int argc, ExecutionContext *context) {
- if (aotFunction) {
+ if (kind == AotCompiled) {
return QV4::convertAndCall(
- context->engine(), aotFunction, thisObject, argv, argc,
+ context->engine(), typedFunction, thisObject, argv, argc,
[this, context](QObject *thisObject,
void **a, const QMetaType *types, int argc) {
call(thisObject, a, types, argc, context);
@@ -64,7 +64,7 @@ ReturnedValue Function::call(
Function *Function::create(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
const CompiledData::Function *function,
- const QQmlPrivate::AOTCompiledFunction *aotFunction)
+ const QQmlPrivate::TypedFunction *aotFunction)
{
return new Function(engine, unit, function, aotFunction);
}
@@ -76,13 +76,14 @@ void Function::destroy()
Function::Function(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
const CompiledData::Function *function,
- const QQmlPrivate::AOTCompiledFunction *aotFunction)
+ const QQmlPrivate::TypedFunction *aotFunction)
: FunctionData(unit)
, compiledFunction(function)
, codeData(function->code())
, jittedCode(nullptr)
, codeRef(nullptr)
- , aotFunction(aotFunction)
+ , typedFunction(aotFunction)
+ , kind(aotFunction ? AotCompiled : JsUntyped)
{
Scope scope(engine);
Scoped<InternalClass> ic(scope, engine->internalClasses(EngineBase::Class_CallContext));
diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h
index 67d31b6c6c..181c88a1e2 100644
--- a/src/qml/jsruntime/qv4function_p.h
+++ b/src/qml/jsruntime/qv4function_p.h
@@ -47,7 +47,7 @@ Q_STATIC_ASSERT(std::is_standard_layout< FunctionData >::value);
struct Q_QML_EXPORT Function : public FunctionData {
protected:
Function(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
- const CompiledData::Function *function, const QQmlPrivate::AOTCompiledFunction *aotFunction);
+ const CompiledData::Function *function, const QQmlPrivate::TypedFunction *aotFunction);
~Function();
public:
@@ -74,18 +74,19 @@ public:
typedef ReturnedValue (*JittedCode)(CppStackFrame *, ExecutionEngine *);
JittedCode jittedCode;
JSC::MacroAssemblerCodeRef *codeRef;
- const QQmlPrivate::AOTCompiledFunction *aotFunction = nullptr;
+ const QQmlPrivate::TypedFunction *typedFunction = nullptr;
// first nArguments names in internalClass are the actual arguments
Heap::InternalClass *internalClass;
int interpreterCallCount = 0;
quint16 nFormals;
- bool isEval = false;
+ enum Kind : quint8 { JsUntyped, JsTyped, AotCompiled, Eval };
+ Kind kind = JsUntyped;
bool detectedInjectedParameters = false;
static Function *create(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
const CompiledData::Function *function,
- const QQmlPrivate::AOTCompiledFunction *aotFunction);
+ const QQmlPrivate::TypedFunction *aotFunction);
void destroy();
// used when dynamically assigning signal handlers (QQmlConnection)
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 437f57e43f..a1d0c94b83 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -495,7 +495,7 @@ DEFINE_OBJECT_VTABLE(ArrowFunction);
void ArrowFunction::virtualCallWithMetaTypes(const FunctionObject *fo, QObject *thisObject,
void **a, const QMetaType *types, int argc)
{
- if (!fo->function()->aotFunction) {
+ if (fo->function()->kind != Function::AotCompiled) {
QV4::convertAndCall(fo->engine(), thisObject, a, types, argc,
[fo](const Value *thisObject, const Value *argv, int argc) {
return ArrowFunction::virtualCall(fo, thisObject, argv, argc);
@@ -514,9 +514,10 @@ void ArrowFunction::virtualCallWithMetaTypes(const FunctionObject *fo, QObject *
ReturnedValue ArrowFunction::virtualCall(const FunctionObject *fo, const Value *thisObject, const Value *argv, int argc)
{
- if (const auto *aotFunction = fo->function()->aotFunction) {
+ Function *function = fo->function();
+ if (function->kind == Function::AotCompiled) {
return QV4::convertAndCall(
- fo->engine(), aotFunction, thisObject, argv, argc,
+ fo->engine(), function->typedFunction, thisObject, argv, argc,
[fo](QObject *thisObject, void **a, const QMetaType *types, int argc) {
ArrowFunction::virtualCallWithMetaTypes(fo, thisObject, a, types, argc);
});
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index 7e016cf8fc..5357b72477 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -328,7 +328,7 @@ ReturnedValue EvalFunction::evalCall(const Value *, const Value *argv, int argc,
Function *function = script.function();
if (!function)
return Encode::undefined();
- function->isEval = true;
+ function->kind = Function::Eval;
if (function->isStrict() || isStrict) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h
index cf62f2549e..27c9cfe052 100644
--- a/src/qml/jsruntime/qv4jscall_p.h
+++ b/src/qml/jsruntime/qv4jscall_p.h
@@ -125,7 +125,7 @@ private:
template<typename Callable>
ReturnedValue convertAndCall(
- ExecutionEngine *engine, const QQmlPrivate::AOTCompiledFunction *aotFunction,
+ ExecutionEngine *engine, const QQmlPrivate::TypedFunction *aotFunction,
const Value *thisObject, const Value *argv, int argc, Callable call)
{
const qsizetype numFunctionArguments = aotFunction->argumentTypes.size();
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index f1f26ee53a..01ee03bddc 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -1039,7 +1039,7 @@ static Object *getSuperBase(Scope &scope)
if (CallContext *c = ctx->asCallContext()) {
f = c->d()->function;
QV4::Function *fn = f->function();
- if (fn && !fn->isArrowFunction() && !fn->isEval)
+ if (fn && !fn->isArrowFunction() && fn->kind != Function::Eval)
break;
}
ctx = ctx->d()->outer;
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index fa699b0e5e..5d86f44fbf 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -404,18 +404,18 @@ void VME::exec(MetaTypesStackFrame *frame, ExecutionEngine *engine)
ExecutionEngineCallDepthRecorder executionEngineCallDepthRecorder(engine);
Function *function = frame->v4Function;
- Q_ASSERT(function->aotFunction);
+ Q_ASSERT(function->typedFunction);
Q_TRACE_SCOPE(QQmlV4_function_call, engine, function->name()->toQString(),
function->executableCompilationUnit()->fileName(),
function->compiledFunction->location.line(),
function->compiledFunction->location.column());
Profiling::FunctionCallProfiler profiler(engine, function); // start execution profiling
- const qsizetype numFunctionArguments = function->aotFunction->argumentTypes.size();
+ const qsizetype numFunctionArguments = function->typedFunction->argumentTypes.size();
Q_ALLOCA_DECLARE(void *, transformedArguments);
for (qsizetype i = 0; i < numFunctionArguments; ++i) {
- const QMetaType argumentType = function->aotFunction->argumentTypes[i];
+ const QMetaType argumentType = function->typedFunction->argumentTypes[i];
if (frame->argc() > i && argumentType == frame->argTypes()[i])
continue;
@@ -450,7 +450,7 @@ void VME::exec(MetaTypesStackFrame *frame, ExecutionEngine *engine)
transformedArguments[i] = arg;
}
- const QMetaType returnType = function->aotFunction->returnType;
+ const QMetaType returnType = function->typedFunction->returnType;
const QMetaType frameReturn = frame->returnType();
Q_ALLOCA_DECLARE(void, transformedResult);
if (frame->returnValue() && returnType != frameReturn) {
@@ -470,7 +470,7 @@ void VME::exec(MetaTypesStackFrame *frame, ExecutionEngine *engine)
aotContext.engine = engine->jsEngine();
aotContext.compilationUnit = function->executableCompilationUnit();
- function->aotFunction->functionPtr(
+ function->typedFunction->functionPtr(
&aotContext, transformedResult ? transformedResult : frame->returnValue(),
transformedArguments ? transformedArguments : frame->argv());
@@ -498,7 +498,7 @@ void VME::exec(MetaTypesStackFrame *frame, ExecutionEngine *engine)
if (arg == nullptr)
continue;
if (i >= frame->argc() || arg != frame->argv()[i])
- function->aotFunction->argumentTypes[i].destruct(arg);
+ function->typedFunction->argumentTypes[i].destruct(arg);
}
}
}
@@ -535,7 +535,7 @@ ReturnedValue VME::exec(JSTypesStackFrame *frame, ExecutionEngine *engine)
debugger->enteringFunction();
ReturnedValue result;
- Q_ASSERT(!function->aotFunction);
+ Q_ASSERT(function->kind != Function::AotCompiled);
if (function->jittedCode != nullptr && debugger == nullptr) {
result = function->jittedCode(frame, engine);
} else {
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 9020a544ac..0116251fb8 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -669,8 +669,8 @@ void QQmlBinding::doUpdate(const DeleteWatcher &watcher, QQmlPropertyData::Write
bool error = false;
auto canWrite = [&]() { return !watcher.wasDeleted() && isAddedToObject() && !hasError(); };
const QV4::Function *v4Function = function();
- if (v4Function && v4Function->aotFunction && !hasBoundFunction()) {
- const auto returnType = v4Function->aotFunction->returnType;
+ if (v4Function && v4Function->kind == QV4::Function::AotCompiled && !hasBoundFunction()) {
+ const auto returnType = v4Function->typedFunction->returnType;
if (returnType == QMetaType::fromType<QVariant>()) {
// It expects uninitialized memory
Q_ALLOCA_VAR(QVariant, result, sizeof(QVariant));
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index 92e8dc9e00..800c534b54 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -699,16 +699,21 @@ namespace QQmlPrivate
void initSetValueLookup(uint index, const QMetaObject *metaObject, QMetaType type) const;
};
- struct AOTCompiledFunction {
+ struct TypedFunction {
qintptr extraData;
QMetaType returnType;
QList<QMetaType> argumentTypes;
void (*functionPtr)(const AOTCompiledContext *context, void *resultPtr, void **arguments);
};
+#if QT_DEPRECATED_SINCE(6, 5)
+ QT_DEPRECATED_VERSION_X(6, 5, "Use TypedFunction instead")
+ typedef TypedFunction AOTCompiledFunction;
+#endif
+
struct CachedQmlUnit {
const QV4::CompiledData::Unit *qmlData;
- const AOTCompiledFunction *aotCompiledFunctions;
+ const TypedFunction *aotCompiledFunctions;
void *unused2;
};
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index a3c78f2fbc..1cc02abe25 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -575,10 +575,10 @@ bool qSaveQmlJSUnitAsCpp(const QString &inputFileName, const QString &outputFile
writeStr(aotFunctions[FileScopeCodeIndex].code.toUtf8().constData());
if (aotFunctions.size() <= 1) {
// FileScopeCodeIndex is always there, but it may be the only one.
- writeStr("extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[] = { { 0, QMetaType::fromType<void>(), {}, nullptr } };");
+ writeStr("extern const QQmlPrivate::TypedFunction aotBuiltFunctions[] = { { 0, QMetaType::fromType<void>(), {}, nullptr } };");
} else {
writeStr(wrapCallCode);
- writeStr("extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[] = {\n");
+ writeStr("extern const QQmlPrivate::TypedFunction aotBuiltFunctions[] = {\n");
QString footer = QStringLiteral("});}\n");
diff --git a/src/qmlcompiler/qqmljsloadergenerator.cpp b/src/qmlcompiler/qqmljsloadergenerator.cpp
index 21be215bba..7582eadceb 100644
--- a/src/qmlcompiler/qqmljsloadergenerator.cpp
+++ b/src/qmlcompiler/qqmljsloadergenerator.cpp
@@ -110,7 +110,7 @@ bool qQmlJSGenerateLoader(const QStringList &compiledFiles, const QString &outpu
const QString ns = qQmlJSSymbolNamespaceForPath(compiledFile);
stream << "namespace " << ns << " { \n";
stream << " extern const unsigned char qmlData[];\n";
- stream << " extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[];\n";
+ stream << " extern const QQmlPrivate::TypedFunction aotBuiltFunctions[];\n";
stream << " const QQmlPrivate::CachedQmlUnit unit = {\n";
stream << " reinterpret_cast<const QV4::CompiledData::Unit*>(&qmlData), &aotBuiltFunctions[0], nullptr\n";
stream << " };\n";
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 3bbf7d3a24..95a5340b75 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -813,7 +813,7 @@ void tst_QmlCppCodegen::onAssignment()
namespace QmlCacheGeneratedCode {
namespace _qt_qml_TestTypes_failures_qml {
-extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[];
+extern const QQmlPrivate::TypedFunction aotBuiltFunctions[];
}
}