39 //
40 // Forward Declarations
41 //
42
43 class JvmtiEnv;
44 class JvmtiThreadState;
45 class JvmtiRawMonitor; // for jvmtiEnv.hpp
46 class JvmtiEventControllerPrivate;
47 class JvmtiTagMap;
48
49
50
51 // One JvmtiEnv object is created per jvmti attachment;
52 // done via JNI GetEnv() call. Multiple attachments are
53 // allowed in jvmti.
54
55 class JvmtiEnvBase : public CHeapObj<mtInternal> {
56
57 private:
58
59 static JvmtiEnvBase* _head_environment; // head of environment list
60
61 static bool _globally_initialized;
62 static jvmtiPhase _phase;
63 static volatile int _dying_thread_env_iteration_count;
64
65 public:
66
67 enum {
68 JDK15_JVMTI_VERSION = JVMTI_VERSION_1_0 + 33, /* version: 1.0.33 */
69 JDK16_JVMTI_VERSION = JVMTI_VERSION_1_1 + 102, /* version: 1.1.102 */
70 JDK17_JVMTI_VERSION = JVMTI_VERSION_1_2 + 1 /* version: 1.2.1 */
71 };
72
73 static jvmtiPhase get_phase() { return _phase; }
74 static void set_phase(jvmtiPhase phase) { _phase = phase; }
75 static bool is_vm_live() { return _phase == JVMTI_PHASE_LIVE; }
76
77 static void entering_dying_thread_env_iteration() { ++_dying_thread_env_iteration_count; }
78 static void leaving_dying_thread_env_iteration() { --_dying_thread_env_iteration_count; }
79 static bool is_inside_dying_thread_env_iteration(){ return _dying_thread_env_iteration_count > 0; }
112 void set_env_local_storage(const void* data) { _env_local_storage = data; }
113 const void* get_env_local_storage() { return _env_local_storage; }
114
115 void record_class_file_load_hook_enabled();
116 void record_first_time_class_file_load_hook_enabled();
117
118 char** get_native_method_prefixes() { return _native_method_prefixes; }
119 int get_native_method_prefix_count() { return _native_method_prefix_count; }
120 jvmtiError set_native_method_prefixes(jint prefix_count, char** prefixes);
121
122 private:
123 friend class JvmtiEventControllerPrivate;
124 void initialize();
125 void set_event_callbacks(const jvmtiEventCallbacks* callbacks, jint size_of_callbacks);
126 static void globally_initialize();
127 static void periodic_clean_up();
128
129 friend class JvmtiEnvIterator;
130 JvmtiEnv* next_environment() { return (JvmtiEnv*)_next; }
131 void set_next_environment(JvmtiEnvBase* env) { _next = env; }
132 static JvmtiEnv* head_environment() { return (JvmtiEnv*)_head_environment; }
133
134 public:
135
136 bool is_valid();
137
138 bool use_version_1_0_semantics(); // agent asked for version 1.0
139 bool use_version_1_1_semantics(); // agent asked for version 1.1
140 bool use_version_1_2_semantics(); // agent asked for version 1.2
141
142 bool is_retransformable() { return _is_retransformable; }
143
144 static ByteSize jvmti_external_offset() {
145 return byte_offset_of(JvmtiEnvBase, _jvmti_external);
146 };
147
148 static JvmtiEnv* JvmtiEnv_from_jvmti_env(jvmtiEnv *env) {
149 return (JvmtiEnv*)((intptr_t)env - in_bytes(jvmti_external_offset()));
150 };
151
152 jvmtiCapabilities *get_capabilities() { return &_current_capabilities; }
|
39 //
40 // Forward Declarations
41 //
42
43 class JvmtiEnv;
44 class JvmtiThreadState;
45 class JvmtiRawMonitor; // for jvmtiEnv.hpp
46 class JvmtiEventControllerPrivate;
47 class JvmtiTagMap;
48
49
50
51 // One JvmtiEnv object is created per jvmti attachment;
52 // done via JNI GetEnv() call. Multiple attachments are
53 // allowed in jvmti.
54
55 class JvmtiEnvBase : public CHeapObj<mtInternal> {
56
57 private:
58
59 #if INCLUDE_JVMTI
60 static JvmtiEnvBase* _head_environment; // head of environment list
61 #endif // INCLUDE_JVMTI
62
63 static bool _globally_initialized;
64 static jvmtiPhase _phase;
65 static volatile int _dying_thread_env_iteration_count;
66
67 public:
68
69 enum {
70 JDK15_JVMTI_VERSION = JVMTI_VERSION_1_0 + 33, /* version: 1.0.33 */
71 JDK16_JVMTI_VERSION = JVMTI_VERSION_1_1 + 102, /* version: 1.1.102 */
72 JDK17_JVMTI_VERSION = JVMTI_VERSION_1_2 + 1 /* version: 1.2.1 */
73 };
74
75 static jvmtiPhase get_phase() { return _phase; }
76 static void set_phase(jvmtiPhase phase) { _phase = phase; }
77 static bool is_vm_live() { return _phase == JVMTI_PHASE_LIVE; }
78
79 static void entering_dying_thread_env_iteration() { ++_dying_thread_env_iteration_count; }
80 static void leaving_dying_thread_env_iteration() { --_dying_thread_env_iteration_count; }
81 static bool is_inside_dying_thread_env_iteration(){ return _dying_thread_env_iteration_count > 0; }
114 void set_env_local_storage(const void* data) { _env_local_storage = data; }
115 const void* get_env_local_storage() { return _env_local_storage; }
116
117 void record_class_file_load_hook_enabled();
118 void record_first_time_class_file_load_hook_enabled();
119
120 char** get_native_method_prefixes() { return _native_method_prefixes; }
121 int get_native_method_prefix_count() { return _native_method_prefix_count; }
122 jvmtiError set_native_method_prefixes(jint prefix_count, char** prefixes);
123
124 private:
125 friend class JvmtiEventControllerPrivate;
126 void initialize();
127 void set_event_callbacks(const jvmtiEventCallbacks* callbacks, jint size_of_callbacks);
128 static void globally_initialize();
129 static void periodic_clean_up();
130
131 friend class JvmtiEnvIterator;
132 JvmtiEnv* next_environment() { return (JvmtiEnv*)_next; }
133 void set_next_environment(JvmtiEnvBase* env) { _next = env; }
134 static JvmtiEnv* head_environment() {
135 JVMTI_ONLY(return (JvmtiEnv*)_head_environment);
136 NOT_JVMTI(return NULL);
137 }
138
139 public:
140
141 bool is_valid();
142
143 bool use_version_1_0_semantics(); // agent asked for version 1.0
144 bool use_version_1_1_semantics(); // agent asked for version 1.1
145 bool use_version_1_2_semantics(); // agent asked for version 1.2
146
147 bool is_retransformable() { return _is_retransformable; }
148
149 static ByteSize jvmti_external_offset() {
150 return byte_offset_of(JvmtiEnvBase, _jvmti_external);
151 };
152
153 static JvmtiEnv* JvmtiEnv_from_jvmti_env(jvmtiEnv *env) {
154 return (JvmtiEnv*)((intptr_t)env - in_bytes(jvmti_external_offset()));
155 };
156
157 jvmtiCapabilities *get_capabilities() { return &_current_capabilities; }
|