annotate src/share/vm/classfile/systemDictionary.hpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children 60b728ec77c1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
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 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
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 // The system dictionary stores all loaded classes and maps:
a61af66fc99e Initial load
duke
parents:
diff changeset
26 //
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // [class name,class loader] -> class i.e. [symbolOop,oop] -> klassOop
a61af66fc99e Initial load
duke
parents:
diff changeset
28 //
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // Classes are loaded lazily. The default VM class loader is
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // represented as NULL.
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // The underlying data structure is an open hash table with a fixed number
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // of buckets. During loading the loader object is locked, (for the VM loader
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // a private lock object is used). Class loading can thus be done concurrently,
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // but only by different loaders.
a61af66fc99e Initial load
duke
parents:
diff changeset
36 //
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // During loading a placeholder (name, loader) is temporarily placed in
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // a side data structure, and is used to detect ClassCircularityErrors
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // and to perform verification during GC. A GC can occur in the midst
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // of class loading, as we call out to Java, have to take locks, etc.
a61af66fc99e Initial load
duke
parents:
diff changeset
41 //
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // When class loading is finished, a new entry is added to the system
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // dictionary and the place holder is removed. Note that the protection
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // domain field of the system dictionary has not yet been filled in when
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // the "real" system dictionary entry is created.
a61af66fc99e Initial load
duke
parents:
diff changeset
46 //
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // Clients of this class who are interested in finding if a class has
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // been completely loaded -- not classes in the process of being loaded --
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // can read the SystemDictionary unlocked. This is safe because
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // - entries are only deleted at safepoints
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // - readers cannot come to a safepoint while actively examining
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // an entry (an entry cannot be deleted from under a reader)
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // - entries must be fully formed before they are available to concurrent
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // readers (we must ensure write ordering)
a61af66fc99e Initial load
duke
parents:
diff changeset
55 //
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // Note that placeholders are deleted at any time, as they are removed
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // when a class is completely loaded. Therefore, readers as well as writers
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // of placeholders must hold the SystemDictionary_lock.
a61af66fc99e Initial load
duke
parents:
diff changeset
59 //
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 class Dictionary;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 class PlaceholderTable;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 class LoaderConstraintTable;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 class HashtableBucket;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 class ResolutionErrorTable;
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 class SystemDictionary : AllStatic {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 friend class CompactingPermGenGen;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 NOT_PRODUCT(friend class instanceKlassKlass;)
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Returns a class with a given class name and class loader. Loads the
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // class if needed. If not found a NoClassDefFoundError or a
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // ClassNotFoundException is thrown, depending on the value on the
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // throw_error flag. For most uses the throw_error argument should be set
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // to true.
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 static klassOop resolve_or_fail(symbolHandle class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // Convenient call for null loader and protection domain.
a61af66fc99e Initial load
duke
parents:
diff changeset
81 static klassOop resolve_or_fail(symbolHandle class_name, bool throw_error, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // handle error translation for resolve_or_null results
a61af66fc99e Initial load
duke
parents:
diff changeset
84 static klassOop handle_resolution_exception(symbolHandle class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // Returns a class with a given class name and class loader.
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // Loads the class if needed. If not found NULL is returned.
a61af66fc99e Initial load
duke
parents:
diff changeset
90 static klassOop resolve_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // Version with null loader and protection domain
a61af66fc99e Initial load
duke
parents:
diff changeset
92 static klassOop resolve_or_null(symbolHandle class_name, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // Resolve a superclass or superinterface. Called from ClassFileParser,
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // parse_interfaces, resolve_instance_class_or_null, load_shared_class
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // "child_name" is the class whose super class or interface is being resolved.
a61af66fc99e Initial load
duke
parents:
diff changeset
97 static klassOop resolve_super_or_fail(symbolHandle child_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
98 symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
99 Handle class_loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
100 Handle protection_domain,
a61af66fc99e Initial load
duke
parents:
diff changeset
101 bool is_superclass,
a61af66fc99e Initial load
duke
parents:
diff changeset
102 TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // Parse new stream. This won't update the system dictionary or
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // class hierarchy, simply parse the stream. Used by JVMTI RedefineClasses.
a61af66fc99e Initial load
duke
parents:
diff changeset
106 static klassOop parse_stream(symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
107 Handle class_loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
108 Handle protection_domain,
a61af66fc99e Initial load
duke
parents:
diff changeset
109 ClassFileStream* st,
a61af66fc99e Initial load
duke
parents:
diff changeset
110 TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // Resolve from stream (called by jni_DefineClass and JVM_DefineClass)
a61af66fc99e Initial load
duke
parents:
diff changeset
113 static klassOop resolve_from_stream(symbolHandle class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // Lookup an already loaded class. If not found NULL is returned.
a61af66fc99e Initial load
duke
parents:
diff changeset
116 static klassOop find(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // Lookup an already loaded instance or array class.
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // Do not make any queries to class loaders; consult only the cache.
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // If not found NULL is returned.
a61af66fc99e Initial load
duke
parents:
diff changeset
121 static klassOop find_instance_or_array_klass(symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
122 Handle class_loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
123 Handle protection_domain,
a61af66fc99e Initial load
duke
parents:
diff changeset
124 TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // Lookup an instance or array class that has already been loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // either into the given class loader, or else into another class
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // loader that is constrained (via loader constraints) to produce
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // a consistent class. Do not take protection domains into account.
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // Do not make any queries to class loaders; consult only the cache.
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // Return NULL if the class is not found.
a61af66fc99e Initial load
duke
parents:
diff changeset
132 //
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // This function is a strict superset of find_instance_or_array_klass.
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // This function (the unchecked version) makes a conservative prediction
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // of the result of the checked version, assuming successful lookup.
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // If both functions return non-null, they must return the same value.
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // Also, the unchecked version may sometimes be non-null where the
a61af66fc99e Initial load
duke
parents:
diff changeset
138 // checked version is null. This can occur in several ways:
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // 1. No query has yet been made to the class loader.
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // 2. The class loader was queried, but chose not to delegate.
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // 3. ClassLoader.checkPackageAccess rejected a proposed protection domain.
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // 4. Loading was attempted, but there was a linkage error of some sort.
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // In all of these cases, the loader constraints on this type are
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // satisfied, and it is safe for classes in the given class loader
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // to manipulate strongly-typed values of the found class, subject
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // to local linkage and access checks.
a61af66fc99e Initial load
duke
parents:
diff changeset
147 static klassOop find_constrained_instance_or_array_klass(symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
148 Handle class_loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
149 TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 // Iterate over all klasses in dictionary
a61af66fc99e Initial load
duke
parents:
diff changeset
152 // Just the classes from defining class loaders
a61af66fc99e Initial load
duke
parents:
diff changeset
153 static void classes_do(void f(klassOop));
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // Added for initialize_itable_for_klass to handle exceptions
a61af66fc99e Initial load
duke
parents:
diff changeset
155 static void classes_do(void f(klassOop, TRAPS), TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // All classes, and their class loaders
a61af66fc99e Initial load
duke
parents:
diff changeset
157 static void classes_do(void f(klassOop, oop));
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // All classes, and their class loaders
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // (added for helpers that use HandleMarks and ResourceMarks)
a61af66fc99e Initial load
duke
parents:
diff changeset
160 static void classes_do(void f(klassOop, oop, TRAPS), TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // All entries in the placeholder table and their class loaders
a61af66fc99e Initial load
duke
parents:
diff changeset
162 static void placeholders_do(void f(symbolOop, oop));
a61af66fc99e Initial load
duke
parents:
diff changeset
163
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // Iterate over all methods in all klasses in dictionary
a61af66fc99e Initial load
duke
parents:
diff changeset
165 static void methods_do(void f(methodOop));
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 // Garbage collection support
a61af66fc99e Initial load
duke
parents:
diff changeset
168
a61af66fc99e Initial load
duke
parents:
diff changeset
169 // This method applies "blk->do_oop" to all the pointers to "system"
a61af66fc99e Initial load
duke
parents:
diff changeset
170 // classes and loaders.
a61af66fc99e Initial load
duke
parents:
diff changeset
171 static void always_strong_oops_do(OopClosure* blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
172 static void always_strong_classes_do(OopClosure* blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
173 // This method applies "blk->do_oop" to all the placeholders.
a61af66fc99e Initial load
duke
parents:
diff changeset
174 static void placeholders_do(OopClosure* blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
175
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // Unload (that is, break root links to) all unmarked classes and
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // loaders. Returns "true" iff something was unloaded.
a61af66fc99e Initial load
duke
parents:
diff changeset
178 static bool do_unloading(BoolObjectClosure* is_alive);
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // Applies "f->do_oop" to all root oops in the system dictionary.
a61af66fc99e Initial load
duke
parents:
diff changeset
181 static void oops_do(OopClosure* f);
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 // System loader lock
a61af66fc99e Initial load
duke
parents:
diff changeset
184 static oop system_loader_lock() { return _system_loader_lock_obj; }
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // Traverses preloaded oops: various system classes. These are
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // guaranteed to be in the perm gen.
a61af66fc99e Initial load
duke
parents:
diff changeset
189 static void preloaded_oops_do(OopClosure* f);
a61af66fc99e Initial load
duke
parents:
diff changeset
190 static void lazily_loaded_oops_do(OopClosure* f);
a61af66fc99e Initial load
duke
parents:
diff changeset
191
a61af66fc99e Initial load
duke
parents:
diff changeset
192 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // Sharing support.
a61af66fc99e Initial load
duke
parents:
diff changeset
194 static void reorder_dictionary();
a61af66fc99e Initial load
duke
parents:
diff changeset
195 static void copy_buckets(char** top, char* end);
a61af66fc99e Initial load
duke
parents:
diff changeset
196 static void copy_table(char** top, char* end);
a61af66fc99e Initial load
duke
parents:
diff changeset
197 static void reverse();
a61af66fc99e Initial load
duke
parents:
diff changeset
198 static void set_shared_dictionary(HashtableBucket* t, int length,
a61af66fc99e Initial load
duke
parents:
diff changeset
199 int number_of_entries);
a61af66fc99e Initial load
duke
parents:
diff changeset
200 // Printing
a61af66fc99e Initial load
duke
parents:
diff changeset
201 static void print() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
202 static void print_class_statistics() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
203 static void print_method_statistics() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
204
a61af66fc99e Initial load
duke
parents:
diff changeset
205 // Number of contained klasses
a61af66fc99e Initial load
duke
parents:
diff changeset
206 // This is both fully loaded classes and classes in the process
a61af66fc99e Initial load
duke
parents:
diff changeset
207 // of being loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
208 static int number_of_classes();
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210 // Monotonically increasing counter which grows as classes are
a61af66fc99e Initial load
duke
parents:
diff changeset
211 // loaded or modifications such as hot-swapping or setting/removing
a61af66fc99e Initial load
duke
parents:
diff changeset
212 // of breakpoints are performed
a61af66fc99e Initial load
duke
parents:
diff changeset
213 static inline int number_of_modifications() { assert_locked_or_safepoint(Compile_lock); return _number_of_modifications; }
a61af66fc99e Initial load
duke
parents:
diff changeset
214 // Needed by evolution and breakpoint code
a61af66fc99e Initial load
duke
parents:
diff changeset
215 static inline void notice_modification() { assert_locked_or_safepoint(Compile_lock); ++_number_of_modifications; }
a61af66fc99e Initial load
duke
parents:
diff changeset
216
a61af66fc99e Initial load
duke
parents:
diff changeset
217 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
218 static void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
219
a61af66fc99e Initial load
duke
parents:
diff changeset
220 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
221 static bool is_internal_format(symbolHandle class_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
222 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
223
a61af66fc99e Initial load
duke
parents:
diff changeset
224 // Verify class is in dictionary
a61af66fc99e Initial load
duke
parents:
diff changeset
225 static void verify_obj_klass_present(Handle obj,
a61af66fc99e Initial load
duke
parents:
diff changeset
226 symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
227 Handle class_loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // Initialization
a61af66fc99e Initial load
duke
parents:
diff changeset
230 static void initialize(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 // Fast access to commonly used classes (preloaded)
a61af66fc99e Initial load
duke
parents:
diff changeset
233 static klassOop check_klass(klassOop k) {
a61af66fc99e Initial load
duke
parents:
diff changeset
234 assert(k != NULL, "preloaded klass not initialized");
a61af66fc99e Initial load
duke
parents:
diff changeset
235 return k;
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
239 static klassOop object_klass() { return check_klass(_object_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
240 static klassOop string_klass() { return check_klass(_string_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 static klassOop class_klass() { return check_klass(_class_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
242 static klassOop cloneable_klass() { return check_klass(_cloneable_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
243 static klassOop classloader_klass() { return check_klass(_classloader_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
244 static klassOop serializable_klass() { return check_klass(_serializable_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
245 static klassOop system_klass() { return check_klass(_system_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
246
a61af66fc99e Initial load
duke
parents:
diff changeset
247 static klassOop throwable_klass() { return check_klass(_throwable_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
248 static klassOop error_klass() { return check_klass(_error_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
249 static klassOop threaddeath_klass() { return check_klass(_threaddeath_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
250 static klassOop exception_klass() { return check_klass(_exception_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
251 static klassOop runtime_exception_klass() { return check_klass(_runtime_exception_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
252 static klassOop classNotFoundException_klass() { return check_klass(_classNotFoundException_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
253 static klassOop noClassDefFoundError_klass() { return check_klass(_noClassDefFoundError_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
254 static klassOop linkageError_klass() { return check_klass(_linkageError_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
255 static klassOop ClassCastException_klass() { return check_klass(_classCastException_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
256 static klassOop ArrayStoreException_klass() { return check_klass(_arrayStoreException_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
257 static klassOop virtualMachineError_klass() { return check_klass(_virtualMachineError_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
258 static klassOop OutOfMemoryError_klass() { return check_klass(_outOfMemoryError_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
259 static klassOop StackOverflowError_klass() { return check_klass(_StackOverflowError_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
260 static klassOop IllegalMonitorStateException_klass() { return check_klass(_illegalMonitorStateException_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
261 static klassOop protectionDomain_klass() { return check_klass(_protectionDomain_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
262 static klassOop AccessControlContext_klass() { return check_klass(_AccessControlContext_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
263 static klassOop reference_klass() { return check_klass(_reference_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
264 static klassOop soft_reference_klass() { return check_klass(_soft_reference_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
265 static klassOop weak_reference_klass() { return check_klass(_weak_reference_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
266 static klassOop final_reference_klass() { return check_klass(_final_reference_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
267 static klassOop phantom_reference_klass() { return check_klass(_phantom_reference_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
268 static klassOop finalizer_klass() { return check_klass(_finalizer_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
269
a61af66fc99e Initial load
duke
parents:
diff changeset
270 static klassOop thread_klass() { return check_klass(_thread_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
271 static klassOop threadGroup_klass() { return check_klass(_threadGroup_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
272 static klassOop properties_klass() { return check_klass(_properties_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
273 static klassOop reflect_accessible_object_klass() { return check_klass(_reflect_accessible_object_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
274 static klassOop reflect_field_klass() { return check_klass(_reflect_field_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
275 static klassOop reflect_method_klass() { return check_klass(_reflect_method_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
276 static klassOop reflect_constructor_klass() { return check_klass(_reflect_constructor_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
277 static klassOop reflect_method_accessor_klass() {
a61af66fc99e Initial load
duke
parents:
diff changeset
278 assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only");
a61af66fc99e Initial load
duke
parents:
diff changeset
279 return check_klass(_reflect_method_accessor_klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
280 }
a61af66fc99e Initial load
duke
parents:
diff changeset
281 static klassOop reflect_constructor_accessor_klass() {
a61af66fc99e Initial load
duke
parents:
diff changeset
282 assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only");
a61af66fc99e Initial load
duke
parents:
diff changeset
283 return check_klass(_reflect_constructor_accessor_klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
284 }
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // NOTE: needed too early in bootstrapping process to have checks based on JDK version
a61af66fc99e Initial load
duke
parents:
diff changeset
286 static klassOop reflect_magic_klass() { return _reflect_magic_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
287 static klassOop reflect_delegating_classloader_klass() { return _reflect_delegating_classloader_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
288 static klassOop reflect_constant_pool_klass() {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
a61af66fc99e Initial load
duke
parents:
diff changeset
290 return _reflect_constant_pool_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
291 }
a61af66fc99e Initial load
duke
parents:
diff changeset
292 static klassOop reflect_unsafe_static_field_accessor_impl_klass() {
a61af66fc99e Initial load
duke
parents:
diff changeset
293 assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
a61af66fc99e Initial load
duke
parents:
diff changeset
294 return _reflect_unsafe_static_field_accessor_impl_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
295 }
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 static klassOop vector_klass() { return check_klass(_vector_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
298 static klassOop hashtable_klass() { return check_klass(_hashtable_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
299 static klassOop stringBuffer_klass() { return check_klass(_stringBuffer_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
300 static klassOop stackTraceElement_klass() { return check_klass(_stackTraceElement_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
301
a61af66fc99e Initial load
duke
parents:
diff changeset
302 static klassOop java_nio_Buffer_klass() { return check_klass(_java_nio_Buffer_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
303
a61af66fc99e Initial load
duke
parents:
diff changeset
304 static klassOop sun_misc_AtomicLongCSImpl_klass() { return _sun_misc_AtomicLongCSImpl_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 // To support incremental JRE downloads (KERNEL JRE). Null if not present.
a61af66fc99e Initial load
duke
parents:
diff changeset
307 static klassOop sun_jkernel_DownloadManager_klass() { return _sun_jkernel_DownloadManager_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
308
a61af66fc99e Initial load
duke
parents:
diff changeset
309 static klassOop boolean_klass() { return check_klass(_boolean_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
310 static klassOop char_klass() { return check_klass(_char_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
311 static klassOop float_klass() { return check_klass(_float_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
312 static klassOop double_klass() { return check_klass(_double_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
313 static klassOop byte_klass() { return check_klass(_byte_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
314 static klassOop short_klass() { return check_klass(_short_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
315 static klassOop int_klass() { return check_klass(_int_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
316 static klassOop long_klass() { return check_klass(_long_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
317
a61af66fc99e Initial load
duke
parents:
diff changeset
318 static klassOop box_klass(BasicType t) {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 assert((uint)t < T_VOID+1, "range check");
a61af66fc99e Initial load
duke
parents:
diff changeset
320 return check_klass(_box_klasses[t]);
a61af66fc99e Initial load
duke
parents:
diff changeset
321 }
a61af66fc99e Initial load
duke
parents:
diff changeset
322 static BasicType box_klass_type(klassOop k); // inverse of box_klass
a61af66fc99e Initial load
duke
parents:
diff changeset
323
a61af66fc99e Initial load
duke
parents:
diff changeset
324 // methods returning lazily loaded klasses
a61af66fc99e Initial load
duke
parents:
diff changeset
325 // The corresponding method to load the class must be called before calling them.
a61af66fc99e Initial load
duke
parents:
diff changeset
326 static klassOop abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
327
a61af66fc99e Initial load
duke
parents:
diff changeset
328 static void load_abstract_ownable_synchronizer_klass(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
329
a61af66fc99e Initial load
duke
parents:
diff changeset
330 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
331 // Tells whether ClassLoader.loadClassInternal is present
a61af66fc99e Initial load
duke
parents:
diff changeset
332 static bool has_loadClassInternal() { return _has_loadClassInternal; }
a61af66fc99e Initial load
duke
parents:
diff changeset
333
a61af66fc99e Initial load
duke
parents:
diff changeset
334 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
335 // Tells whether ClassLoader.checkPackageAccess is present
a61af66fc99e Initial load
duke
parents:
diff changeset
336 static bool has_checkPackageAccess() { return _has_checkPackageAccess; }
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338 static bool class_klass_loaded() { return _class_klass != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
339 static bool cloneable_klass_loaded() { return _cloneable_klass != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
340
a61af66fc99e Initial load
duke
parents:
diff changeset
341 // Returns default system loader
a61af66fc99e Initial load
duke
parents:
diff changeset
342 static oop java_system_loader();
a61af66fc99e Initial load
duke
parents:
diff changeset
343
a61af66fc99e Initial load
duke
parents:
diff changeset
344 // Compute the default system loader
a61af66fc99e Initial load
duke
parents:
diff changeset
345 static void compute_java_system_loader(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
346
a61af66fc99e Initial load
duke
parents:
diff changeset
347 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
348 // Mirrors for primitive classes (created eagerly)
a61af66fc99e Initial load
duke
parents:
diff changeset
349 static oop check_mirror(oop m) {
a61af66fc99e Initial load
duke
parents:
diff changeset
350 assert(m != NULL, "mirror not initialized");
a61af66fc99e Initial load
duke
parents:
diff changeset
351 return m;
a61af66fc99e Initial load
duke
parents:
diff changeset
352 }
a61af66fc99e Initial load
duke
parents:
diff changeset
353
a61af66fc99e Initial load
duke
parents:
diff changeset
354 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
355 // Note: java_lang_Class::primitive_type is the inverse of java_mirror
a61af66fc99e Initial load
duke
parents:
diff changeset
356
a61af66fc99e Initial load
duke
parents:
diff changeset
357 // Check class loader constraints
a61af66fc99e Initial load
duke
parents:
diff changeset
358 static bool add_loader_constraint(symbolHandle name, Handle loader1,
a61af66fc99e Initial load
duke
parents:
diff changeset
359 Handle loader2, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
360 static char* check_signature_loaders(symbolHandle signature, Handle loader1,
a61af66fc99e Initial load
duke
parents:
diff changeset
361 Handle loader2, bool is_method, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
362
a61af66fc99e Initial load
duke
parents:
diff changeset
363 // Utility for printing loader "name" as part of tracing constraints
a61af66fc99e Initial load
duke
parents:
diff changeset
364 static const char* loader_name(oop loader) {
a61af66fc99e Initial load
duke
parents:
diff changeset
365 return ((loader) == NULL ? "<bootloader>" :
a61af66fc99e Initial load
duke
parents:
diff changeset
366 instanceKlass::cast((loader)->klass())->name()->as_C_string() );
a61af66fc99e Initial load
duke
parents:
diff changeset
367 }
a61af66fc99e Initial load
duke
parents:
diff changeset
368
a61af66fc99e Initial load
duke
parents:
diff changeset
369 // Record the error when the first attempt to resolve a reference from a constant
a61af66fc99e Initial load
duke
parents:
diff changeset
370 // pool entry to a class fails.
a61af66fc99e Initial load
duke
parents:
diff changeset
371 static void add_resolution_error(constantPoolHandle pool, int which, symbolHandle error);
a61af66fc99e Initial load
duke
parents:
diff changeset
372 static symbolOop find_resolution_error(constantPoolHandle pool, int which);
a61af66fc99e Initial load
duke
parents:
diff changeset
373
a61af66fc99e Initial load
duke
parents:
diff changeset
374 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
375
a61af66fc99e Initial load
duke
parents:
diff changeset
376 enum Constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
377 _loader_constraint_size = 107, // number of entries in constraint table
a61af66fc99e Initial load
duke
parents:
diff changeset
378 _resolution_error_size = 107, // number of entries in resolution error table
a61af66fc99e Initial load
duke
parents:
diff changeset
379 _nof_buckets = 1009 // number of buckets in hash table
a61af66fc99e Initial load
duke
parents:
diff changeset
380 };
a61af66fc99e Initial load
duke
parents:
diff changeset
381
a61af66fc99e Initial load
duke
parents:
diff changeset
382
a61af66fc99e Initial load
duke
parents:
diff changeset
383 // Static variables
a61af66fc99e Initial load
duke
parents:
diff changeset
384
a61af66fc99e Initial load
duke
parents:
diff changeset
385 // Hashtable holding loaded classes.
a61af66fc99e Initial load
duke
parents:
diff changeset
386 static Dictionary* _dictionary;
a61af66fc99e Initial load
duke
parents:
diff changeset
387
a61af66fc99e Initial load
duke
parents:
diff changeset
388 // Hashtable holding placeholders for classes being loaded.
a61af66fc99e Initial load
duke
parents:
diff changeset
389 static PlaceholderTable* _placeholders;
a61af66fc99e Initial load
duke
parents:
diff changeset
390
a61af66fc99e Initial load
duke
parents:
diff changeset
391 // Hashtable holding classes from the shared archive.
a61af66fc99e Initial load
duke
parents:
diff changeset
392 static Dictionary* _shared_dictionary;
a61af66fc99e Initial load
duke
parents:
diff changeset
393
a61af66fc99e Initial load
duke
parents:
diff changeset
394 // Monotonically increasing counter which grows with
a61af66fc99e Initial load
duke
parents:
diff changeset
395 // _number_of_classes as well as hot-swapping and breakpoint setting
a61af66fc99e Initial load
duke
parents:
diff changeset
396 // and removal.
a61af66fc99e Initial load
duke
parents:
diff changeset
397 static int _number_of_modifications;
a61af66fc99e Initial load
duke
parents:
diff changeset
398
a61af66fc99e Initial load
duke
parents:
diff changeset
399 // Lock object for system class loader
a61af66fc99e Initial load
duke
parents:
diff changeset
400 static oop _system_loader_lock_obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
401
a61af66fc99e Initial load
duke
parents:
diff changeset
402 // Constraints on class loaders
a61af66fc99e Initial load
duke
parents:
diff changeset
403 static LoaderConstraintTable* _loader_constraints;
a61af66fc99e Initial load
duke
parents:
diff changeset
404
a61af66fc99e Initial load
duke
parents:
diff changeset
405 // Resolution errors
a61af66fc99e Initial load
duke
parents:
diff changeset
406 static ResolutionErrorTable* _resolution_errors;
a61af66fc99e Initial load
duke
parents:
diff changeset
407
a61af66fc99e Initial load
duke
parents:
diff changeset
408 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
409 // for VM_CounterDecay iteration support
a61af66fc99e Initial load
duke
parents:
diff changeset
410 friend class CounterDecay;
a61af66fc99e Initial load
duke
parents:
diff changeset
411 static klassOop try_get_next_class();
a61af66fc99e Initial load
duke
parents:
diff changeset
412
a61af66fc99e Initial load
duke
parents:
diff changeset
413 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
414 static void validate_protection_domain(instanceKlassHandle klass,
a61af66fc99e Initial load
duke
parents:
diff changeset
415 Handle class_loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
416 Handle protection_domain, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
417
a61af66fc99e Initial load
duke
parents:
diff changeset
418 friend class VM_PopulateDumpSharedSpace;
a61af66fc99e Initial load
duke
parents:
diff changeset
419 friend class TraversePlaceholdersClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
420 static Dictionary* dictionary() { return _dictionary; }
a61af66fc99e Initial load
duke
parents:
diff changeset
421 static Dictionary* shared_dictionary() { return _shared_dictionary; }
a61af66fc99e Initial load
duke
parents:
diff changeset
422 static PlaceholderTable* placeholders() { return _placeholders; }
a61af66fc99e Initial load
duke
parents:
diff changeset
423 static LoaderConstraintTable* constraints() { return _loader_constraints; }
a61af66fc99e Initial load
duke
parents:
diff changeset
424 static ResolutionErrorTable* resolution_errors() { return _resolution_errors; }
a61af66fc99e Initial load
duke
parents:
diff changeset
425
a61af66fc99e Initial load
duke
parents:
diff changeset
426 // Basic loading operations
a61af66fc99e Initial load
duke
parents:
diff changeset
427 static klassOop resolve_instance_class_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
428 static klassOop resolve_array_class_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
429 static instanceKlassHandle handle_parallel_super_load(symbolHandle class_name, symbolHandle supername, Handle class_loader, Handle protection_domain, Handle lockObject, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
430 // Wait on SystemDictionary_lock; unlocks lockObject before
a61af66fc99e Initial load
duke
parents:
diff changeset
431 // waiting; relocks lockObject with correct recursion count
a61af66fc99e Initial load
duke
parents:
diff changeset
432 // after waiting, but before reentering SystemDictionary_lock
a61af66fc99e Initial load
duke
parents:
diff changeset
433 // to preserve lock order semantics.
a61af66fc99e Initial load
duke
parents:
diff changeset
434 static void double_lock_wait(Handle lockObject, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
435 static void define_instance_class(instanceKlassHandle k, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
436 static instanceKlassHandle find_or_define_instance_class(symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
437 Handle class_loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
438 instanceKlassHandle k, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
439 static instanceKlassHandle load_shared_class(symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
440 Handle class_loader, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
441 static instanceKlassHandle load_shared_class(instanceKlassHandle ik,
a61af66fc99e Initial load
duke
parents:
diff changeset
442 Handle class_loader, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
443 static instanceKlassHandle load_instance_class(symbolHandle class_name, Handle class_loader, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
444 static Handle compute_loader_lock_object(Handle class_loader, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
445 static void check_loader_lock_contention(Handle loader_lock, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
446
a61af66fc99e Initial load
duke
parents:
diff changeset
447 static klassOop find_shared_class(symbolHandle class_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
448
a61af66fc99e Initial load
duke
parents:
diff changeset
449 // Setup link to hierarchy
a61af66fc99e Initial load
duke
parents:
diff changeset
450 static void add_to_hierarchy(instanceKlassHandle k, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
451
a61af66fc99e Initial load
duke
parents:
diff changeset
452 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
453 // We pass in the hashtable index so we can calculate it outside of
a61af66fc99e Initial load
duke
parents:
diff changeset
454 // the SystemDictionary_lock.
a61af66fc99e Initial load
duke
parents:
diff changeset
455
a61af66fc99e Initial load
duke
parents:
diff changeset
456 // Basic find on loaded classes
a61af66fc99e Initial load
duke
parents:
diff changeset
457 static klassOop find_class(int index, unsigned int hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
458 symbolHandle name, Handle loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
459
a61af66fc99e Initial load
duke
parents:
diff changeset
460 // Basic find on classes in the midst of being loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
461 static symbolOop find_placeholder(int index, unsigned int hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
462 symbolHandle name, Handle loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
463
a61af66fc99e Initial load
duke
parents:
diff changeset
464 // Basic find operation of loaded classes and classes in the midst
a61af66fc99e Initial load
duke
parents:
diff changeset
465 // of loading; used for assertions and verification only.
a61af66fc99e Initial load
duke
parents:
diff changeset
466 static oop find_class_or_placeholder(symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
467 Handle class_loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
468
a61af66fc99e Initial load
duke
parents:
diff changeset
469 // Updating entry in dictionary
a61af66fc99e Initial load
duke
parents:
diff changeset
470 // Add a completely loaded class
a61af66fc99e Initial load
duke
parents:
diff changeset
471 static void add_klass(int index, symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
472 Handle class_loader, KlassHandle obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
473
a61af66fc99e Initial load
duke
parents:
diff changeset
474 // Add a placeholder for a class being loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
475 static void add_placeholder(int index,
a61af66fc99e Initial load
duke
parents:
diff changeset
476 symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
477 Handle class_loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
478 static void remove_placeholder(int index,
a61af66fc99e Initial load
duke
parents:
diff changeset
479 symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
480 Handle class_loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
481
a61af66fc99e Initial load
duke
parents:
diff changeset
482 // Performs cleanups after resolve_super_or_fail. This typically needs
a61af66fc99e Initial load
duke
parents:
diff changeset
483 // to be called on failure.
a61af66fc99e Initial load
duke
parents:
diff changeset
484 // Won't throw, but can block.
a61af66fc99e Initial load
duke
parents:
diff changeset
485 static void resolution_cleanups(symbolHandle class_name,
a61af66fc99e Initial load
duke
parents:
diff changeset
486 Handle class_loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
487 TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
488
a61af66fc99e Initial load
duke
parents:
diff changeset
489 // Initialization
a61af66fc99e Initial load
duke
parents:
diff changeset
490 static void initialize_preloaded_classes(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
491
a61af66fc99e Initial load
duke
parents:
diff changeset
492 // Class loader constraints
a61af66fc99e Initial load
duke
parents:
diff changeset
493 static void check_constraints(int index, unsigned int hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
494 instanceKlassHandle k, Handle loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
495 bool defining, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
496 static void update_dictionary(int d_index, unsigned int d_hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
497 int p_index, unsigned int p_hash,
a61af66fc99e Initial load
duke
parents:
diff changeset
498 instanceKlassHandle k, Handle loader, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
499
a61af66fc99e Initial load
duke
parents:
diff changeset
500 // Variables holding commonly used klasses (preloaded)
a61af66fc99e Initial load
duke
parents:
diff changeset
501 static klassOop _object_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
502 static klassOop _string_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
503 static klassOop _class_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
504 static klassOop _cloneable_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
505 static klassOop _classloader_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
506 static klassOop _serializable_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
507 static klassOop _system_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
508
a61af66fc99e Initial load
duke
parents:
diff changeset
509 static klassOop _throwable_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
510 static klassOop _error_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
511 static klassOop _threaddeath_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
512 static klassOop _exception_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
513 static klassOop _runtime_exception_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
514 static klassOop _classNotFoundException_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
515 static klassOop _noClassDefFoundError_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
516 static klassOop _linkageError_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
517 static klassOop _classCastException_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
518 static klassOop _arrayStoreException_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
519 static klassOop _virtualMachineError_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
520 static klassOop _outOfMemoryError_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
521 static klassOop _StackOverflowError_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
522 static klassOop _illegalMonitorStateException_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
523 static klassOop _protectionDomain_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
524 static klassOop _AccessControlContext_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
525 static klassOop _reference_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
526 static klassOop _soft_reference_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
527 static klassOop _weak_reference_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
528 static klassOop _final_reference_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
529 static klassOop _phantom_reference_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
530 static klassOop _finalizer_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
531
a61af66fc99e Initial load
duke
parents:
diff changeset
532 static klassOop _thread_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
533 static klassOop _threadGroup_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
534 static klassOop _properties_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
535 static klassOop _reflect_accessible_object_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
536 static klassOop _reflect_field_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
537 static klassOop _reflect_method_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
538 static klassOop _reflect_constructor_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
539 // 1.4 reflection implementation
a61af66fc99e Initial load
duke
parents:
diff changeset
540 static klassOop _reflect_magic_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
541 static klassOop _reflect_method_accessor_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
542 static klassOop _reflect_constructor_accessor_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
543 static klassOop _reflect_delegating_classloader_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
544 // 1.5 annotations implementation
a61af66fc99e Initial load
duke
parents:
diff changeset
545 static klassOop _reflect_constant_pool_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
546 static klassOop _reflect_unsafe_static_field_accessor_impl_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
547
a61af66fc99e Initial load
duke
parents:
diff changeset
548 static klassOop _stringBuffer_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
549 static klassOop _vector_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
550 static klassOop _hashtable_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
551
a61af66fc99e Initial load
duke
parents:
diff changeset
552 static klassOop _stackTraceElement_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
553
a61af66fc99e Initial load
duke
parents:
diff changeset
554 static klassOop _java_nio_Buffer_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
555
a61af66fc99e Initial load
duke
parents:
diff changeset
556 static klassOop _sun_misc_AtomicLongCSImpl_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
557
a61af66fc99e Initial load
duke
parents:
diff changeset
558 // KERNEL JRE support.
a61af66fc99e Initial load
duke
parents:
diff changeset
559 static klassOop _sun_jkernel_DownloadManager_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
560
a61af66fc99e Initial load
duke
parents:
diff changeset
561 // Lazily loaded klasses
a61af66fc99e Initial load
duke
parents:
diff changeset
562 static volatile klassOop _abstract_ownable_synchronizer_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
563
a61af66fc99e Initial load
duke
parents:
diff changeset
564 // Box klasses
a61af66fc99e Initial load
duke
parents:
diff changeset
565 static klassOop _boolean_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
566 static klassOop _char_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
567 static klassOop _float_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
568 static klassOop _double_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
569 static klassOop _byte_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
570 static klassOop _short_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
571 static klassOop _int_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
572 static klassOop _long_klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
573
a61af66fc99e Initial load
duke
parents:
diff changeset
574 // table of same
a61af66fc99e Initial load
duke
parents:
diff changeset
575 static klassOop _box_klasses[T_VOID+1];
a61af66fc99e Initial load
duke
parents:
diff changeset
576
a61af66fc99e Initial load
duke
parents:
diff changeset
577 static oop _java_system_loader;
a61af66fc99e Initial load
duke
parents:
diff changeset
578
a61af66fc99e Initial load
duke
parents:
diff changeset
579 static bool _has_loadClassInternal;
a61af66fc99e Initial load
duke
parents:
diff changeset
580 static bool _has_checkPackageAccess;
a61af66fc99e Initial load
duke
parents:
diff changeset
581 };