Skip to content

Merge lastline and other bits from 9.2#6772

Merged
headius merged 6 commits intojruby:masterfrom
headius:merge_lastline
Aug 6, 2021
Merged

Merge lastline and other bits from 9.2#6772
headius merged 6 commits intojruby:masterfrom
headius:merge_lastline

Conversation

@headius
Copy link
Member

@headius headius commented Aug 5, 2021

Doing this as a PR because it was a pretty messy merge.

headius added 5 commits August 5, 2021 13:42
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
@headius headius added this to the JRuby 9.3.0.0 milestone Aug 5, 2021
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.
@headius headius merged commit 5a0ac49 into jruby:master Aug 6, 2021
@headius headius deleted the merge_lastline branch August 6, 2021 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant