From 2dff1d4fdabd0fafeeac675baaaf7b06bb3150f9 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Tue, 18 Apr 2023 07:09:16 -0700 Subject: YJIT: Fix raw sample stack lengths in exit traces (#7728) yjit-trace-exits appends a synthetic sample for the instruction being exited, but we didn't increment the size of the stack. Fixing this count correctly lets us successfully generate a flamegraph from the exits. I also replaced the line number for instructions with 0, as I don't think the previous value had meaning. Co-authored-by: Adam Hess --- yjit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'yjit.c') diff --git a/yjit.c b/yjit.c index 2d3b7c9e9d..72d01d78f4 100644 --- a/yjit.c +++ b/yjit.c @@ -186,8 +186,9 @@ rb_yjit_exit_locations_dict(VALUE *yjit_raw_samples, int *yjit_line_samples, int int line_num = (int)yjit_line_samples[idx]; idx++; - rb_ary_push(raw_samples, SIZET2NUM(num)); - rb_ary_push(line_samples, INT2NUM(line_num)); + // + 1 as we append an additional sample for the insn + rb_ary_push(raw_samples, SIZET2NUM(num + 1)); + rb_ary_push(line_samples, INT2NUM(line_num + 1)); // Loop through the length of samples_len and add data to the // frames hash. Also push the current value onto the raw_samples -- cgit v1.2.3