Fix handling of exceptions raised inside TracePoint :call handling #4578
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, exceptions raised inside a TracePoint :call handler could
be handled by a rescue clause inside the method. However, TracePoint
:call handling should occur before the body of the method is executed.
Exceptions in TracePoint :call handling should be treated similarly to
exceptions raised when getting default values for arguments, and not
be rescued by exception handlers inside the method.
This fixes the issue by inserting a nop during rescue compilation, so
the start of the rescue catch table will definitely be after TracePoint
:call handling. It also works if you insert a nop during method
compilation, but I think it is better to make rescue handling slower
than than making method calling slower. Possibly this nop could be
optimized out in cases where it is not needed, but I was not able to
figure out how to do that. Hopefully someone with more knowledge of
the compiler will be able to do so.
Fixes [Bug #14479]
This apparently causes a failure in the typeprof tests, though I'm not sure
why that is.