From d4ff8bd1ec92ea5258c9914995072c910e0f6140 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 24 Oct 2013 08:54:03 +0200 Subject: Remove qv4unwindhelper class This class is not required anymore to generate stack traces, as we now store the required information in the JS context stack. Change-Id: I3893c805ca89dda70efde07fdd120e7dfaf3639f Reviewed-by: Simon Hausmann --- src/qml/compiler/qv4compileddata.cpp | 1 - src/qml/compiler/qv4isel_masm.cpp | 14 -- src/qml/jsruntime/jsruntime.pri | 4 - src/qml/jsruntime/qv4engine.cpp | 1 - src/qml/jsruntime/qv4engine_p.h | 1 - src/qml/jsruntime/qv4executableallocator.cpp | 1 - src/qml/jsruntime/qv4executableallocator_p.h | 8 - src/qml/jsruntime/qv4function.cpp | 1 - src/qml/jsruntime/qv4unwindhelper.cpp | 82 ---------- src/qml/jsruntime/qv4unwindhelper_arm_p.h | 234 --------------------------- src/qml/jsruntime/qv4unwindhelper_dw2_p.h | 191 ---------------------- src/qml/jsruntime/qv4unwindhelper_p.h | 72 --------- 12 files changed, 610 deletions(-) delete mode 100644 src/qml/jsruntime/qv4unwindhelper.cpp delete mode 100644 src/qml/jsruntime/qv4unwindhelper_arm_p.h delete mode 100644 src/qml/jsruntime/qv4unwindhelper_dw2_p.h delete mode 100644 src/qml/jsruntime/qv4unwindhelper_p.h (limited to 'src/qml') diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index b485dcc240..0f5c1857c8 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index 09fcbfd946..461f028c99 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -44,7 +44,6 @@ #include "qv4object_p.h" #include "qv4functionobject_p.h" #include "qv4regexpobject_p.h" -#include "qv4unwindhelper_p.h" #include "qv4lookup_p.h" #include "qv4function_p.h" #include "qv4ssa_p.h" @@ -70,7 +69,6 @@ CompilationUnit::~CompilationUnit() { foreach (Function *f, runtimeFunctions) engine->allFunctions.remove(reinterpret_cast(f->codePtr)); - UnwindHelper::deregisterFunctions(runtimeFunctions); } void CompilationUnit::linkBackendToEngine(ExecutionEngine *engine) @@ -86,8 +84,6 @@ void CompilationUnit::linkBackendToEngine(ExecutionEngine *engine) runtimeFunctions[i] = runtimeFunction; } - UnwindHelper::registerFunctions(runtimeFunctions); - foreach (Function *f, runtimeFunctions) engine->allFunctions.insert(reinterpret_cast(f->codePtr), f); } @@ -201,8 +197,6 @@ static const Assembler::RegisterID calleeSavedRegisters[] = { #if CPU(ARM) static const Assembler::RegisterID calleeSavedRegisters[] = { // ### FIXME: remove unused registers. - // Keep these in reverse order and make sure to also edit the unwind program in - // qv4unwindhelper_arm_p.h when changing this list. JSC::ARMRegisters::r12, JSC::ARMRegisters::r10, JSC::ARMRegisters::r9, @@ -519,11 +513,6 @@ void Assembler::recordLineNumber(int lineNumber) JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize) { Label endOfCode = label(); -#if defined(Q_PROCESSOR_ARM) && !defined(Q_OS_IOS) - // Let the ARM exception table follow right after that - for (int i = 0, nops = UnwindHelper::unwindInfoSize() / 2; i < nops; ++i) - nop(); -#endif { QHashIterator > it(_patches); @@ -575,9 +564,6 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize) _constTable.finalize(linkBuffer, _isel); *codeSize = linkBuffer.offsetOf(endOfCode); -#if defined(Q_PROCESSOR_ARM) && !defined(Q_OS_IOS) - UnwindHelper::writeARMUnwindInfo(linkBuffer.debugAddress(), *codeSize); -#endif JSC::MacroAssemblerCodeRef codeRef; diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri index 6310c27988..883205e92e 100644 --- a/src/qml/jsruntime/jsruntime.pri +++ b/src/qml/jsruntime/jsruntime.pri @@ -37,7 +37,6 @@ SOURCES += \ $$PWD/qv4string.cpp \ $$PWD/qv4objectiterator.cpp \ $$PWD/qv4regexp.cpp \ - $$PWD/qv4unwindhelper.cpp \ $$PWD/qv4serialize.cpp \ $$PWD/qv4script.cpp \ $$PWD/qv4executableallocator.cpp \ @@ -83,9 +82,6 @@ HEADERS += \ $$PWD/qv4property_p.h \ $$PWD/qv4objectiterator_p.h \ $$PWD/qv4regexp_p.h \ - $$PWD/qv4unwindhelper_p.h \ - $$PWD/qv4unwindhelper_dw2_p.h \ - $$PWD/qv4unwindhelper_arm_p.h \ $$PWD/qv4serialize_p.h \ $$PWD/qv4script_p.h \ $$PWD/qv4scopedvalue_p.h \ diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 4e7beb51c1..3b5b1f3ff9 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -60,7 +60,6 @@ #include #include #include -#include #include "qv4debugging_p.h" #include "qv4executableallocator_p.h" #include "qv4sequenceobject_p.h" diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 595f637572..b49964a669 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -85,7 +85,6 @@ struct ArgumentsObject; struct ExecutionContext; struct ExecutionEngine; class MemoryManager; -class UnwindHelper; class ExecutableAllocator; struct ObjectPrototype; diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp index e539d62d54..9b31524614 100644 --- a/src/qml/jsruntime/qv4executableallocator.cpp +++ b/src/qml/jsruntime/qv4executableallocator.cpp @@ -121,7 +121,6 @@ bool ExecutableAllocator::Allocation::mergePrevious(ExecutableAllocator *allocat ExecutableAllocator::ChunkOfPages::~ChunkOfPages() { - delete unwindInfo; Allocation *alloc = firstAllocation; while (alloc) { Allocation *next = alloc->next; diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h index b4fb2fb0e5..8ce1146ac9 100644 --- a/src/qml/jsruntime/qv4executableallocator_p.h +++ b/src/qml/jsruntime/qv4executableallocator_p.h @@ -105,24 +105,16 @@ public: int freeAllocationCount() const { return freeAllocations.count(); } int chunkCount() const { return chunks.count(); } - // Used to store CIE+FDE on x86/x86-64. - struct PlatformUnwindInfo - { - virtual ~PlatformUnwindInfo() {} - }; - struct ChunkOfPages { ChunkOfPages() : pages(0) , firstAllocation(0) - , unwindInfo(0) {} ~ChunkOfPages(); WTF::PageAllocation *pages; Allocation *firstAllocation; - PlatformUnwindInfo *unwindInfo; bool contains(Allocation *alloc) const; }; diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index 291d7cc033..d660457aa6 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -45,7 +45,6 @@ #include "qv4value_p.h" #include "qv4engine_p.h" #include "qv4lookup_p.h" -#include "qv4unwindhelper_p.h" QT_BEGIN_NAMESPACE diff --git a/src/qml/jsruntime/qv4unwindhelper.cpp b/src/qml/jsruntime/qv4unwindhelper.cpp deleted file mode 100644 index 47266c892c..0000000000 --- a/src/qml/jsruntime/qv4unwindhelper.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include - -#if CPU(X86_64) && (OS(LINUX) || OS(MAC_OS_X)) -# define USE_DW2_HELPER -#elif CPU(X86) && COMPILER(GCC) -# define USE_DW2_HELPER -#elif CPU(ARM) && (OS(LINUX) || OS(QNX)) -# define USE_ARM_HELPER -#elif OS(WINDOWS) - // SJLJ will unwind on Windows -# define USE_NULL_HELPER -#elif OS(IOS) - // SJLJ will unwind on iOS -# define USE_NULL_HELPER -#else -# warning "Unsupported/untested platform!" -# define USE_NULL_HELPER -#endif - -#ifdef USE_DW2_HELPER -# include -#endif // USE_DW2_HELPER - -#ifdef USE_ARM_HELPER -# include -#endif // USE_ARM_HELPER - -QT_BEGIN_NAMESPACE - -#ifdef USE_NULL_HELPER -using namespace QV4; -void UnwindHelper::prepareForUnwind(ExecutionContext *) {} -void UnwindHelper::registerFunction(Function *function) {Q_UNUSED(function);} -void UnwindHelper::registerFunctions(const QVector &functions) {Q_UNUSED(functions);} -void UnwindHelper::deregisterFunction(Function *function) {Q_UNUSED(function);} -void UnwindHelper::deregisterFunctions(const QVector &functions) {Q_UNUSED(functions);} -#endif // USE_NULL_HELPER - -QT_END_NAMESPACE diff --git a/src/qml/jsruntime/qv4unwindhelper_arm_p.h b/src/qml/jsruntime/qv4unwindhelper_arm_p.h deleted file mode 100644 index e15dbb0f2b..0000000000 --- a/src/qml/jsruntime/qv4unwindhelper_arm_p.h +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QV4UNWINDHELPER_ARM_P_H -#define QV4UNWINDHELPER_ARM_P_H - -#include "qv4unwindhelper_p.h" -#include "qv4functionobject_p.h" -#include "qv4function_p.h" -#include - -#include -#include - -#define __USE_GNU -#include - -#if USE(LIBUNWIND_DEBUG) -#include -#include -#endif - -QT_BEGIN_NAMESPACE - -namespace QV4 { - -static void *removeThumbBit(void *addr) -{ - return reinterpret_cast(reinterpret_cast(addr) & ~1u); -} - -static QMutex functionProtector; -static QMap allFunctions; - -static Function *lookupFunction(void *pc) -{ - quintptr key = reinterpret_cast(pc); - QMap::Iterator it = allFunctions.lowerBound(key); - if (it != allFunctions.begin() && allFunctions.count() > 0) - --it; - if (it == allFunctions.end()) - return 0; - - quintptr codeStart = reinterpret_cast(removeThumbBit((void*)(*it)->codePtr)); - if (key < codeStart || key >= codeStart + (*it)->codeSize) - return 0; - return *it; -} - - -/* Program: -vsp = r4 (REG_TO_SP r4) -vsp -= 8 * 4 -- > vsp = vsp - (7 << 2) - 4 -pop r12, r10, r9, r8, r7, r6, r5, r4 -pop r4 -pop lr -pop r0, r1, r2, r3 -*/ - -#define REG_TO_SP ((unsigned int) 0b10010000) -#define VSP_MINUS ((unsigned int) 0b01000000) -#define POP_REG_MULTI ((unsigned int) 0b10000000) -#define POP_R4_MULTI ((unsigned int) 0b10100000) -#define POP_R4_R14_MULTI ((unsigned int) 0b10101000) -#define POP_R0_TO_R3 ((unsigned int) 0b10110001) -#define FINISH ((unsigned int) 0b10110000) - -#define MK_UW_WORD(first, second, third, fourth) \ - (((first) << 24) | \ - ((second) << 16) | \ - ((third) << 8) | \ - (fourth)) - -static unsigned int extbl[] = { - MK_UW_WORD(0x80 | // High bit set to indicate that this isn't a PREL31 - 2, // Choose personality routine #2 - 2, // Number of 4 byte words used to encode remaining unwind instructions - REG_TO_SP | 4, // Encoded program from above. - VSP_MINUS | 7), - MK_UW_WORD(POP_REG_MULTI | 1, 0b01111111, - POP_R4_R14_MULTI, - POP_R0_TO_R3), - MK_UW_WORD(0b00001111, - FINISH, - FINISH, - FINISH), - 0 // no additional entries -}; - -static unsigned write_prel31(unsigned *addr, void *ptr) -{ - int delta = (char *)ptr - (char*)addr; - if (delta < 0) - delta |= (1 << 30); - else - delta &= ~(1 << 30); - *addr = ((unsigned)delta) & 0x7fffffffU; -} - -void UnwindHelper::deregisterFunction(Function *function) -{ - QMutexLocker locker(&functionProtector); - allFunctions.remove(reinterpret_cast(function->codePtr)); -} - -void UnwindHelper::deregisterFunctions(const QVector &functions) -{ - QMutexLocker locker(&functionProtector); - foreach (Function *f, functions) - allFunctions.remove(reinterpret_cast(f->codePtr)); -} - -void UnwindHelper::registerFunction(Function *function) -{ - QMutexLocker locker(&functionProtector); - allFunctions.insert(reinterpret_cast(function->codePtr), function); -} - -void UnwindHelper::registerFunctions(const QVector &functions) -{ - QMutexLocker locker(&functionProtector); - foreach (Function *f, functions) - allFunctions.insert(reinterpret_cast(f->codePtr), f); -} - -void UnwindHelper::prepareForUnwind(ExecutionContext *) -{ -} - -int UnwindHelper::unwindInfoSize() -{ - return 2 * sizeof(unsigned int) // 2 extbl entries - + sizeof(extbl); -} - -void UnwindHelper::writeARMUnwindInfo(void *codeAddr, int codeSize) -{ - unsigned int *exidx = (unsigned int *)((char *)codeAddr + codeSize); - - unsigned char *exprog = (unsigned char *)((unsigned char *)codeAddr + codeSize + 8); - - write_prel31(exidx, codeAddr); - exidx[1] = 4; // PREL31 offset to extbl, which follows right afterwards - - memcpy(exprog, extbl, sizeof(extbl)); - -#if USE(LIBUNWIND_DEBUG) - unw_dyn_info_t *info = (unw_dyn_info_t*)malloc(sizeof(unw_dyn_info_t)); - info->start_ip = (unw_word_t)codeAddr; - info->end_ip = info->start_ip + codeSize; - info->gp = 0; - info->format = UNW_INFO_FORMAT_ARM_EXIDX; - info->u.rti.name_ptr = 0; - info->u.rti.segbase = 0; - info->u.rti.table_len = 8; - info->u.rti.table_data = (unw_word_t)exidx; - _U_dyn_register(info); -#endif -} - -} - -QT_END_NAMESPACE - -#if defined(Q_OS_ANDROID) -extern "C" void *dl_unwind_find_exidx(void *pc, int *entryCount); -#endif - -extern "C" Q_DECL_EXPORT void *__gnu_Unwind_Find_exidx(void *pc, int *entryCount) -{ -#if !defined(Q_OS_ANDROID) - typedef void *(*Old_Unwind_Find_exidx)(void*, int*); - static Old_Unwind_Find_exidx oldFunction = 0; - if (!oldFunction) - oldFunction = (Old_Unwind_Find_exidx)dlsym(RTLD_NEXT, "__gnu_Unwind_Find_exidx"); -#endif - - { - QMutexLocker locker(&QT_PREPEND_NAMESPACE(QV4::functionProtector)); - QV4::Function *function = QT_PREPEND_NAMESPACE(QV4::lookupFunction(pc)); - if (function) { - *entryCount = 1; - void * codeStart = QT_PREPEND_NAMESPACE(QV4::removeThumbBit((void*)function->codePtr)); - // At the end of the function we store our synthetic exception table entry. - return (char *)codeStart + function->codeSize; - } - } - -#if defined(Q_OS_ANDROID) - return dl_unwind_find_exidx(pc, entryCount); -#else - return oldFunction(pc, entryCount); -#endif -} - -#endif // QV4UNWINDHELPER_PDW2_H diff --git a/src/qml/jsruntime/qv4unwindhelper_dw2_p.h b/src/qml/jsruntime/qv4unwindhelper_dw2_p.h deleted file mode 100644 index 03533ba526..0000000000 --- a/src/qml/jsruntime/qv4unwindhelper_dw2_p.h +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QV4UNWINDHELPER_PDW2_H -#define QV4UNWINDHELPER_PDW2_H - -#include "qv4unwindhelper_p.h" -#include "qv4functionobject_p.h" -#include "qv4function_p.h" -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QV4 { - -namespace { -#if CPU(X86_64) -// Generated by fdegen -static const unsigned char cie_fde_data[] = { - 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x1, 0x0, 0x8, 0x78, 0x10, 0xc, 0x7, 0x8, - 0x90, 0x1, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, - 0x18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x41, 0x13, 0x7e, 0x86, - 0x2, 0x43, 0xd, 0x6, 0x8c, 0x3, 0x8e, 0x4, - 0x0, 0x0, 0x0, 0x0 -}; -static const int fde_offset = 20; -static const int initial_location_offset = 28; -static const int address_range_offset = 36; -#elif CPU(X86) -static const unsigned char cie_fde_data[] = { - 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x1, 0x0, 0x4, 0x7c, 0x8, 0xc, 0x4, 0x4, - 0x88, 0x1, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, - 0x18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x41, 0x13, 0x7e, 0x85, - 0x2, 0x43, 0xd, 0x5, 0x86, 0x3, 0x87, 0x4, - 0x0, 0x0, 0x0, 0x0, -}; -static const int fde_offset = 20; -static const int initial_location_offset = 28; -static const int address_range_offset = 32; -#endif - -void writeIntPtrValue(unsigned char *addr, qintptr val) -{ - addr[0] = (val >> 0) & 0xff; - addr[1] = (val >> 8) & 0xff; - addr[2] = (val >> 16) & 0xff; - addr[3] = (val >> 24) & 0xff; -#if QT_POINTER_SIZE == 8 - addr[4] = (val >> 32) & 0xff; - addr[5] = (val >> 40) & 0xff; - addr[6] = (val >> 48) & 0xff; - addr[7] = (val >> 56) & 0xff; -#endif -} -} // anonymous namespace - -extern "C" void __register_frame(void *fde); -extern "C" void __deregister_frame(void *fde); - -struct UnwindInfo : public ExecutableAllocator::PlatformUnwindInfo -{ - UnwindInfo(const QByteArray &cieFde); - virtual ~UnwindInfo(); - QByteArray data; -}; - -UnwindInfo::UnwindInfo(const QByteArray &cieFde) - : data(cieFde) -{ - __register_frame(data.data() + fde_offset); -} - -UnwindInfo::~UnwindInfo() -{ - __deregister_frame(data.data() + fde_offset); -} - -static void ensureUnwindInfo(Function *f) -{ - if (!f->codePtr) - return; // Not a JIT generated function - - ExecutableAllocator::ChunkOfPages *chunk = f->compilationUnit->chunkForFunction(f->compiledFunction->index); - if (!chunk) - return; - - // Already registered? - if (chunk->unwindInfo) - return; - - QByteArray info; - info.resize(sizeof(cie_fde_data)); - - unsigned char *cie_and_fde = reinterpret_cast(info.data()); - memcpy(cie_and_fde, cie_fde_data, sizeof(cie_fde_data)); - - qintptr ptr = static_cast(chunk->pages->base()) - static_cast(0); - writeIntPtrValue(cie_and_fde + initial_location_offset, ptr); - - writeIntPtrValue(cie_and_fde + address_range_offset, chunk->pages->size()); - - chunk->unwindInfo = new UnwindInfo(info); -} - -void UnwindHelper::prepareForUnwind(ExecutionContext *context) -{ - for (ExecutionContext *ctx = context; ctx; ctx = ctx->parent) { - if (CallContext *callCtx = ctx->asCallContext()) - if (FunctionObject *fobj = callCtx->function) - if (Function *fun = fobj->function) - ensureUnwindInfo(fun); - for (ExecutionContext::EvalCode *code = ctx->currentEvalCode; - code; code = code->next) - ensureUnwindInfo(code->function); - } - - if (context->engine->globalCode) - ensureUnwindInfo(context->engine->globalCode); -} - -void UnwindHelper::registerFunction(Function *) -{ -} - -void UnwindHelper::registerFunctions(const QVector&) -{ -} - -void UnwindHelper::deregisterFunction(Function *) -{ -} - -void UnwindHelper::deregisterFunctions(const QVector &) -{ -} - -} - -QT_END_NAMESPACE - -#endif // QV4UNWINDHELPER_PDW2_H diff --git a/src/qml/jsruntime/qv4unwindhelper_p.h b/src/qml/jsruntime/qv4unwindhelper_p.h deleted file mode 100644 index 9ef564449a..0000000000 --- a/src/qml/jsruntime/qv4unwindhelper_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QV4UNWINDHELPER_H -#define QV4UNWINDHELPER_H - -#include - -QT_BEGIN_NAMESPACE - -namespace QV4 { - -struct Function; -struct ExecutionContext; - -class UnwindHelper -{ -public: - static void prepareForUnwind(ExecutionContext *ctx); - static void registerFunction(Function *function); - static void registerFunctions(const QVector &functions); - static void deregisterFunction(Function *function); - static void deregisterFunctions(const QVector &functions); -#ifdef Q_PROCESSOR_ARM - static int unwindInfoSize(); - static void writeARMUnwindInfo(void *codeAddr, int codeSize); -#endif -}; - -} - -QT_END_NAMESPACE - -#endif // QV4UNWINDHELPER_H -- cgit v1.2.3