238
239 #if INCLUDE_JVMCI
240 FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(JVMCI_klass),
241 LAST_JVMCI_WKID = WK_KLASS_ENUM_NAME(Value_klass),
242 #endif
243
244 FIRST_WKID = NO_WKID + 1
245 };
246
247 enum InitOption {
248 Pre, // preloaded; error if not present
249
250 // Order is significant. Options before this point require resolve_or_fail.
251 // Options after this point will use resolve_or_null instead.
252
253 Opt, // preload tried; NULL if not present
254 #if INCLUDE_JVMCI
255 Jvmci, // preload tried; error if not present if JVMCI enabled
256 #endif
257 ValhallaClasses, // loaded if Valhalla enabled
258 MVTClasses, // loaded if MVT enabled
259 OPTION_LIMIT,
260 CEIL_LG_OPTION_LIMIT = 3 // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
261 };
262
263
264 // Returns a class with a given class name and class loader. Loads the
265 // class if needed. If not found a NoClassDefFoundError or a
266 // ClassNotFoundException is thrown, depending on the value on the
267 // throw_error flag. For most uses the throw_error argument should be set
268 // to true.
269
270 static Klass* resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS);
271 // Convenient call for null loader and protection domain.
272 static Klass* resolve_or_fail(Symbol* class_name, bool throw_error, TRAPS);
273 protected:
274 // handle error translation for resolve_or_null results
275 static Klass* handle_resolution_exception(Symbol* class_name, bool throw_error, Klass* klass, TRAPS);
276
277 public:
278
409 // of breakpoints are performed
410 static inline int number_of_modifications() { assert_locked_or_safepoint(Compile_lock); return _number_of_modifications; }
411 // Needed by evolution and breakpoint code
412 static inline void notice_modification() { assert_locked_or_safepoint(Compile_lock); ++_number_of_modifications; }
413
414 // Verification
415 static void verify();
416
417 // Initialization
418 static void initialize(TRAPS);
419
420 // Checked fast access to commonly used classes - mostly preloaded
421 static InstanceKlass* check_klass(InstanceKlass* k) {
422 assert(k != NULL, "klass not loaded");
423 return k;
424 }
425
426 static InstanceKlass* check_klass_Pre(InstanceKlass* k) { return check_klass(k); }
427 static InstanceKlass* check_klass_Opt(InstanceKlass* k) { return k; }
428 static InstanceKlass* check_klass_ValhallaClasses(InstanceKlass* k) { return k; }
429 static InstanceKlass* check_klass_MVTClasses(InstanceKlass* k) { return k; }
430
431 JVMCI_ONLY(static InstanceKlass* check_klass_Jvmci(InstanceKlass* k) { return k; })
432
433 static bool initialize_wk_klass(WKID id, int init_opt, TRAPS);
434 static void initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
435 static void initialize_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
436 int limit = (int)end_id + 1;
437 initialize_wk_klasses_until((WKID) limit, start_id, THREAD);
438 }
439
440 public:
441 #define WK_KLASS_DECLARE(name, symbol, option) \
442 static InstanceKlass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
443 static InstanceKlass** name##_addr() { \
444 return &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
445 }
446 WK_KLASSES_DO(WK_KLASS_DECLARE);
447 #undef WK_KLASS_DECLARE
448
449 static InstanceKlass* well_known_klass(WKID id) {
|
238
239 #if INCLUDE_JVMCI
240 FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(JVMCI_klass),
241 LAST_JVMCI_WKID = WK_KLASS_ENUM_NAME(Value_klass),
242 #endif
243
244 FIRST_WKID = NO_WKID + 1
245 };
246
247 enum InitOption {
248 Pre, // preloaded; error if not present
249
250 // Order is significant. Options before this point require resolve_or_fail.
251 // Options after this point will use resolve_or_null instead.
252
253 Opt, // preload tried; NULL if not present
254 #if INCLUDE_JVMCI
255 Jvmci, // preload tried; error if not present if JVMCI enabled
256 #endif
257 ValhallaClasses, // loaded if Valhalla enabled
258 OPTION_LIMIT,
259 CEIL_LG_OPTION_LIMIT = 3 // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
260 };
261
262
263 // Returns a class with a given class name and class loader. Loads the
264 // class if needed. If not found a NoClassDefFoundError or a
265 // ClassNotFoundException is thrown, depending on the value on the
266 // throw_error flag. For most uses the throw_error argument should be set
267 // to true.
268
269 static Klass* resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS);
270 // Convenient call for null loader and protection domain.
271 static Klass* resolve_or_fail(Symbol* class_name, bool throw_error, TRAPS);
272 protected:
273 // handle error translation for resolve_or_null results
274 static Klass* handle_resolution_exception(Symbol* class_name, bool throw_error, Klass* klass, TRAPS);
275
276 public:
277
408 // of breakpoints are performed
409 static inline int number_of_modifications() { assert_locked_or_safepoint(Compile_lock); return _number_of_modifications; }
410 // Needed by evolution and breakpoint code
411 static inline void notice_modification() { assert_locked_or_safepoint(Compile_lock); ++_number_of_modifications; }
412
413 // Verification
414 static void verify();
415
416 // Initialization
417 static void initialize(TRAPS);
418
419 // Checked fast access to commonly used classes - mostly preloaded
420 static InstanceKlass* check_klass(InstanceKlass* k) {
421 assert(k != NULL, "klass not loaded");
422 return k;
423 }
424
425 static InstanceKlass* check_klass_Pre(InstanceKlass* k) { return check_klass(k); }
426 static InstanceKlass* check_klass_Opt(InstanceKlass* k) { return k; }
427 static InstanceKlass* check_klass_ValhallaClasses(InstanceKlass* k) { return k; }
428
429 JVMCI_ONLY(static InstanceKlass* check_klass_Jvmci(InstanceKlass* k) { return k; })
430
431 static bool initialize_wk_klass(WKID id, int init_opt, TRAPS);
432 static void initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
433 static void initialize_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
434 int limit = (int)end_id + 1;
435 initialize_wk_klasses_until((WKID) limit, start_id, THREAD);
436 }
437
438 public:
439 #define WK_KLASS_DECLARE(name, symbol, option) \
440 static InstanceKlass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
441 static InstanceKlass** name##_addr() { \
442 return &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
443 }
444 WK_KLASSES_DO(WK_KLASS_DECLARE);
445 #undef WK_KLASS_DECLARE
446
447 static InstanceKlass* well_known_klass(WKID id) {
|