Skip to content

Fix lulpeg benchmark arg handling for harness compatibility#39

Merged
ltratt merged 1 commit intomainfrom
fix-lulpeg-arg-handling
Mar 7, 2026
Merged

Fix lulpeg benchmark arg handling for harness compatibility#39
ltratt merged 1 commit intomainfrom
fix-lulpeg-arg-handling

Conversation

@Pavel-Durov
Copy link
Contributor

luagrammar.lua expects arg[1]=module path and arg[2]=source file when run standalone, but via the harness arg contains harness arguments (arg[1]="lulpeg", arg[2]="1"), causing it to load the benchmark object instead of the LuLPeg library.

Fix by temporarily setting arg to the expected values before dofile().

luagrammar.lua expects arg[1]=module path and arg[2]=source file when
run standalone, but via the harness arg contains harness arguments
(arg[1]="lulpeg", arg[2]="1"), causing it to load the benchmark object
instead of the LuLPeg library.

Fix by temporarily setting arg to the expected values before dofile().
@ltratt ltratt self-assigned this Mar 7, 2026
@ltratt
Copy link
Contributor

ltratt commented Mar 7, 2026

I can buy this. I'll tag @vext01 so he can look at this next week, but in the meantime I think this is worth merging.

@ltratt ltratt added this pull request to the merge queue Mar 7, 2026
@Pavel-Durov
Copy link
Contributor Author

Pavel-Durov commented Mar 7, 2026

Without this fix I get:

RUST_BACKTRACE=full YKD_LOG=4 LUA_PATH="?.lua;../../awfy/Lua/?.lua" sh ../../../haste_harness.sh /tmp/out ~/yklua/src/lua lulpeg 1
yk-tracing: start-tracing
yk-tracing: stop-tracing
yk-tracing: start-tracing
yk-tracing: stop-tracing
yk-tracing: start-tracing
yk-tracing: stop-tracing
yk-tracing: start-tracing
yk-tracing: stop-tracing
yk-tracing: start-tracing
yk-tracing: stop-tracing
yk-tracing: start-tracing
yk-tracing: stop-tracing
yk-tracing: start-tracing
yk-tracing: stop-tracing
yk-tracing: start-tracing
yk-warning: tracing-aborted: tracing unrolled a loop
yk-tracing: start-tracing
yk-tracing: stop-tracing
Starting lulpeg benchmark ...
yk-warning: trace-compilation-aborted: Unimplemented: '%216 = insertelement <8 x i64> poison, i64 %215, i64 0'
~/yklua/src/lua: LuLPeg/tests/luagrammar.lua:7: attempt to call a nil value (field 'setmaxstack')
stack traceback:
        LuLPeg/tests/luagrammar.lua:7: in main chunk
        [C]: in function 'dofile'
        lulpeg.lua:16: in function 'lulpeg.inner_benchmark_loop'
        ../../awfy/Lua/harness.lua:48: in method 'measure'
        ../../awfy/Lua/harness.lua:59: in method 'do_runs'
        ../../awfy/Lua/harness.lua:42: in method 'run_benchmark'
        ../../awfy/Lua/harness.lua:96: in main chunk
        [C]: in ?
error: failed to run inner harness

@ltratt
Copy link
Contributor

ltratt commented Mar 7, 2026

FWIW I think cd might be having a vaguely similar problem. It fails sometimes under harness.sh but survives 100s of run under try_repeat.

Merged via the queue into main with commit 5127331 Mar 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants