annotate src/share/vm/classfile/placeholders.cpp @ 1552:c18cbe5936b8

6941466: Oracle rebranding changes for Hotspot repositories Summary: Change all the Sun copyrights to Oracle copyright Reviewed-by: ohair
author trims
date Thu, 27 May 2010 19:08:38 -0700
parents a61af66fc99e
children f95d63e2154a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
2 * Copyright (c) 2003, 2007, 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 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_placeholders.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // Placeholder methods
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 PlaceholderEntry* PlaceholderTable::new_entry(int hash, symbolOop name,
a61af66fc99e Initial load
duke
parents:
diff changeset
31 oop loader, bool havesupername,
a61af66fc99e Initial load
duke
parents:
diff changeset
32 symbolOop supername) {
a61af66fc99e Initial load
duke
parents:
diff changeset
33 PlaceholderEntry* entry = (PlaceholderEntry*)Hashtable::new_entry(hash, name);
a61af66fc99e Initial load
duke
parents:
diff changeset
34 entry->set_loader(loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
35 entry->set_havesupername(havesupername);
a61af66fc99e Initial load
duke
parents:
diff changeset
36 entry->set_supername(supername);
a61af66fc99e Initial load
duke
parents:
diff changeset
37 entry->set_superThreadQ(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
38 entry->set_loadInstanceThreadQ(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
39 entry->set_defineThreadQ(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
40 entry->set_definer(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
41 entry->set_instanceKlass(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
42 return entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 }
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // Placeholder objects represent classes currently being loaded.
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // All threads examining the placeholder table must hold the
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // SystemDictionary_lock, so we don't need special precautions
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // on store ordering here.
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void PlaceholderTable::add_entry(int index, unsigned int hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
51 symbolHandle class_name, Handle class_loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
52 bool havesupername, symbolHandle supername){
a61af66fc99e Initial load
duke
parents:
diff changeset
53 assert_locked_or_safepoint(SystemDictionary_lock);
a61af66fc99e Initial load
duke
parents:
diff changeset
54 assert(!class_name.is_null(), "adding NULL obj");
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // Both readers and writers are locked so it's safe to just
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // create the placeholder and insert it in the list without a membar.
a61af66fc99e Initial load
duke
parents:
diff changeset
58 PlaceholderEntry* entry = new_entry(hash, class_name(), class_loader(), havesupername, supername());
a61af66fc99e Initial load
duke
parents:
diff changeset
59 add_entry(index, entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // Remove a placeholder object.
a61af66fc99e Initial load
duke
parents:
diff changeset
64 void PlaceholderTable::remove_entry(int index, unsigned int hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
65 symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
66 Handle class_loader) {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 assert_locked_or_safepoint(SystemDictionary_lock);
a61af66fc99e Initial load
duke
parents:
diff changeset
68 PlaceholderEntry** p = bucket_addr(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
69 while (*p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 PlaceholderEntry *probe = *p;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 if (probe->hash() == hash && probe->equals(class_name(), class_loader())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // Delete entry
a61af66fc99e Initial load
duke
parents:
diff changeset
73 *p = probe->next();
a61af66fc99e Initial load
duke
parents:
diff changeset
74 free_entry(probe);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77 p = probe->next_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 PlaceholderEntry* PlaceholderTable::get_entry(int index, unsigned int hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
82 symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
83 Handle class_loader) {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 assert_locked_or_safepoint(SystemDictionary_lock);
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 symbolOop class_name_ = class_name();
a61af66fc99e Initial load
duke
parents:
diff changeset
87 oop class_loader_ = class_loader();
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 for (PlaceholderEntry *place_probe = bucket(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 place_probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 place_probe = place_probe->next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 if (place_probe->hash() == hash &&
a61af66fc99e Initial load
duke
parents:
diff changeset
93 place_probe->equals(class_name_, class_loader_)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 return place_probe;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 symbolOop PlaceholderTable::find_entry(int index, unsigned int hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
101 symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
102 Handle class_loader) {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 PlaceholderEntry* probe = get_entry(index, hash, class_name, class_loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
104 return (probe? probe->klass(): symbolOop(NULL));
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // find_and_add returns probe pointer - old or new
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // If no entry exists, add a placeholder entry
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // If entry exists, reuse entry
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // For both, push SeenThread for classloadAction
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // if havesupername: this is used for circularity for instanceklass loading
a61af66fc99e Initial load
duke
parents:
diff changeset
112 PlaceholderEntry* PlaceholderTable::find_and_add(int index, unsigned int hash, symbolHandle name, Handle loader, classloadAction action, symbolHandle supername, Thread* thread) {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 PlaceholderEntry* probe = get_entry(index, hash, name, loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
114 if (probe == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // Nothing found, add place holder
a61af66fc99e Initial load
duke
parents:
diff changeset
116 add_entry(index, hash, name, loader, (action == LOAD_SUPER), supername);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 probe = get_entry(index, hash, name, loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
118 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 if (action == LOAD_SUPER) {
a61af66fc99e Initial load
duke
parents:
diff changeset
120 probe->set_havesupername(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
121 probe->set_supername(supername());
a61af66fc99e Initial load
duke
parents:
diff changeset
122 }
a61af66fc99e Initial load
duke
parents:
diff changeset
123 }
a61af66fc99e Initial load
duke
parents:
diff changeset
124 if (probe) probe->add_seen_thread(thread, action);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 return probe;
a61af66fc99e Initial load
duke
parents:
diff changeset
126 }
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // placeholder used to track class loading internal states
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // placeholder existence now for loading superclass/superinterface
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // superthreadQ tracks class circularity, while loading superclass/superinterface
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // loadInstanceThreadQ tracks load_instance_class calls
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // definer() tracks the single thread that owns define token
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // defineThreadQ tracks waiters on defining thread's results
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // 1st claimant creates placeholder
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // find_and_add adds SeenThread entry for appropriate queue
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // All claimants remove SeenThread after completing action
a61af66fc99e Initial load
duke
parents:
diff changeset
138 // On removal: if definer and all queues empty, remove entry
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // Note: you can be in both placeholders and systemDictionary
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // see parse_stream for redefine classes
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // Therefore - must always check SD first
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // Ignores the case where entry is not found
a61af66fc99e Initial load
duke
parents:
diff changeset
143 void PlaceholderTable::find_and_remove(int index, unsigned int hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
144 symbolHandle name, Handle loader, Thread* thread) {
a61af66fc99e Initial load
duke
parents:
diff changeset
145 assert_locked_or_safepoint(SystemDictionary_lock);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 PlaceholderEntry *probe = get_entry(index, hash, name, loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 if (probe != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // No other threads using this entry
a61af66fc99e Initial load
duke
parents:
diff changeset
149 if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
150 && (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
151 remove_entry(index, hash, name, loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
152 }
a61af66fc99e Initial load
duke
parents:
diff changeset
153 }
a61af66fc99e Initial load
duke
parents:
diff changeset
154 }
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156 PlaceholderTable::PlaceholderTable(int table_size)
a61af66fc99e Initial load
duke
parents:
diff changeset
157 : TwoOopHashtable(table_size, sizeof(PlaceholderEntry)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 }
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161 void PlaceholderTable::oops_do(OopClosure* f) {
a61af66fc99e Initial load
duke
parents:
diff changeset
162 for (int index = 0; index < table_size(); index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
163 for (PlaceholderEntry* probe = bucket(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
164 probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
165 probe = probe->next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
166 probe->oops_do(f);
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
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 void PlaceholderEntry::oops_do(OopClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 assert(klass() != NULL, "should have a non-null klass");
a61af66fc99e Initial load
duke
parents:
diff changeset
174 blk->do_oop((oop*)klass_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
175 if (_loader != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
176 blk->do_oop(loader_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178 if (_supername != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
179 blk->do_oop((oop*)supername_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
180 }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 if (_instanceKlass != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
182 blk->do_oop((oop*)instanceKlass_addr());
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 // do all entries in the placeholder table
a61af66fc99e Initial load
duke
parents:
diff changeset
187 void PlaceholderTable::entries_do(void f(symbolOop, oop)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
188 for (int index = 0; index < table_size(); index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 for (PlaceholderEntry* probe = bucket(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
190 probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
191 probe = probe->next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
192 f(probe->klass(), probe->loader());
a61af66fc99e Initial load
duke
parents:
diff changeset
193 }
a61af66fc99e Initial load
duke
parents:
diff changeset
194 }
a61af66fc99e Initial load
duke
parents:
diff changeset
195 }
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
199 // Note, doesn't append a cr
a61af66fc99e Initial load
duke
parents:
diff changeset
200 void PlaceholderEntry::print() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 klass()->print_value();
a61af66fc99e Initial load
duke
parents:
diff changeset
202 if (loader() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
203 tty->print(", loader ");
a61af66fc99e Initial load
duke
parents:
diff changeset
204 loader()->print_value();
a61af66fc99e Initial load
duke
parents:
diff changeset
205 }
a61af66fc99e Initial load
duke
parents:
diff changeset
206 if (supername() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
207 tty->print(", supername ");
a61af66fc99e Initial load
duke
parents:
diff changeset
208 supername()->print_value();
a61af66fc99e Initial load
duke
parents:
diff changeset
209 }
a61af66fc99e Initial load
duke
parents:
diff changeset
210 if (definer() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
211 tty->print(", definer ");
a61af66fc99e Initial load
duke
parents:
diff changeset
212 definer()->print_value();
a61af66fc99e Initial load
duke
parents:
diff changeset
213 }
a61af66fc99e Initial load
duke
parents:
diff changeset
214 if (instanceKlass() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
215 tty->print(", instanceKlass ");
a61af66fc99e Initial load
duke
parents:
diff changeset
216 instanceKlass()->print_value();
a61af66fc99e Initial load
duke
parents:
diff changeset
217 }
a61af66fc99e Initial load
duke
parents:
diff changeset
218 tty->print("\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
219 tty->print("loadInstanceThreadQ threads:");
a61af66fc99e Initial load
duke
parents:
diff changeset
220 loadInstanceThreadQ()->printActionQ();
a61af66fc99e Initial load
duke
parents:
diff changeset
221 tty->print("\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
222 tty->print("superThreadQ threads:");
a61af66fc99e Initial load
duke
parents:
diff changeset
223 superThreadQ()->printActionQ();
a61af66fc99e Initial load
duke
parents:
diff changeset
224 tty->print("\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
225 tty->print("defineThreadQ threads:");
a61af66fc99e Initial load
duke
parents:
diff changeset
226 defineThreadQ()->printActionQ();
a61af66fc99e Initial load
duke
parents:
diff changeset
227 tty->print("\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
228 }
a61af66fc99e Initial load
duke
parents:
diff changeset
229 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 void PlaceholderEntry::verify() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
232 guarantee(loader() == NULL || loader()->is_instance(),
a61af66fc99e Initial load
duke
parents:
diff changeset
233 "checking type of _loader");
a61af66fc99e Initial load
duke
parents:
diff changeset
234 guarantee(instanceKlass() == NULL
a61af66fc99e Initial load
duke
parents:
diff changeset
235 || Klass::cast(instanceKlass())->oop_is_instance(),
a61af66fc99e Initial load
duke
parents:
diff changeset
236 "checking type of instanceKlass result");
a61af66fc99e Initial load
duke
parents:
diff changeset
237 klass()->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
238 }
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 void PlaceholderTable::verify() {
a61af66fc99e Initial load
duke
parents:
diff changeset
241 int element_count = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
242 for (int pindex = 0; pindex < table_size(); pindex++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
243 for (PlaceholderEntry* probe = bucket(pindex);
a61af66fc99e Initial load
duke
parents:
diff changeset
244 probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
245 probe = probe->next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
246 probe->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
247 element_count++; // both klasses and place holders count
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
a61af66fc99e Initial load
duke
parents:
diff changeset
249 }
a61af66fc99e Initial load
duke
parents:
diff changeset
250 guarantee(number_of_entries() == element_count,
a61af66fc99e Initial load
duke
parents:
diff changeset
251 "Verify of system dictionary failed");
a61af66fc99e Initial load
duke
parents:
diff changeset
252 }
a61af66fc99e Initial load
duke
parents:
diff changeset
253
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
256 void PlaceholderTable::print() {
a61af66fc99e Initial load
duke
parents:
diff changeset
257 for (int pindex = 0; pindex < table_size(); pindex++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
258 for (PlaceholderEntry* probe = bucket(pindex);
a61af66fc99e Initial load
duke
parents:
diff changeset
259 probe != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
260 probe = probe->next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
261 if (Verbose) tty->print("%4d: ", pindex);
a61af66fc99e Initial load
duke
parents:
diff changeset
262 tty->print(" place holder ");
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 probe->print();
a61af66fc99e Initial load
duke
parents:
diff changeset
265 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }
a61af66fc99e Initial load
duke
parents:
diff changeset
267 }
a61af66fc99e Initial load
duke
parents:
diff changeset
268 }
a61af66fc99e Initial load
duke
parents:
diff changeset
269 #endif