author | dcubed |
Wed, 22 Nov 2017 17:54:50 -0800 | |
changeset 48105 | 8d15b1369c7a |
parent 47580 | 96392e113a0a |
child 48157 | 7c4d43c26352 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42895
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4761
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4761
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4761
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_PRIMS_JVMTITHREADSTATE_HPP |
26 |
#define SHARE_VM_PRIMS_JVMTITHREADSTATE_HPP |
|
27 |
||
28 |
#include "jvmtifiles/jvmti.h" |
|
29 |
#include "memory/allocation.hpp" |
|
30 |
#include "memory/allocation.inline.hpp" |
|
31 |
#include "prims/jvmtiEventController.hpp" |
|
32 |
#include "runtime/thread.hpp" |
|
33 |
#include "utilities/growableArray.hpp" |
|
1 | 34 |
|
35 |
// |
|
36 |
// Forward Declarations |
|
37 |
// |
|
38 |
||
39 |
class JvmtiEnvBase; |
|
40 |
class JvmtiEnvThreadState; |
|
41 |
class JvmtiDynamicCodeEventCollector; |
|
42 |
||
43 |
enum JvmtiClassLoadKind { |
|
44 |
jvmti_class_load_kind_load = 100, |
|
45 |
jvmti_class_load_kind_retransform, |
|
46 |
jvmti_class_load_kind_redefine |
|
47 |
}; |
|
48 |
||
49 |
/////////////////////////////////////////////////////////////// |
|
50 |
// |
|
51 |
// class JvmtiEnvThreadStateIterator |
|
52 |
// |
|
53 |
// The only safe means of iterating through the JvmtiEnvThreadStates |
|
54 |
// in a JvmtiThreadState. |
|
55 |
// Note that this iteratation includes invalid environments pending |
|
56 |
// deallocation -- in fact, some uses depend on this behavior. |
|
57 |
// |
|
58 |
class JvmtiEnvThreadStateIterator : public StackObj { |
|
59 |
private: |
|
60 |
JvmtiThreadState* state; |
|
61 |
public: |
|
62 |
JvmtiEnvThreadStateIterator(JvmtiThreadState* thread_state); |
|
63 |
~JvmtiEnvThreadStateIterator(); |
|
64 |
JvmtiEnvThreadState* first(); |
|
65 |
JvmtiEnvThreadState* next(JvmtiEnvThreadState* ets); |
|
66 |
}; |
|
67 |
||
68 |
||
69 |
/////////////////////////////////////////////////////////////// |
|
70 |
// |
|
71 |
// class JvmtiThreadState |
|
72 |
// |
|
73 |
// The Jvmti state for each thread (across all JvmtiEnv): |
|
74 |
// 1. Local table of enabled events. |
|
13195 | 75 |
class JvmtiThreadState : public CHeapObj<mtInternal> { |
1 | 76 |
private: |
77 |
friend class JvmtiEnv; |
|
78 |
JavaThread *_thread; |
|
79 |
bool _hide_single_stepping; |
|
80 |
bool _pending_step_for_popframe; |
|
81 |
bool _pending_step_for_earlyret; |
|
82 |
int _hide_level; |
|
83 |
||
42895
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
84 |
public: |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
85 |
enum ExceptionState { |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
86 |
ES_CLEARED, |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
87 |
ES_DETECTED, |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
88 |
ES_CAUGHT |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
89 |
}; |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
90 |
|
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
91 |
private: |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
92 |
ExceptionState _exception_state; |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
93 |
|
1 | 94 |
// Used to send class being redefined/retransformed and kind of transform |
95 |
// info to the class file load hook event handler. |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
96 |
Klass* _class_being_redefined; |
1 | 97 |
JvmtiClassLoadKind _class_load_kind; |
98 |
||
99 |
// This is only valid when is_interp_only_mode() returns true |
|
100 |
int _cur_stack_depth; |
|
101 |
||
102 |
JvmtiThreadEventEnable _thread_event_enable; |
|
103 |
||
104 |
// for support of JvmtiEnvThreadState |
|
105 |
JvmtiEnvThreadState* _head_env_thread_state; |
|
106 |
||
107 |
// doubly-linked linear list of active thread state |
|
108 |
// needed in order to iterate the list without holding Threads_lock |
|
109 |
static JvmtiThreadState *_head; |
|
110 |
JvmtiThreadState *_next; |
|
111 |
JvmtiThreadState *_prev; |
|
112 |
||
113 |
// holds the current dynamic code event collector, NULL if no event collector in use |
|
114 |
JvmtiDynamicCodeEventCollector* _dynamic_code_event_collector; |
|
115 |
// holds the current vm object alloc event collector, NULL if no event collector in use |
|
116 |
JvmtiVMObjectAllocEventCollector* _vm_object_alloc_event_collector; |
|
117 |
||
118 |
// Should only be created by factory methods |
|
119 |
JvmtiThreadState(JavaThread *thread); |
|
120 |
||
121 |
friend class JvmtiEnvThreadStateIterator; |
|
122 |
inline JvmtiEnvThreadState* head_env_thread_state(); |
|
123 |
inline void set_head_env_thread_state(JvmtiEnvThreadState* ets); |
|
124 |
||
125 |
public: |
|
126 |
~JvmtiThreadState(); |
|
127 |
||
128 |
// is event_type enabled and usable for this thread in any enviroments? |
|
129 |
bool is_enabled(jvmtiEvent event_type) { |
|
130 |
return _thread_event_enable.is_enabled(event_type); |
|
131 |
} |
|
132 |
||
133 |
JvmtiThreadEventEnable *thread_event_enable() { |
|
134 |
return &_thread_event_enable; |
|
135 |
} |
|
136 |
||
137 |
// Must only be called in situations where the state is for the current thread and |
|
138 |
// the environment can not go away. To be safe, the returned JvmtiEnvThreadState |
|
139 |
// must be used in such a way as there can be no intervening safepoints. |
|
140 |
inline JvmtiEnvThreadState* env_thread_state(JvmtiEnvBase *env); |
|
141 |
||
142 |
static void periodic_clean_up(); |
|
143 |
||
144 |
void add_env(JvmtiEnvBase *env); |
|
145 |
||
146 |
// Used by the interpreter for fullspeed debugging support |
|
147 |
bool is_interp_only_mode() { return _thread->is_interp_only_mode(); } |
|
148 |
void enter_interp_only_mode(); |
|
149 |
void leave_interp_only_mode(); |
|
150 |
||
151 |
// access to the linked list of all JVMTI thread states |
|
152 |
static JvmtiThreadState *first() { |
|
153 |
assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check"); |
|
154 |
return _head; |
|
155 |
} |
|
156 |
||
157 |
JvmtiThreadState *next() { |
|
158 |
return _next; |
|
159 |
} |
|
160 |
||
161 |
// Current stack depth is only valid when is_interp_only_mode() returns true. |
|
162 |
// These functions should only be called at a safepoint - usually called from same thread. |
|
163 |
// Returns the number of Java activations on the stack. |
|
164 |
int cur_stack_depth(); |
|
165 |
void invalidate_cur_stack_depth(); |
|
166 |
void incr_cur_stack_depth(); |
|
167 |
void decr_cur_stack_depth(); |
|
168 |
||
169 |
int count_frames(); |
|
170 |
||
171 |
inline JavaThread *get_thread() { return _thread; } |
|
42895
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
172 |
|
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
173 |
inline bool is_exception_detected() { return _exception_state == ES_DETECTED; } |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
174 |
inline bool is_exception_caught() { return _exception_state == ES_CAUGHT; } |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
175 |
|
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
176 |
inline void set_exception_detected() { _exception_state = ES_DETECTED; } |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
177 |
inline void set_exception_caught() { _exception_state = ES_CAUGHT; } |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
178 |
|
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
179 |
inline void clear_exception_state() { _exception_state = ES_CLEARED; } |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
180 |
|
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
181 |
// We need to save and restore exception state inside JvmtiEventMark |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
182 |
inline ExceptionState get_exception_state() { return _exception_state; } |
c97cd79636ec
8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents:
13975
diff
changeset
|
183 |
inline void restore_exception_state(ExceptionState state) { _exception_state = state; } |
1 | 184 |
|
185 |
inline void clear_hide_single_stepping() { |
|
186 |
if (_hide_level > 0) { |
|
187 |
_hide_level--; |
|
188 |
} else { |
|
189 |
assert(_hide_single_stepping, "hide_single_stepping is out of phase"); |
|
190 |
_hide_single_stepping = false; |
|
191 |
} |
|
192 |
} |
|
193 |
inline bool hide_single_stepping() { return _hide_single_stepping; } |
|
194 |
inline void set_hide_single_stepping() { |
|
195 |
if (_hide_single_stepping) { |
|
196 |
_hide_level++; |
|
197 |
} else { |
|
198 |
assert(_hide_level == 0, "hide_level is out of phase"); |
|
199 |
_hide_single_stepping = true; |
|
200 |
} |
|
201 |
} |
|
202 |
||
203 |
// Step pending flag is set when PopFrame is called and it is cleared |
|
204 |
// when step for the Pop Frame is completed. |
|
205 |
// This logic is used to distinguish b/w step for pop frame and repeat step. |
|
206 |
void set_pending_step_for_popframe() { _pending_step_for_popframe = true; } |
|
207 |
void clr_pending_step_for_popframe() { _pending_step_for_popframe = false; } |
|
208 |
bool is_pending_step_for_popframe() { return _pending_step_for_popframe; } |
|
209 |
void process_pending_step_for_popframe(); |
|
210 |
||
211 |
// Step pending flag is set when ForceEarlyReturn is called and it is cleared |
|
212 |
// when step for the ForceEarlyReturn is completed. |
|
213 |
// This logic is used to distinguish b/w step for early return and repeat step. |
|
214 |
void set_pending_step_for_earlyret() { _pending_step_for_earlyret = true; } |
|
215 |
void clr_pending_step_for_earlyret() { _pending_step_for_earlyret = false; } |
|
216 |
bool is_pending_step_for_earlyret() { return _pending_step_for_earlyret; } |
|
217 |
void process_pending_step_for_earlyret(); |
|
218 |
||
219 |
// Setter and getter method is used to send redefined class info |
|
220 |
// when class file load hook event is posted. |
|
221 |
// It is set while loading redefined class and cleared before the |
|
222 |
// class file load hook event is posted. |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
223 |
inline void set_class_being_redefined(Klass* k, JvmtiClassLoadKind kind) { |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
224 |
_class_being_redefined = k; |
1 | 225 |
_class_load_kind = kind; |
226 |
} |
|
227 |
||
228 |
inline void clear_class_being_redefined() { |
|
229 |
_class_being_redefined = NULL; |
|
230 |
_class_load_kind = jvmti_class_load_kind_load; |
|
231 |
} |
|
232 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
233 |
inline Klass* get_class_being_redefined() { |
1 | 234 |
return _class_being_redefined; |
235 |
} |
|
236 |
||
237 |
inline JvmtiClassLoadKind get_class_load_kind() { |
|
238 |
return _class_load_kind; |
|
239 |
} |
|
240 |
||
241 |
// RedefineClasses support |
|
242 |
// The bug 6214132 caused the verification to fail. |
|
243 |
// |
|
244 |
// Below is the detailed description of the fix approach taken: |
|
245 |
// 1. What's done in RedefineClasses() before verification: |
|
246 |
// a) A reference to the class being redefined (_the_class) and a |
|
247 |
// reference to new version of the class (_scratch_class) are |
|
248 |
// saved here for use during the bytecode verification phase of |
|
249 |
// RedefineClasses. See RedefineVerifyMark for how these fields |
|
250 |
// are managed. |
|
251 |
// b) The _java_mirror field from _the_class is copied to the |
|
252 |
// _java_mirror field in _scratch_class. This means that a jclass |
|
253 |
// returned for _the_class or _scratch_class will refer to the |
|
254 |
// same Java mirror. The verifier will see the "one true mirror" |
|
255 |
// for the class being verified. |
|
256 |
// 2. What is done at verification: |
|
257 |
// When the verifier makes calls into the VM to ask questions about |
|
258 |
// the class being verified, it will pass the jclass to JVM_* functions. |
|
259 |
// The jclass is always pointing to the mirror of _the_class. |
|
260 |
// ~28 JVM_* functions called by the verifier for the information |
|
261 |
// about CP entries and klass structure should check the jvmtiThreadState |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
262 |
// info about equivalent klass versions and use it to replace a Klass* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
263 |
// of _the_class with a Klass* of _scratch_class. The function |
1 | 264 |
// class_to_verify_considering_redefinition() must be called for it. |
265 |
// |
|
266 |
// Note again, that this redirection happens only for the verifier thread. |
|
267 |
// Other threads have very small overhead by checking the existence |
|
268 |
// of the jvmtiThreadSate and the information about klasses equivalence. |
|
269 |
// No JNI functions need to be changed, they don't reference the klass guts. |
|
270 |
// The JavaThread pointer is already available in all JVM_* functions |
|
271 |
// used by the verifier, so there is no extra performance issue with it. |
|
272 |
||
273 |
private: |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
274 |
Klass* _the_class_for_redefinition_verification; |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
275 |
Klass* _scratch_class_for_redefinition_verification; |
1 | 276 |
|
277 |
public: |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
278 |
inline void set_class_versions_map(Klass* the_class, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
279 |
Klass* scratch_class) { |
1 | 280 |
_the_class_for_redefinition_verification = the_class; |
281 |
_scratch_class_for_redefinition_verification = scratch_class; |
|
282 |
} |
|
283 |
||
284 |
inline void clear_class_versions_map() { set_class_versions_map(NULL, NULL); } |
|
285 |
||
286 |
static inline |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
287 |
Klass* class_to_verify_considering_redefinition(Klass* klass, |
1 | 288 |
JavaThread *thread) { |
289 |
JvmtiThreadState *state = thread->jvmti_thread_state(); |
|
290 |
if (state != NULL && state->_the_class_for_redefinition_verification != NULL) { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
291 |
if (state->_the_class_for_redefinition_verification == klass) { |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
292 |
klass = state->_scratch_class_for_redefinition_verification; |
1 | 293 |
} |
294 |
} |
|
295 |
return klass; |
|
296 |
} |
|
297 |
||
298 |
// Todo: get rid of this! |
|
299 |
private: |
|
300 |
bool _debuggable; |
|
301 |
public: |
|
302 |
// Should the thread be enumerated by jvmtiInternal::GetAllThreads? |
|
303 |
bool is_debuggable() { return _debuggable; } |
|
304 |
// If a thread cannot be suspended (has no valid last_java_frame) then it gets marked !debuggable |
|
305 |
void set_debuggable(bool debuggable) { _debuggable = debuggable; } |
|
306 |
||
307 |
public: |
|
308 |
||
309 |
bool may_be_walked(); |
|
310 |
||
311 |
// Thread local event collector setter and getter methods. |
|
312 |
JvmtiDynamicCodeEventCollector* get_dynamic_code_event_collector() { |
|
313 |
return _dynamic_code_event_collector; |
|
314 |
} |
|
315 |
JvmtiVMObjectAllocEventCollector* get_vm_object_alloc_event_collector() { |
|
316 |
return _vm_object_alloc_event_collector; |
|
317 |
} |
|
318 |
void set_dynamic_code_event_collector(JvmtiDynamicCodeEventCollector* collector) { |
|
319 |
_dynamic_code_event_collector = collector; |
|
320 |
} |
|
321 |
void set_vm_object_alloc_event_collector(JvmtiVMObjectAllocEventCollector* collector) { |
|
322 |
_vm_object_alloc_event_collector = collector; |
|
323 |
} |
|
324 |
||
325 |
||
326 |
// |
|
327 |
// Frame routines |
|
328 |
// |
|
329 |
||
330 |
public: |
|
331 |
||
332 |
// true when the thread was suspended with a pointer to the last Java frame. |
|
333 |
bool has_last_frame() { return _thread->has_last_Java_frame(); } |
|
334 |
||
335 |
void update_for_pop_top_frame(); |
|
336 |
||
337 |
// already holding JvmtiThreadState_lock - retrieve or create JvmtiThreadState |
|
2135
f82c3012ec86
6800721: 3/4 JavaThread::jvmti_thread_state() and JvmtiThreadState::state_for() robustness
dcubed
parents:
2134
diff
changeset
|
338 |
// Can return NULL if JavaThread is exiting. |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47580
diff
changeset
|
339 |
static JvmtiThreadState *state_for_while_locked(JavaThread *thread); |
1 | 340 |
// retrieve or create JvmtiThreadState |
2135
f82c3012ec86
6800721: 3/4 JavaThread::jvmti_thread_state() and JvmtiThreadState::state_for() robustness
dcubed
parents:
2134
diff
changeset
|
341 |
// Can return NULL if JavaThread is exiting. |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47580
diff
changeset
|
342 |
static JvmtiThreadState *state_for(JavaThread *thread); |
1 | 343 |
|
344 |
// JVMTI ForceEarlyReturn support |
|
345 |
||
346 |
// This is set to earlyret_pending to signal that top Java frame |
|
347 |
// should be returned immediately |
|
348 |
public: |
|
349 |
int _earlyret_state; |
|
350 |
TosState _earlyret_tos; |
|
351 |
jvalue _earlyret_value; |
|
352 |
oop _earlyret_oop; // Used to return an oop result into Java code from |
|
353 |
// ForceEarlyReturnObject, GC-preserved |
|
354 |
||
355 |
// Setting and clearing earlyret_state |
|
356 |
// earlyret_pending indicates that a ForceEarlyReturn() has been |
|
357 |
// requested and not yet been completed. |
|
358 |
public: |
|
359 |
enum EarlyretState { |
|
360 |
earlyret_inactive = 0, |
|
361 |
earlyret_pending = 1 |
|
362 |
}; |
|
363 |
||
364 |
void set_earlyret_pending(void) { _earlyret_state = earlyret_pending; } |
|
365 |
void clr_earlyret_pending(void) { _earlyret_state = earlyret_inactive; } |
|
366 |
bool is_earlyret_pending(void) { return (_earlyret_state == earlyret_pending); } |
|
367 |
||
368 |
TosState earlyret_tos() { return _earlyret_tos; } |
|
369 |
oop earlyret_oop() const { return _earlyret_oop; } |
|
370 |
void set_earlyret_oop (oop x) { _earlyret_oop = x; } |
|
371 |
jvalue earlyret_value() { return _earlyret_value; } |
|
372 |
void set_earlyret_value(jvalue val, TosState tos) { _earlyret_tos = tos; _earlyret_value = val; } |
|
373 |
void clr_earlyret_value() { _earlyret_tos = ilgl; _earlyret_value.j = 0L; } |
|
374 |
||
375 |
static ByteSize earlyret_state_offset() { return byte_offset_of(JvmtiThreadState, _earlyret_state); } |
|
376 |
static ByteSize earlyret_tos_offset() { return byte_offset_of(JvmtiThreadState, _earlyret_tos); } |
|
377 |
static ByteSize earlyret_oop_offset() { return byte_offset_of(JvmtiThreadState, _earlyret_oop); } |
|
378 |
static ByteSize earlyret_value_offset() { return byte_offset_of(JvmtiThreadState, _earlyret_value); } |
|
379 |
||
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
13728
diff
changeset
|
380 |
void oops_do(OopClosure* f) NOT_JVMTI_RETURN; // GC support |
4761
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
2135
diff
changeset
|
381 |
|
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
2135
diff
changeset
|
382 |
public: |
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
2135
diff
changeset
|
383 |
void set_should_post_on_exceptions(bool val) { _thread->set_should_post_on_exceptions_flag(val ? JNI_TRUE : JNI_FALSE); } |
1 | 384 |
}; |
385 |
||
386 |
class RedefineVerifyMark : public StackObj { |
|
387 |
private: |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
388 |
JvmtiThreadState* _state; |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
389 |
Klass* _scratch_class; |
47580 | 390 |
OopHandle _scratch_mirror; |
1 | 391 |
|
392 |
public: |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
393 |
RedefineVerifyMark(Klass* the_class, Klass* scratch_class, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46271
diff
changeset
|
394 |
JvmtiThreadState *state) : _state(state), _scratch_class(scratch_class) |
1 | 395 |
{ |
396 |
_state->set_class_versions_map(the_class, scratch_class); |
|
47580 | 397 |
_scratch_mirror = _scratch_class->java_mirror_handle(); |
398 |
_scratch_class->set_java_mirror_handle(the_class->java_mirror_handle()); |
|
1 | 399 |
} |
400 |
||
401 |
~RedefineVerifyMark() { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
402 |
// Restore the scratch class's mirror, so when scratch_class is removed |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
403 |
// the correct mirror pointing to it can be cleared. |
47580 | 404 |
_scratch_class->set_java_mirror_handle(_scratch_mirror); |
1 | 405 |
_state->clear_class_versions_map(); |
406 |
} |
|
407 |
}; |
|
408 |
||
7397 | 409 |
#endif // SHARE_VM_PRIMS_JVMTITHREADSTATE_HPP |