annotate src/share/vm/classfile/placeholders.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children 070d523b96a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
2 * Copyright (c) 2003, 2012, 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
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "classfile/placeholders.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "classfile/systemDictionary.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "runtime/fieldType.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "utilities/hashtable.inline.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // Placeholder methods
a61af66fc99e Initial load
duke
parents:
diff changeset
33
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
34 PlaceholderEntry* PlaceholderTable::new_entry(int hash, Symbol* name,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
35 ClassLoaderData* loader_data,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
36 bool havesupername,
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
37 Symbol* supername) {
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 2426
diff changeset
38 PlaceholderEntry* entry = (PlaceholderEntry*)Hashtable<Symbol*, mtClass>::new_entry(hash, name);
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
39 // Hashtable with Symbol* literal must increment and decrement refcount.
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
40 name->increment_refcount();
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
41 entry->set_loader_data(loader_data);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
42 entry->set_havesupername(havesupername);
a61af66fc99e Initial load
duke
parents:
diff changeset
43 entry->set_supername(supername);
a61af66fc99e Initial load
duke
parents:
diff changeset
44 entry->set_superThreadQ(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
45 entry->set_loadInstanceThreadQ(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 entry->set_defineThreadQ(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
47 entry->set_definer(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
48 entry->set_instanceKlass(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
49 return entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 }
a61af66fc99e Initial load
duke
parents:
diff changeset
51
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
52 void PlaceholderTable::free_entry(PlaceholderEntry* entry) {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
53 // decrement Symbol refcount here because Hashtable doesn't.
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
54 entry->literal()->decrement_refcount();
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
55 if (entry->supername() != NULL) entry->supername()->decrement_refcount();
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 2426
diff changeset
56 Hashtable<Symbol*, mtClass>::free_entry(entry);
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
57 }
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
58
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // Placeholder objects represent classes currently being loaded.
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // All threads examining the placeholder table must hold the
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // SystemDictionary_lock, so we don't need special precautions
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // on store ordering here.
a61af66fc99e Initial load
duke
parents:
diff changeset
64 void PlaceholderTable::add_entry(int index, unsigned int hash,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
65 Symbol* class_name, ClassLoaderData* loader_data,
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
66 bool havesupername, Symbol* supername){
0
a61af66fc99e Initial load
duke
parents:
diff changeset
67 assert_locked_or_safepoint(SystemDictionary_lock);
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
68 assert(class_name != NULL, "adding NULL obj");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // Both readers and writers are locked so it's safe to just
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // create the placeholder and insert it in the list without a membar.
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
72 PlaceholderEntry* entry = new_entry(hash, class_name, loader_data, havesupername, supername);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
73 add_entry(index, entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // Remove a placeholder object.
a61af66fc99e Initial load
duke
parents:
diff changeset
78 void PlaceholderTable::remove_entry(int index, unsigned int hash,
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
79 Symbol* class_name,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
80 ClassLoaderData* loader_data) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
81 assert_locked_or_safepoint(SystemDictionary_lock);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 PlaceholderEntry** p = bucket_addr(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 while (*p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 PlaceholderEntry *probe = *p;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
85 if (probe->hash() == hash && probe->equals(class_name, loader_data)) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // Delete entry
a61af66fc99e Initial load
duke
parents:
diff changeset
87 *p = probe->next();
a61af66fc99e Initial load
duke
parents:
diff changeset
88 free_entry(probe);
a61af66fc99e Initial load
duke
parents:
diff changeset
89 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 p = probe->next_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
92 }
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 PlaceholderEntry* PlaceholderTable::get_entry(int index, unsigned int hash,
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
96 Symbol* class_name,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
97 ClassLoaderData* loader_data) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
98 assert_locked_or_safepoint(SystemDictionary_lock);
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 for (PlaceholderEntry *place_probe = bucket(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 place_probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 place_probe = place_probe->next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 if (place_probe->hash() == hash &&
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
104 place_probe->equals(class_name, loader_data)) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
105 return place_probe;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 }
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
111 Symbol* PlaceholderTable::find_entry(int index, unsigned int hash,
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
112 Symbol* class_name,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
113 ClassLoaderData* loader_data) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
114 PlaceholderEntry* probe = get_entry(index, hash, class_name, loader_data);
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
115 return (probe? probe->klassname(): (Symbol*)NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // find_and_add returns probe pointer - old or new
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // If no entry exists, add a placeholder entry
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // If entry exists, reuse entry
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // For both, push SeenThread for classloadAction
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // if havesupername: this is used for circularity for instanceklass loading
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
123 PlaceholderEntry* PlaceholderTable::find_and_add(int index, unsigned int hash,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
124 Symbol* name,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
125 ClassLoaderData* loader_data,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
126 classloadAction action,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
127 Symbol* supername,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
128 Thread* thread) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
129 PlaceholderEntry* probe = get_entry(index, hash, name, loader_data);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
130 if (probe == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // Nothing found, add place holder
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
132 add_entry(index, hash, name, loader_data, (action == LOAD_SUPER), supername);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
133 probe = get_entry(index, hash, name, loader_data);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
134 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 if (action == LOAD_SUPER) {
a61af66fc99e Initial load
duke
parents:
diff changeset
136 probe->set_havesupername(true);
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
137 probe->set_supername(supername);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
138 }
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 if (probe) probe->add_seen_thread(thread, action);
a61af66fc99e Initial load
duke
parents:
diff changeset
141 return probe;
a61af66fc99e Initial load
duke
parents:
diff changeset
142 }
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // placeholder used to track class loading internal states
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // placeholder existence now for loading superclass/superinterface
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // superthreadQ tracks class circularity, while loading superclass/superinterface
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // loadInstanceThreadQ tracks load_instance_class calls
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // definer() tracks the single thread that owns define token
a61af66fc99e Initial load
duke
parents:
diff changeset
150 // defineThreadQ tracks waiters on defining thread's results
a61af66fc99e Initial load
duke
parents:
diff changeset
151 // 1st claimant creates placeholder
a61af66fc99e Initial load
duke
parents:
diff changeset
152 // find_and_add adds SeenThread entry for appropriate queue
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // All claimants remove SeenThread after completing action
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // On removal: if definer and all queues empty, remove entry
a61af66fc99e Initial load
duke
parents:
diff changeset
155 // Note: you can be in both placeholders and systemDictionary
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // see parse_stream for redefine classes
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // Therefore - must always check SD first
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // Ignores the case where entry is not found
a61af66fc99e Initial load
duke
parents:
diff changeset
159 void PlaceholderTable::find_and_remove(int index, unsigned int hash,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
160 Symbol* name, ClassLoaderData* loader_data, Thread* thread) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
161 assert_locked_or_safepoint(SystemDictionary_lock);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
162 PlaceholderEntry *probe = get_entry(index, hash, name, loader_data);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
163 if (probe != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // No other threads using this entry
a61af66fc99e Initial load
duke
parents:
diff changeset
165 if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
166 && (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
167 remove_entry(index, hash, name, loader_data);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
168 }
a61af66fc99e Initial load
duke
parents:
diff changeset
169 }
a61af66fc99e Initial load
duke
parents:
diff changeset
170 }
a61af66fc99e Initial load
duke
parents:
diff changeset
171
a61af66fc99e Initial load
duke
parents:
diff changeset
172 PlaceholderTable::PlaceholderTable(int table_size)
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 2426
diff changeset
173 : TwoOopHashtable<Symbol*, mtClass>(table_size, sizeof(PlaceholderEntry)) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
a61af66fc99e Initial load
duke
parents:
diff changeset
175
a61af66fc99e Initial load
duke
parents:
diff changeset
176
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
177 void PlaceholderTable::classes_do(KlassClosure* f) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
178 for (int index = 0; index < table_size(); index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
179 for (PlaceholderEntry* probe = bucket(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
180 probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
181 probe = probe->next()) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
182 probe->classes_do(f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
183 }
a61af66fc99e Initial load
duke
parents:
diff changeset
184 }
a61af66fc99e Initial load
duke
parents:
diff changeset
185 }
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
188 void PlaceholderEntry::classes_do(KlassClosure* closure) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
189 assert(klassname() != NULL, "should have a non-null klass");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
190 if (_instanceKlass != NULL) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
191 closure->do_klass(InstanceKlass());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
192 }
a61af66fc99e Initial load
duke
parents:
diff changeset
193 }
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 // do all entries in the placeholder table
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
196 void PlaceholderTable::entries_do(void f(Symbol*)) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
197 for (int index = 0; index < table_size(); index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
198 for (PlaceholderEntry* probe = bucket(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
199 probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
200 probe = probe->next()) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
201 f(probe->klassname());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203 }
a61af66fc99e Initial load
duke
parents:
diff changeset
204 }
a61af66fc99e Initial load
duke
parents:
diff changeset
205
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
208 // Note, doesn't append a cr
a61af66fc99e Initial load
duke
parents:
diff changeset
209 void PlaceholderEntry::print() const {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
210 klassname()->print_value();
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
211 if (loader_data() != NULL) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
212 tty->print(", loader ");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
213 loader_data()->print_value();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
214 }
a61af66fc99e Initial load
duke
parents:
diff changeset
215 if (supername() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
216 tty->print(", supername ");
a61af66fc99e Initial load
duke
parents:
diff changeset
217 supername()->print_value();
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219 if (definer() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
220 tty->print(", definer ");
a61af66fc99e Initial load
duke
parents:
diff changeset
221 definer()->print_value();
a61af66fc99e Initial load
duke
parents:
diff changeset
222 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
223 if (InstanceKlass() != NULL) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
224 tty->print(", InstanceKlass ");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
225 InstanceKlass()->print_value();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
226 }
a61af66fc99e Initial load
duke
parents:
diff changeset
227 tty->print("\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
228 tty->print("loadInstanceThreadQ threads:");
a61af66fc99e Initial load
duke
parents:
diff changeset
229 loadInstanceThreadQ()->printActionQ();
a61af66fc99e Initial load
duke
parents:
diff changeset
230 tty->print("\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
231 tty->print("superThreadQ threads:");
a61af66fc99e Initial load
duke
parents:
diff changeset
232 superThreadQ()->printActionQ();
a61af66fc99e Initial load
duke
parents:
diff changeset
233 tty->print("\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
234 tty->print("defineThreadQ threads:");
a61af66fc99e Initial load
duke
parents:
diff changeset
235 defineThreadQ()->printActionQ();
a61af66fc99e Initial load
duke
parents:
diff changeset
236 tty->print("\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
237 }
a61af66fc99e Initial load
duke
parents:
diff changeset
238 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 void PlaceholderEntry::verify() const {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
241 guarantee(loader_data() != NULL, "Must have been setup.");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
242 guarantee(loader_data()->class_loader() == NULL || loader_data()->class_loader()->is_instance(),
0
a61af66fc99e Initial load
duke
parents:
diff changeset
243 "checking type of _loader");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
244 guarantee(InstanceKlass() == NULL
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
245 || Klass::cast(InstanceKlass())->oop_is_instance(),
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
246 "checking type of InstanceKlass result");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 void PlaceholderTable::verify() {
a61af66fc99e Initial load
duke
parents:
diff changeset
250 int element_count = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
251 for (int pindex = 0; pindex < table_size(); pindex++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
252 for (PlaceholderEntry* probe = bucket(pindex);
a61af66fc99e Initial load
duke
parents:
diff changeset
253 probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
254 probe = probe->next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
255 probe->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
256 element_count++; // both klasses and place holders count
a61af66fc99e Initial load
duke
parents:
diff changeset
257 }
a61af66fc99e Initial load
duke
parents:
diff changeset
258 }
a61af66fc99e Initial load
duke
parents:
diff changeset
259 guarantee(number_of_entries() == element_count,
a61af66fc99e Initial load
duke
parents:
diff changeset
260 "Verify of system dictionary failed");
a61af66fc99e Initial load
duke
parents:
diff changeset
261 }
a61af66fc99e Initial load
duke
parents:
diff changeset
262
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
265 void PlaceholderTable::print() {
a61af66fc99e Initial load
duke
parents:
diff changeset
266 for (int pindex = 0; pindex < table_size(); pindex++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
267 for (PlaceholderEntry* probe = bucket(pindex);
a61af66fc99e Initial load
duke
parents:
diff changeset
268 probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
269 probe = probe->next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
270 if (Verbose) tty->print("%4d: ", pindex);
a61af66fc99e Initial load
duke
parents:
diff changeset
271 tty->print(" place holder ");
a61af66fc99e Initial load
duke
parents:
diff changeset
272
a61af66fc99e Initial load
duke
parents:
diff changeset
273 probe->print();
a61af66fc99e Initial load
duke
parents:
diff changeset
274 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
275 }
a61af66fc99e Initial load
duke
parents:
diff changeset
276 }
a61af66fc99e Initial load
duke
parents:
diff changeset
277 }
a61af66fc99e Initial load
duke
parents:
diff changeset
278 #endif