Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH luajit 0/5] Fix pow inconsistencies and improve asserts
@ 2023-08-15  9:36 Sergey Kaplun via Tarantool-patches
  2023-08-15  9:36 ` [Tarantool-patches] [PATCH luajit 1/5] test: introduce `samevalues()` TAP checker Sergey Kaplun via Tarantool-patches
                   ` (6 more replies)
  0 siblings, 7 replies; 34+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2023-08-15  9:36 UTC (permalink / raw)
  To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches

This patchset fix `^` operator insconsistencies. Since the last 2
commits are based on the patch "Improve assertions." (*) it is backported as
well (it's about time).

(*) Be aware that assertions in <src/luajit.c> aren't replaced in the
upstream too.
The following functions/modules contains our own code with assertions,
so we can discuss some better namings for them:
* `lj_fullhash()` in <src/lj_str.c>
* `lua_hashstring()` in <src/lj_api.c>
* <src/lib_misc.c>
* <src/lj_mapi.c>
* <src/lj_memprof.c>
* <src/lj_sysprof.c>
* <src/lj_utils_leb128.c>
* <src/lj_wbuf.c>

P.S. Unfortunately, I can't find any reproducer for dropping
optimization of 2 ^ i => ldexp(1.0, i). Please, guide me, if you may
found any.

Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-9-pow-inconsistencies
PR: https://github.com/tarantool/tarantool/pull/8985
Related issues:
* https://github.com/tarantool/tarantool/issues/8825
* https://github.com/LuaJIT/LuaJIT/issues/9
* https://github.com/LuaJIT/LuaJIT/issues/684
* https://github.com/LuaJIT/LuaJIT/issues/817


Mike Pall (4):
  Remove pow() splitting and cleanup backends.
  Improve assertions.
  Fix pow() optimization inconsistencies.
  Revert to trival pow() optimizations to prevent inaccuracies.

Sergey Kaplun (1):
  test: introduce `samevalues()` TAP checker

 src/CMakeLists.txt                            |   1 +
 src/Makefile.dep.original                     |  13 +-
 src/Makefile.original                         |   4 +-
 src/lib_io.c                                  |   6 +-
 src/lib_jit.c                                 |   4 +-
 src/lib_misc.c                                |  12 +-
 src/lib_string.c                              |   6 +-
 src/lj_api.c                                  | 140 ++++++-----
 src/lj_arch.h                                 |   3 -
 src/lj_asm.c                                  | 230 +++++++++++-------
 src/lj_asm_arm.h                              | 129 +++++-----
 src/lj_asm_arm64.h                            | 134 +++++-----
 src/lj_asm_mips.h                             | 189 +++++++-------
 src/lj_asm_ppc.h                              | 122 ++++++----
 src/lj_asm_x86.h                              | 211 +++++++---------
 src/lj_assert.c                               |  28 +++
 src/lj_bcread.c                               |  20 +-
 src/lj_bcwrite.c                              |  24 +-
 src/lj_buf.c                                  |   4 +-
 src/lj_carith.c                               |  10 +-
 src/lj_ccall.c                                |  19 +-
 src/lj_ccallback.c                            |  42 ++--
 src/lj_cconv.c                                |  57 +++--
 src/lj_cconv.h                                |   5 +-
 src/lj_cdata.c                                |  27 +-
 src/lj_cdata.h                                |   7 +-
 src/lj_clib.c                                 |   6 +-
 src/lj_cparse.c                               |  25 +-
 src/lj_crecord.c                              |  19 +-
 src/lj_ctype.c                                |  13 +-
 src/lj_ctype.h                                |  14 +-
 src/lj_debug.c                                |  18 +-
 src/lj_def.h                                  |  26 +-
 src/lj_dispatch.c                             |  11 +-
 src/lj_emit_arm.h                             |  50 ++--
 src/lj_emit_arm64.h                           |  21 +-
 src/lj_emit_mips.h                            |  22 +-
 src/lj_emit_ppc.h                             |  12 +-
 src/lj_emit_x86.h                             |  22 +-
 src/lj_err.c                                  |  40 +--
 src/lj_ffrecord.c                             |   4 +-
 src/lj_func.c                                 |  18 +-
 src/lj_gc.c                                   |  78 +++---
 src/lj_gc.h                                   |   6 +-
 src/lj_gdbjit.c                               |   5 +-
 src/lj_ir.c                                   |  31 +--
 src/lj_ir.h                                   |   7 +-
 src/lj_ircall.h                               |   2 -
 src/lj_iropt.h                                |   1 -
 src/lj_jit.h                                  |   6 +
 src/lj_lex.c                                  |  14 +-
 src/lj_lex.h                                  |   6 +
 src/lj_load.c                                 |   2 +-
 src/lj_mapi.c                                 |   2 +-
 src/lj_mcode.c                                |   2 +-
 src/lj_memprof.c                              |  35 +--
 src/lj_meta.c                                 |   6 +-
 src/lj_obj.h                                  |  35 ++-
 src/lj_opt_fold.c                             | 144 +++++------
 src/lj_opt_loop.c                             |   5 +-
 src/lj_opt_mem.c                              |  15 +-
 src/lj_opt_narrow.c                           |  55 +----
 src/lj_opt_split.c                            |  45 +---
 src/lj_parse.c                                | 114 +++++----
 src/lj_record.c                               | 164 ++++++++-----
 src/lj_snap.c                                 | 100 +++++---
 src/lj_snap.h                                 |   3 +-
 src/lj_state.c                                |  18 +-
 src/lj_str.c                                  |   7 +-
 src/lj_strfmt.c                               |   4 +-
 src/lj_strfmt.h                               |   3 +-
 src/lj_strfmt_num.c                           |   6 +-
 src/lj_strscan.c                              |   9 +-
 src/lj_symtab.c                               |  11 +-
 src/lj_sysprof.c                              |  31 +--
 src/lj_tab.c                                  |  20 +-
 src/lj_target.h                               |   3 +-
 src/lj_trace.c                                |  57 +++--
 src/lj_utils_leb128.c                         |   5 +-
 src/lj_vm.h                                   |   9 -
 src/lj_vmmath.c                               |  51 +---
 src/lj_wbuf.c                                 |   3 +-
 src/ljamalg.c                                 |   1 +
 src/luaconf.h                                 |   2 +-
 src/vm_x64.dasc                               |  35 ---
 src/vm_x86.dasc                               |  35 ---
 test/tarantool-tests/gh-6163-min-max.test.lua |  52 ++--
 .../lj-684-pow-inconsistencies.test.lua       | 106 ++++++++
 .../lj-9-pow-inconsistencies.test.lua         |  65 +++++
 test/tarantool-tests/tap.lua                  |  14 ++
 90 files changed, 1729 insertions(+), 1469 deletions(-)
 create mode 100644 src/lj_assert.c
 create mode 100644 test/tarantool-tests/lj-684-pow-inconsistencies.test.lua
 create mode 100644 test/tarantool-tests/lj-9-pow-inconsistencies.test.lua

-- 
2.41.0


^ permalink raw reply	[flat|nested] 34+ messages in thread