Skip to content

Refactor stackwalker#451

Open
zhengyu123 wants to merge 8 commits intomainfrom
zgu/refactor-stackwalk
Open

Refactor stackwalker#451
zhengyu123 wants to merge 8 commits intomainfrom
zgu/refactor-stackwalk

Conversation

@zhengyu123
Copy link
Copy Markdown
Contributor

@zhengyu123 zhengyu123 commented Apr 2, 2026

What does this PR do?:
This is the second part of code refactoring that builds better abstraction among different JVM implementations. This PR focuses on stack walker components.

  • jvmSupport to encapsulate different JVM specific implementation details (hotspot/HotspotSupport, j9/J9Support and zing/ZingSupport)
  • Moved Hotspot specific stack walkers (walkVMs) into HotspotSupport
  • Moved hotspot specific JIT'ed code cache management to newly created hotspot/jitCodeCache.h/cpp
  • Renamed J9Ext.h/cpp to J9Support.h/cpp to be consistent with others
  • Removed unused files jvm.h/cpp
  • Moved shared frame creation code to new frames.h

Motivation:
This is the second part of efforts to build abstraction among different JVM implements, so that one implementation specific code does not inadvertently pollute unsupported JVMs. This PR focus on stack walker.

Additional Notes:

How to test the change?:

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.
  • JIRA: PROF-13889

Unsure? Have a question? Request a review!

@dd-octo-sts
Copy link
Copy Markdown

dd-octo-sts bot commented Apr 2, 2026

Scan-Build Report

User:runner@runnervm727z3
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 all
Clang Version:Ubuntu clang version 18.1.3 (1ubuntu1)
Date:Wed Apr 8 15:35:53 2026

Bug Summary

Bug TypeQuantityDisplay?
All Bugs1
Logic error
Stack address stored into global variable1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Logic errorStack address stored into global variablehotspotSupport.cppwalkVM70037

@zhengyu123 zhengyu123 changed the title v0 WIP: Refactor stackwalker Apr 2, 2026
@dd-octo-sts
Copy link
Copy Markdown

dd-octo-sts bot commented Apr 2, 2026

CI Test Results

Run: #24143940840 | Commit: 10db83e | Duration: 27m 54s (longest job)

All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - - -
8-ibm - - -
8-j9 - -
8-librca - -
8-orcl - - -
11 - - -
11-j9 - -
11-librca - -
17 - -
17-graal - -
17-j9 - -
17-librca - -
21 - -
21-graal - -
21-librca - -
25 - -
25-graal - -
25-librca - -

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-04-08 16:11:51 UTC

@zhengyu123 zhengyu123 changed the title WIP: Refactor stackwalker Refactor stackwalker Apr 7, 2026
@zhengyu123 zhengyu123 marked this pull request as ready for review April 7, 2026 15:40
@zhengyu123 zhengyu123 requested a review from a team as a code owner April 7, 2026 15:40
@zhengyu123 zhengyu123 requested review from jbachorik and rkennke April 7, 2026 15:40
Copy link
Copy Markdown
Collaborator

@jbachorik jbachorik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Review generated by Claude Sonnet (AI assistant) on behalf of @jbachorik . All findings verified against the current state of the PR.


Summary: The refactoring is mostly mechanical code movement and generally clean. There are 2 correctness bugs introduced during the extraction, plus 4 dead-code leftovers. Findings below, roughly by severity.


Additionally (line not in diff context):

profiler.h lines 114–117 + constructor init: _stubs_lock, _runtime_stubs, _call_stub_begin, _call_stub_end are still declared in Profiler and initialised in its constructor, but every usage was removed from profiler.cpp in this PR — all stub routing moved to JitCodeCache. These four fields are now dead weight. The alignment comment on line 63 (// _class_map_lock, _locks[], and _stubs_lock) should also be updated once _stubs_lock is removed.

Copy link
Copy Markdown
Collaborator

@jbachorik jbachorik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Second review pass (ivoanjo lens) by Claude Sonnet on behalf of @jbachorik. All findings verified against the current state of the PR.

Six additional findings: 3 dead-code items, 1 mode inconsistency, 1 doc drift, 1 minor atomics issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants