Discussion:
[jruby-user] java.lang.invoke.SwitchPoint problem when using invokedynamic
O. L.
2014-08-19 19:08:12 UTC
Permalink
I'm using JRuby 1.7.13 and Java 7 to perform this task. Firstly, I use
"jrubyc" to compile a simple HelloWorld program into a Java class file
"hello.class". Next, I download the jruby library
"jruby-complete-1.7.13.jar" and execute the following command:

java -cp .:jruby-complete-1.7.13.jar hello

In the case when I disable the invokedynamic when doing the jrubyc, this
above command executes smoothly and prints out "hello, world!" without
problems. But if invokedynamic is enabled, the following exception
occurs:

Exception in thread "main" java.lang.ClassCastException:
java.lang.Integer cannot be cast to java.lang.invoke.SwitchPoint

at
org.jruby.runtime.invokedynamic.InvocationLinker.invocationFallback(InvocationLinker.java:130)

at hello.__file__(hello.rb:10)


I'm wondering what this "SwitchPoint" is and why it is causing problems.
I'm scanning through the jruby properties and see the following two
parameters that might be relevant:

#invokedynamic.invocation.java=true
#invokedynamic.invocation.switchpoint=true

But I've tried various ways attempting to change the value of these two
parameters but couldn't manage to do it. I'm also not sure if this is
the correct way of fixing the above exception.

If anyone encounters this, please let me know how you work around with
it. I'm sure there're people who try to compile a Ruby file with the
latest JRuby version.
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Christian MICHON
2014-08-20 07:31:59 UTC
Permalink
Isn't it because invokeddynamic is available for JDK8 and not JDK7?

If you've the possibility to upgrade to JDK 1.8.0_11 and report back, you
might see a different behavior.
Post by O. L.
I'm using JRuby 1.7.13 and Java 7 to perform this task. Firstly, I use
"jrubyc" to compile a simple HelloWorld program into a Java class file
"hello.class". Next, I download the jruby library
java -cp .:jruby-complete-1.7.13.jar hello
In the case when I disable the invokedynamic when doing the jrubyc, this
above command executes smoothly and prints out "hello, world!" without
problems. But if invokedynamic is enabled, the following exception
java.lang.Integer cannot be cast to java.lang.invoke.SwitchPoint
at
org.jruby.runtime.invokedynamic.InvocationLinker.invocationFallback(InvocationLinker.java:130)
at hello.__file__(hello.rb:10)
I'm wondering what this "SwitchPoint" is and why it is causing problems.
I'm scanning through the jruby properties and see the following two
#invokedynamic.invocation.java=true
#invokedynamic.invocation.switchpoint=true
But I've tried various ways attempting to change the value of these two
parameters but couldn't manage to do it. I'm also not sure if this is
the correct way of fixing the above exception.
If anyone encounters this, please let me know how you work around with
it. I'm sure there're people who try to compile a Ruby file with the
latest JRuby version.
--
Posted via http://www.ruby-forum.com/.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
Christian
O. L.
2014-08-21 19:48:49 UTC
Permalink
Yes I upgrade to JDK 8 and now it runs.

But why is it so? invokedynamic is available in JDK 7 as well. I can
enable invokedynamic in JRuby compiler args and compile it to see
invokedynamic appearing in the class files.
Post by Christian MICHON
Isn't it because invokeddynamic is available for JDK8 and not JDK7?
If you've the possibility to upgrade to JDK 1.8.0_11 and report back, you
might see a different behavior.
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...