Skip to content

Fix continuation metadata lookup and frame alignment - #870

Draft
kaahos wants to merge 2 commits into
mainfrom
paul.fournillon/repro-continuation-metadata-layout
Draft

kaahos wants to merge 2 commits into
mainfrom
paul.fournillon/repro-continuation-metadata-layout

Conversation

@kaahos

@kaahos kaahos commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fix two errors in HotSpot continuation walking:

  • Allow metadata lookup to reach later field groups for the same VM type. The previous type-level continue skipped JavaThread::_cont_entry and StubRoutines::_cont_returnBarrier.
  • Round the exported ContinuationEntry size to two machine words before computing its entry frame pointer.
  • Add eight native regression cases using the production metadata dispatcher and frame-pointer calculation, including missing-metadata and already-aligned controls.

Motivation

On JVM builds exporting continuation metadata, cstack=vmx could discover the entry type size but fail to resolve the current thread's entry, truncating samples at break_cont_entry_null. Fixing that lookup exposes the second error: HotSpot's exported sizeof(ContinuationEntry) can be smaller than its stack allocation. The tested JDK 27 exports 56 bytes and requires 64, so adding the raw size places the frame pointer eight bytes too low.

Additional Notes

The alignment matches HotSpot's shared ContinuationEntry::size() and the entry-frame calculation on both x86 and aarch64. It adds no allocations. Missing metadata remains optional, and already-aligned sizes remain unchanged.

How to test the change?

./.claude/commands/build-and-summarize :ddprof-lib:gtestDebug_continuationMetadata_ut

JAVA_TEST_HOME=/path/to/hotspot-jdk-27 \
  ./.claude/commands/build-and-summarize :ddprof-test:testDebug \
  -Ptests=VirtualThreadWallClockTest.samplesCarrierFramesFromCpuBoundVT -Pskip-gtest

For Datadog employees:

  • This PR doesn't touch code that signs or publishes builds or packages, or handles credentials.
  • JIRA: N/A.

@dd-octo-sts

dd-octo-sts Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #38913801280 | Commit: 47cd98a | Duration: 18m 18s (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-10-16 14:33:53 UTC

This branch has not been deployed

No deployments
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.

1 participant