annotate src/share/vm/prims/jvmtiTagMap.hpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children 7246a374a9f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // JvmtiTagMap
a61af66fc99e Initial load
duke
parents:
diff changeset
26
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #ifndef SHARE_VM_PRIMS_JVMTITAGMAP_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #define SHARE_VM_PRIMS_JVMTITAGMAP_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #ifndef JVMTI_KERNEL
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "gc_interface/collectedHeap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "jvmtifiles/jvmti.h"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "jvmtifiles/jvmtiEnv.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #include "memory/genCollectedHeap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 #include "memory/universe.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // forward references
a61af66fc99e Initial load
duke
parents:
diff changeset
40 class JvmtiTagHashmap;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 class JvmtiTagHashmapEntry;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 class JvmtiTagHashmapEntryClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 class JvmtiTagMap : public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 enum{
a61af66fc99e Initial load
duke
parents:
diff changeset
48 n_hashmaps = 2, // encapsulates 2 hashmaps
a61af66fc99e Initial load
duke
parents:
diff changeset
49 max_free_entries = 4096 // maximum number of free entries per env
a61af66fc99e Initial load
duke
parents:
diff changeset
50 };
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // memory region for young generation
a61af66fc99e Initial load
duke
parents:
diff changeset
53 static MemRegion _young_gen;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 static void get_young_generation();
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 JvmtiEnv* _env; // the jvmti environment
a61af66fc99e Initial load
duke
parents:
diff changeset
57 Mutex _lock; // lock for this tag map
a61af66fc99e Initial load
duke
parents:
diff changeset
58 JvmtiTagHashmap* _hashmap[n_hashmaps]; // the hashmaps
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 JvmtiTagHashmapEntry* _free_entries; // free list for this environment
a61af66fc99e Initial load
duke
parents:
diff changeset
61 int _free_entries_count; // number of entries on the free list
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // create a tag map
a61af66fc99e Initial load
duke
parents:
diff changeset
64 JvmtiTagMap(JvmtiEnv* env);
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
67 inline Mutex* lock() { return &_lock; }
a61af66fc99e Initial load
duke
parents:
diff changeset
68 inline JvmtiEnv* env() const { return _env; }
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // rehash tags maps for generation start to end
a61af66fc99e Initial load
duke
parents:
diff changeset
71 void rehash(int start, int end);
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // indicates if the object is in the young generation
a61af66fc99e Initial load
duke
parents:
diff changeset
74 static bool is_in_young(oop o);
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // iterate over all entries in this tag map
a61af66fc99e Initial load
duke
parents:
diff changeset
77 void entry_iterate(JvmtiTagHashmapEntryClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // indicates if this tag map is locked
a61af66fc99e Initial load
duke
parents:
diff changeset
82 bool is_locked() { return lock()->is_locked(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // return the appropriate hashmap for a given object
a61af66fc99e Initial load
duke
parents:
diff changeset
85 JvmtiTagHashmap* hashmap_for(oop o);
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // create/destroy entries
a61af66fc99e Initial load
duke
parents:
diff changeset
88 JvmtiTagHashmapEntry* create_entry(jweak ref, jlong tag);
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void destroy_entry(JvmtiTagHashmapEntry* entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // returns true if the hashmaps are empty
a61af66fc99e Initial load
duke
parents:
diff changeset
92 bool is_empty();
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // return tag for the given environment
a61af66fc99e Initial load
duke
parents:
diff changeset
95 static JvmtiTagMap* tag_map_for(JvmtiEnv* env);
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // destroy tag map
a61af66fc99e Initial load
duke
parents:
diff changeset
98 ~JvmtiTagMap();
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // set/get tag
a61af66fc99e Initial load
duke
parents:
diff changeset
101 void set_tag(jobject obj, jlong tag);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 jlong get_tag(jobject obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // deprecated heap iteration functions
a61af66fc99e Initial load
duke
parents:
diff changeset
105 void iterate_over_heap(jvmtiHeapObjectFilter object_filter,
a61af66fc99e Initial load
duke
parents:
diff changeset
106 KlassHandle klass,
a61af66fc99e Initial load
duke
parents:
diff changeset
107 jvmtiHeapObjectCallback heap_object_callback,
a61af66fc99e Initial load
duke
parents:
diff changeset
108 const void* user_data);
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 void iterate_over_reachable_objects(jvmtiHeapRootCallback heap_root_callback,
a61af66fc99e Initial load
duke
parents:
diff changeset
111 jvmtiStackReferenceCallback stack_ref_callback,
a61af66fc99e Initial load
duke
parents:
diff changeset
112 jvmtiObjectReferenceCallback object_ref_callback,
a61af66fc99e Initial load
duke
parents:
diff changeset
113 const void* user_data);
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 void iterate_over_objects_reachable_from_object(jobject object,
a61af66fc99e Initial load
duke
parents:
diff changeset
116 jvmtiObjectReferenceCallback object_reference_callback,
a61af66fc99e Initial load
duke
parents:
diff changeset
117 const void* user_data);
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // advanced (JVMTI 1.1) heap iteration functions
a61af66fc99e Initial load
duke
parents:
diff changeset
121 void iterate_through_heap(jint heap_filter,
a61af66fc99e Initial load
duke
parents:
diff changeset
122 KlassHandle klass,
a61af66fc99e Initial load
duke
parents:
diff changeset
123 const jvmtiHeapCallbacks* callbacks,
a61af66fc99e Initial load
duke
parents:
diff changeset
124 const void* user_data);
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 void follow_references(jint heap_filter,
a61af66fc99e Initial load
duke
parents:
diff changeset
127 KlassHandle klass,
a61af66fc99e Initial load
duke
parents:
diff changeset
128 jobject initial_object,
a61af66fc99e Initial load
duke
parents:
diff changeset
129 const jvmtiHeapCallbacks* callbacks,
a61af66fc99e Initial load
duke
parents:
diff changeset
130 const void* user_data);
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // get tagged objects
a61af66fc99e Initial load
duke
parents:
diff changeset
133 jvmtiError get_objects_with_tags(const jlong* tags, jint count,
a61af66fc99e Initial load
duke
parents:
diff changeset
134 jint* count_ptr, jobject** object_result_ptr,
a61af66fc99e Initial load
duke
parents:
diff changeset
135 jlong** tag_result_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // call post-GC to rehash the tag maps.
a61af66fc99e Initial load
duke
parents:
diff changeset
138 static void gc_epilogue(bool full);
a61af66fc99e Initial load
duke
parents:
diff changeset
139
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // call after referencing processing has completed (CMS)
a61af66fc99e Initial load
duke
parents:
diff changeset
141 static void cms_ref_processing_epilogue();
a61af66fc99e Initial load
duke
parents:
diff changeset
142 };
a61af66fc99e Initial load
duke
parents:
diff changeset
143
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
144 #endif // SHARE_VM_PRIMS_JVMTITAGMAP_HPP