<kares[m]>
so now I am a bit confused why the interpreter is failing trying to read a (temp) local variable ...
lucasb has joined #jruby
nirvdrum has joined #jruby
snickers has joined #jruby
snickers has quit [Ping timeout: 246 seconds]
<enebo[m]>
kares: seems likely somehow that variable get is happening on wrong interp context
<enebo[m]>
not really sure why...I will have to study what changed here....also this was not passing before so how did this error manifest before?
<kares[m]>
only tried to add an instruction to restore $! ... where I needed to cross a single IRBuilder boundary
<kares[m]>
before the change there's no error but $! leaks (is not nil when it should be)
<kares[m]>
the attempted fix resolved it for my script, but went that piece of code is "inside" the spec it throws AIOoBE
<enebo[m]>
ah yeah this won't work
<enebo[m]>
you are asking for a temp from the parent method which the current context will not have
<kares[m]>
thought it might be messy to cross the boundary
<kares[m]>
not even sure if the attempted fix is the right direction, wdyt?
<enebo[m]>
yeah internally in JIT or in interp temps are either java locals or an array of temps in the current interp method
<enebo[m]>
so this patch added a case for if we did not know the restore variable to ask it's parent for it
<enebo[m]>
I think the scenario you are trying to fix is we are in a soft scope (e.g. closure) and something wants $! at that point but it is unset. Is that right?
<enebo[m]>
If I described what you were trying to do I think one other problem is that $! is a down stack value and the parent would only restore an older value (which may be right or not in this case)
<enebo[m]>
I believe one path to solving this is that activeRescueBlock is not empty in all cases where we encounter non-local returns (or potential non-local because at build time this might not be one [e.g. lambda]).
<kares[m]>
yes in a closure that is being passed to another scope (method) - the closure does a return
<kares[m]>
(an early return happens in the original scope)
<kares[m]>
and the important thing is this is happening from within a rescue
<kares[m]>
so `$!` should be restored. haven't looked how MRI handles these but I guess it will be a different codebase compared to JRuby's IR
nirvdrum has quit [Ping timeout: 265 seconds]
<kares[m]>
I think I get what you mean - there's an internal ensure generated that we could tackle
<kares[m]>
or not
<kares[m]>
all the alternatives I could come up with aren't feeling right
<kares[m]>
activeRescueBlock won't be empty at the scope where the closure gets defined
<kares[m]>
but than I call another method which yields and thus the non-local return executes
<kares[m]>
at that point there's no info that I should have restored $! (due coming from a rescue) down the stack ...
<enebo[m]>
we need to push $! at all possible rescue levels as it comes down I think
<enebo[m]>
This arguably is the most complicated part of IR Building
<enebo[m]>
In part because we duplicate a lot of code