151 template(BoundMethodHandle_klass, java_lang_invoke_BoundMethodHandle, Pre_JSR292) \
152 template(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Pre_JSR292) \
153 template(MethodType_klass, java_lang_invoke_MethodType, Pre_JSR292) \
154 template(MethodTypeForm_klass, java_lang_invoke_MethodTypeForm, Pre_JSR292) \
155 template(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre_JSR292) \
156 template(WrongMethodTypeException_klass, java_lang_invoke_WrongMethodTypeException, Pre_JSR292) \
157 template(CallSite_klass, java_lang_invoke_CallSite, Pre_JSR292) \
158 template(CountingMethodHandle_klass, java_lang_invoke_CountingMethodHandle, Opt) \
159 template(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre_JSR292) \
160 template(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre_JSR292) \
161 template(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre_JSR292) \
162 /* Note: MethodHandle must be first, and VolatileCallSite last in group */ \
163 \
164 template(StringBuffer_klass, java_lang_StringBuffer, Pre) \
165 template(StringBuilder_klass, java_lang_StringBuilder, Pre) \
166 \
167 /* It's NULL in non-1.4 JDKs. */ \
168 template(StackTraceElement_klass, java_lang_StackTraceElement, Opt) \
169 /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \
170 /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
171 template(java_nio_Buffer_klass, java_nio_Buffer, Opt) \
172 \
173 /* If this class isn't present, it won't be referenced. */ \
174 template(sun_misc_AtomicLongCSImpl_klass, sun_misc_AtomicLongCSImpl, Opt) \
175 \
176 template(sun_jkernel_DownloadManager_klass, sun_jkernel_DownloadManager, Opt_Kernel) \
177 \
178 template(sun_misc_PostVMInitHook_klass, sun_misc_PostVMInitHook, Opt) \
179 \
180 /* Preload boxing klasses */ \
181 template(Boolean_klass, java_lang_Boolean, Pre) \
182 template(Character_klass, java_lang_Character, Pre) \
183 template(Float_klass, java_lang_Float, Pre) \
184 template(Double_klass, java_lang_Double, Pre) \
185 template(Byte_klass, java_lang_Byte, Pre) \
186 template(Short_klass, java_lang_Short, Pre) \
187 template(Integer_klass, java_lang_Integer, Pre) \
188 template(Long_klass, java_lang_Long, Pre) \
189 /*end*/
190
191
192 class SystemDictionary : AllStatic {
193 friend class VMStructs;
194 friend class CompactingPermGenGen;
195 friend class SystemDictionaryHandles;
196 NOT_PRODUCT(friend class instanceKlassKlass;)
197
198 public:
199 enum WKID {
200 NO_WKID = 0,
201
202 #define WK_KLASS_ENUM(name, ignore_s, ignore_o) WK_KLASS_ENUM_NAME(name),
203 WK_KLASSES_DO(WK_KLASS_ENUM)
204 #undef WK_KLASS_ENUM
205
206 WKID_LIMIT,
207
208 FIRST_WKID = NO_WKID + 1
209 };
210
211 enum InitOption {
212 Pre, // preloaded; error if not present
213 Pre_JSR292, // preloaded if EnableInvokeDynamic
214
215 // Order is significant. Options before this point require resolve_or_fail.
216 // Options after this point will use resolve_or_null instead.
217
218 Opt, // preload tried; NULL if not present
219 Opt_Only_JDK14NewRef, // preload tried; use only with NewReflection
220 Opt_Only_JDK15, // preload tried; use only with JDK1.5+
221 Opt_Kernel, // preload tried only #ifdef KERNEL
222 OPTION_LIMIT,
409 static klassOop check_klass_Opt(klassOop k) { return k; }
410 static klassOop check_klass_Opt_Kernel(klassOop k) { return k; } //== Opt
411 static klassOop check_klass_Opt_Only_JDK15(klassOop k) {
412 assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
413 return k;
414 }
415 static klassOop check_klass_Opt_Only_JDK14NewRef(klassOop k) {
416 assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only");
417 // despite the optional loading, if you use this it must be present:
418 return check_klass(k);
419 }
420
421 static bool initialize_wk_klass(WKID id, int init_opt, TRAPS);
422 static void initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
423 static void initialize_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
424 int limit = (int)end_id + 1;
425 initialize_wk_klasses_until((WKID) limit, start_id, THREAD);
426 }
427
428 public:
429 #define WK_KLASS_DECLARE(name, ignore_symbol, option) \
430 static klassOop name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); }
431 WK_KLASSES_DO(WK_KLASS_DECLARE);
432 #undef WK_KLASS_DECLARE
433
434 // Local definition for direct access to the private array:
435 #define WK_KLASS(name) _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]
436
437 static klassOop box_klass(BasicType t) {
438 assert((uint)t < T_VOID+1, "range check");
439 return check_klass(_box_klasses[t]);
440 }
441 static BasicType box_klass_type(klassOop k); // inverse of box_klass
442
443 // methods returning lazily loaded klasses
444 // The corresponding method to load the class must be called before calling them.
445 static klassOop abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
446
447 static void load_abstract_ownable_synchronizer_klass(TRAPS);
448
449 private:
450 // Tells whether ClassLoader.loadClassInternal is present
451 static bool has_loadClassInternal() { return _has_loadClassInternal; }
452
453 public:
|
151 template(BoundMethodHandle_klass, java_lang_invoke_BoundMethodHandle, Pre_JSR292) \
152 template(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Pre_JSR292) \
153 template(MethodType_klass, java_lang_invoke_MethodType, Pre_JSR292) \
154 template(MethodTypeForm_klass, java_lang_invoke_MethodTypeForm, Pre_JSR292) \
155 template(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre_JSR292) \
156 template(WrongMethodTypeException_klass, java_lang_invoke_WrongMethodTypeException, Pre_JSR292) \
157 template(CallSite_klass, java_lang_invoke_CallSite, Pre_JSR292) \
158 template(CountingMethodHandle_klass, java_lang_invoke_CountingMethodHandle, Opt) \
159 template(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre_JSR292) \
160 template(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre_JSR292) \
161 template(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre_JSR292) \
162 /* Note: MethodHandle must be first, and VolatileCallSite last in group */ \
163 \
164 template(StringBuffer_klass, java_lang_StringBuffer, Pre) \
165 template(StringBuilder_klass, java_lang_StringBuilder, Pre) \
166 \
167 /* It's NULL in non-1.4 JDKs. */ \
168 template(StackTraceElement_klass, java_lang_StackTraceElement, Opt) \
169 /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \
170 /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
171 template(nio_Buffer_klass, java_nio_Buffer, Opt) \
172 \
173 /* If this class isn't present, it won't be referenced. */ \
174 template(AtomicLongCSImpl_klass, sun_misc_AtomicLongCSImpl, Opt) \
175 \
176 template(DownloadManager_klass, sun_jkernel_DownloadManager, Opt_Kernel) \
177 \
178 template(PostVMInitHook_klass, sun_misc_PostVMInitHook, Opt) \
179 \
180 /* Preload boxing klasses */ \
181 template(Boolean_klass, java_lang_Boolean, Pre) \
182 template(Character_klass, java_lang_Character, Pre) \
183 template(Float_klass, java_lang_Float, Pre) \
184 template(Double_klass, java_lang_Double, Pre) \
185 template(Byte_klass, java_lang_Byte, Pre) \
186 template(Short_klass, java_lang_Short, Pre) \
187 template(Integer_klass, java_lang_Integer, Pre) \
188 template(Long_klass, java_lang_Long, Pre) \
189 /*end*/
190
191
192 class SystemDictionary : AllStatic {
193 friend class VMStructs;
194 friend class CompactingPermGenGen;
195 friend class SystemDictionaryHandles;
196 NOT_PRODUCT(friend class instanceKlassKlass;)
197
198 public:
199 enum WKID {
200 NO_WKID = 0,
201
202 #define WK_KLASS_ENUM(name, symbol, ignore_o) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
203 WK_KLASSES_DO(WK_KLASS_ENUM)
204 #undef WK_KLASS_ENUM
205
206 WKID_LIMIT,
207
208 FIRST_WKID = NO_WKID + 1
209 };
210
211 enum InitOption {
212 Pre, // preloaded; error if not present
213 Pre_JSR292, // preloaded if EnableInvokeDynamic
214
215 // Order is significant. Options before this point require resolve_or_fail.
216 // Options after this point will use resolve_or_null instead.
217
218 Opt, // preload tried; NULL if not present
219 Opt_Only_JDK14NewRef, // preload tried; use only with NewReflection
220 Opt_Only_JDK15, // preload tried; use only with JDK1.5+
221 Opt_Kernel, // preload tried only #ifdef KERNEL
222 OPTION_LIMIT,
409 static klassOop check_klass_Opt(klassOop k) { return k; }
410 static klassOop check_klass_Opt_Kernel(klassOop k) { return k; } //== Opt
411 static klassOop check_klass_Opt_Only_JDK15(klassOop k) {
412 assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
413 return k;
414 }
415 static klassOop check_klass_Opt_Only_JDK14NewRef(klassOop k) {
416 assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only");
417 // despite the optional loading, if you use this it must be present:
418 return check_klass(k);
419 }
420
421 static bool initialize_wk_klass(WKID id, int init_opt, TRAPS);
422 static void initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
423 static void initialize_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
424 int limit = (int)end_id + 1;
425 initialize_wk_klasses_until((WKID) limit, start_id, THREAD);
426 }
427
428 public:
429 #define WK_KLASS_DECLARE(name, symbol, option) \
430 static klassOop name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); }
431 WK_KLASSES_DO(WK_KLASS_DECLARE);
432 #undef WK_KLASS_DECLARE
433
434 static klassOop well_known_klass(WKID id) {
435 assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
436 return _well_known_klasses[id];
437 }
438
439 // Local definition for direct access to the private array:
440 #define WK_KLASS(name) _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]
441
442 static klassOop box_klass(BasicType t) {
443 assert((uint)t < T_VOID+1, "range check");
444 return check_klass(_box_klasses[t]);
445 }
446 static BasicType box_klass_type(klassOop k); // inverse of box_klass
447
448 // methods returning lazily loaded klasses
449 // The corresponding method to load the class must be called before calling them.
450 static klassOop abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
451
452 static void load_abstract_ownable_synchronizer_klass(TRAPS);
453
454 private:
455 // Tells whether ClassLoader.loadClassInternal is present
456 static bool has_loadClassInternal() { return _has_loadClassInternal; }
457
458 public:
|