YJIT: dump-disasm: Print comments and bytes in release builds
This change implements a fallback mode for the --yjit-dump-disasm
development command-line option to make it usable in release builds.
Previously, using the option with release builds of YJIT yielded only
a warning asking the user to build with --enable-yjit=dev.
While builds that use the disasm feature still give the best output,
just having the comments is useful enough for many kinds of debugging.
Having it usable in release builds is nice for new hackers, too, since
this allows for tinkering without having to learn how to build YJIT in
development mode.
Sample output on A64:
# regenerate_branch
# Insn: 0001 opt_send_without_block (stack_size: 1)
# guard known object with singleton class
0x11f7e0034: 4b 00 00 58 03 00 00 14 08 ce 9c 04 01 00 00
0x11f7e0043: 00 3f 00 0b eb 81 06 01 54 1f 20 03 d5
# RUBY_VM_CHECK_INTS(ec)
0x11f7e0050: 8b 02 42 b8 cb 07 01 35
# stack overflow check
0x11f7e0058: ab 62 02 91 7f 02 0b eb 69 07 01 54
# save PC to CFP
0x11f7e0064: 0b 3b 9a d2 2b 2f a0 f2 0b 00 cc f2 6b 02 00
0x11f7e0073: f8 ab 82 00 91
To ensure this feature doesn't incur too much cost when running without
the --yjit-dump-disasm option, I checked that there is no significant
impact to compile time and memory usage with the compile_time_ns and yjit_alloc_size entry in RubyVM::YJIT.runtime_stats. For each
sample, I ran 3 iterations of the lobsters YJIT benchmark. The
statistics summary and done with the summary function in R.
Compile time, sample size of 60, lower is better:
Before After
Min. :2.054e+09 Min. :2.028e+09
1st Qu.:2.069e+09 1st Qu.:2.044e+09
Median :2.081e+09 Median :2.060e+09
Mean :2.089e+09 Mean :2.066e+09
3rd Qu.:2.109e+09 3rd Qu.:2.085e+09
Max. :2.146e+09 Max. :2.144e+09
Allocation size, sample size of 20, lower is better:
Before After
Min. :21804742 Min. :21794082
1st Qu.:21826682 1st Qu.:21816282
Median :21844042 Median :21826814
Mean :21960664 Mean :22026291
3rd Qu.:21861228 3rd Qu.:22040439
Max. :22587426 Max. :22930614
The yjit_alloc_size samples are noisy, but since the average increased
by only 0.3%, and the median is lower, I feel safe saying that there is
no significant change.
YJIT:
dump-disasm
: Print comments and bytes in release buildsThis change implements a fallback mode for the
--yjit-dump-disasm
development command-line option to make it usable in release builds.
Previously, using the option with release builds of YJIT yielded only
a warning asking the user to build with
--enable-yjit=dev
.While builds that use the
disasm
feature still give the best output,just having the comments is useful enough for many kinds of debugging.
Having it usable in release builds is nice for new hackers, too, since
this allows for tinkering without having to learn how to build YJIT in
development mode.
Sample output on A64:
To ensure this feature doesn't incur too much cost when running without
the
--yjit-dump-disasm
option, I checked that there is no significantimpact to compile time and memory usage with the
compile_time_ns
andyjit_alloc_size
entry inRubyVM::YJIT.runtime_stats
. For eachsample, I ran 3 iterations of the
lobsters
YJIT benchmark. Thestatistics summary and done with the
summary
function in R.Compile time, sample size of 60, lower is better:
Allocation size, sample size of 20, lower is better:
The
yjit_alloc_size
samples are noisy, but since the average increasedby only 0.3%, and the median is lower, I feel safe saying that there is
no significant change.