summaryrefslogtreecommitdiff
path: root/yjit.rb
diff options
context:
space:
mode:
authorannichai-stripe <[email protected]>2025-03-03 12:45:39 -0800
committer<[email protected]>2025-03-03 15:45:39 -0500
commit5085ec3ed90beb54125d5eb9329e202ae1542b5c ()
tree9c40255c049e323bf9e3e56ad12d695a454093ef /yjit.rb
parent9ccba88160c1b702a97b80817b97109cc2b9f33c (diff)
Allow YJIT `mem-size` and `call-threshold` to be set at runtime via `YJIT.enable()` (#12505)
* first commit * yjit.rb change * revert formatting * rename mem-size to exec-mem-size for correctness * wip, move setting into rb_yjit_enable directly * remove unused helper functions * add in call threshold * input validation with extensive eprintln * delete test script * exec-mem-size -> mem-size * handle input validation with asserts * add test cases related to input validation * modify test cases * move validation out of rs, into rb * add comments * remove trailing spaces * remove logging Co-authored-by: Takashi Kokubun <[email protected]> * remove helper fn * Update test/ruby/test_yjit.rb Co-authored-by: Takashi Kokubun <[email protected]> * trailing white space --------- Co-authored-by: Alan Wu <[email protected]> Co-authored-by: Takashi Kokubun <[email protected]> Co-authored-by: Maxime Chevalier-Boisvert <[email protected]>
Notes: Merged-By: maximecb <[email protected]>
-rw-r--r--yjit.rb20
1 files changed, 16 insertions, 4 deletions
@@ -34,7 +34,8 @@ module RubyVM::YJIT
end
# Enable \YJIT compilation. `stats` option decides whether to enable \YJIT stats or not. `compilation_log` decides
- # whether to enable \YJIT compilation logging or not.
#
# * `stats`:
# * `false`: Don't enable stats.
@@ -44,11 +45,22 @@ module RubyVM::YJIT
# * `false`: Don't enable the log.
# * `true`: Enable the log. Print log at exit.
# * `:quiet`: Enable the log. Do not print log at exit.
- def self.enable(stats: false, log: false)
return false if enabled?
at_exit { print_and_dump_stats } if stats
call_yjit_hooks
- Primitive.rb_yjit_enable(stats, stats != :quiet, log, log != :quiet)
end
# If --yjit-trace-exits is enabled parse the hashes from
@@ -532,4 +544,4 @@ module RubyVM::YJIT
# :startdoc:
end
-end