Skip to content

Commit 4f682c3

Browse files
committed
New --jit options
1 parent 5c95be3 commit 4f682c3

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

doc/user/compatibility.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ Programs passed in `-e` arguments with magic-comments must have an encoding that
120120
is UTF-8 or a subset of UTF-8, as the JVM has already decoded arguments by the
121121
time we get them.
122122

123+
`--jit` options and the `jit` feature are not supported because TruffleRuby
124+
uses Graal as a JIT.
125+
123126
#### Setting the process title doesn't always work
124127

125128
Setting the process title (via `$0` or `Process.setproctitle` in Ruby) is done

spec/tags/truffle/launcher_tags.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ slow:The launcher sets the log level using --log.ruby.level=
5959
fails(GR-13956):The launcher prints help containing runtime options
6060
slow:The launcher logs options if --options.log is set
6161
slow:The launcher sets the log level using --log.level=
62+
slow:The launcher ignores --jit option with a warning
63+
slow:The launcher ignores --jit-... options with a warning and a hint to look at Graal options
64+
slow:The launcher ignores --jit... options with a warning and a hint to look at Graal documentation
65+
slow:The launcher warns on ignored options

spec/truffle/launcher_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,37 @@ def should_print_full_java_command(options, env: {})
300300
out.should include("[truffle] opt done")
301301
end
302302
end
303+
304+
it "ignores --jit... options with a warning and a hint to look at Graal documentation" do
305+
[
306+
"--jit",
307+
"--jit-warnings",
308+
"--jit-debug",
309+
"--jit-wait",
310+
"--jit-save-temps",
311+
"--jit-verbose",
312+
"--jit-max-cache",
313+
"--jit-min-calls",
314+
].each do |option|
315+
out = ruby_exe("p 14", options: option, args: "2>&1")
316+
$?.success?.should == true
317+
out.should include("JIT options are not supported - see the Graal documentation instead")
318+
out.should include("14")
319+
end
320+
end
321+
322+
it "warns on ignored options" do
323+
[
324+
"-y",
325+
"--yydebug",
326+
"--debug-frozen-string-literal",
327+
"--dump=insns",
328+
].each do |option|
329+
out = ruby_exe("p 14", options: option, args: "2>&1")
330+
$?.success?.should == true
331+
out.should include("[ruby] WARNING the #{option} switch is silently ignored as it is an internal development tool")
332+
out.should include("14")
333+
end
334+
end
335+
303336
end

src/launcher/java/org/truffleruby/launcher/RubyLauncher.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ protected void collectArguments(Set<String> options) {
163163
"--external-encoding", "--internal-encoding",
164164
"--version",
165165
"--help",
166+
"--jit",
167+
"--jit-warnings",
168+
"--jit-debug",
169+
"--jit-wait",
170+
"--jit-save-temps",
171+
"--jit-verbose",
172+
"--jit-max-cache",
173+
"--jit-min-calls"));
166174
}
167175

168176
@Override

src/launcher/java/org/truffleruby/launcher/options/CommandLineParser.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ private void processArgument() throws CommandLineException {
464464
break FOR;
465465
} else if (argument.startsWith("--dump=")) {
466466
LOGGER.warning("the --dump= switch is silently ignored as it is an internal development tool");
467+
} else if (argument.equals("--jit") || argument.startsWith("--jit-")) {
468+
LOGGER.warning("JIT options are not supported - see the Graal documentation instead");
467469
break FOR;
468470
} else {
469471
if (argument.equals("--")) {

0 commit comments

Comments
 (0)