ruby/tool/ruby_vm/views
Peter Zhu 3e09822407 Fix incorrect line numbers in GC hook
If the previous instruction is not a leaf instruction, then the PC was
incremented before the instruction was ran (meaning the currently
executing instruction is actually the previous instruction), so we
should not increment the PC otherwise we will calculate the source
line for the next instruction.

This bug can be reproduced in the following script:

```
require "objspace"

ObjectSpace.trace_object_allocations_start
a =

  1.0 / 0.0
p [ObjectSpace.allocation_sourceline(a), ObjectSpace.allocation_sourcefile(a)]
```

Which outputs: [4, "test.rb"]

This is incorrect because the object was allocated on line 10 and not
line 4. The behaviour is correct when we use a leaf instruction (e.g.
if we replaced `1.0 / 0.0` with `"hello"`), then the output is:
[10, "test.rb"].

[Bug #19456]
2023-02-24 14:10:09 -05:00
..
lib/ruby_vm/mjit Polish the public docs for MJIT [ci skip] 2022-12-22 14:30:09 -08:00
_attributes.erb
_c_expr.erb
_comptime_insn_stack_increase.erb
_copyright.erb
_insn_entry.erb Make leaf const in VM generator 2021-12-05 11:06:05 -05:00
_insn_len_info.erb Expose instruction information for debuggers [Feature #18026] 2021-10-04 09:43:09 -07:00
_insn_name_info.erb Expose instruction information for debuggers [Feature #18026] 2021-10-04 09:43:09 -07:00
_insn_operand_info.erb Expose instruction information for debuggers [Feature #18026] 2021-10-04 09:43:09 -07:00
_insn_sp_pc_dependency.erb
_insn_type_chars.erb Separate TS_IVC and TS_ICVARC in is_entries buffers 2022-07-18 14:06:30 -07:00
_leaf_helpers.erb Fix incorrect line numbers in GC hook 2023-02-24 14:10:09 -05:00
_notice.erb
_sp_inc_helpers.erb
_trace_instruction.erb
insns.inc.erb
insns_info.inc.erb
mjit_sp_inc.inc.erb MJIT: Rename mjit_compile_attr to mjit_sp_inc 2022-11-29 21:45:34 -08:00
opt_sc.inc.erb
optinsn.inc.erb Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
optunifs.inc.erb
vm.inc.erb Remove the scraper 2021-10-20 18:19:38 -04:00
vmtc.inc.erb