676 constantPoolHandle h_this(THREAD, this);
677 return resolve_constant_at_impl(h_this, index, _no_index_sentinel, THREAD);
678 }
679
680 oop resolve_cached_constant_at(int cache_index, TRAPS) {
681 constantPoolHandle h_this(THREAD, this);
682 return resolve_constant_at_impl(h_this, _no_index_sentinel, cache_index, THREAD);
683 }
684
685 oop resolve_possibly_cached_constant_at(int pool_index, TRAPS) {
686 constantPoolHandle h_this(THREAD, this);
687 return resolve_constant_at_impl(h_this, pool_index, _possible_index_sentinel, THREAD);
688 }
689
690 oop resolve_bootstrap_specifier_at(int index, TRAPS) {
691 constantPoolHandle h_this(THREAD, this);
692 return resolve_bootstrap_specifier_at_impl(h_this, index, THREAD);
693 }
694
695 // Klass name matches name at offset
696 bool klass_name_at_matches(instanceKlassHandle k, int which);
697
698 // Sizing
699 int length() const { return _length; }
700 void set_length(int length) { _length = length; }
701
702 // Tells whether index is within bounds.
703 bool is_within_bounds(int index) const {
704 return 0 <= index && index < length();
705 }
706
707 // Sizing (in words)
708 static int header_size() { return sizeof(ConstantPool)/wordSize; }
709 static int size(int length) { return align_metadata_size(header_size() + length); }
710 int size() const { return size(length()); }
711 #if INCLUDE_SERVICES
712 void collect_statistics(KlassSizeStats *sz) const;
713 #endif
714
715 friend class ClassFileParser;
716 friend class SystemDictionary;
762 void patch_resolved_references(GrowableArray<Handle>* cp_patches);
763
764 Symbol* impl_name_ref_at(int which, bool uncached);
765 Symbol* impl_signature_ref_at(int which, bool uncached);
766 int impl_klass_ref_index_at(int which, bool uncached);
767 int impl_name_and_type_ref_index_at(int which, bool uncached);
768 constantTag impl_tag_ref_at(int which, bool uncached);
769
770 // Used while constructing constant pool (only by ClassFileParser)
771 jint klass_index_at(int which) {
772 assert(tag_at(which).is_klass_index(), "Corrupted constant pool");
773 return *int_at_addr(which);
774 }
775
776 jint string_index_at(int which) {
777 assert(tag_at(which).is_string_index(), "Corrupted constant pool");
778 return *int_at_addr(which);
779 }
780
781 // Performs the LinkResolver checks
782 static void verify_constant_pool_resolve(const constantPoolHandle& this_cp, KlassHandle klass, TRAPS);
783
784 // Implementation of methods that needs an exposed 'this' pointer, in order to
785 // handle GC while executing the method
786 static Klass* klass_at_impl(const constantPoolHandle& this_cp, int which,
787 bool save_resolution_error, TRAPS);
788 static oop string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS);
789
790 static void trace_class_resolution(const constantPoolHandle& this_cp, KlassHandle k);
791
792 // Resolve string constants (to prevent allocation during compilation)
793 static void resolve_string_constants_impl(const constantPoolHandle& this_cp, TRAPS);
794
795 static oop resolve_constant_at_impl(const constantPoolHandle& this_cp, int index, int cache_index, TRAPS);
796 static oop resolve_bootstrap_specifier_at_impl(const constantPoolHandle& this_cp, int index, TRAPS);
797
798 // Exception handling
799 static void throw_resolution_error(const constantPoolHandle& this_cp, int which, TRAPS);
800 static Symbol* exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception);
801 static void save_and_throw_exception(const constantPoolHandle& this_cp, int which, constantTag tag, TRAPS);
802
803 public:
804 // Merging ConstantPool* support:
805 bool compare_entry_to(int index1, const constantPoolHandle& cp2, int index2, TRAPS);
806 void copy_cp_to(int start_i, int end_i, const constantPoolHandle& to_cp, int to_i, TRAPS) {
807 constantPoolHandle h_this(THREAD, this);
808 copy_cp_to_impl(h_this, start_i, end_i, to_cp, to_i, THREAD);
809 }
810 static void copy_cp_to_impl(const constantPoolHandle& from_cp, int start_i, int end_i, const constantPoolHandle& to_cp, int to_i, TRAPS);
|
676 constantPoolHandle h_this(THREAD, this);
677 return resolve_constant_at_impl(h_this, index, _no_index_sentinel, THREAD);
678 }
679
680 oop resolve_cached_constant_at(int cache_index, TRAPS) {
681 constantPoolHandle h_this(THREAD, this);
682 return resolve_constant_at_impl(h_this, _no_index_sentinel, cache_index, THREAD);
683 }
684
685 oop resolve_possibly_cached_constant_at(int pool_index, TRAPS) {
686 constantPoolHandle h_this(THREAD, this);
687 return resolve_constant_at_impl(h_this, pool_index, _possible_index_sentinel, THREAD);
688 }
689
690 oop resolve_bootstrap_specifier_at(int index, TRAPS) {
691 constantPoolHandle h_this(THREAD, this);
692 return resolve_bootstrap_specifier_at_impl(h_this, index, THREAD);
693 }
694
695 // Klass name matches name at offset
696 bool klass_name_at_matches(const InstanceKlass* k, int which);
697
698 // Sizing
699 int length() const { return _length; }
700 void set_length(int length) { _length = length; }
701
702 // Tells whether index is within bounds.
703 bool is_within_bounds(int index) const {
704 return 0 <= index && index < length();
705 }
706
707 // Sizing (in words)
708 static int header_size() { return sizeof(ConstantPool)/wordSize; }
709 static int size(int length) { return align_metadata_size(header_size() + length); }
710 int size() const { return size(length()); }
711 #if INCLUDE_SERVICES
712 void collect_statistics(KlassSizeStats *sz) const;
713 #endif
714
715 friend class ClassFileParser;
716 friend class SystemDictionary;
762 void patch_resolved_references(GrowableArray<Handle>* cp_patches);
763
764 Symbol* impl_name_ref_at(int which, bool uncached);
765 Symbol* impl_signature_ref_at(int which, bool uncached);
766 int impl_klass_ref_index_at(int which, bool uncached);
767 int impl_name_and_type_ref_index_at(int which, bool uncached);
768 constantTag impl_tag_ref_at(int which, bool uncached);
769
770 // Used while constructing constant pool (only by ClassFileParser)
771 jint klass_index_at(int which) {
772 assert(tag_at(which).is_klass_index(), "Corrupted constant pool");
773 return *int_at_addr(which);
774 }
775
776 jint string_index_at(int which) {
777 assert(tag_at(which).is_string_index(), "Corrupted constant pool");
778 return *int_at_addr(which);
779 }
780
781 // Performs the LinkResolver checks
782 static void verify_constant_pool_resolve(const constantPoolHandle& this_cp, Klass* klass, TRAPS);
783
784 // Implementation of methods that needs an exposed 'this' pointer, in order to
785 // handle GC while executing the method
786 static Klass* klass_at_impl(const constantPoolHandle& this_cp, int which,
787 bool save_resolution_error, TRAPS);
788 static oop string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS);
789
790 static void trace_class_resolution(const constantPoolHandle& this_cp, Klass* k);
791
792 // Resolve string constants (to prevent allocation during compilation)
793 static void resolve_string_constants_impl(const constantPoolHandle& this_cp, TRAPS);
794
795 static oop resolve_constant_at_impl(const constantPoolHandle& this_cp, int index, int cache_index, TRAPS);
796 static oop resolve_bootstrap_specifier_at_impl(const constantPoolHandle& this_cp, int index, TRAPS);
797
798 // Exception handling
799 static void throw_resolution_error(const constantPoolHandle& this_cp, int which, TRAPS);
800 static Symbol* exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception);
801 static void save_and_throw_exception(const constantPoolHandle& this_cp, int which, constantTag tag, TRAPS);
802
803 public:
804 // Merging ConstantPool* support:
805 bool compare_entry_to(int index1, const constantPoolHandle& cp2, int index2, TRAPS);
806 void copy_cp_to(int start_i, int end_i, const constantPoolHandle& to_cp, int to_i, TRAPS) {
807 constantPoolHandle h_this(THREAD, this);
808 copy_cp_to_impl(h_this, start_i, end_i, to_cp, to_i, THREAD);
809 }
810 static void copy_cp_to_impl(const constantPoolHandle& from_cp, int start_i, int end_i, const constantPoolHandle& to_cp, int to_i, TRAPS);
|