When I try running Ruby 1.9 from withing Java (JRuby 1.1.6), I see the
following exception:
Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: -1
at
org.jruby.ast.executable.YARVMachine.pop(YARVMachine.java:188)
at
org.jruby.ast.executable.YARVMachine.exec(YARVMachine.java:618)
at
org.jruby.ast.executable.YARVMachine.exec(YARVMachine.java:262)
at
org.jruby.ast.executable.YARVCompiledRunner.run(YARVCompiledRunner.java:89)
at org.jruby.Ruby.runYarv(Ruby.java:572)
at org.jruby.Ruby.runNormally(Ruby.java:470)
at
ed.lang.ruby.RuntimeEnvironment.commonRun(RuntimeEnvironment.java:171)
at ed.lang.ruby.RubyJxpSource._doCall(RubyJxpSource.java:57)
…
The only thing I’ve changed is making the yarvCompile argument to
Ruby#runNormally true instead of false. Here’s a simplified version of
my
code:
Ruby runtime = …;
Node node = runtime.parseFile(bytesFromScriptString, …);
boolean yarvCompile = true;
// yarvCompile is false for Ruby 1.8 (works), true for Ruby 1.9
(fails)
runtime.runNormally(node, yarvCompile);
Any idea what I’m doing wrong?
Funny thing is, when I look at the source code to see what the ‘–1.9’
flag
does, I can’t find it anywhere in RubyInstanceConfig#processArgument().
Jim
Jim M., [email protected], [email protected]
http://www.io.com/~jimm/
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
You want RubyInstanceConfig.compatVersion to be set to
CompatVersion.Ruby1_9.
The yarvcompile stuff should be yanked out of that method. It was an
experimental yarv machine which is unrelated to 1.9 support.
-Tom
On Mon, Jan 5, 2009 at 3:35 PM, Jim M. [email protected] wrote:
at ed.lang.ruby.RuntimeEnvironment.commonRun(RuntimeEnvironment.java:171)
// yarvCompile is false for Ruby 1.8 (works), true for Ruby 1.9 (fails)
http://www.io.com/~jimm/
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
–
Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Tue, Jan 6, 2009 at 10:36 AM, Thomas E Enebo [email protected]
wrote:
You want RubyInstanceConfig.compatVersion to be set to CompatVersion.Ruby1_9.
The yarvcompile stuff should be yanked out of that method. It was an
experimental yarv machine which is unrelated to 1.9 support.
Thank you.
There is no public method in RubyInstanceConfig to set compatVersion
directly; only the “–compat” command line arg and the
jruby.compat.version setting.
Wouldn’t it make sense to create a public setCompatVersion method? I
think I’m going to add that as a feature request in JIRA.
Jim
at org.jruby.ast.executable.YARVMachine.exec(YARVMachine.java:262)
http://xircles.codehaus.org/manage_email
–
Jim M., [email protected], [email protected]
http://www.io.com/~jimm/
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Submitted, including the code for RubyInstanceConfig#setCompatVersion
http://jira.codehaus.org/browse/JRUBY-3287
Jim
On Tue, Jan 6, 2009 at 12:51 PM, Jim M. [email protected]
wrote:
jruby.compat.version setting.
When I try running Ruby 1.9 from withing Java (JRuby 1.1.6), I see the
at ed.lang.ruby.RubyJxpSource._doCall(RubyJxpSource.java:57)
runtime.runNormally(node, yarvCompile);
–
–
Jim M., [email protected], [email protected]
http://www.io.com/~jimm/
–
Jim M., [email protected], [email protected]
http://www.io.com/~jimm/
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email