Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.6.7
-
Component/s: Compiler
-
Labels:None
-
Number of attachments :
Description
Have not narrowed this down yet:
could not compile: /Users/headius/projects/jruby/lib/ruby/gems/1.8/gems/rubylexer-0.7.2/lib/rubylexer/rulexer.rb because of: "1" java.lang.ArrayIndexOutOfBoundsException: 1 at jruby.objectweb.asm.Frame.a(Unknown Source) at jruby.objectweb.asm.Frame.a(Unknown Source) at jruby.objectweb.asm.MethodWriter.visitMaxs(Unknown Source) at org.jruby.compiler.impl.SkinnyMethodAdapter.end(SkinnyMethodAdapter.java:499) at org.jruby.compiler.impl.MethodBodyCompiler.endBody(MethodBodyCompiler.java:97) at org.jruby.compiler.impl.BaseBodyCompiler.defineNewMethod(BaseBodyCompiler.java:2147) at org.jruby.compiler.ASTCompiler.compileDefn(ASTCompiler.java:1732)
Ok, it's a stack management problem. Here's a reduced case:
The problem here is that the break (a simple jump in this case) occurs when there's state on the stack (preparation for the puts call). So the break jump jumps to a point in the stack which doesn't expect to have that stuff on the stack, and so there's an inconsistency which the bytecode validator picks up.
The fix for this, I believe, would be to detect when "break" is being used as an expression and fall back on the exception-based flow control. It's not a trivial fix at the moment, unfortunately.