[Tarantool-patches] [PATCH luajit] Actually implement maxirconst trace limit.

Sergey Kaplun skaplun at tarantool.org
Sat Jan 29 04:17:44 MSK 2022


Igor,

On 29.01.22, Igor Munkin wrote:
> Sergey,
> 
> Bad things happen... I was much concerned about using <misc> module in
> the test, but I failed to understand why exactly. Now I finally got it
> (the hard way): <misc> is missing in 1.10 which is one of the target
> branches for this patch. Could you please adjust the test using
> <jit.util.traceinfo> helper or via any other way to check that only the
> first trace is compiled?

Fixed, see the iterative patch below:
Branch is force-pushed.

===================================================================
diff --git a/test/tarantool-tests/lj-430-maxirconst.test.lua b/test/tarantool-tests/lj-430-maxirconst.test.lua
index 10de2520..45f0bb1d 100644
--- a/test/tarantool-tests/lj-430-maxirconst.test.lua
+++ b/test/tarantool-tests/lj-430-maxirconst.test.lua
@@ -7,6 +7,7 @@ jit.flush()
 require('utils').skipcond(jit.os == 'BSD', 'Disabled due to #4819')
 
 local tap = require('tap')
+local traceinfo = require('jit.util').traceinfo
 
 local test = tap.test('lj-430-maxirconst')
 test:plan(2)
@@ -24,20 +25,17 @@ local function irconst4()
   local _ = 42
 end
 
-local ntrace_old = misc.getmetrics().jit_trace_num
+assert(not traceinfo(1), 'no any traces')
 jit.on()
 irconst3()
 irconst3()
 jit.off()
-test:ok(ntrace_old + 1 == misc.getmetrics().jit_trace_num,
-        'trace number increases')
+test:ok(traceinfo(1), 'new trace created')
 
-ntrace_old = misc.getmetrics().jit_trace_num
 jit.on()
 irconst4()
 irconst4()
 jit.off()
-test:ok(ntrace_old == misc.getmetrics().jit_trace_num,
-        'trace should not appear due to maxirconst limit')
+test:ok(not traceinfo(2), 'trace should not appear due to maxirconst limit')
 
 os.exit(test:check() and 0 or 1)
===================================================================

> 
> P.S. many thanks to luacheck:
> | $ make -j test
> | Consolidate compiler generated dependencies of target minilua
> | Consolidate compiler generated dependencies of target libmixcframe
> | Consolidate compiler generated dependencies of target libsandwich
> | Consolidate compiler generated dependencies of target lib1
> | Consolidate compiler generated dependencies of target lib2
> | Consolidate compiler generated dependencies of target lib21
> | Consolidate compiler generated dependencies of target lib11
> | Consolidate compiler generated dependencies of target libflush
> | [  3%] Built target libsandwich
> | [  3%] Built target libmixcframe
> | Running luacheck static analysis
> | [  8%] Built target lib1
> | [ 11%] Built target lib21
> | [  6%] Built target minilua
> | [  6%] Built target lib2
> | [ 13%] Built target lib11
> | [ 15%] Built target libflush
> | [ 16%] Generating buildvm_arch.h
> | Create directory for PUC-Rio Lua 5.1 tests
> | [ 16%] Built target PUC-Rio-Lua-5.1-tests-prepare
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/luajit-test-init.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/gh-3196-incorrect-string-length.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/gh-4476-fix-string-find-recording.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/gh-4773-tonumber-fail-on-NUL-char.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/gh-6227-bytecode-allocator-for-comparisons.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-375-ir-bufput-signed-char.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-430-maxirconst.test.lua 4 warnings
> | 
> |     /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-430-maxirconst.test.lua:27:20: (W113) accessing undefined variable misc
> |     /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-430-maxirconst.test.lua:32:27: (W113) accessing undefined variable misc
> |     /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-430-maxirconst.test.lua:35:14: (W113) accessing undefined variable misc
> |     /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-430-maxirconst.test.lua:40:23: (W113) accessing undefined variable misc
> | 
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-494-table-chain-infinite-loop.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-505-fold-no-strref-for-ptrdiff.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-524-fold-conv-respect-src-irt.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-584-bad-renames-for-sunk-values.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-601-fix-gc-finderrfunc.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/lj-flush-on-trace.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/or-232-unsink-64-kptr.test.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/tap.lua OK
> | Checking /home/imun/projects/tarantool-luajit-maintain/test/tarantool-tests/utils.lua OK
> | 
> | Total: 4 warnings / 0 errors in 18 files
> | make[3]: *** [test/CMakeFiles/LuaJIT-luacheck.dir/build.make:331: LuaJIT-luacheck] Error 1
> | make[2]: *** [CMakeFiles/Makefile2:731: test/CMakeFiles/LuaJIT-luacheck.dir/all] Error 2
> | make[2]: *** Waiting for unfinished jobs....
> | [ 20%] Building C object src/host/CMakeFiles/buildvm.dir/buildvm_fold.c.o
> | [ 20%] Building C object src/host/CMakeFiles/buildvm.dir/buildvm_lib.c.o
> | [ 20%] Building C object src/host/CMakeFiles/buildvm.dir/buildvm_asm.c.o
> | [ 20%] Building C object src/host/CMakeFiles/buildvm.dir/buildvm.c.o
> | [ 22%] Building C object src/host/CMakeFiles/buildvm.dir/buildvm_peobj.c.o
> | [ 22%] Linking C executable buildvm
> | [ 22%] Built target buildvm
> | make[1]: *** [CMakeFiles/Makefile2:683: test/CMakeFiles/test.dir/rule] Error 2
> | make: *** [Makefile:351: test] Error 2
> 
> -- 
> Best regards,
> IM

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list