Merge lastline and other bits from 9.2#6772
Merged
headius merged 6 commits intojruby:masterfrom Aug 6, 2021
Merged
Conversation
This code previously used the current line from context, which would be the line of the caller invocation. Fixes jruby#6768
Use line number of scope for initial backtrace
Jitted code handles arity-checking differently than in the interpreter. Where the interpreter always pushed a backtrace element before the arity check, the JVM does the arity-check in a separately-generated varargs wrapper (if the method is specific- arity) or before setting a line number (if the method is variable- arity). This has the effect of either omitting the error frame altogether (specific) or having the line number be -1 (variable). This commit makes the following modifications to allow the arity error line to be shown in jitted code: * Set the current line number immediately upon creating the method so that it is set in the JVM before the arity check. * Process jitted method names with the varargs marker if they were not preceded by the actual method body. The varargs-marked method can only appear on its own or immediately after the real jitted method body. This fixes all known cases where the argument error line is omitted or not set properly in the JVM trace. In addition, this patch moves the management of the current line number into the IRBytecodeAdapter, rather than maintaining it in the JVMVisitor instance. Fixes jruby#6335. This may also improve the case described in jruby#5103, since all JVM frames will have proper line numbers at the point of error.
Handle varargs frame on arity error in jitted code
These backtrace calls are only on master, so I am fixing them in this PR. They are only used by inlining, which is not enabled. Fixes jruby#6768 in the relevant parts of the inlining logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Doing this as a PR because it was a pretty messy merge.