602 603 // Find method indices by name. If a method with the specified name is 604 // found the index to the first method is returned, and 'end' is filled in 605 // with the index of first non-name-matching method. If no method is found 606 // -1 is returned. 607 int find_method_by_name(const Symbol* name, int* end) const; 608 static int find_method_by_name(const Array<Method*>* methods, 609 const Symbol* name, int* end); 610 611 // constant pool 612 ConstantPool* constants() const { return _constants; } 613 void set_constants(ConstantPool* c) { _constants = c; } 614 615 // protection domain 616 oop protection_domain() const; 617 618 // signers 619 objArrayOop signers() const; 620 621 // host class 622 Klass* host_klass() const { 623 Klass** hk = (Klass**)adr_host_klass(); 624 if (hk == NULL) { 625 return NULL; 626 } else { 627 assert(*hk != NULL, "host klass should always be set if the address is not null"); 628 return *hk; 629 } 630 } 631 void set_host_klass(const Klass* host) { 632 assert(is_anonymous(), "not anonymous"); 633 const Klass** addr = (const Klass**)adr_host_klass(); 634 assert(addr != NULL, "no reversed space"); 635 if (addr != NULL) { 636 *addr = host; 637 } 638 } 639 bool is_anonymous() const { 640 return (_misc_flags & _misc_is_anonymous) != 0; 641 } 642 void set_is_anonymous(bool value) { 643 if (value) { 644 _misc_flags |= _misc_is_anonymous; 645 } else { 646 _misc_flags &= ~_misc_is_anonymous; 647 } 648 } 649 650 // Oop that keeps the metadata for this class from being unloaded 651 // in places where the metadata is stored in other places, like nmethods 652 oop klass_holder() const { 653 return is_anonymous() ? java_mirror() : class_loader(); 1040 1041 address static_field_addr(int offset); 1042 1043 OopMapBlock* start_of_nonstatic_oop_maps() const { 1044 return (OopMapBlock*)(start_of_itable() + itable_length()); 1045 } 1046 1047 Klass** end_of_nonstatic_oop_maps() const { 1048 return (Klass**)(start_of_nonstatic_oop_maps() + 1049 nonstatic_oop_map_count()); 1050 } 1051 1052 Klass** adr_implementor() const { 1053 if (is_interface()) { 1054 return (Klass**)end_of_nonstatic_oop_maps(); 1055 } else { 1056 return NULL; 1057 } 1058 }; 1059 1060 Klass** adr_host_klass() const { 1061 if (is_anonymous()) { 1062 Klass** adr_impl = adr_implementor(); 1063 if (adr_impl != NULL) { 1064 return adr_impl + 1; 1065 } else { 1066 return end_of_nonstatic_oop_maps(); 1067 } 1068 } else { 1069 return NULL; 1070 } 1071 } 1072 1073 // Use this to return the size of an instance in heap words: 1074 int size_helper() const { 1075 return layout_helper_to_size_helper(layout_helper()); 1076 } 1077 1078 // This bit is initialized in classFileParser.cpp. 1079 // It is false under any of the following conditions: 1080 // - the class is abstract (including any interface) 1081 // - the class has a finalizer (if !RegisterFinalizersAtInit) 1082 // - the class size is larger than FastAllocateSizeLimit 1083 // - the class is java/lang/Class, which cannot be allocated directly 1084 bool can_be_fastpath_allocated() const { 1085 return !layout_helper_needs_slow_path(layout_helper()); 1086 } | 602 603 // Find method indices by name. If a method with the specified name is 604 // found the index to the first method is returned, and 'end' is filled in 605 // with the index of first non-name-matching method. If no method is found 606 // -1 is returned. 607 int find_method_by_name(const Symbol* name, int* end) const; 608 static int find_method_by_name(const Array<Method*>* methods, 609 const Symbol* name, int* end); 610 611 // constant pool 612 ConstantPool* constants() const { return _constants; } 613 void set_constants(ConstantPool* c) { _constants = c; } 614 615 // protection domain 616 oop protection_domain() const; 617 618 // signers 619 objArrayOop signers() const; 620 621 // host class 622 InstanceKlass* host_klass() const { 623 InstanceKlass** hk = adr_host_klass(); 624 if (hk == NULL) { 625 return NULL; 626 } else { 627 assert(*hk != NULL, "host klass should always be set if the address is not null"); 628 return *hk; 629 } 630 } 631 void set_host_klass(const InstanceKlass* host) { 632 assert(is_anonymous(), "not anonymous"); 633 const InstanceKlass** addr = (const InstanceKlass **)adr_host_klass(); 634 assert(addr != NULL, "no reversed space"); 635 if (addr != NULL) { 636 *addr = host; 637 } 638 } 639 bool is_anonymous() const { 640 return (_misc_flags & _misc_is_anonymous) != 0; 641 } 642 void set_is_anonymous(bool value) { 643 if (value) { 644 _misc_flags |= _misc_is_anonymous; 645 } else { 646 _misc_flags &= ~_misc_is_anonymous; 647 } 648 } 649 650 // Oop that keeps the metadata for this class from being unloaded 651 // in places where the metadata is stored in other places, like nmethods 652 oop klass_holder() const { 653 return is_anonymous() ? java_mirror() : class_loader(); 1040 1041 address static_field_addr(int offset); 1042 1043 OopMapBlock* start_of_nonstatic_oop_maps() const { 1044 return (OopMapBlock*)(start_of_itable() + itable_length()); 1045 } 1046 1047 Klass** end_of_nonstatic_oop_maps() const { 1048 return (Klass**)(start_of_nonstatic_oop_maps() + 1049 nonstatic_oop_map_count()); 1050 } 1051 1052 Klass** adr_implementor() const { 1053 if (is_interface()) { 1054 return (Klass**)end_of_nonstatic_oop_maps(); 1055 } else { 1056 return NULL; 1057 } 1058 }; 1059 1060 InstanceKlass** adr_host_klass() const { 1061 if (is_anonymous()) { 1062 InstanceKlass** adr_impl = (InstanceKlass **)adr_implementor(); 1063 if (adr_impl != NULL) { 1064 return adr_impl + 1; 1065 } else { 1066 return (InstanceKlass **)end_of_nonstatic_oop_maps(); 1067 } 1068 } else { 1069 return NULL; 1070 } 1071 } 1072 1073 // Use this to return the size of an instance in heap words: 1074 int size_helper() const { 1075 return layout_helper_to_size_helper(layout_helper()); 1076 } 1077 1078 // This bit is initialized in classFileParser.cpp. 1079 // It is false under any of the following conditions: 1080 // - the class is abstract (including any interface) 1081 // - the class has a finalizer (if !RegisterFinalizersAtInit) 1082 // - the class size is larger than FastAllocateSizeLimit 1083 // - the class is java/lang/Class, which cannot be allocated directly 1084 bool can_be_fastpath_allocated() const { 1085 return !layout_helper_needs_slow_path(layout_helper()); 1086 } |