@@ -45,9 +45,15 @@ static bool isVmRuntimeEntry(const char* blob_name) {
45
45
|| strncmp (blob_name, " _Z22post_allocation_notify" , 26 ) == 0
46
46
|| strncmp (blob_name, " _ZN11OptoRuntime" , 16 ) == 0
47
47
|| strncmp (blob_name, " _ZN8Runtime1" , 12 ) == 0
48
+ || strncmp (blob_name, " _ZN13SharedRuntime" , 18 ) == 0
48
49
|| strncmp (blob_name, " _ZN18InterpreterRuntime" , 23 ) == 0 ;
49
50
}
50
51
52
+ static bool isZingRuntimeEntry (const char * blob_name) {
53
+ return strncmp (blob_name, " _ZN14DolphinRuntime" , 19 ) == 0
54
+ || strncmp (blob_name, " _ZN37JvmtiSampledObjectAllocEventCollector" , 42 ) == 0 ;
55
+ }
56
+
51
57
static bool isZeroInterpreterMethod (const char * blob_name) {
52
58
return strncmp (blob_name, " _ZN15ZeroInterpreter" , 20 ) == 0
53
59
|| strncmp (blob_name, " _ZN19BytecodeInterpreter3run" , 28 ) == 0 ;
@@ -83,6 +89,10 @@ static bool isOpenJ9GcAlloc(const char* blob_name) {
83
89
return strncmp (blob_name, " J9Allocate" , 10 ) == 0 ;
84
90
}
85
91
92
+ static bool isOpenJ9JvmtiAlloc (const char * blob_name) {
93
+ return strcmp (blob_name, " jvmtiHookSampledObjectAlloc" ) == 0 ;
94
+ }
95
+
86
96
static bool isCompilerEntry (const char * blob_name) {
87
97
return strncmp (blob_name, " _ZN13CompileBroker25invoke_compiler_on_method" , 45 ) == 0 ;
88
98
}
@@ -104,13 +114,6 @@ bool VM::init(JavaVM* vm, bool attach) {
104
114
return false ;
105
115
}
106
116
107
- Dl_info dl_info;
108
- if (dladdr ((const void *)resolveMethodId, &dl_info) && dl_info.dli_fname != NULL ) {
109
- // Make sure async-profiler DSO cannot be unloaded, since it contains JVM callbacks.
110
- // Don't use ELF NODELETE flag because of https://sourceware.org/bugzilla/show_bug.cgi?id=20839
111
- dlopen (dl_info.dli_fname , RTLD_LAZY | RTLD_NODELETE);
112
- }
113
-
114
117
bool is_hotspot = false ;
115
118
bool is_zero_vm = false ;
116
119
char * prop;
@@ -148,18 +151,18 @@ bool VM::init(JavaVM* vm, bool attach) {
148
151
_freeMemory = (JVM_MemoryFunc)dlsym (libjvm, " JVM_FreeMemory" );
149
152
150
153
Profiler* profiler = Profiler::instance ();
151
- profiler->updateSymbols (false );
154
+ if (VMStructs::libjvm () == NULL ) {
155
+ profiler->updateSymbols (false );
156
+ VMStructs::init (profiler->findLibraryByAddress ((const void *)_asyncGetCallTrace));
157
+ }
152
158
153
159
_openj9 = !is_hotspot && J9Ext::initialize (_jvmti, profiler->resolveSymbol (" j9thread_self" ));
154
160
155
- CodeCache* lib = isOpenJ9 ()
156
- ? profiler->findJvmLibrary (" libj9vm" )
157
- : profiler->findLibraryByAddress ((const void *)_asyncGetCallTrace);
161
+ CodeCache* lib = profiler->findJvmLibrary (" libj9vm" );
158
162
if (lib == NULL ) {
159
163
return false ;
160
164
}
161
165
162
- VMStructs::init (lib);
163
166
if (isOpenJ9 ()) {
164
167
lib->mark (isOpenJ9InterpreterMethod, MARK_INTERPRETER);
165
168
lib->mark (isOpenJ9Resolve, MARK_VM_RUNTIME);
@@ -172,9 +175,15 @@ bool VM::init(JavaVM* vm, bool attach) {
172
175
if (libgc != NULL ) {
173
176
libgc->mark (isOpenJ9GcAlloc, MARK_VM_RUNTIME);
174
177
}
178
+ CodeCache* libjvmti = profiler->findJvmLibrary (" libj9jvmti" );
179
+ if (libjvmti != NULL ) {
180
+ libjvmti->mark (isOpenJ9JvmtiAlloc, MARK_VM_RUNTIME);
181
+ }
175
182
} else {
176
183
lib->mark (isVmRuntimeEntry, MARK_VM_RUNTIME);
177
- if (is_zero_vm) {
184
+ if (isZing ()) {
185
+ lib->mark (isZingRuntimeEntry, MARK_VM_RUNTIME);
186
+ } else if (is_zero_vm) {
178
187
lib->mark (isZeroInterpreterMethod, MARK_INTERPRETER);
179
188
} else {
180
189
lib->mark (isCompilerEntry, MARK_COMPILER_ENTRY);
@@ -239,7 +248,7 @@ bool VM::init(JavaVM* vm, bool attach) {
239
248
// DebugNonSafepoints is automatically enabled with CompiledMethodLoad,
240
249
// otherwise we set the flag manually
241
250
JVMFlag* f = JVMFlag::find (" DebugNonSafepoints" );
242
- if (f != NULL && f->origin () == 0 ) {
251
+ if (f != NULL && f->isDefault () ) {
243
252
f->set (1 );
244
253
}
245
254
}
0 commit comments