Skip to content

Commit 56f206e

Browse files
jbachorikclaude
andcommitted
fix(comments): v21 fields absent from vmStructs in all JDK 21-26 builds, not just some distributions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f3c509c commit 56f206e

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

ddprof-lib/src/main/cpp/hotspot/vmStructs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ void VMStructs::verify_offsets() {
290290
// Note: DECLARE_V21_TYPE_FIELD_DO is intentionally excluded here.
291291
// Continuation-related fields (_cont_entry_offset, _cont_return_barrier_addr,
292292
// _cont_entry_return_pc_addr, _cont_entry_parent_offset) are absent from
293-
// gHotSpotVMStructs in many JDK 21-26 distributions; walkVM degrades
293+
// gHotSpotVMStructs in all JDK 21-26 builds: ContinuationEntry was not
294+
// exported in the vmStructs table until JDK 27 (JDK-8378985). walkVM degrades
294295
// gracefully when they are missing.
295296
#define offset_value -1
296297
#define address_value nullptr

ddprof-lib/src/main/cpp/hotspot/vmStructs.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ inline T* cast_to(const void* ptr) {
132132
f(VMContinuationEntry, MATCH_SYMBOLS("ContinuationEntry"))
133133

134134
// Fields for JDK 21+ virtual-thread / continuation support.
135-
// These are NOT reliably exported in gHotSpotVMStructs before JDK 27
136-
// (added via JDK-8378985) and may be absent even on JDK 21-26 in some
137-
// distributions. They are declared and populated the same way as regular
138-
// fields but are intentionally excluded from verify_offsets() assertions
139-
// so that a missing entry causes graceful degradation rather than SIGABRT.
135+
// ContinuationEntry was not exported in gHotSpotVMStructs until JDK 27
136+
// (JDK-8378985), so these fields are absent from the table in all JDK 21-26
137+
// builds and are populated via C++ mangled-symbol fallback instead. They are
138+
// intentionally excluded from verify_offsets() so that a missing entry causes
139+
// graceful degradation rather than SIGABRT.
140140
#define DECLARE_V21_TYPE_FIELD_DO(type_begin, field, field_with_version, type_end) \
141141
type_begin(VMJavaThread, MATCH_SYMBOLS("JavaThread", "Thread")) \
142142
field_with_version(_cont_entry_offset, offset, 21, MAX_VERSION, MATCH_SYMBOLS("_cont_entry")) \
@@ -870,6 +870,10 @@ DECLARE(VMThread)
870870
return VMJavaFrameAnchor::cast(at(_thread_anchor_offset));
871871
}
872872

873+
// Returns the innermost active ContinuationEntry for this thread, or nullptr
874+
// if none exists or ContinuationEntry layout is unavailable (JDK 21-26 without
875+
// vmStructs export). Used by stackWalker to locate the enterSpecial frame
876+
// when crossing the virtual-thread continuation boundary.
873877
VMContinuationEntry* contEntry() {
874878
if (_cont_entry_offset < 0 || VMContinuationEntry::type_size() == 0) return nullptr;
875879
void* ptr = SafeAccess::loadPtr((void**) at(_cont_entry_offset), nullptr);

0 commit comments

Comments
 (0)