summaryrefslogtreecommitdiff
path: root/yjit.rb
diff options
context:
space:
mode:
authorDaniel Colson <[email protected]>2025-05-16 13:31:43 -0400
committer<[email protected]>2025-05-16 17:31:43 +0000
commiteead83160bcc5f49706e05669e5a7e2620b9b605 ()
tree2b453ce707650917b182ddcde01dac213fecf097 /yjit.rb
parentcc90adb68d8457a5c79af6cb732906a882438092 (diff)
Prevent enabling yjit when zjit enabled (GH-13358)
`ruby --yjit --zjit` already warns and exits, but it was still possible to enable both with `ruby --zjit -e 'RubyVM:YJIT.enable`. This commit prevents that with a warning and an early return. (We could also exit, but that seems a bit unfriendly once we're already running the program.) Co-authored-by: ywenc <[email protected]>
Notes: Merged: https://.com/ruby/ruby/pull/13358 Merged-By: XrXr
-rw-r--r--yjit.rb5
1 files changed, 5 insertions, 0 deletions
@@ -48,6 +48,11 @@ module RubyVM::YJIT
def self.enable(stats: false, log: false, mem_size: nil, call_threshold: nil)
return false if enabled?
if mem_size
raise ArgumentError, "mem_size must be a Integer" unless mem_size.is_a?(Integer)
raise ArgumentError, "mem_size must be between 1 and 2048 MB" unless (1..2048).include?(mem_size)