Mercurial > hg > graal-compiler
comparison src/share/vm/oops/constantPoolOop.hpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 96c40b338c1a 1d7922586cf6 |
children |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
640 oop resolve_possibly_cached_constant_at(int pool_index, TRAPS) { | 640 oop resolve_possibly_cached_constant_at(int pool_index, TRAPS) { |
641 constantPoolHandle h_this(THREAD, this); | 641 constantPoolHandle h_this(THREAD, this); |
642 return resolve_constant_at_impl(h_this, pool_index, _possible_index_sentinel, THREAD); | 642 return resolve_constant_at_impl(h_this, pool_index, _possible_index_sentinel, THREAD); |
643 } | 643 } |
644 | 644 |
645 oop resolve_bootstrap_specifier_at(int index, TRAPS) { | |
646 constantPoolHandle h_this(THREAD, this); | |
647 return resolve_bootstrap_specifier_at_impl(h_this, index, THREAD); | |
648 } | |
649 | |
645 // Klass name matches name at offset | 650 // Klass name matches name at offset |
646 bool klass_name_at_matches(instanceKlassHandle k, int which); | 651 bool klass_name_at_matches(instanceKlassHandle k, int which); |
647 | 652 |
648 // Sizing | 653 // Sizing |
649 int length() const { return _length; } | 654 int length() const { return _length; } |
664 friend class constantPoolKlass; | 669 friend class constantPoolKlass; |
665 friend class ClassFileParser; | 670 friend class ClassFileParser; |
666 friend class SystemDictionary; | 671 friend class SystemDictionary; |
667 | 672 |
668 // Used by compiler to prevent classloading. | 673 // Used by compiler to prevent classloading. |
669 static methodOop method_at_if_loaded (constantPoolHandle this_oop, int which, | 674 static methodOop method_at_if_loaded (constantPoolHandle this_oop, int which); |
670 Bytecodes::Code bc = Bytecodes::_illegal); | 675 static bool has_appendix_at_if_loaded (constantPoolHandle this_oop, int which); |
671 static klassOop klass_at_if_loaded (constantPoolHandle this_oop, int which); | 676 static oop appendix_at_if_loaded (constantPoolHandle this_oop, int which); |
672 static klassOop klass_ref_at_if_loaded (constantPoolHandle this_oop, int which); | 677 static klassOop klass_at_if_loaded (constantPoolHandle this_oop, int which); |
678 static klassOop klass_ref_at_if_loaded (constantPoolHandle this_oop, int which); | |
673 // Same as above - but does LinkResolving. | 679 // Same as above - but does LinkResolving. |
674 static klassOop klass_ref_at_if_loaded_check(constantPoolHandle this_oop, int which, TRAPS); | 680 static klassOop klass_ref_at_if_loaded_check(constantPoolHandle this_oop, int which, TRAPS); |
675 | 681 |
676 // Routines currently used for annotations (only called by jvm.cpp) but which might be used in the | 682 // Routines currently used for annotations (only called by jvm.cpp) but which might be used in the |
677 // future by other Java code. These take constant pool indices rather than | 683 // future by other Java code. These take constant pool indices rather than |
678 // constant pool cache indices as do the peer methods above. | 684 // constant pool cache indices as do the peer methods above. |
679 Symbol* uncached_klass_ref_at_noresolve(int which); | 685 Symbol* uncached_klass_ref_at_noresolve(int which); |
695 enum { CPCACHE_INDEX_TAG = 0x10000 }; // helps keep CP cache indices distinct from CP indices | 701 enum { CPCACHE_INDEX_TAG = 0x10000 }; // helps keep CP cache indices distinct from CP indices |
696 #else | 702 #else |
697 enum { CPCACHE_INDEX_TAG = 0 }; // in product mode, this zero value is a no-op | 703 enum { CPCACHE_INDEX_TAG = 0 }; // in product mode, this zero value is a no-op |
698 #endif //ASSERT | 704 #endif //ASSERT |
699 | 705 |
706 static int get_cpcache_index(int index) { return index - CPCACHE_INDEX_TAG; } | |
707 | |
700 private: | 708 private: |
701 | 709 |
702 Symbol* impl_name_ref_at(int which, bool uncached); | 710 Symbol* impl_name_ref_at(int which, bool uncached); |
703 Symbol* impl_signature_ref_at(int which, bool uncached); | 711 Symbol* impl_signature_ref_at(int which, bool uncached); |
704 int impl_klass_ref_index_at(int which, bool uncached); | 712 int impl_klass_ref_index_at(int which, bool uncached); |
729 | 737 |
730 // Resolve string constants (to prevent allocation during compilation) | 738 // Resolve string constants (to prevent allocation during compilation) |
731 static void resolve_string_constants_impl(constantPoolHandle this_oop, TRAPS); | 739 static void resolve_string_constants_impl(constantPoolHandle this_oop, TRAPS); |
732 | 740 |
733 static oop resolve_constant_at_impl(constantPoolHandle this_oop, int index, int cache_index, TRAPS); | 741 static oop resolve_constant_at_impl(constantPoolHandle this_oop, int index, int cache_index, TRAPS); |
742 static oop resolve_bootstrap_specifier_at_impl(constantPoolHandle this_oop, int index, TRAPS); | |
734 | 743 |
735 public: | 744 public: |
736 // Merging constantPoolOop support: | 745 // Merging constantPoolOop support: |
737 bool compare_entry_to(int index1, constantPoolHandle cp2, int index2, TRAPS); | 746 bool compare_entry_to(int index1, constantPoolHandle cp2, int index2, TRAPS); |
738 void copy_cp_to(int start_i, int end_i, constantPoolHandle to_cp, int to_i, TRAPS) { | 747 void copy_cp_to(int start_i, int end_i, constantPoolHandle to_cp, int to_i, TRAPS) { |
764 int copy_cpool_bytes(int cpool_size, | 773 int copy_cpool_bytes(int cpool_size, |
765 SymbolHashMap* tbl, | 774 SymbolHashMap* tbl, |
766 unsigned char *bytes); | 775 unsigned char *bytes); |
767 }; | 776 }; |
768 | 777 |
769 class SymbolHashMapEntry : public CHeapObj { | 778 class SymbolHashMapEntry : public CHeapObj<mtSymbol> { |
770 private: | 779 private: |
771 unsigned int _hash; // 32-bit hash for item | 780 unsigned int _hash; // 32-bit hash for item |
772 SymbolHashMapEntry* _next; // Next element in the linked list for this bucket | 781 SymbolHashMapEntry* _next; // Next element in the linked list for this bucket |
773 Symbol* _symbol; // 1-st part of the mapping: symbol => value | 782 Symbol* _symbol; // 1-st part of the mapping: symbol => value |
774 u2 _value; // 2-nd part of the mapping: symbol => value | 783 u2 _value; // 2-nd part of the mapping: symbol => value |
790 : _hash(hash), _symbol(symbol), _value(value), _next(NULL) {} | 799 : _hash(hash), _symbol(symbol), _value(value), _next(NULL) {} |
791 | 800 |
792 }; // End SymbolHashMapEntry class | 801 }; // End SymbolHashMapEntry class |
793 | 802 |
794 | 803 |
795 class SymbolHashMapBucket : public CHeapObj { | 804 class SymbolHashMapBucket : public CHeapObj<mtSymbol> { |
796 | 805 |
797 private: | 806 private: |
798 SymbolHashMapEntry* _entry; | 807 SymbolHashMapEntry* _entry; |
799 | 808 |
800 public: | 809 public: |
803 void clear() { _entry = NULL; } | 812 void clear() { _entry = NULL; } |
804 | 813 |
805 }; // End SymbolHashMapBucket class | 814 }; // End SymbolHashMapBucket class |
806 | 815 |
807 | 816 |
808 class SymbolHashMap: public CHeapObj { | 817 class SymbolHashMap: public CHeapObj<mtSymbol> { |
809 | 818 |
810 private: | 819 private: |
811 // Default number of entries in the table | 820 // Default number of entries in the table |
812 enum SymbolHashMap_Constants { | 821 enum SymbolHashMap_Constants { |
813 _Def_HashMap_Size = 256 | 822 _Def_HashMap_Size = 256 |
816 int _table_size; | 825 int _table_size; |
817 SymbolHashMapBucket* _buckets; | 826 SymbolHashMapBucket* _buckets; |
818 | 827 |
819 void initialize_table(int table_size) { | 828 void initialize_table(int table_size) { |
820 _table_size = table_size; | 829 _table_size = table_size; |
821 _buckets = NEW_C_HEAP_ARRAY(SymbolHashMapBucket, table_size); | 830 _buckets = NEW_C_HEAP_ARRAY(SymbolHashMapBucket, table_size, mtSymbol); |
822 for (int index = 0; index < table_size; index++) { | 831 for (int index = 0; index < table_size; index++) { |
823 _buckets[index].clear(); | 832 _buckets[index].clear(); |
824 } | 833 } |
825 } | 834 } |
826 | 835 |