diff options
| author | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-08-20 12:20:28 +0200 |
|---|---|---|
| committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-08-20 11:50:15 +0000 |
| commit | e47bd1fc0e6fc2b2e3ca82c48ccb2f8f7dd5ee92 (patch) | |
| tree | a5c98155ca381ebee6fe4f7c455f9b3dac73c604 /src/qml/compiler/qv4bytecodehandler.cpp | |
| parent | 87a4d4babe0a3d6b8a57048205eccc7105931474 (diff) | |
V4: clarify current vs. next instruction offset in ByteCodeHandler
When executing an interpreter instruction, the code pointer points to
the next instruction. However, sometimes a pointer to the current
instruction is needed. That was hacked-around by having startInstruction
be called before updating the pointer. This is confusing and leads to
unexpected off-by-one-instruction cases.
So now during startInstruction calls and generate_instructionName calls,
there is a currentInstructionOffset() and a nextInstructionOffset() that
do what's on the tin in both places.
Change-Id: Ie8dd35ff0a7d236f008030ef4c29ec3f31c07349
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4bytecodehandler.cpp')
| -rw-r--r-- | src/qml/compiler/qv4bytecodehandler.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4bytecodehandler.cpp b/src/qml/compiler/qv4bytecodehandler.cpp index d3c5582b28..e2533a0505 100644 --- a/src/qml/compiler/qv4bytecodehandler.cpp +++ b/src/qml/compiler/qv4bytecodehandler.cpp @@ -56,8 +56,9 @@ ByteCodeHandler::~ByteCodeHandler() { \ INSTR_##instr(MOTH_DECODE_WITH_BASE) \ Q_UNUSED(base_ptr); \ + _currentOffset = _nextOffset; \ + _nextOffset = code - start; \ startInstruction(Instr::Type::instr); \ - _offset = code - start; \ INSTR_##instr(DISPATCH) \ endInstruction(Instr::Type::instr); \ continue; \ |
