[Tarantool-patches] [PATCH luajit 00/19] Prerequisites for improve assertions

Sergey Kaplun skaplun at tarantool.org
Wed Aug 9 18:35:49 MSK 2023


This patch-set contains all commits are necessary to avoid conflicts
during the backporting of 8ae5170c "Improve assertions" [1], that are
caused by outdating from the upstream.

This patch-set:
- includes several new ports (see patches 4-6, 8, 19) -- only
  description is added for such patches.
- fixes some MIPS misbehaviour (1, 3, 17) -- include tests (*), except
  the first one, since it depends on memory mapping.
- fixes non-Linux/macOS build (7)
- backportes patches, that was excluded or partially stripped before (10,
  14, 15)
- includes refactoring (2, 9, 18)
- fixes general bugs (16)
- fixes gcc 7.1 -Wimplicit-fallthrough warnings (11 - 13)

Note: that only patches 3, 16, 17 adds some new tests.
Other patches just provided description, and the patch 13 adds
-Wimplicit-fallthrough for GCC (>= 7.1) builds.

Patches are backported in the free order as far as they are unrelated
to each other.

(*) To run tests for mips64 in qemu:

Compile with the following command:

| make -j -f Makefile.original HOST_CC="gcc " \
|         CROSS=mips64el-unknown-linux-gnu- \
|         CCDEBUG=" -g -ggdb3" CFLAGS=" -O0" \
|         XCFLAGS=" -DLUA_USE_APICHECK -DLUA_USE_ASSERT "

Be avare, that mips64el-unknown-linux-gnu-gcc should provide n64 abi by
default.
Side note: installed on Gentoo with the following command
| crossdev -t mips64el --abis n64 --ex-gdb

And run the corresponding test (-g 7776 to use GDB server on 7776
port):
| LUA_PATH="src/?.lua;test/tarantool-tests/?.lua;test/tarantool-tests/?/init.lua;;" \
| LD_LIBRARY_PATH="/usr/lib/gcc/mips64el-unknown-linux-gnu/13/" \
|   qemu-mips64el  -g 7776 -L /usr/mips64el-unknown-linux-gnu/ \
|     src/luajit -jdump=ta test/tarantool-tests/fix-mips64-spare-side-exit-patching.test.lua

If you want to connect to the running test from multiarch-gdb:
| mips64el-unknown-linux-gnu-gdb src/luajit
| (gdb) target remote 0.0.0.0:7776
| ...
| 0x000000400297fd00 in __start () from /usr/mips64el-unknown-linux-gnu/lib64/ld.so.1
| (gdb) c

[1]: https://github.com/LuaJIT/LuaJIT/commit/8ae5170c

Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-8825-mips-ppc-refactoring
PR: https://github.com/tarantool/tarantool/pull/8969
Related Issues:
* https://github.com/tarantool/tarantool/issues/8825
* https://github.com/LuaJIT/LuaJIT/pull/362
* https://github.com/LuaJIT/LuaJIT/issues/812

Mike Pall (17):
  MIPS: Use precise search for exit jump patching.
  MIPS: Fix handling of spare long-range jump slots.
  MIPS64: Add soft-float support to JIT compiler backend.
  PPC: Add soft-float support to interpreter.
  PPC: Add soft-float support to JIT compiler backend.
  Windows: Add UWP support, part 1.
  FFI: Eliminate hardcoded string hashes.
  Cleanup math function compilation and fix inconsistencies.
  Fix GCC 7 -Wimplicit-fallthrough warnings.
  DynASM: Fix warning.
  ARM: Fix GCC 7 -Wimplicit-fallthrough warnings.
  Fix debug.getinfo() argument check.
  Fix LJ_MAX_JSLOTS assertion in rec_check_slots().
  Prevent integer overflow while parsing long strings.
  MIPS64: Fix register allocation in assembly of HREF.
  DynASM/MIPS: Fix shadowed variable.
  MIPS: Add MIPS64 R6 port.

