aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-12-16 16:45:36 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-18 16:35:58 +0000
commit68c3a6128469c435810e319411cceb72992ac6b5 (patch)
tree997f0a1d72032185b4a98585d6838911c826f944 /src/qml
parent5b69e17405df7d903dd7da9b506cbba74de14147 (diff)
JIT: When making memory writable, include the exception handler
makeWritable() rounds the memory down to the next page boundary. Usually we include the exception handler this way, unless the offset from the page boundary is less than the exception handler size. Make it explicit that we do want the exception handler to be writable, too. Fixes: QTBUG-89513 Change-Id: I2fb8fb0e1dcc3450b036924463dc1b40d2020c46 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 86a595b126bc6794380dc00af80ec4802f7d058c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsruntime/qv4executableallocator.cpp14
-rw-r--r--src/qml/jsruntime/qv4executableallocator_p.h10
-rw-r--r--src/qml/jsruntime/qv4functiontable_win64.cpp4
3 files changed, 22 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp
index 7ee6f39aa2..c06773d3c5 100644
--- a/src/qml/jsruntime/qv4executableallocator.cpp
+++ b/src/qml/jsruntime/qv4executableallocator.cpp
@@ -45,12 +45,22 @@
using namespace QV4;
-void *ExecutableAllocator::Allocation::exceptionHandler() const
+void *ExecutableAllocator::Allocation::exceptionHandlerStart() const
{
return reinterpret_cast<void*>(addr);
}
-void *ExecutableAllocator::Allocation::start() const
+size_t ExecutableAllocator::Allocation::exceptionHandlerSize() const
+{
+ return QV4::exceptionHandlerSize();
+}
+
+void *ExecutableAllocator::Allocation::memoryStart() const
+{
+ return reinterpret_cast<void*>(addr);
+}
+
+void *ExecutableAllocator::Allocation::codeStart() const
{
return reinterpret_cast<void*>(addr + exceptionHandlerSize());
}
diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h
index f98f2c7d33..4735fb151f 100644
--- a/src/qml/jsruntime/qv4executableallocator_p.h
+++ b/src/qml/jsruntime/qv4executableallocator_p.h
@@ -86,8 +86,14 @@ public:
, free(true)
{}
- void *exceptionHandler() const;
- void *start() const;
+ void *memoryStart() const;
+ size_t memorySize() const { return size; }
+
+ void *exceptionHandlerStart() const;
+ size_t exceptionHandlerSize() const;
+
+ void *codeStart() const;
+
void invalidate() { addr = 0; }
bool isValid() const { return addr != 0; }
void deallocate(ExecutableAllocator *allocator);
diff --git a/src/qml/jsruntime/qv4functiontable_win64.cpp b/src/qml/jsruntime/qv4functiontable_win64.cpp
index fc13dc2602..0cb98641cd 100644
--- a/src/qml/jsruntime/qv4functiontable_win64.cpp
+++ b/src/qml/jsruntime/qv4functiontable_win64.cpp
@@ -106,7 +106,7 @@ struct ExceptionHandlerRecord
void generateFunctionTable(Function *, JSC::MacroAssemblerCodeRef *codeRef)
{
ExceptionHandlerRecord *record = reinterpret_cast<ExceptionHandlerRecord *>(
- codeRef->executableMemory()->exceptionHandler());
+ codeRef->executableMemory()->exceptionHandlerStart());
record->info.Version = 1;
record->info.Flags = 0;
@@ -136,7 +136,7 @@ void generateFunctionTable(Function *, JSC::MacroAssemblerCodeRef *codeRef)
void destroyFunctionTable(Function *, JSC::MacroAssemblerCodeRef *codeRef)
{
ExceptionHandlerRecord *record = reinterpret_cast<ExceptionHandlerRecord *>(
- codeRef->executableMemory()->exceptionHandler());
+ codeRef->executableMemory()->exceptionHandlerStart());
if (!RtlDeleteFunctionTable(&record->handler)) {
const unsigned int errorCode = GetLastError();
qWarning() << "Failed to remove win64 unwind hook. Error code:" << errorCode;