hotspot Sdiff src/share/vm/oops (original) (raw)
645 // actually rewritten constant pool cache indices. 646 // The routine remap_instruction_operand_from_cache manages the adjustment 647 // of these values back to constant pool indices. 648 649 // There are also "uncached" versions which do not adjust the operand index; see below. 650 651 // FIXME: Consider renaming these with a prefix "cached_" to make the distinction clear. 652 // In a few cases (the verifier) there are uses before a cpcache has been built, 653 // which are handled by a dynamic check in remap_instruction_operand_from_cache. 654 // FIXME: Remove the dynamic check, and adjust all callers to specify the correct mode. 655 656 // Lookup for entries consisting of (klass_index, name_and_type index) 657 Klass* klass_ref_at(int which, TRAPS); 658 Symbol* klass_ref_at_noresolve(int which); 659 Symbol* name_ref_at(int which) { return impl_name_ref_at(which, false); } 660 Symbol* signature_ref_at(int which) { return impl_signature_ref_at(which, false); } 661 662 int klass_ref_index_at(int which) { return impl_klass_ref_index_at(which, false); } 663 int name_and_type_ref_index_at(int which) { return impl_name_and_type_ref_index_at(which, false); } 664
665 // Lookup for entries consisting of (name_index, signature_index) 666 int name_ref_index_at(int which_nt); // == low-order jshort of name_and_type_at(which_nt) 667 int signature_ref_index_at(int which_nt); // == high-order jshort of name_and_type_at(which_nt) 668 669 BasicType basic_type_for_signature_at(int which); 670 671 // Resolve string constants (to prevent allocation during compilation) 672 void resolve_string_constants(TRAPS) { 673 constantPoolHandle h_this(THREAD, this); 674 resolve_string_constants_impl(h_this, CHECK); 675 } 676 677 // CDS support 678 void remove_unshareable_info(); 679 void restore_unshareable_info(TRAPS); 680 bool resolve_class_constants(TRAPS); 681 // The ConstantPool vtable is restored by this call when the ConstantPool is 682 // in the shared archive. See patch_klass_vtables() in metaspaceShared.cpp for 683 // all the gory details. SA, dtrace and pstack helpers distinguish metadata 684 // by their vtable.
766 if (invokedynamic_ok && is_invokedynamic_index(raw_index)) 767 return decode_invokedynamic_index(raw_index); 768 else 769 return raw_index - CPCACHE_INDEX_TAG; 770 } 771 772 private: 773 774 void set_resolved_references(jobject s) { _resolved_references = s; } 775 Array* reference_map() const { return _reference_map; } 776 void set_reference_map(Array* o) { _reference_map = o; } 777 778 // patch JSR 292 resolved references after the class is linked. 779 void patch_resolved_references(GrowableArray* cp_patches); 780 781 Symbol* impl_name_ref_at(int which, bool uncached); 782 Symbol* impl_signature_ref_at(int which, bool uncached); 783 int impl_klass_ref_index_at(int which, bool uncached); 784 int impl_name_and_type_ref_index_at(int which, bool uncached); 785 786 int remap_instruction_operand_from_cache(int operand); // operand must be biased by CPCACHE_INDEX_TAG 787 788 // Used while constructing constant pool (only by ClassFileParser) 789 jint klass_index_at(int which) { 790 assert(tag_at(which).is_klass_index(), "Corrupted constant pool"); 791 return *int_at_addr(which); 792 } 793 794 jint string_index_at(int which) { 795 assert(tag_at(which).is_string_index(), "Corrupted constant pool"); 796 return int_at_addr(which); 797 } 798 799 // Performs the LinkResolver checks 800 static void verify_constant_pool_resolve(constantPoolHandle this_cp, KlassHandle klass, TRAPS); 801 802 // Implementation of methods that needs an exposed 'this' pointer, in order to 803 // handle GC while executing the method 804 static Klass klass_at_impl(constantPoolHandle this_cp, int which, 805 bool save_resolution_error, TRAPS); 806 static oop string_at_impl(constantPoolHandle this_cp, int which, int obj_index, TRAPS); 807
645 // actually rewritten constant pool cache indices. 646 // The routine remap_instruction_operand_from_cache manages the adjustment 647 // of these values back to constant pool indices. 648 649 // There are also "uncached" versions which do not adjust the operand index; see below. 650 651 // FIXME: Consider renaming these with a prefix "cached_" to make the distinction clear. 652 // In a few cases (the verifier) there are uses before a cpcache has been built, 653 // which are handled by a dynamic check in remap_instruction_operand_from_cache. 654 // FIXME: Remove the dynamic check, and adjust all callers to specify the correct mode. 655 656 // Lookup for entries consisting of (klass_index, name_and_type index) 657 Klass* klass_ref_at(int which, TRAPS); 658 Symbol* klass_ref_at_noresolve(int which); 659 Symbol* name_ref_at(int which) { return impl_name_ref_at(which, false); } 660 Symbol* signature_ref_at(int which) { return impl_signature_ref_at(which, false); } 661 662 int klass_ref_index_at(int which) { return impl_klass_ref_index_at(which, false); } 663 int name_and_type_ref_index_at(int which) { return impl_name_and_type_ref_index_at(which, false); } 664 665 int remap_instruction_operand_from_cache(int operand); // operand must be biased by CPCACHE_INDEX_TAG 666 667 // Lookup for entries consisting of (name_index, signature_index) 668 int name_ref_index_at(int which_nt); // == low-order jshort of name_and_type_at(which_nt) 669 int signature_ref_index_at(int which_nt); // == high-order jshort of name_and_type_at(which_nt) 670 671 BasicType basic_type_for_signature_at(int which); 672 673 // Resolve string constants (to prevent allocation during compilation) 674 void resolve_string_constants(TRAPS) { 675 constantPoolHandle h_this(THREAD, this); 676 resolve_string_constants_impl(h_this, CHECK); 677 } 678 679 // CDS support 680 void remove_unshareable_info(); 681 void restore_unshareable_info(TRAPS); 682 bool resolve_class_constants(TRAPS); 683 // The ConstantPool vtable is restored by this call when the ConstantPool is 684 // in the shared archive. See patch_klass_vtables() in metaspaceShared.cpp for 685 // all the gory details. SA, dtrace and pstack helpers distinguish metadata 686 // by their vtable.
768 if (invokedynamic_ok && is_invokedynamic_index(raw_index)) 769 return decode_invokedynamic_index(raw_index); 770 else 771 return raw_index - CPCACHE_INDEX_TAG; 772 } 773 774 private: 775 776 void set_resolved_references(jobject s) { _resolved_references = s; } 777 Array* reference_map() const { return _reference_map; } 778 void set_reference_map(Array* o) { _reference_map = o; } 779 780 // patch JSR 292 resolved references after the class is linked. 781 void patch_resolved_references(GrowableArray* cp_patches); 782 783 Symbol* impl_name_ref_at(int which, bool uncached); 784 Symbol* impl_signature_ref_at(int which, bool uncached); 785 int impl_klass_ref_index_at(int which, bool uncached); 786 int impl_name_and_type_ref_index_at(int which, bool uncached); 787
788 // Used while constructing constant pool (only by ClassFileParser) 789 jint klass_index_at(int which) { 790 assert(tag_at(which).is_klass_index(), "Corrupted constant pool"); 791 return *int_at_addr(which); 792 } 793 794 jint string_index_at(int which) { 795 assert(tag_at(which).is_string_index(), "Corrupted constant pool"); 796 return int_at_addr(which); 797 } 798 799 // Performs the LinkResolver checks 800 static void verify_constant_pool_resolve(constantPoolHandle this_cp, KlassHandle klass, TRAPS); 801 802 // Implementation of methods that needs an exposed 'this' pointer, in order to 803 // handle GC while executing the method 804 static Klass klass_at_impl(constantPoolHandle this_cp, int which, 805 bool save_resolution_error, TRAPS); 806 static oop string_at_impl(constantPoolHandle this_cp, int which, int obj_index, TRAPS); 807