Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.7.0.pre2
-
Fix Version/s: JRuby 1.7.0.RC1
-
Component/s: None
-
Labels:None
-
Environment:64-bit Debian 6.0.3 running JDK 1.7.0_02
-
Number of attachments :
Description
I've noticed a bit of strange behaviour in the attached test program. I have:
- A main function with a top-level begin/ensure block, where the ensure block is supposed to perform some sort of cleanup at program exit.
- A 'while true' loop that runs a bit of code in a loop. That code is expected to throw an exception for the first few iterations, and the loop continues until the exceptions stop (think of polling a web server until it starts up)
- When the exceptions stop, the loop is terminated with a 'break'
What I'm seeing: the code immediately following this loop never runs. We jump straight to the 'ensure' block and the program terminates. What I see:
$ /usr/local/jdk1.7.0_02/bin/java -cp jruby-complete-1.7.0.preview2.jar org.jruby.Main test.rb Around we go Around we go Around we go Ensure block
the statement 'puts "Why doesn't this get printed?"' never seems to fire.
I've tested against the following JVMs:
java version "1.6.0_30" Java(TM) SE Runtime Environment (build 1.6.0_30-b12) Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)
java version "1.7.0_02" Java(TM) SE Runtime Environment (build 1.7.0_02-b13) Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
and I see the same issue with jruby-complete-1.6.7.2.jar as with jruby-complete-1.7.0.preview2.jar.
Please let me know if I can do any debugging from this side.
Cheers,
Mark
Looks like it's a bug in the compiler's handling of break in this particular case (old interpreter and IR interpreter are ok):