You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into an issue where defined? stops working properly with JIT enabled in JRuby 9k. The following simple script is enough to illustrate the problem:
X = true
1000.times do
raise 'X undefined' unless defined?(::X)
end
puts 'Success'
With JIT disabled, "Succes" will be printed to the screen. With it enabled, I see the following:
RuntimeError: X undefined
jit_defined_bug.rb_CLOSURE_1__jit_defined_bug.rb_0 at jit_defined_bug.rb:4
times at org/jruby/RubyFixnum.java:296
__script__ at jit_defined_bug.rb:3
Ruby version:
$ ruby -v
jruby 9000.dev-SNAPSHOT (2.1.2p142) 2014-11-04 dc55205 Java HotSpot(TM) 64-Bit Server VM 25.25-b02 on 1.8.0_25-b17 +jit [linux-amd64]
The text was updated successfully, but these errors were encountered:
The current IR for this logic uses the runtime helper call
isDefinedConstantOrMethod, which can trigger exceptions on its own
(if e.g. the method lookup triggers an error?). Because of that
handler, this bug in the JIT was caught and swallowed, resulting
in the defined? returning nil. That is not correct behavior; only
the exceptions we would expect to be raised by these lookups
should be caught.
In addition, I don't believe the :: form can be used to call
methods (::foo doesn't parse), so the use of exception handling
and isDefinedConstOrMethod may be inappropriate here.
We can't remember or determine what's actually needed to "finish" this, so we're going to close it. The fix in place is simple and works, and if any defined? bugs remain they'd need to be fixed in IR first anyway.
I ran into an issue where
defined?
stops working properly with JIT enabled in JRuby 9k. The following simple script is enough to illustrate the problem:With JIT disabled, "Succes" will be printed to the screen. With it enabled, I see the following:
Ruby version:
The text was updated successfully, but these errors were encountered: