diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-07-10 10:46:05 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-07-11 17:22:52 +0200 |
commit | de0d91abbbcf58a66018a08ca77bb4d63a5efda1 (patch) | |
tree | e960c18118f09b793b54c6767d0ffd4633da7d9d | |
parent | 1948139d4c7c76817e13334e8528b01093afa69d (diff) |
Split compiler and runtime more clearly
Provide different export macros and different top level headers for
each, don't include runtime headers from compiler sources.
Change-Id: I7dc3f8c95839a00a871ba045ec65af87123154be
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
43 files changed, 310 insertions, 101 deletions
diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h index 4a9fecb504..1e34086b0c 100644 --- a/src/particles/qquickparticlesystem_p.h +++ b/src/particles/qquickparticlesystem_p.h @@ -61,6 +61,7 @@ #include <QtQml/qqml.h> #include <private/qv4util_p.h> #include <private/qv4global_p.h> +#include <private/qv4staticvalue_p.h> #include "qtquickparticlesglobal_p.h" QT_BEGIN_NAMESPACE diff --git a/src/qml/common/common.pri b/src/qml/common/common.pri index 9de4fcae16..bcc3ea0fa0 100644 --- a/src/qml/common/common.pri +++ b/src/qml/common/common.pri @@ -1,5 +1,35 @@ +!build_pass { + # Create a header containing a hash that describes this library. For a + # released version of Qt, we'll use the .tag file that is updated by git + # archive with the commit hash. For unreleased versions, we'll ask git + # describe. Note that it won't update unless qmake is run again, even if + # the commit change also changed something in this library. + tagFile = $$PWD/../../.tag + tag = + exists($$tagFile) { + tag = $$cat($$tagFile, singleline) + QMAKE_INTERNAL_INCLUDED_FILES += $$tagFile + } + !equals(tag, "$${LITERAL_DOLLAR}Format:%H$${LITERAL_DOLLAR}") { + QML_COMPILE_HASH = $$tag + } else:exists($$PWD/../../.git) { + commit = $$system(git rev-parse HEAD) + QML_COMPILE_HASH = $$commit + } + compile_hash_contents = \ + "// Generated file, DO NOT EDIT" \ + "$${LITERAL_HASH}define QML_COMPILE_HASH \"$$QML_COMPILE_HASH\"" \ + "$${LITERAL_HASH}define QML_COMPILE_HASH_LENGTH $$str_size($$QML_COMPILE_HASH)" + write_file("$$OUT_PWD/qml_compile_hash_p.h", compile_hash_contents)|error() +} + HEADERS += \ $$PWD/qqmlapiversion_p.h \ $$PWD/qqmljsdiagnosticmessage_p.h \ $$PWD/qqmljsfixedpoolarray_p.h \ - $$PWD/qqmljsmemorypool_p.h + $$PWD/qqmljsmemorypool_p.h \ + $$PWD/qv4alloca_p.h \ + $$PWD/qv4calldata_p.h \ + $$PWD/qv4compileddata_p.h \ + $$PWD/qv4staticvalue_p.h \ + $$PWD/qv4stringtoarrayindex_p.h diff --git a/src/qml/compiler/qv4alloca_p.h b/src/qml/common/qv4alloca_p.h index 65c3e4d65a..65c3e4d65a 100644 --- a/src/qml/compiler/qv4alloca_p.h +++ b/src/qml/common/qv4alloca_p.h diff --git a/src/qml/compiler/qv4calldata_p.h b/src/qml/common/qv4calldata_p.h index 5a5280cb86..5a5280cb86 100644 --- a/src/qml/compiler/qv4calldata_p.h +++ b/src/qml/common/qv4calldata_p.h diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h index 60d0c50599..c3ddce5884 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/common/qv4compileddata_p.h @@ -64,6 +64,7 @@ #include <private/qendian_p.h> #include <private/qv4staticvalue_p.h> +#include <functional> QT_BEGIN_NAMESPACE @@ -1123,10 +1124,10 @@ struct CompilationUnitBase } // pointers either to data->constants() or little-endian memory copy. - QV4::Heap::String **runtimeStrings = nullptr; // Array + Heap::String **runtimeStrings = nullptr; // Array const StaticValue* constants = nullptr; QV4::StaticValue *runtimeRegularExpressions = nullptr; - QV4::Heap::InternalClass **runtimeClasses = nullptr; + Heap::InternalClass **runtimeClasses = nullptr; const StaticValue** imports = nullptr; }; diff --git a/src/qml/compiler/qv4staticvalue_p.h b/src/qml/common/qv4staticvalue_p.h index c6b4bdb158..8160bbb748 100644 --- a/src/qml/compiler/qv4staticvalue_p.h +++ b/src/qml/common/qv4staticvalue_p.h @@ -50,14 +50,24 @@ // We mean it. // -#include <QtQml/private/qtqmlglobal_p.h> -#include <QtQml/private/qv4global_p.h> #include <QtCore/private/qnumeric_p.h> +#ifdef QT_NO_DEBUG +#define QV4_NEARLY_ALWAYS_INLINE Q_ALWAYS_INLINE +#else +#define QV4_NEARLY_ALWAYS_INLINE inline +#endif + QT_BEGIN_NAMESPACE namespace QV4 { +// ReturnedValue is used to return values from runtime methods +// the type has to be a primitive type (no struct or union), so that the compiler +// will return it in a register on all platforms. +// It will be returned in rax on x64, [eax,edx] on x86 and [r0,r1] on arm +typedef quint64 ReturnedValue; + struct Double { quint64 d; @@ -105,7 +115,7 @@ struct Double { } }; -struct Q_QML_PRIVATE_EXPORT StaticValue +struct StaticValue { StaticValue() = default; constexpr StaticValue(quint64 val) : _val(val) {} @@ -180,9 +190,9 @@ struct Q_QML_PRIVATE_EXPORT StaticValue quint64 _val; - QML_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR quint64 &rawValueRef() { return _val; } - QML_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR quint64 rawValue() const { return _val; } - QML_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setRawValue(quint64 raw) { _val = raw; } + QV4_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR quint64 &rawValueRef() { return _val; } + QV4_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR quint64 rawValue() const { return _val; } + QV4_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setRawValue(quint64 raw) { _val = raw; } #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN static inline int valueOffset() { return 0; } @@ -192,22 +202,22 @@ struct Q_QML_PRIVATE_EXPORT StaticValue static inline int tagOffset() { return 0; } #endif static inline constexpr quint64 tagValue(quint32 tag, quint32 value) { return quint64(tag) << 32 | value; } - QML_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setTagValue(quint32 tag, quint32 value) { _val = quint64(tag) << 32 | value; } - QML_NEARLY_ALWAYS_INLINE constexpr quint32 value() const { return _val & quint64(~quint32(0)); } - QML_NEARLY_ALWAYS_INLINE constexpr quint32 tag() const { return _val >> 32; } - QML_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setTag(quint32 tag) { setTagValue(tag, value()); } + QV4_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setTagValue(quint32 tag, quint32 value) { _val = quint64(tag) << 32 | value; } + QV4_NEARLY_ALWAYS_INLINE constexpr quint32 value() const { return _val & quint64(~quint32(0)); } + QV4_NEARLY_ALWAYS_INLINE constexpr quint32 tag() const { return _val >> 32; } + QV4_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setTag(quint32 tag) { setTagValue(tag, value()); } - QML_NEARLY_ALWAYS_INLINE constexpr int int_32() const + QV4_NEARLY_ALWAYS_INLINE constexpr int int_32() const { return int(value()); } - QML_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setInt_32(int i) + QV4_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setInt_32(int i) { setTagValue(quint32(ValueTypeInternal::Integer), quint32(i)); } - QML_NEARLY_ALWAYS_INLINE uint uint_32() const { return value(); } + QV4_NEARLY_ALWAYS_INLINE uint uint_32() const { return value(); } - QML_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setEmpty() + QV4_NEARLY_ALWAYS_INLINE Q_DECL_RELAXED_CONSTEXPR void setEmpty() { setTagValue(quint32(ValueTypeInternal::Empty), 0); } @@ -353,7 +363,7 @@ struct Q_QML_PRIVATE_EXPORT StaticValue #endif } - QML_NEARLY_ALWAYS_INLINE double doubleValue() const { + QV4_NEARLY_ALWAYS_INLINE double doubleValue() const { Q_ASSERT(isDouble()); double d; StaticValue v = *this; @@ -362,7 +372,7 @@ struct Q_QML_PRIVATE_EXPORT StaticValue return d; } - QML_NEARLY_ALWAYS_INLINE void setDouble(double d) { + QV4_NEARLY_ALWAYS_INLINE void setDouble(double d) { if (qt_is_nan(d)) d = qt_qnan(); memcpy(&_val, &d, 8); @@ -383,7 +393,7 @@ struct Q_QML_PRIVATE_EXPORT StaticValue return false; } - QML_NEARLY_ALWAYS_INLINE static bool isInt32(double d) { + QV4_NEARLY_ALWAYS_INLINE static bool isInt32(double d) { int i = int(d); return (i == d && !(d == 0 && std::signbit(d))); } diff --git a/src/qml/compiler/qv4stringtoarrayindex_p.h b/src/qml/common/qv4stringtoarrayindex_p.h index 61bd988d1e..61bd988d1e 100644 --- a/src/qml/compiler/qv4stringtoarrayindex_p.h +++ b/src/qml/common/qv4stringtoarrayindex_p.h diff --git a/src/qml/compiler/compiler.pri b/src/qml/compiler/compiler.pri index c6ae8c6b69..4d6926d420 100644 --- a/src/qml/compiler/compiler.pri +++ b/src/qml/compiler/compiler.pri @@ -2,21 +2,17 @@ INCLUDEPATH += $$PWD INCLUDEPATH += $$OUT_PWD HEADERS += \ - $$PWD/qv4alloca_p.h \ $$PWD/qv4bytecodegenerator_p.h \ - $$PWD/qv4compileddata_p.h \ $$PWD/qv4compiler_p.h \ $$PWD/qv4compilercontext_p.h \ $$PWD/qv4compilercontrolflow_p.h \ + $$PWD/qv4compilerglobal_p.h \ $$PWD/qv4compilerscanfunctions_p.h \ $$PWD/qv4codegen_p.h \ $$PWD/qqmlirbuilder_p.h \ $$PWD/qv4instr_moth_p.h \ $$PWD/qv4bytecodehandler_p.h \ - $$PWD/qv4calldata_p.h \ - $$PWD/qv4util_p.h \ - $$PWD/qv4staticvalue_p.h \ - $$PWD/qv4stringtoarrayindex_p.h + $$PWD/qv4util_p.h SOURCES += \ $$PWD/qv4bytecodegenerator.cpp \ diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index 82b9050c0b..c366c8e459 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -280,7 +280,7 @@ struct Function Function *next; }; -struct Q_QML_PRIVATE_EXPORT CompiledFunctionOrExpression +struct Q_QMLCOMPILER_PRIVATE_EXPORT CompiledFunctionOrExpression { CompiledFunctionOrExpression() {} @@ -291,7 +291,7 @@ struct Q_QML_PRIVATE_EXPORT CompiledFunctionOrExpression CompiledFunctionOrExpression *next = nullptr; }; -struct Q_QML_PRIVATE_EXPORT Object +struct Q_QMLCOMPILER_PRIVATE_EXPORT Object { Q_DECLARE_TR_FUNCTIONS(Object) public: @@ -367,7 +367,7 @@ private: PoolList<Function> *functions; }; -struct Q_QML_PRIVATE_EXPORT Pragma +struct Q_QMLCOMPILER_PRIVATE_EXPORT Pragma { enum PragmaType { PragmaSingleton = 0x1 @@ -377,7 +377,7 @@ struct Q_QML_PRIVATE_EXPORT Pragma QV4::CompiledData::Location location; }; -struct Q_QML_PRIVATE_EXPORT Document +struct Q_QMLCOMPILER_PRIVATE_EXPORT Document { Document(bool debugMode); QString code; @@ -395,7 +395,7 @@ struct Q_QML_PRIVATE_EXPORT Document QString stringAt(int index) const { return jsGenerator.stringForIndex(index); } }; -class Q_QML_PRIVATE_EXPORT ScriptDirectivesCollector : public QQmlJS::Directives +class Q_QMLCOMPILER_PRIVATE_EXPORT ScriptDirectivesCollector : public QQmlJS::Directives { QmlIR::Document *document; QQmlJS::Engine *engine; @@ -409,7 +409,7 @@ public: void importModule(const QString &uri, const QString &version, const QString &module, int lineNumber, int column) override; }; -struct Q_QML_PRIVATE_EXPORT IRBuilder : public QQmlJS::AST::Visitor +struct Q_QMLCOMPILER_PRIVATE_EXPORT IRBuilder : public QQmlJS::AST::Visitor { Q_DECLARE_TR_FUNCTIONS(QQmlCodeGenerator) public: @@ -513,7 +513,7 @@ public: QV4::Compiler::JSUnitGenerator *jsGenerator; }; -struct Q_QML_PRIVATE_EXPORT QmlUnitGenerator +struct Q_QMLCOMPILER_PRIVATE_EXPORT QmlUnitGenerator { void generate(Document &output, const QV4::CompiledData::DependentTypesHasher &dependencyHasher = QV4::CompiledData::DependentTypesHasher()); @@ -522,7 +522,7 @@ private: char *writeBindings(char *bindingPtr, const Object *o, BindingFilter filter) const; }; -struct Q_QML_PRIVATE_EXPORT JSCodeGen : public QV4::Compiler::Codegen +struct Q_QMLCOMPILER_PRIVATE_EXPORT JSCodeGen : public QV4::Compiler::Codegen { JSCodeGen(Document *document, const QSet<QString> &globalNames); diff --git a/src/qml/compiler/qv4bytecodegenerator_p.h b/src/qml/compiler/qv4bytecodegenerator_p.h index acd4aa62ea..8c509dd9f1 100644 --- a/src/qml/compiler/qv4bytecodegenerator_p.h +++ b/src/qml/compiler/qv4bytecodegenerator_p.h @@ -62,6 +62,11 @@ class SourceLocation; } namespace QV4 { + +namespace Compiler { +struct Context; +} + namespace Moth { class BytecodeGenerator { diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 86617aa428..c43ea64e2e 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -48,7 +48,6 @@ #include <private/qqmljsast_p.h> #include <private/qqmljslexer_p.h> #include <private/qqmljsparser_p.h> -#include <private/qv4stringtoarrayindex_p.h> #include <private/qv4staticvalue_p.h> #include <private/qv4compilercontext_p.h> #include <private/qv4compilercontrolflow_p.h> diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index 491ecb2a0d..82a4fc3289 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -50,7 +50,6 @@ // We mean it. // -#include "private/qv4global_p.h" #include <private/qqmljsastvisitor_p.h> #include <private/qqmljsengine_p.h> #include <private/qqmljsast_p.h> @@ -79,7 +78,7 @@ struct ControlFlow; struct ControlFlowCatch; struct ControlFlowFinally; -class Q_QML_PRIVATE_EXPORT Codegen: protected QQmlJS::AST::Visitor +class Q_QMLCOMPILER_PRIVATE_EXPORT Codegen: protected QQmlJS::AST::Visitor { protected: using BytecodeGenerator = QV4::Moth::BytecodeGenerator; diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index 22f393eaec..acc4b02e96 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -38,8 +38,8 @@ ****************************************************************************/ #include <qv4compiler_p.h> -#include <qv4compileddata_p.h> #include <qv4codegen_p.h> +#include <private/qv4compileddata_p.h> #include <private/qv4staticvalue_p.h> #include <private/qv4alloca_p.h> #include <private/qqmljslexer_p.h> diff --git a/src/qml/compiler/qv4compiler_p.h b/src/qml/compiler/qv4compiler_p.h index f5884f6478..4f3c718175 100644 --- a/src/qml/compiler/qv4compiler_p.h +++ b/src/qml/compiler/qv4compiler_p.h @@ -53,9 +53,10 @@ #include <QtCore/qstring.h> #include <QtCore/qhash.h> #include <QtCore/qstringlist.h> -#include <private/qv4global_p.h> +#include <private/qv4compilerglobal_p.h> #include <private/qqmljsastfwd_p.h> #include <private/qv4compileddata_p.h> +#include <private/qv4staticvalue_p.h> QT_BEGIN_NAMESPACE @@ -72,10 +73,12 @@ struct JSClassMember; namespace Compiler { +struct Context; +struct Module; struct Class; struct TemplateObject; -struct Q_QML_PRIVATE_EXPORT StringTableGenerator { +struct Q_QMLCOMPILER_PRIVATE_EXPORT StringTableGenerator { StringTableGenerator(); int registerString(const QString &str); @@ -102,7 +105,7 @@ private: bool frozen = false; }; -struct Q_QML_PRIVATE_EXPORT JSUnitGenerator { +struct Q_QMLCOMPILER_PRIVATE_EXPORT JSUnitGenerator { static void generateUnitChecksum(CompiledData::Unit *unit); struct MemberInfo { diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index 1ae7c8c149..8c124ac409 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -50,7 +50,6 @@ // We mean it. // -#include "private/qv4global_p.h" #include <private/qqmljsast_p.h> #include <private/qv4compileddata_p.h> #include <QtCore/QStringList> @@ -62,8 +61,13 @@ QT_BEGIN_NAMESPACE namespace QV4 { +namespace Moth { +class BytecodeGenerator; +} + namespace Compiler { +class Codegen; struct ControlFlow; enum class ContextType { diff --git a/src/qml/compiler/qv4compilercontrolflow_p.h b/src/qml/compiler/qv4compilercontrolflow_p.h index 8ae618a6d4..5623473726 100644 --- a/src/qml/compiler/qv4compilercontrolflow_p.h +++ b/src/qml/compiler/qv4compilercontrolflow_p.h @@ -50,7 +50,6 @@ // We mean it. // -#include <private/qv4global_p.h> #include <private/qv4codegen_p.h> #include <private/qqmljsast_p.h> #include <private/qv4bytecodegenerator_p.h> diff --git a/src/qml/compiler/qv4compilerglobal_p.h b/src/qml/compiler/qv4compilerglobal_p.h new file mode 100644 index 0000000000..3478074827 --- /dev/null +++ b/src/qml/compiler/qv4compilerglobal_p.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QV4COMPILERGLOBAL_H +#define QV4COMPILERGLOBAL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qglobal.h> +#include <QString> + +#include <private/qtqmlcompilerglobal_p.h> + +QT_BEGIN_NAMESPACE + +namespace QV4 { + +enum class ObjectLiteralArgument { + Value, + Method, + Getter, + Setter +}; + +} // namespace QV4 + +QT_END_NAMESPACE + +#endif // QV4COMPILERGLOBAL_H diff --git a/src/qml/compiler/qv4compilerscanfunctions_p.h b/src/qml/compiler/qv4compilerscanfunctions_p.h index 84d3ff5e31..f67db030a2 100644 --- a/src/qml/compiler/qv4compilerscanfunctions_p.h +++ b/src/qml/compiler/qv4compilerscanfunctions_p.h @@ -50,7 +50,7 @@ // We mean it. // -#include "private/qv4global_p.h" +#include <private/qtqmlcompilerglobal_p.h> #include <private/qqmljsastvisitor_p.h> #include <private/qqmljsast_p.h> #include <private/qqmljsengine_p.h> diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index ec81701160..c0dd696b8a 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -50,7 +50,7 @@ // // We mean it. // -#include <private/qv4global_p.h> + #include <private/qv4staticvalue_p.h> #include <private/qv4compileddata_p.h> // for CompiledData::CodeOffsetToLine used by the dumper #include <qendian.h> diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index 98e0ef9e70..206e2b9aa4 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -38,13 +38,14 @@ ****************************************************************************/ #include <qv4argumentsobject_p.h> #include <qv4arrayobject_p.h> -#include <qv4alloca_p.h> #include <qv4scopedvalue_p.h> #include <qv4string_p.h> #include <qv4function_p.h> #include <qv4jscall_p.h> #include <qv4symbol_p.h> +#include <private/qv4alloca_p.h> + using namespace QV4; DEFINE_OBJECT_VTABLE(ArgumentsObject); diff --git a/src/qml/jsruntime/qv4compilationunitmapper.cpp b/src/qml/jsruntime/qv4compilationunitmapper.cpp index 350f6f9485..74f34a284d 100644 --- a/src/qml/jsruntime/qv4compilationunitmapper.cpp +++ b/src/qml/jsruntime/qv4compilationunitmapper.cpp @@ -39,7 +39,7 @@ #include "qv4compilationunitmapper_p.h" -#include "qv4compileddata_p.h" +#include <private/qv4compileddata_p.h> #include <QFileInfo> #include <QDateTime> #include <QCoreApplication> diff --git a/src/qml/jsruntime/qv4debugging_p.h b/src/qml/jsruntime/qv4debugging_p.h index 9b41bb6e7a..52263105fa 100644 --- a/src/qml/jsruntime/qv4debugging_p.h +++ b/src/qml/jsruntime/qv4debugging_p.h @@ -52,6 +52,7 @@ // #include "qv4global_p.h" +#include <private/qv4staticvalue_p.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index c6d6c77d11..525d3458f4 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -47,7 +47,7 @@ #include "qv4string_p.h" #include <private/qv4mm_p.h> -#include <qv4codegen_p.h> +#include <private/qv4codegen_p.h> #ifndef Q_OS_WIN # include <time.h> diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h index 8a853d5dcd..51960863c4 100644 --- a/src/qml/jsruntime/qv4function_p.h +++ b/src/qml/jsruntime/qv4function_p.h @@ -53,6 +53,7 @@ #include "qv4global_p.h" #include <private/qv4executablecompilationunit_p.h> #include <private/qv4context_p.h> +#include <private/qv4string_p.h> namespace JSC { class MacroAssemblerCodeRef; diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index b1b0d67e64..6fb7946023 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -59,10 +59,10 @@ #include "private/qqmlbuiltinfunctions_p.h" #include <private/qv4jscall_p.h> #include <private/qv4vme_moth_p.h> +#include <private/qv4alloca_p.h> #include <QtCore/QDebug> #include <algorithm> -#include "qv4alloca_p.h" #include "qv4profiling_p.h" using namespace QV4; diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h index ebd21b3543..c6a737b467 100644 --- a/src/qml/jsruntime/qv4global_p.h +++ b/src/qml/jsruntime/qv4global_p.h @@ -52,6 +52,7 @@ // #include <QtCore/qglobal.h> +#include <private/qv4compilerglobal_p.h> #include <QString> #ifdef QT_NO_DEBUG @@ -207,11 +208,6 @@ struct SetMapObject; struct PromiseObject; struct PromiseCapability; -// ReturnedValue is used to return values from runtime methods -// the type has to be a primitive type (no struct or union), so that the compiler -// will return it in a register on all platforms. -// It will be returned in rax on x64, [eax,edx] on x86 and [r0,r1] on arm -typedef quint64 ReturnedValue; struct CallData; struct Scope; struct ScopedValue; @@ -341,13 +337,6 @@ struct Q_QML_EXPORT StackFrame { }; typedef QVector<StackFrame> StackTrace; -enum class ObjectLiteralArgument { - Value, - Method, - Getter, - Setter -}; - namespace JIT { enum class CallResultDestination { diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 247ebd2e1b..bb81fb52d4 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -49,14 +49,14 @@ #include "qv4string_p.h" #include "qv4jscall_p.h" -#include <qv4codegen_p.h> +#include <private/qv4codegen_p.h> +#include <private/qv4alloca_p.h> #include "private/qlocale_tools_p.h" #include "private/qtools_p.h" #include <QtCore/QDebug> #include <QtCore/QString> #include <iostream> -#include "qv4alloca_p.h" #include <wtf/MathExtras.h> diff --git a/src/qml/jsruntime/qv4math_p.h b/src/qml/jsruntime/qv4math_p.h index bca4c2ef66..6632d69c27 100644 --- a/src/qml/jsruntime/qv4math_p.h +++ b/src/qml/jsruntime/qv4math_p.h @@ -52,7 +52,7 @@ #include <qglobal.h> -#include <QtQml/private/qv4staticvalue_p.h> +#include <private/qv4staticvalue_p.h> #include <QtCore/qnumeric.h> #include <QtCore/private/qnumeric_p.h> #include <cmath> diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 64aba1d85c..c1a42c4afa 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -56,7 +56,7 @@ #include <cassert> #include <typeinfo> #include <iostream> -#include "qv4alloca_p.h" +#include <private/qv4alloca_p.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/jsruntime/qv4runtimeapi_p.h b/src/qml/jsruntime/qv4runtimeapi_p.h index 13a73b7046..05ffb84d58 100644 --- a/src/qml/jsruntime/qv4runtimeapi_p.h +++ b/src/qml/jsruntime/qv4runtimeapi_p.h @@ -51,6 +51,7 @@ // #include <private/qv4global_p.h> +#include <private/qv4staticvalue_p.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/jsruntime/qv4runtimecodegen.cpp b/src/qml/jsruntime/qv4runtimecodegen.cpp index b6902d41b0..162d75db63 100644 --- a/src/qml/jsruntime/qv4runtimecodegen.cpp +++ b/src/qml/jsruntime/qv4runtimecodegen.cpp @@ -39,7 +39,7 @@ #include "qv4engine_p.h" #include "qv4runtimecodegen_p.h" -#include "qv4compilerscanfunctions_p.h" +#include <private/qv4compilerscanfunctions_p.h> using namespace QV4; using namespace QQmlJS; diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 227df4014e..9b4a2d575e 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -45,7 +45,7 @@ #include <private/qv4mm_p.h> #include "qv4scopedvalue_p.h" #include "qv4symbol_p.h" -#include "qv4alloca_p.h" +#include <private/qv4alloca_p.h> #include "qv4jscall_p.h" #include "qv4stringiterator_p.h" #include <QtCore/QDateTime> diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index b2bbe985d3..b4c34d60fa 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -38,11 +38,11 @@ ****************************************************************************/ #include "qv4vme_moth_p.h" -#include "qv4instr_moth_p.h" #include <QtCore/qjsondocument.h> #include <QtCore/qjsonobject.h> +#include <private/qv4instr_moth_p.h> #include <private/qv4value_p.h> #include <private/qv4debugging_p.h> #include <private/qv4function_p.h> @@ -56,11 +56,10 @@ #include <private/qv4profiling_p.h> #include <private/qv4jscall_p.h> #include <private/qv4generatorobject_p.h> +#include <private/qv4alloca_p.h> #include <private/qqmljavascriptexpression_p.h> #include <iostream> -#include "qv4alloca_p.h" - #if QT_CONFIG(qml_jit) #include <private/qv4baselinejit_p.h> #endif diff --git a/src/qml/jsruntime/qv4vme_moth_p.h b/src/qml/jsruntime/qv4vme_moth_p.h index 8a76e60f20..b3944f5454 100644 --- a/src/qml/jsruntime/qv4vme_moth_p.h +++ b/src/qml/jsruntime/qv4vme_moth_p.h @@ -52,6 +52,7 @@ // #include <private/qv4global_p.h> +#include <private/qv4staticvalue_p.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index 86202a6729..c7f52eac6b 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -46,6 +46,7 @@ #include <QtCore/qalgorithms.h> #include <QtCore/private/qnumeric_p.h> #include <QtCore/qloggingcategory.h> +#include <private/qv4alloca_p.h> #include <qqmlengine.h> #include "PageReservation.h" #include "PageAllocation.h" @@ -59,7 +60,6 @@ #include <iostream> #include <cstdlib> #include <algorithm> -#include "qv4alloca_p.h" #include "qv4profiling_p.h" #include "qv4mapobject_p.h" #include "qv4setobject_p.h" diff --git a/src/qml/parser/parser.pri b/src/qml/parser/parser.pri index 6d7bde248d..e15730f5d1 100644 --- a/src/qml/parser/parser.pri +++ b/src/qml/parser/parser.pri @@ -7,7 +7,6 @@ HEADERS += \ $$PWD/qqmljsglobal_p.h \ $$PWD/qqmljskeywords_p.h \ $$PWD/qqmljsengine_p.h \ - $$PWD/qqmljsglobal_p.h \ $$PWD/qqmljssourcelocation_p.h SOURCES += \ diff --git a/src/qml/qml.pro b/src/qml/qml.pro index 99ad6ace60..3c889244f4 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -19,31 +19,6 @@ gcc:isEqual(QT_ARCH, "mips"): QMAKE_CXXFLAGS += -fno-reorder-blocks DEFINES += QT_NO_FOREACH -!build_pass { - # Create a header containing a hash that describes this library. For a - # released version of Qt, we'll use the .tag file that is updated by git - # archive with the commit hash. For unreleased versions, we'll ask git - # describe. Note that it won't update unless qmake is run again, even if - # the commit change also changed something in this library. - tagFile = $$PWD/../../.tag - tag = - exists($$tagFile) { - tag = $$cat($$tagFile, singleline) - QMAKE_INTERNAL_INCLUDED_FILES += $$tagFile - } - !equals(tag, "$${LITERAL_DOLLAR}Format:%H$${LITERAL_DOLLAR}") { - QML_COMPILE_HASH = $$tag - } else:exists($$PWD/../../.git) { - commit = $$system(git rev-parse HEAD) - QML_COMPILE_HASH = $$commit - } - compile_hash_contents = \ - "// Generated file, DO NOT EDIT" \ - "$${LITERAL_HASH}define QML_COMPILE_HASH \"$$QML_COMPILE_HASH\"" \ - "$${LITERAL_HASH}define QML_COMPILE_HASH_LENGTH $$str_size($$QML_COMPILE_HASH)" - write_file("$$OUT_PWD/qml_compile_hash_p.h", compile_hash_contents)|error() -} - exists("qqml_enable_gcov") { QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors LIBS_PRIVATE += -lgcov @@ -64,7 +39,9 @@ greaterThan(QT_CLANG_MAJOR_VERSION, 3)|greaterThan(QT_CLANG_MINOR_VERSION, 3)| \ WERROR += -Wno-error=unused-const-variable HEADERS += qtqmlglobal.h \ - qtqmlglobal_p.h + qtqmlglobal_p.h \ + qtqmlcompilerglobal.h \ + qtqmlcompilerglobal_p.h #modules include(common/common.pri) diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri index 660a883e63..08591b5237 100644 --- a/src/qml/qml/qml.pri +++ b/src/qml/qml/qml.pri @@ -79,6 +79,7 @@ HEADERS += \ $$PWD/qqmltypeloaderthread_p.h \ $$PWD/qqmlvmemetaobject_p.h \ $$PWD/qqml.h \ + $$PWD/qqmlerror.h \ $$PWD/qqmlproperty.h \ $$PWD/qqmlcomponent.h \ $$PWD/qqmlcomponent_p.h \ diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index b5c38ce522..00d2a6b502 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -51,13 +51,13 @@ #include "qqmlscriptstring.h" #include "qqmlglobal_p.h" #include "qqmlcomponent_p.h" -#include "qqmldirparser_p.h" #include "qqmlextensioninterface.h" #include "qqmllist_p.h" #include "qqmltypenamecache_p.h" #include "qqmlnotifier_p.h" #include "qqmlincubator.h" #include "qqmlabstracturlinterceptor.h" +#include <private/qqmldirparser_p.h> #include <private/qqmlboundsignal_p.h> #include <private/qqmljsdiagnosticmessage_p.h> #include <QtCore/qstandardpaths.h> diff --git a/src/qml/qml/qqmlinfo.h b/src/qml/qml/qqmlinfo.h index 673125632e..faa112d4af 100644 --- a/src/qml/qml/qqmlinfo.h +++ b/src/qml/qml/qqmlinfo.h @@ -40,6 +40,7 @@ #ifndef QQMLINFO_H #define QQMLINFO_H +#include <QtQml/qtqmlglobal.h> #include <QtCore/qdebug.h> #include <QtCore/qurl.h> #include <QtQml/qqmlerror.h> diff --git a/src/qml/qmldirparser/qqmldirparser_p.h b/src/qml/qmldirparser/qqmldirparser_p.h index 0957c8373a..20b92ab3c6 100644 --- a/src/qml/qmldirparser/qqmldirparser_p.h +++ b/src/qml/qmldirparser/qqmldirparser_p.h @@ -54,14 +54,14 @@ #include <QtCore/QUrl> #include <QtCore/QHash> #include <QtCore/QDebug> +#include <private/qtqmlcompilerglobal_p.h> #include <private/qqmljsengine_p.h> -#include <private/qv4global_p.h> #include <private/qqmljsdiagnosticmessage_p.h> QT_BEGIN_NAMESPACE class QQmlEngine; -class Q_QML_PRIVATE_EXPORT QQmlDirParser +class Q_QMLCOMPILER_PRIVATE_EXPORT QQmlDirParser { public: QQmlDirParser(); diff --git a/src/qml/qtqmlcompilerglobal.h b/src/qml/qtqmlcompilerglobal.h new file mode 100644 index 0000000000..850d413372 --- /dev/null +++ b/src/qml/qtqmlcompilerglobal.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTQMLCOMPILERGLOBAL_H +#define QTQMLCOMPILERGLOBAL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB) || defined(QT_STATIC) +# define Q_QMLCOMPILER_EXPORT +#else +# if defined(QT_BUILD_QML_LIB) +# define Q_QMLCOMPILER_EXPORT Q_DECL_EXPORT +# else +# define Q_QMLCOMPILER_EXPORT Q_DECL_IMPORT +# endif +#endif + +QT_END_NAMESPACE +#endif // QTQMLCOMPILERGLOBAL_H diff --git a/src/qml/qtqmlcompilerglobal_p.h b/src/qml/qtqmlcompilerglobal_p.h new file mode 100644 index 0000000000..9c8bce23d3 --- /dev/null +++ b/src/qml/qtqmlcompilerglobal_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTQMLCOMPILERGLOBAL_P_H +#define QTQMLCOMPILERGLOBAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/private/qglobal_p.h> +#include <qtqmlcompilerglobal.h> + +#define Q_QMLCOMPILER_PRIVATE_EXPORT Q_QMLCOMPILER_EXPORT + +#endif // QTQMLCOMPILERGLOBAL_P_H |