[Tarantool-patches] [PATCH luajit] ARM64: Fix exit stub patching.

Igor Munkin imun at tarantool.org
Thu Aug 19 11:24:01 MSK 2021


I've checked the patch into tarantool branch in tarantool/luajit and
bumped a new version in master.

On 18.08.21, Igor Munkin wrote:
> From: Mike Pall <mike>
> 
> Contributed by Javier Guerra Giraldez.
> 
> (cherry picked from commit 9da06535092d6d9dec442641a26c64bce5574322)
> 
> When the side trace is assembled, it is linked to its parent trace. For
> this purpose, JIT runs through the parent trace mcode and updates jump
> instruction targeted to the corresponding exitno. Prior to this patch,
> these instructions were patched unconditionally, that leads to errors if
> the jump target address is out of the value ranges specified in ARM64
> references[1][2][3][4][5][6].
> 
> As a result of the patch <lj_asm_patchexit> considers value ranges of
> the jump targets and updates directly only those instructions fitting
> the particular jump range. Moreover, the corresponding jump in the pad
> leading to <lj_vm_exit_handler> is also patched, so those instructions,
> that are not updated before, targets to the linked side trace too.
> 
> Additionaly, there is some refactoring of jump targets assembling in
> scope of this patch.
> 
> Igor Munkin:
> * added the description and the test for the problem
> 
> [1]: https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/B
> [2]: https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/B-cond
> [3]: https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/CBZ
> [4]: https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/CBNZ
> [5]: https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/TBZ
> [6]: https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/TBNZ
> 
> Resoves tarantool/tarantool#6098
> Part of tarantool/tarantool#5629
> 
> Signed-off-by: Igor Munkin <imun at tarantool.org>
> ---
> 
> Issue: https://github.com/tarantool/tarantool/issues/6098
> Branch: https://github.com/tarantool/luajit/tree/imun/gh-6098-fix-luajit-tests-suite-failures
> CI: https://github.com/tarantool/tarantool/commit/67f92d2
> Related PR in LuaJIT repo: https://github.com/LuaJIT/LuaJIT/pull/429
> 
>  src/lj_asm_arm64.h                            |  64 +++++----
>  src/lj_emit_arm64.h                           |  18 +--
>  src/lj_target_arm64.h                         |   7 +-
>  test/tarantool-tests/CMakeLists.txt           |   1 +
>  ...8-fix-side-exit-patching-on-arm64.test.lua | 129 ++++++++++++++++++
>  .../CMakeLists.txt                            |   1 +
>  .../libproxy.c                                |  23 ++++
>  7 files changed, 205 insertions(+), 38 deletions(-)
>  create mode 100644 test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64.test.lua
>  create mode 100644 test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt
>  create mode 100644 test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/libproxy.c
> 

<snipped>

> -- 
> 2.25.0
> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list