ruby/yjit
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
..
bindgen Move `attached_object` into `rb_classext_struct` 2023-02-16 08:14:44 +01:00
src Fix incorrect line numbers in GC hook 2023-02-24 14:10:09 -05:00
.gitignore
Cargo.lock YJIT: Instrument global allocations on stats build (#6712) 2022-11-13 12:54:41 -05:00
Cargo.toml YJIT: Use ThinLTO for Rust parts in release mode 2023-01-16 17:32:15 -05:00
not_gmake.mk YJIT: Fix shared/static library symbol leaks 2023-01-27 12:28:09 -05:00
yjit.mk YJIT: Add `make yjit-smoke-test` [ci skip] 2023-02-23 12:12:57 -05:00