From bc84dd0b85c5067a75c7a7b6c30527c08a4844bb Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 13 Jul 2016 11:27:28 +0200 Subject: Make generated code loading constants relocatable On 32-bit architectures we were encoding the absolute address of generated constants in memory into the load instruction. In order to make the code reloctable, this patch changes the JIT over to use the constant table in the compilation unit. This means two additional loads per constant. On architectures that support instruction pointer relative addressing, we can try to fix this in the future (arm32 for example). Change-Id: I8ed7aa7c67711696d6c46c72b3b642d610ff2cbc Reviewed-by: Erik Verbruggen --- src/qml/compiler/qv4compiler.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/qml/compiler/qv4compiler.cpp') diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index 8503317430..924f2e15e2 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -43,6 +43,7 @@ #include #include #include +#include QV4::Compiler::StringTableGenerator::StringTableGenerator() { @@ -378,6 +379,9 @@ QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Comp nextOffset += unit.regexpTableSize * sizeof(CompiledData::RegExp); unit.constantTableSize = constants.size(); + + // Ensure we load constants from well-aligned addresses into for example SSE registers. + nextOffset = static_cast(WTF::roundUpToMultipleOf(16, nextOffset)); unit.offsetToConstantTable = nextOffset; nextOffset += unit.constantTableSize * sizeof(ReturnedValue); -- cgit v1.2.3