Skip to content

Commit 066245c

Browse files
committed
Roman's comments
1 parent a1ae1ce commit 066245c

4 files changed

Lines changed: 15 additions & 10 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,11 +690,11 @@ enum JVMJavaThreadState {
690690
};
691691

692692
DECLARE(VMThread)
693+
friend class JVMThread;
693694
public:
694695
static void* initialize(jthread thread);
695696

696697
static inline VMThread* current();
697-
static inline int nativeThreadId(JNIEnv* jni, jthread thread);
698698
static inline VMThread* fromJavaThread(JNIEnv* env, jthread thread);
699699
static ExecutionMode getExecutionMode();
700700
static OSThreadState getOSThreadState();
@@ -782,6 +782,8 @@ DECLARE(VMThread)
782782
}
783783

784784
inline VMMethod* compiledMethod();
785+
private:
786+
static inline int nativeThreadId(JNIEnv* jni, jthread thread);
785787
DECLARE_END
786788

787789
DECLARE(VMConstMethod)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ VMThread* VMThread::fromJavaThread(JNIEnv* env, jthread thread) {
2222
}
2323

2424
int VMThread::nativeThreadId(JNIEnv* jni, jthread thread) {
25-
// assert(_has_native_thread_id);
2625
if (_has_native_thread_id) {
2726
VMThread* vm_thread = fromJavaThread(jni, thread);
2827
return vm_thread != NULL ? vm_thread->osThreadId() : -1;

ddprof-lib/src/main/cpp/j9/j9Ext.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ static inline int sanitizeJ9FrameType(jint j9_type) {
7171
}
7272

7373
class J9Ext {
74+
friend class JVMThread;
75+
friend class J9WallClock;
7476
private:
7577
static jvmtiEnv *_jvmti;
7678

@@ -119,14 +121,6 @@ class J9Ext {
119121

120122
static bool initialize(jvmtiEnv *jvmti, const void *j9thread_self);
121123

122-
static int GetOSThreadID(jthread thread) {
123-
jlong thread_id;
124-
return JVMTI_EXT(_GetOSThreadID, jthread, jlong *)(_jvmti, thread,
125-
&thread_id) == 0
126-
? (int)thread_id
127-
: -1;
128-
}
129-
130124
static JNIEnv *GetJ9vmThread(jthread thread) {
131125
JNIEnv *result;
132126
return JVMTI_EXT(_GetJ9vmThread, jthread, JNIEnv **)(_jvmti, thread,
@@ -176,6 +170,15 @@ class J9Ext {
176170
}
177171

178172
static int InstrumentableObjectAlloc_id;
173+
174+
private:
175+
static int GetOSThreadID(jthread thread) {
176+
jlong thread_id;
177+
return JVMTI_EXT(_GetOSThreadID, jthread, jlong *)(_jvmti, thread,
178+
&thread_id) == 0
179+
? (int)thread_id
180+
: -1;
181+
}
179182
};
180183

181184
#endif // _J9_J9EXT_H

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "stackFrame.h"
1313
#include "symbols.h"
1414
#include "hotspot/vmStructs.inline.h"
15+
#include "jvmThread.h"
1516
#include "thread.h"
1617

1718

0 commit comments

Comments
 (0)