Sergey Kaplun (2):
  test: introduce mcode generator for tests
  build: fix non-Linux/macOS builds

 cmake/SetDynASMFlags.cmake                    |    5 +
 cmake/SetTargetFlags.cmake                    |    6 +
 doc/ext_ffi_api.html                          |    2 +
 dynasm/dasm_arm.h                             |    2 +
 dynasm/dasm_arm64.h                           |    1 +
 dynasm/dasm_mips.h                            |   14 +-
 dynasm/dasm_mips.lua                          |  629 ++++++---
 dynasm/dasm_ppc.h                             |    1 +
 dynasm/dasm_x86.h                             |   18 +-
 dynasm/dynasm.lua                             |    1 +
 src/Makefile.original                         |    3 +
 src/host/buildvm_asm.c                        |    2 +-
 src/jit/bcsave.lua                            |   84 +-
 src/jit/dis_mips.lua                          |  293 +++-
 src/jit/dis_mips64r6.lua                      |   17 +
 src/jit/dis_mips64r6el.lua                    |   17 +
 src/lib_ffi.c                                 |   36 +-
 src/lib_io.c                                  |    4 +-
 src/lib_misc.c                                |   16 +-
 src/lib_package.c                             |   24 +-
 src/lj_alloc.c                                |    6 +-
 src/lj_arch.h                                 |   80 +-
 src/lj_asm.c                                  |   19 +-
 src/lj_asm_arm.h                              |    4 +-
 src/lj_asm_mips.h                             |  379 ++++-
 src/lj_asm_ppc.h                              |  322 ++++-
 src/lj_ccall.c                                |   38 +-
 src/lj_ccall.h                                |    4 +-
 src/lj_ccallback.c                            |   34 +-
 src/lj_clib.c                                 |   20 +-
 src/lj_cparse.c                               |   87 +-
 src/lj_cparse.h                               |    2 +
 src/lj_crecord.c                              |    4 +-
 src/lj_debug.c                                |   16 +-
 src/lj_emit_mips.h                            |   17 +-
 src/lj_err.c                                  |    1 +
 src/lj_ffrecord.c                             |    2 +-
 src/lj_frame.h                                |    2 +-
 src/lj_ircall.h                               |   45 +-
 src/lj_iropt.h                                |    2 +-
 src/lj_jit.h                                  |   18 +-
 src/lj_lex.c                                  |    2 +-
 src/lj_mcode.c                                |   14 +-
 src/lj_obj.h                                  |    3 +
 src/lj_opt_sink.c                             |    2 +-
 src/lj_opt_split.c                            |    2 +-
 src/lj_parse.c                                |    3 +-
 src/lj_profile_timer.c                        |    8 +-
 src/lj_profile_timer.h                        |    8 +-
 src/lj_record.c                               |    4 +-
 src/lj_snap.c                                 |   21 +-
 src/lj_target_mips.h                          |   52 +-
 src/luajit.c                                  |    1 +
 src/vm_mips64.dasc                            |  413 +++++-
 src/vm_ppc.dasc                               | 1249 ++++++++++++++---
 ...x-mips64-spare-side-exit-patching.test.lua |   65 +
 ...8-fix-side-exit-patching-on-arm64.test.lua |   78 +-
 ...-mips64-href-delay-slot-side-exit.test.lua |  101 ++
 .../lj-812-too-long-string-separator.test.lua |   31 +
 test/tarantool-tests/utils/frontend.lua       |   24 +
 test/tarantool-tests/utils/jit/generators.lua |  115 ++
 61 files changed, 3565 insertions(+), 908 deletions(-)
 create mode 100644 src/jit/dis_mips64r6.lua
 create mode 100644 src/jit/dis_mips64r6el.lua
 create mode 100644 test/tarantool-tests/fix-mips64-spare-side-exit-patching.test.lua
 create mode 100644 test/tarantool-tests/lj-362-mips64-href-delay-slot-side-exit.test.lua
 create mode 100644 test/tarantool-tests/lj-812-too-long-string-separator.test.lua
 create mode 100644 test/tarantool-tests/utils/jit/generators.lua

-- 
2.41.0



More information about the Tarantool-patches mailing list