author | stefank |
Thu, 09 May 2019 14:28:30 +0200 | |
changeset 54786 | ebf733a324d4 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49734
diff
changeset
|
2 |
* Copyright (c) 2003, 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 |
||
25 |
// JvmtiTagMap |
|
26 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49734
diff
changeset
|
27 |
#ifndef SHARE_PRIMS_JVMTITAGMAP_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49734
diff
changeset
|
28 |
#define SHARE_PRIMS_JVMTITAGMAP_HPP |
7397 | 29 |
|
30764 | 30 |
#include "gc/shared/collectedHeap.hpp" |
7397 | 31 |
#include "jvmtifiles/jvmti.h" |
32 |
#include "jvmtifiles/jvmtiEnv.hpp" |
|
33 |
#include "memory/allocation.hpp" |
|
1 | 34 |
|
35 |
// forward references |
|
36 |
class JvmtiTagHashmap; |
|
37 |
class JvmtiTagHashmapEntry; |
|
38 |
class JvmtiTagHashmapEntryClosure; |
|
39 |
||
13195 | 40 |
class JvmtiTagMap : public CHeapObj<mtInternal> { |
1 | 41 |
private: |
42 |
||
43 |
enum{ |
|
7896
08aadd7aa3ee
6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
kamg
parents:
7397
diff
changeset
|
44 |
max_free_entries = 4096 // maximum number of free entries per env |
1 | 45 |
}; |
46 |
||
47 |
JvmtiEnv* _env; // the jvmti environment |
|
48 |
Mutex _lock; // lock for this tag map |
|
7896
08aadd7aa3ee
6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
kamg
parents:
7397
diff
changeset
|
49 |
JvmtiTagHashmap* _hashmap; // the hashmap |
1 | 50 |
|
51 |
JvmtiTagHashmapEntry* _free_entries; // free list for this environment |
|
52 |
int _free_entries_count; // number of entries on the free list |
|
53 |
||
54 |
// create a tag map |
|
55 |
JvmtiTagMap(JvmtiEnv* env); |
|
56 |
||
57 |
// accessors |
|
58 |
inline Mutex* lock() { return &_lock; } |
|
59 |
inline JvmtiEnv* env() const { return _env; } |
|
60 |
||
32817
acc2744fd84b
8136627: Backout JDK-8133818 Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
kbarrett
parents:
32607
diff
changeset
|
61 |
void do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f); |
1 | 62 |
|
63 |
// iterate over all entries in this tag map |
|
64 |
void entry_iterate(JvmtiTagHashmapEntryClosure* closure); |
|
65 |
||
66 |
public: |
|
67 |
||
68 |
// indicates if this tag map is locked |
|
69 |
bool is_locked() { return lock()->is_locked(); } |
|
70 |
||
7896
08aadd7aa3ee
6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
kamg
parents:
7397
diff
changeset
|
71 |
JvmtiTagHashmap* hashmap() { return _hashmap; } |
1 | 72 |
|
73 |
// create/destroy entries |
|
7896
08aadd7aa3ee
6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
kamg
parents:
7397
diff
changeset
|
74 |
JvmtiTagHashmapEntry* create_entry(oop ref, jlong tag); |
1 | 75 |
void destroy_entry(JvmtiTagHashmapEntry* entry); |
76 |
||
77 |
// returns true if the hashmaps are empty |
|
78 |
bool is_empty(); |
|
79 |
||
80 |
// return tag for the given environment |
|
81 |
static JvmtiTagMap* tag_map_for(JvmtiEnv* env); |
|
82 |
||
83 |
// destroy tag map |
|
84 |
~JvmtiTagMap(); |
|
85 |
||
86 |
// set/get tag |
|
87 |
void set_tag(jobject obj, jlong tag); |
|
88 |
jlong get_tag(jobject obj); |
|
89 |
||
90 |
// deprecated heap iteration functions |
|
91 |
void iterate_over_heap(jvmtiHeapObjectFilter object_filter, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
32817
diff
changeset
|
92 |
Klass* klass, |
1 | 93 |
jvmtiHeapObjectCallback heap_object_callback, |
94 |
const void* user_data); |
|
95 |
||
96 |
void iterate_over_reachable_objects(jvmtiHeapRootCallback heap_root_callback, |
|
97 |
jvmtiStackReferenceCallback stack_ref_callback, |
|
98 |
jvmtiObjectReferenceCallback object_ref_callback, |
|
99 |
const void* user_data); |
|
100 |
||
101 |
void iterate_over_objects_reachable_from_object(jobject object, |
|
102 |
jvmtiObjectReferenceCallback object_reference_callback, |
|
103 |
const void* user_data); |
|
104 |
||
105 |
||
106 |
// advanced (JVMTI 1.1) heap iteration functions |
|
107 |
void iterate_through_heap(jint heap_filter, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
32817
diff
changeset
|
108 |
Klass* klass, |
1 | 109 |
const jvmtiHeapCallbacks* callbacks, |
110 |
const void* user_data); |
|
111 |
||
112 |
void follow_references(jint heap_filter, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
32817
diff
changeset
|
113 |
Klass* klass, |
1 | 114 |
jobject initial_object, |
115 |
const jvmtiHeapCallbacks* callbacks, |
|
116 |
const void* user_data); |
|
117 |
||
118 |
// get tagged objects |
|
119 |
jvmtiError get_objects_with_tags(const jlong* tags, jint count, |
|
120 |
jint* count_ptr, jobject** object_result_ptr, |
|
121 |
jlong** tag_result_ptr); |
|
122 |
||
32817
acc2744fd84b
8136627: Backout JDK-8133818 Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
kbarrett
parents:
32607
diff
changeset
|
123 |
static void weak_oops_do( |
acc2744fd84b
8136627: Backout JDK-8133818 Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
kbarrett
parents:
32607
diff
changeset
|
124 |
BoolObjectClosure* is_alive, OopClosure* f) NOT_JVMTI_RETURN; |
1 | 125 |
}; |
126 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49734
diff
changeset
|
127 |
#endif // SHARE_PRIMS_JVMTITAGMAP_HPP |