summaryrefslogtreecommitdiff
path: root/lib/rdoc/options.rb
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-07-13 19:01:09 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-12-01 17:42:33 -0500
commit9121e57a5f50bc91bae48b3b91edb283bf96cb6b (patch)
treea90f8d855b86e508f7a9928395c85b4001fb6c29 /lib/rdoc/options.rb
parent3b2b28d035c9635b9473c7a03ede04fa6ac57a34 (diff)
Rework tracing for blocks running as methods
The main impetus for this change is to fix [Bug #13392]. Previously, we fired the "return" TracePoint event after popping the stack frame for the block running as method (BMETHOD). This gave undesirable source location outputs as the return event normally fires right before the frame going away. The iseq for each block can run both as a block and as a method. To accommodate that, this commit makes vm_trace() fire call/return events for instructions that have b_call/b_return events attached when the iseq is running as a BMETHOD. The logic for rewriting to "trace_*" instruction is tweaked so that when the user listens to call/return events, instructions with b_call/b_return become trace variants. To continue to provide the return value for non-local returns done using the "return" or "break" keyword inside BMETHODs, the stack unwinding code is tweaked. b_return events now provide the same return value as return events for these non-local cases. A pre-existing test deemed not providing a return value for these b_return events as a limitation. This commit removes the checks for call/return TracePoint events that happen when calling into BMETHODs when no TracePoints are active. Technically, migrating just the return event is enough to fix the bug, but migrating both call and return removes our reliance on `VM_FRAME_FLAG_FINISH` and re-entering the interpreter when the caller is already in the interpreter.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4637
Diffstat (limited to 'lib/rdoc/options.rb')
0 files changed, 0 insertions, 0 deletions