Drop some dead bootstrap code
The dependencies are only hashed if a dependencyHasher is given. This is generally not the case when compiling ahead of time. There is also no need to hide the declaration of DependentTypesHasher from the bootstrap code. Change-Id: I0ea74c3079656ce1fe353956999820916c8ff626 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
12829b50fc
commit
ae8c798a0a
|
@ -48,12 +48,6 @@
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#ifndef V4_BOOTSTRAP
|
|
||||||
#include <private/qqmlglobal_p.h>
|
|
||||||
#include <private/qqmltypeloader_p.h>
|
|
||||||
#include <private/qqmlengine_p.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONST
|
#ifdef CONST
|
||||||
#undef CONST
|
#undef CONST
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,11 +55,6 @@
|
||||||
QT_USE_NAMESPACE
|
QT_USE_NAMESPACE
|
||||||
|
|
||||||
static const quint32 emptyStringIndex = 0;
|
static const quint32 emptyStringIndex = 0;
|
||||||
|
|
||||||
#if 0 //ndef V4_BOOTSTRAP
|
|
||||||
DEFINE_BOOL_CONFIG_OPTION(lookupHints, QML_LOOKUP_HINTS);
|
|
||||||
#endif // V4_BOOTSTRAP
|
|
||||||
|
|
||||||
using namespace QmlIR;
|
using namespace QmlIR;
|
||||||
|
|
||||||
#define COMPILE_EXCEPTION(location, desc) \
|
#define COMPILE_EXCEPTION(location, desc) \
|
||||||
|
@ -1586,18 +1575,14 @@ void QmlUnitGenerator::generate(Document &output, const QV4::CompiledData::Depen
|
||||||
// definitely not suitable for StaticData access.
|
// definitely not suitable for StaticData access.
|
||||||
createdUnit->flags &= ~QV4::CompiledData::Unit::StaticData;
|
createdUnit->flags &= ~QV4::CompiledData::Unit::StaticData;
|
||||||
|
|
||||||
#ifndef V4_BOOTSTRAP
|
|
||||||
if (dependencyHasher) {
|
if (dependencyHasher) {
|
||||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
const QByteArray checksum = dependencyHasher();
|
||||||
if (dependencyHasher(&hash)) {
|
if (checksum.size() == sizeof(createdUnit->dependencyMD5Checksum)) {
|
||||||
QByteArray checksum = hash.result();
|
memcpy(createdUnit->dependencyMD5Checksum, checksum.constData(),
|
||||||
Q_ASSERT(checksum.size() == sizeof(createdUnit->dependencyMD5Checksum));
|
sizeof(createdUnit->dependencyMD5Checksum));
|
||||||
memcpy(createdUnit->dependencyMD5Checksum, checksum.constData(), sizeof(createdUnit->dependencyMD5Checksum));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
Q_UNUSED(dependencyHasher);
|
|
||||||
#endif
|
|
||||||
createdUnit->sourceFileIndex = output.jsGenerator.stringTable.getStringId(output.jsModule.fileName);
|
createdUnit->sourceFileIndex = output.jsGenerator.stringTable.getStringId(output.jsModule.fileName);
|
||||||
createdUnit->finalUrlIndex = output.jsGenerator.stringTable.getStringId(output.jsModule.finalUrl);
|
createdUnit->finalUrlIndex = output.jsGenerator.stringTable.getStringId(output.jsModule.finalUrl);
|
||||||
|
|
||||||
|
|
|
@ -425,13 +425,10 @@ bool CompilationUnit::verifyChecksum(const DependentTypesHasher &dependencyHashe
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
const QByteArray checksum = dependencyHasher();
|
||||||
if (!dependencyHasher(&hash))
|
return checksum.size() == sizeof(data->dependencyMD5Checksum)
|
||||||
return false;
|
&& memcmp(data->dependencyMD5Checksum, checksum.constData(),
|
||||||
QByteArray checksum = hash.result();
|
sizeof(data->dependencyMD5Checksum)) == 0;
|
||||||
Q_ASSERT(checksum.size() == sizeof(data->dependencyMD5Checksum));
|
|
||||||
return memcmp(data->dependencyMD5Checksum, checksum.constData(),
|
|
||||||
sizeof(data->dependencyMD5Checksum)) == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CompilationUnit::moduleRequests() const
|
QStringList CompilationUnit::moduleRequests() const
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
|
#include <QtCore/qcryptographichash.h>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
@ -1057,12 +1058,10 @@ struct ResolvedTypeReferenceMap: public QMap<int, ResolvedTypeReference*>
|
||||||
{
|
{
|
||||||
bool addToHash(QCryptographicHash *hash, QQmlEngine *engine) const;
|
bool addToHash(QCryptographicHash *hash, QQmlEngine *engine) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
using DependentTypesHasher = std::function<bool(QCryptographicHash *)>;
|
|
||||||
#else
|
|
||||||
struct DependentTypesHasher {};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using DependentTypesHasher = std::function<QByteArray()>;
|
||||||
|
|
||||||
// index is per-object binding index
|
// index is per-object binding index
|
||||||
typedef QVector<QQmlPropertyData*> BindingPropertyData;
|
typedef QVector<QQmlPropertyData*> BindingPropertyData;
|
||||||
|
|
||||||
|
|
|
@ -2357,10 +2357,12 @@ void QQmlTypeData::done()
|
||||||
|
|
||||||
QQmlEngine *const engine = typeLoader()->engine();
|
QQmlEngine *const engine = typeLoader()->engine();
|
||||||
|
|
||||||
const auto dependencyHasher = [engine, &resolvedTypeCache, this](QCryptographicHash *hash) {
|
const auto dependencyHasher = [engine, &resolvedTypeCache, this]() {
|
||||||
if (!resolvedTypeCache.addToHash(hash, engine))
|
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||||
return false;
|
return (resolvedTypeCache.addToHash(&hash, engine)
|
||||||
return ::addTypeReferenceChecksumsToHash(m_compositeSingletons, hash, engine);
|
&& ::addTypeReferenceChecksumsToHash(m_compositeSingletons, &hash, engine))
|
||||||
|
? hash.result()
|
||||||
|
: QByteArray();
|
||||||
};
|
};
|
||||||
|
|
||||||
// verify if any dependencies changed if we're using a cache
|
// verify if any dependencies changed if we're using a cache
|
||||||
|
|
Loading…
Reference in New Issue