< prev index next >

src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp

Print this page
*** 210,14 ***
            // the huge SafepointBlob stub frame. Of course, the synthetic frame only contains random stack memory,
            // but it is safe because stack walking cares only about the form of the frame (i.e., an sp and a pc).
            // We also do not have to worry about stackbanging because we currently have a huge SafepointBlob stub frame
            // on the stack. For extra assurance, we know that we can create this frame size at this
            // very location because we just popped such a frame before we hit the return poll site.
            //
            // Let's attempt to correct for the safepoint bias.
            const PcDesc* const pc_desc = get_pc_desc(sampled_nm, sampled_pc);
!           if (is_valid(pc_desc)) {
              intptr_t* const synthetic_sp = sender_sp - sampled_nm->frame_size();
              top_frame = frame(synthetic_sp, synthetic_sp, sender_sp, pc_desc->real_pc(sampled_nm), sampled_nm);
              in_continuation = is_in_continuation(top_frame, jt);
              return true;
            }
--- 210,16 ---
            // the huge SafepointBlob stub frame. Of course, the synthetic frame only contains random stack memory,
            // but it is safe because stack walking cares only about the form of the frame (i.e., an sp and a pc).
            // We also do not have to worry about stackbanging because we currently have a huge SafepointBlob stub frame
            // on the stack. For extra assurance, we know that we can create this frame size at this
            // very location because we just popped such a frame before we hit the return poll site.
+           // For frames that need stack repair we skip this trick. This is because the stack walking code reads
+           // the frame size from the stack, but the memory has already been overwritten by the SafepointBlob.
            //
            // Let's attempt to correct for the safepoint bias.
            const PcDesc* const pc_desc = get_pc_desc(sampled_nm, sampled_pc);
!           if (is_valid(pc_desc) && !sampled_nm->needs_stack_repair()) {
              intptr_t* const synthetic_sp = sender_sp - sampled_nm->frame_size();
              top_frame = frame(synthetic_sp, synthetic_sp, sender_sp, pc_desc->real_pc(sampled_nm), sampled_nm);
              in_continuation = is_in_continuation(top_frame, jt);
              return true;
            }
< prev index next >