Project

General

Profile

Actions

Feature #14878

closed

Add command line argument to deactivate JIT

Added by noahgibbs (Noah Gibbs) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Target version:
[ruby-core:87671]

Description

For Ruby 2.6, JIT is off by default. But if a particular application can't use JIT for some reason, it may want to explicitly turn JIT off, even for later Ruby versions that have JIT on by default.

It would be useful to have a --jit-disable command line option to turn JIT off explicitly for later Ruby versions. This option should do nothing in Ruby 2.6.

Why turn JIT off? Some possible reasons:

  • benchmarking
  • no compiler installed
  • known compiler/library bug in non-Ruby system software
  • short program run-time so JIT won't help
  • very tight memory constraints, don't want to start a compiler process
  • read-only file system so you can't write .c files

I'm not married to the name "--jit-disable". I'd be fine with "--no-jit" or "--disable=jit", etc. But there should be an option to disable JIT in future Ruby versions.

Updated by shevegen (Robert A. Heiler) over 6 years ago

Agreed!

I guess it may have already been on Takashi's todo list but he is like doing
lots of changes as-is.

As for options, I think "--disable-jit" and/or "--no-jit" would be best;
--disable=jit is also ok but a bit less commonly used compared to options
without a '='.

The flag "--jit-disable" is a bit weird because I think it is not very common
to have the verb come last (e.g. --FEATURE--enable or --FEATURE--disable) but
I think these are details, not the big picture.

And on the suggestion itself to be able to have control over the jit, I
fully agree. I would even enable both compilation support for jit (yes/no)
and also on the commandline (yes/no). I myself would want to run with jit
on all the time, but as described, there may be many reasons why some
people may not want to or can not use mjit, so in these cases, I think
it makes sense to have it optional (or "controllable" by the ruby hacker
at hand), so

+1

Updated by akr (Akira Tanaka) over 6 years ago

There is already --enable=... and --disable=...

% ruby --help
...
  --enable={gems|rubyopt|...}[,...], --disable={gems|rubyopt|...}[,...]
                  enable or disable features. see below for available features
...

I think there is no reason to use different style for this issue.

Actions #3

Updated by k0kubun (Takashi Kokubun) over 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r63995.


ruby.c: accept --disable-jit option

by promoting jit to feature flag.

mjit.h: update comment about mjit_opts.on

test_rubyoptions.rb: add test for switching JIT enablement

"--jit" flag usage may be deprecated later, but not discussed yet.

[Feature #14878]

Updated by k0kubun (Takashi Kokubun) over 6 years ago

Now --enable-jit, --enable=jit, --disable-jit, --disable=jit are available.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0