Skip to content

Commit

Permalink
async-profiler#993: Filter native frames in allocation profile: OpenJ…
Browse files Browse the repository at this point in the history
…9 and stripped symbols
  • Loading branch information
apangin committed Sep 15, 2024
1 parent e6a1581 commit c299592
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/codeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ void CodeCache::mark(NamePredicate predicate, char value) {
NativeFunc::mark(blob_name, value);
}
}

if (value == MARK_VM_RUNTIME && _name != NULL) {
// In case a library has no debug symbols
NativeFunc::mark(_name, value);
}
}

CodeBlob* CodeCache::findBlob(const char* name) {
Expand Down
21 changes: 20 additions & 1 deletion src/vmEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,24 @@ static bool isOpenJ9JitStub(const char* blob_name) {
blob_name += 3;
return strcmp(blob_name, "NewObject") == 0
|| strcmp(blob_name, "NewArray") == 0
|| strcmp(blob_name, "ANewArray") == 0;
|| strcmp(blob_name, "ANewArray") == 0
|| strcmp(blob_name, "AMultiNewArray") == 0;
}
return false;
}

static bool isOpenJ9Resolve(const char* blob_name) {
return strncmp(blob_name, "resolve", 7) == 0;
}

static bool isOpenJ9JitAlloc(const char* blob_name) {
return strncmp(blob_name, "old_", 4) == 0;
}

static bool isOpenJ9GcAlloc(const char* blob_name) {
return strncmp(blob_name, "J9Allocate", 10) == 0;
}

static bool isCompilerEntry(const char* blob_name) {
return strncmp(blob_name, "_ZN13CompileBroker25invoke_compiler_on_method", 45) == 0;
}
Expand Down Expand Up @@ -153,9 +166,15 @@ bool VM::init(JavaVM* vm, bool attach) {
VMStructs::init(lib);
if (isOpenJ9()) {
lib->mark(isOpenJ9InterpreterMethod, MARK_INTERPRETER);
lib->mark(isOpenJ9Resolve, MARK_VM_RUNTIME);
CodeCache* libjit = profiler->findJvmLibrary("libj9jit");
if (libjit != NULL) {
libjit->mark(isOpenJ9JitStub, MARK_INTERPRETER);
libjit->mark(isOpenJ9JitAlloc, MARK_VM_RUNTIME);
}
CodeCache* libgc = profiler->findJvmLibrary("libj9gc");
if (libgc != NULL) {
libgc->mark(isOpenJ9GcAlloc, MARK_VM_RUNTIME);
}
} else {
lib->mark(isVmRuntimeEntry, MARK_VM_RUNTIME);
Expand Down

0 comments on commit c299592

Please sign in to comment.