diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-24 14:46:45 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-28 13:18:48 +0000 |
commit | 7f0bb07631648ffbe70b92c42fb10e04280d95bd (patch) | |
tree | 02cdb455458fd80cbd80bf8de6f04e68ba20e2af /src/qml/compiler/qv4bytecodegenerator.cpp | |
parent | 062dd5c38379e660c75092260e94d3c5a103ae17 (diff) |
Get rid of the separate vector of Jumps
Instead add it to the unencoded instruction vector
Change-Id: I7e88d808bb94f75aecdf9d3ed9bace2055c1da5d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4bytecodegenerator.cpp')
-rw-r--r-- | src/qml/compiler/qv4bytecodegenerator.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/qml/compiler/qv4bytecodegenerator.cpp b/src/qml/compiler/qv4bytecodegenerator.cpp index 1d4e91bdf6..8c0f809a28 100644 --- a/src/qml/compiler/qv4bytecodegenerator.cpp +++ b/src/qml/compiler/qv4bytecodegenerator.cpp @@ -90,14 +90,17 @@ void BytecodeGenerator::finalize(Compiler::Context *context) // resolve jumps // qDebug() << "resolving jumps"; - for (const auto &j : jumps) { - Q_ASSERT(j.linkedLabel != -1); - int linkedInstruction = labels.at(j.linkedLabel); + for (int index = 0; index < instructions.size(); ++index) { + const auto &i = instructions.at(index); + if (i.offsetForJump == -1) // no jump + continue; + Q_ASSERT(i.linkedLabel != -1); + int linkedInstruction = labels.at(i.linkedLabel); Q_ASSERT(linkedInstruction != -1); - int offset = instructionOffsets.at(j.instructionIndex) + j.offset; + int offset = instructionOffsets.at(index) + i.offsetForJump; // qDebug() << "offset data is at" << offset; char *c = code.data() + offset; - int linkedInstructionOffset = instructionOffsets.at(linkedInstruction) - instructionOffsets.at(j.instructionIndex + 1); + int linkedInstructionOffset = instructionOffsets.at(linkedInstruction) - instructionOffsets.at(index + 1); // qDebug() << "linked instruction" << linkedInstruction << "at " << instructionOffsets.at(linkedInstruction); memcpy(c, &linkedInstructionOffset, sizeof(int)); } |