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
BEGIN blocks will end up being inserted into the front of the script as callouts or inlined.
END blocks will be at the end of the scope. Instead of RecourseEndBlockInstr we will allocate a temp var in the script scope. Where RRBI was we will instead set the temp to a particular value. At the end of the script the END block the temp represents will wrap execution of the END with an if (IR-equiv).
The additional complexity of changing this is that all END blocks must effectively be in a finally. And they, I think, must each execute whether they error or not. So all of this will be something like this pseudo code:
try { BEGINs; code } finally { if %t_end_1 { try { END } {}} if %t_end2 { try {END2} {} }
The benefits of this change:
remove an instr
simplify eval/script handling so the no longer need to separately record BEGIN/END blocks
zero work needed after this change for JIT to work
The text was updated successfully, but these errors were encountered:
This won't work. The end blocks have to be collected across all scripts and run during ruby tear down. So, to do this entirely via pre-generated IR, we would have to be able to retroactively fixup the top-level scope (that kicked of the execution) to add a new try-finally around it. But, that won't work since the interpreter/JIT has already started execution.
But, as it stands, the current implementation in 9k master is also buggy. The interpreter / JIT would have to register these end blocks with the runtime which pushes them onto a stack just as is happening in 1.7 mode, and then run them as part of tear down.
So, I am closing this ticket. Reopen if I have missed anything.
BEGIN blocks will end up being inserted into the front of the script as callouts or inlined.
END blocks will be at the end of the scope. Instead of RecourseEndBlockInstr we will allocate a temp var in the script scope. Where RRBI was we will instead set the temp to a particular value. At the end of the script the END block the temp represents will wrap execution of the END with an if (IR-equiv).
The additional complexity of changing this is that all END blocks must effectively be in a finally. And they, I think, must each execute whether they error or not. So all of this will be something like this pseudo code:
The benefits of this change:
The text was updated successfully, but these errors were encountered: