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
This is a complicated example that's been distilled down from a larger problem JRuby+Truffle has running RSpec. What appears to be happening is a variable declared in some ancestor frame is being accessed from the current frame instead. In this case, the frame slot index exceeds the number of locals in the frame and an exception is thrown.
Example:
class X
def y(new_name)
yield(:y_name)
end
def z(name, opts)
yield
end
def w(category, name, backtrace_line, *args)
p backtrace_line
end
def x(new_name, label = 'default')
y(new_name) do |name, *args, &block|
group = z(name, :caller => (the_caller = caller)) do
w("examples", name, the_caller.first, *args, &block)
end
end
end
end
X.new.x(:x_name)
MRI 2.2.2:
> ruby -v blah.rb
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
blah.rb:16: warning: assigned but unused variable - group
"blah.rb:3:in `y'
JRuby+Truffle:
> bin/jruby -X+T -v blah.rb
jruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-05-28 e0b1489 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
blah.rb:6:in `z': internal implementation error - IllegalArgumentException The frame slot '[4,the_caller,Object]' is not known by the frame descriptor. com.oracle.truffle.api.impl.DefaultVirtualFrame.getSlotIndexChecked(DefaultVirtualFrame.java:161) (RubyTruffleError)
from blah.rb:16:in `block in x'
from blah.rb:3:in `y'
from blah.rb:15:in `x'
from blah.rb:23:in `<main>'
The text was updated successfully, but these errors were encountered:
nirvdrum
changed the title
[Truffle] Incorrect frame use for block variable access
[Truffle] Incorrect frame used for block variable access
May 28, 2015
This looks like a much simpler case showing the same problem:
def m(arg)
p arg
yield
end
def z
yield
end
z do
m(something_unique = :arg) do
p something_unique
end
end
z {}
In order for this to fail, it needs to be a block-declared variable with a depth > 0 that hasn't been previously seen before. Doing a local variable assignment in a method call seems to be the easiest way to induce this.
This is a complicated example that's been distilled down from a larger problem JRuby+Truffle has running RSpec. What appears to be happening is a variable declared in some ancestor frame is being accessed from the current frame instead. In this case, the frame slot index exceeds the number of
locals
in the frame and an exception is thrown.Example:
MRI 2.2.2:
JRuby+Truffle:
The text was updated successfully, but these errors were encountered: