Skip to content

Commit ae838ba

Browse files
jbachorikclaude
andauthored
Bump the AP lock to get the walkvm crash fix in (#316)
* Bump the AP lock to get the walkvm crash fix in * Align findFrameDesc API with upstream async-profiler Changed CodeCache::findFrameDesc() to return FrameDesc by value instead of pointer, matching upstream async-profiler API. Updated isSafeToWalk() to work with the new return type. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent dc61549 commit ae838ba

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

ddprof-lib/src/main/cpp/codeCache.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ void CodeCache::setDwarfTable(FrameDesc *table, int length) {
363363
_dwarf_table_length = length;
364364
}
365365

366-
FrameDesc *CodeCache::findFrameDesc(const void *pc) {
366+
FrameDesc CodeCache::findFrameDesc(const void *pc) {
367367
u32 target_loc = (const char *)pc - _text_base;
368368
int low = 0;
369369
int high = _dwarf_table_length - 1;
@@ -375,15 +375,15 @@ FrameDesc *CodeCache::findFrameDesc(const void *pc) {
375375
} else if (_dwarf_table[mid].loc > target_loc) {
376376
high = mid - 1;
377377
} else {
378-
return &_dwarf_table[mid];
378+
return _dwarf_table[mid];
379379
}
380380
}
381381

382382
if (low > 0) {
383-
return &_dwarf_table[low - 1];
383+
return _dwarf_table[low - 1];
384384
} else if (target_loc - _plt_offset < _plt_size) {
385-
return &FrameDesc::empty_frame;
385+
return FrameDesc::empty_frame;
386386
} else {
387-
return &FrameDesc::default_frame;
387+
return FrameDesc::default_frame;
388388
}
389389
}

ddprof-lib/src/main/cpp/codeCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class CodeCache {
202202
std::vector<const void *> &symbols);
203203

204204
void setDwarfTable(FrameDesc *table, int length);
205-
FrameDesc *findFrameDesc(const void *pc);
205+
FrameDesc findFrameDesc(const void *pc);
206206

207207
long long memoryUsage() {
208208
return _capacity * sizeof(CodeBlob *) + _count * sizeof(NativeFunc);

ddprof-lib/src/main/cpp/vmStructs_dd.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,11 @@ namespace ddprof {
328328
}
329329

330330
bool VMStructs_::isSafeToWalk(uintptr_t pc) {
331-
return !(_unsafe_to_walk.contains((const void *)pc) &&
332-
_unsafe_to_walk.findFrameDesc((const void *)pc));
331+
// Check if PC is in the unsafe-to-walk code region
332+
// Note: findFrameDesc now returns by value instead of pointer, but it always returns
333+
// a valid FrameDesc (either from table or default_frame), so the old pointer check
334+
// was always true. The effective logic is simply checking if pc is in _unsafe_to_walk.
335+
return !_unsafe_to_walk.contains((const void *)pc);
333336
}
334337

335338
void VMStructs_::NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,

gradle/lock.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ap.branch=dd/master
2-
ap.commit=114bd43e91b910035978631492b46568989a6760
2+
ap.commit=cf49c3a568b1884285dfe92a9992606af2a62040
33

44
ctx_branch=main
55
ctx_commit=b33673d801b85a6c38fa0e9f1a139cb246737ce8

0 commit comments

Comments
 (0)