202 do_klass(LiveStackFrameInfo_klass, java_lang_LiveStackFrameInfo ) \
203 \
204 /* support for stack dump lock analysis */ \
205 do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
206 \
207 /* boxing klasses */ \
208 do_klass(Boolean_klass, java_lang_Boolean ) \
209 do_klass(Character_klass, java_lang_Character ) \
210 do_klass(Float_klass, java_lang_Float ) \
211 do_klass(Double_klass, java_lang_Double ) \
212 do_klass(Byte_klass, java_lang_Byte ) \
213 do_klass(Short_klass, java_lang_Short ) \
214 do_klass(Integer_klass, java_lang_Integer ) \
215 do_klass(Long_klass, java_lang_Long ) \
216 \
217 /* force inline of iterators */ \
218 do_klass(Iterator_klass, java_util_Iterator ) \
219 \
220 /*end*/
221
222
223 class SystemDictionary : AllStatic {
224 friend class BootstrapInfo;
225 friend class VMStructs;
226 friend class SystemDictionaryHandles;
227
228 public:
229 enum WKID {
230 NO_WKID = 0,
231
232 #define WK_KLASS_ENUM(name, symbol) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
233 WK_KLASSES_DO(WK_KLASS_ENUM)
234 #undef WK_KLASS_ENUM
235
236 WKID_LIMIT,
237
238 FIRST_WKID = NO_WKID + 1
239 };
240
241 // Returns a class with a given class name and class loader. Loads the
242 // class if needed. If not found a NoClassDefFoundError or a
366
367 // Verification
368 static void verify();
369
370 // Initialization
371 static void initialize(TRAPS);
372
373 // Checked fast access to the well-known classes -- so that you don't try to use them
374 // before they are resolved.
375 static InstanceKlass* check_klass(InstanceKlass* k) {
376 assert(k != NULL, "klass not loaded");
377 return k;
378 }
379
380 static bool resolve_wk_klass(WKID id, TRAPS);
381 static void resolve_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
382 static void resolve_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
383 int limit = (int)end_id + 1;
384 resolve_wk_klasses_until((WKID) limit, start_id, THREAD);
385 }
386
387 public:
388 #define WK_KLASS_DECLARE(name, symbol) \
389 static InstanceKlass* name() { return check_klass(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
390 static InstanceKlass** name##_addr() { \
391 return &_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
392 } \
393 static bool name##_is_loaded() { \
394 return _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)] != NULL; \
395 }
396 WK_KLASSES_DO(WK_KLASS_DECLARE);
397 #undef WK_KLASS_DECLARE
398
399 static InstanceKlass* well_known_klass(WKID id) {
400 assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
401 return _well_known_klasses[id];
402 }
403
404 static InstanceKlass** well_known_klass_addr(WKID id) {
405 assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
406 return &_well_known_klasses[id];
613 static bool is_system_class_loader(oop class_loader);
614 static bool is_platform_class_loader(oop class_loader);
615
616 // Returns TRUE if the method is a non-public member of class java.lang.Object.
617 static bool is_nonpublic_Object_method(Method* m) {
618 assert(m != NULL, "Unexpected NULL Method*");
619 return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass();
620 }
621
622 protected:
623 // Setup link to hierarchy
624 static void add_to_hierarchy(InstanceKlass* k, TRAPS);
625
626 // Basic find on loaded classes
627 static InstanceKlass* find_class(unsigned int hash,
628 Symbol* name, Dictionary* dictionary);
629 static InstanceKlass* find_class(Symbol* class_name, ClassLoaderData* loader_data);
630
631 // Basic find on classes in the midst of being loaded
632 static Symbol* find_placeholder(Symbol* name, ClassLoaderData* loader_data);
633
634 // Add a placeholder for a class being loaded
635 static void add_placeholder(int index,
636 Symbol* class_name,
637 ClassLoaderData* loader_data);
638 static void remove_placeholder(int index,
639 Symbol* class_name,
640 ClassLoaderData* loader_data);
641
642 // Performs cleanups after resolve_super_or_fail. This typically needs
643 // to be called on failure.
644 // Won't throw, but can block.
645 static void resolution_cleanups(Symbol* class_name,
646 ClassLoaderData* loader_data,
647 TRAPS);
648
649 // Resolve well-known classes so they can be used like SystemDictionary::String_klass()
650 static void resolve_well_known_classes(TRAPS);
651
652 // Class loader constraints
653 static void check_constraints(unsigned int hash,
654 InstanceKlass* k, Handle loader,
655 bool defining, TRAPS);
656 static void update_dictionary(unsigned int d_hash,
657 int p_index, unsigned int p_hash,
658 InstanceKlass* k, Handle loader,
659 TRAPS);
660
661 static InstanceKlass* _well_known_klasses[];
662
663 // table of box klasses (int_klass, etc.)
664 static InstanceKlass* _box_klasses[T_VOID+1];
665
666 private:
667 static oop _java_system_loader;
|
202 do_klass(LiveStackFrameInfo_klass, java_lang_LiveStackFrameInfo ) \
203 \
204 /* support for stack dump lock analysis */ \
205 do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
206 \
207 /* boxing klasses */ \
208 do_klass(Boolean_klass, java_lang_Boolean ) \
209 do_klass(Character_klass, java_lang_Character ) \
210 do_klass(Float_klass, java_lang_Float ) \
211 do_klass(Double_klass, java_lang_Double ) \
212 do_klass(Byte_klass, java_lang_Byte ) \
213 do_klass(Short_klass, java_lang_Short ) \
214 do_klass(Integer_klass, java_lang_Integer ) \
215 do_klass(Long_klass, java_lang_Long ) \
216 \
217 /* force inline of iterators */ \
218 do_klass(Iterator_klass, java_util_Iterator ) \
219 \
220 /*end*/
221
222 class SystemDictionary : AllStatic {
223 friend class BootstrapInfo;
224 friend class VMStructs;
225 friend class SystemDictionaryHandles;
226
227 public:
228 enum WKID {
229 NO_WKID = 0,
230
231 #define WK_KLASS_ENUM(name, symbol) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
232 WK_KLASSES_DO(WK_KLASS_ENUM)
233 #undef WK_KLASS_ENUM
234
235 WKID_LIMIT,
236
237 FIRST_WKID = NO_WKID + 1
238 };
239
240 // Returns a class with a given class name and class loader. Loads the
241 // class if needed. If not found a NoClassDefFoundError or a
365
366 // Verification
367 static void verify();
368
369 // Initialization
370 static void initialize(TRAPS);
371
372 // Checked fast access to the well-known classes -- so that you don't try to use them
373 // before they are resolved.
374 static InstanceKlass* check_klass(InstanceKlass* k) {
375 assert(k != NULL, "klass not loaded");
376 return k;
377 }
378
379 static bool resolve_wk_klass(WKID id, TRAPS);
380 static void resolve_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
381 static void resolve_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
382 int limit = (int)end_id + 1;
383 resolve_wk_klasses_until((WKID) limit, start_id, THREAD);
384 }
385 public:
386 #define WK_KLASS_DECLARE(name, symbol) \
387 static InstanceKlass* name() { return check_klass(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
388 static InstanceKlass** name##_addr() { \
389 return &_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
390 } \
391 static bool name##_is_loaded() { \
392 return _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)] != NULL; \
393 }
394 WK_KLASSES_DO(WK_KLASS_DECLARE);
395 #undef WK_KLASS_DECLARE
396
397 static InstanceKlass* well_known_klass(WKID id) {
398 assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
399 return _well_known_klasses[id];
400 }
401
402 static InstanceKlass** well_known_klass_addr(WKID id) {
403 assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
404 return &_well_known_klasses[id];
611 static bool is_system_class_loader(oop class_loader);
612 static bool is_platform_class_loader(oop class_loader);
613
614 // Returns TRUE if the method is a non-public member of class java.lang.Object.
615 static bool is_nonpublic_Object_method(Method* m) {
616 assert(m != NULL, "Unexpected NULL Method*");
617 return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass();
618 }
619
620 protected:
621 // Setup link to hierarchy
622 static void add_to_hierarchy(InstanceKlass* k, TRAPS);
623
624 // Basic find on loaded classes
625 static InstanceKlass* find_class(unsigned int hash,
626 Symbol* name, Dictionary* dictionary);
627 static InstanceKlass* find_class(Symbol* class_name, ClassLoaderData* loader_data);
628
629 // Basic find on classes in the midst of being loaded
630 static Symbol* find_placeholder(Symbol* name, ClassLoaderData* loader_data);
631
632 // Resolve well-known classes so they can be used like SystemDictionary::String_klass()
633 static void resolve_well_known_classes(TRAPS);
634
635 // Class loader constraints
636 static void check_constraints(unsigned int hash,
637 InstanceKlass* k, Handle loader,
638 bool defining, TRAPS);
639 static void update_dictionary(unsigned int d_hash,
640 int p_index, unsigned int p_hash,
641 InstanceKlass* k, Handle loader,
642 TRAPS);
643
644 static InstanceKlass* _well_known_klasses[];
645
646 // table of box klasses (int_klass, etc.)
647 static InstanceKlass* _box_klasses[T_VOID+1];
648
649 private:
650 static oop _java_system_loader;
|