author | naoto |
Tue, 09 Jul 2019 08:05:38 -0700 | |
changeset 55627 | 9c1885fb2a42 |
parent 53244 | 9807daeb47c4 |
child 57745 | 789e967c2731 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48105
diff
changeset
|
2 |
* Copyright (c) 2006, 2019, 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:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
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:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48105
diff
changeset
|
25 |
#ifndef SHARE_PRIMS_JVMTITHREADSTATE_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48105
diff
changeset
|
26 |
#define SHARE_PRIMS_JVMTITHREADSTATE_INLINE_HPP |
7397 | 27 |
|
28 |
#include "prims/jvmtiEnvThreadState.hpp" |
|
29 |
#include "prims/jvmtiThreadState.hpp" |
|
24351
61b33cc6d3cf
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
7397
diff
changeset
|
30 |
#include "runtime/thread.inline.hpp" |
7397 | 31 |
|
1 | 32 |
// JvmtiEnvThreadStateIterator implementation |
33 |
||
34 |
inline JvmtiEnvThreadStateIterator::JvmtiEnvThreadStateIterator(JvmtiThreadState* thread_state) { |
|
35 |
state = thread_state; |
|
36 |
Thread::current()->entering_jvmti_env_iteration(); |
|
37 |
} |
|
38 |
||
39 |
inline JvmtiEnvThreadStateIterator::~JvmtiEnvThreadStateIterator() { |
|
40 |
Thread::current()->leaving_jvmti_env_iteration(); |
|
41 |
} |
|
42 |
||
43 |
inline JvmtiEnvThreadState* JvmtiEnvThreadStateIterator::first() { |
|
44 |
return state->head_env_thread_state(); |
|
45 |
} |
|
46 |
||
47 |
inline JvmtiEnvThreadState* JvmtiEnvThreadStateIterator::next(JvmtiEnvThreadState* ets) { |
|
48 |
return ets->next(); |
|
49 |
} |
|
50 |
||
51 |
// JvmtiThreadState implementation |
|
52 |
||
53 |
JvmtiEnvThreadState* JvmtiThreadState::env_thread_state(JvmtiEnvBase *env) { |
|
54 |
JvmtiEnvThreadStateIterator it(this); |
|
55 |
for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { |
|
56 |
if ((JvmtiEnvBase*)(ets->get_env()) == env) { |
|
57 |
return ets; |
|
58 |
} |
|
59 |
} |
|
60 |
return NULL; |
|
61 |
} |
|
62 |
||
63 |
JvmtiEnvThreadState* JvmtiThreadState::head_env_thread_state() { |
|
64 |
return _head_env_thread_state; |
|
65 |
} |
|
66 |
||
67 |
void JvmtiThreadState::set_head_env_thread_state(JvmtiEnvThreadState* ets) { |
|
68 |
_head_env_thread_state = ets; |
|
69 |
} |
|
7397 | 70 |
|
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
71 |
inline JvmtiThreadState* JvmtiThreadState::state_for_while_locked(JavaThread *thread) { |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
72 |
assert(JvmtiThreadState_lock->is_locked(), "sanity check"); |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
73 |
|
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
74 |
JvmtiThreadState *state = thread->jvmti_thread_state(); |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
75 |
if (state == NULL) { |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
76 |
if (thread->is_exiting()) { |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
77 |
// don't add a JvmtiThreadState to a thread that is exiting |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
78 |
return NULL; |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
79 |
} |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
80 |
|
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
81 |
state = new JvmtiThreadState(thread); |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
82 |
} |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
83 |
return state; |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
84 |
} |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
85 |
|
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
86 |
inline JvmtiThreadState* JvmtiThreadState::state_for(JavaThread *thread) { |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
87 |
JvmtiThreadState *state = thread->jvmti_thread_state(); |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
88 |
if (state == NULL) { |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
89 |
MutexLocker mu(JvmtiThreadState_lock); |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
90 |
// check again with the lock held |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
91 |
state = state_for_while_locked(thread); |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
92 |
} else { |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
93 |
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
94 |
} |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
95 |
return state; |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
96 |
} |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
97 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48105
diff
changeset
|
98 |
#endif // SHARE_PRIMS_JVMTITHREADSTATE_INLINE_HPP |