I did everything well in window, but fail in linux. What i want to do is to compile ruby script to java bytecode with -Xcompile.invokedynamic=true parameters:
[sxu3@** rubyscript]$ jrubyc -Xcompile.invokedynamic=true hello.rb
OptionParser::InvalidOption: invalid option: -Xcompile.invokedynamic=true
complete at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1542
catch at org/jruby/RubyKernel.java:1282
complete at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1540
parse_in_order at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1380
catch at org/jruby/RubyKernel.java:1282
parse_in_order at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1347
order! at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1341
permute! at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1432
parse! at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:1453
compile_argv at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/shared/jruby/compiler.rb:83
initialize at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/1.9/optparse.rb:882
compile_argv at /homes/sxu3/tools/jruby-1.7.10/lib/ruby/shared/jruby/compiler.rb:35
(root) at /homes/sxu3/tools/jruby-1.7.10/bin/jrubyc:5
[sxu3@** rubyscript]$ jrubyc -Xcompile.invokedynamic=true hello.rb ^C
[sxu3@** rubyscript]$ which jrubyc
~/tools/jruby-1.7.10/bin/jrubyc
[sxu3@** rubyscript]$ jruby -v
jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot(TM) Server VM 1.7.0_51-b13 [linux-i386]
[sxu3@** rubyscript]$
[sxu3@** rubyscript]$ uname -a
Linux .. 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Without -Xcompile.invokedynamic=true, jrubyc works but none of invokedynamic instruction is in generated bytecodes. Also,
"jrubyc -Xcompile.invokedynamic=true hello.rb"
works in window and i saw invokedynamic in class file in window.
I leave all other jrubyc properties(.jrubyrc) as default value
hello.rb is one line ruby script:
puts "hello world"
I also tried jrubyc 1.7.6 and the same errors . Anyone could provide some clue ?
[Update]:
Finally, I think the exception indicates jrubyc does not support -Xcompile.invokedynamic=true option. The jruby wiki page says jruby, instead of "jrubyc" can work with option.
I also had issues with jruby and invokedynamic. The problem is that invokedynamic is not really supported on JVM 1.7. To get it working you should install the JVM 1.8. You can read about the issues here: https://github.com/jruby/jruby/wiki/PerformanceTuning But be careful when installing Java 8 - it's not so easy switching between versions and some programs like several eclipse IDEs don't want to run on that JVM.
However maybe jruby with invokedynamic works on Windows, because you have installed the Oracle JVM, which is a little bit different from the HotSpot OpenJDK version.