Fix crash when generating cache files

Make sure that the allocator in bootstrap builds really just allocates
memory for the generated code and otherwise doesn't try to allocate
executable memory.

Change-Id: Ic40724903706ae98ef272a028e7d8299400e232b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Simon Hausmann 2017-02-08 10:25:24 +01:00
parent fd9871095c
commit 7cab0a31de
2 changed files with 8 additions and 2 deletions

View File

@ -107,7 +107,7 @@ struct ExecutableAllocator {
size = size + (iaddr - roundAddr);
addr = reinterpret_cast<void*>(roundAddr);
#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
#if ENABLE(ASSEMBLER_WX_EXCLUSIVE) && !defined(V4_BOOTSTRAP)
# if OS(WINDOWS)
DWORD oldProtect;
# if !OS(WINRT)
@ -140,6 +140,7 @@ struct ExecutableAllocator {
size = size + (iaddr - roundAddr);
addr = reinterpret_cast<void*>(roundAddr);
#if !defined(V4_BOOTSTRAP)
#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
# if OS(WINDOWS)
DWORD oldProtect;
@ -160,6 +161,10 @@ struct ExecutableAllocator {
# endif
#else
# error "Only W^X is supported"
#endif
#else
(void)addr; // suppress unused parameter warning
(void)size; // suppress unused parameter warning
#endif
}

View File

@ -141,7 +141,8 @@ static bool compileQmlFile(const QString &inputFileName, QV4::EvalISelFactory *i
// ### translation binding simplification
QScopedPointer<QV4::EvalInstructionSelection> isel(iselFactory->create(/*engine*/nullptr, /*executable allocator*/nullptr, &irDocument.jsModule, &irDocument.jsGenerator));
QV4::ExecutableAllocator allocator;
QScopedPointer<QV4::EvalInstructionSelection> isel(iselFactory->create(/*engine*/nullptr, &allocator, &irDocument.jsModule, &irDocument.jsGenerator));
// Disable lookups in non-standalone (aka QML) mode
isel->setUseFastLookups(false);
irDocument.javaScriptCompilationUnit = isel->compile(/*generate unit*/false);