comparison src/share/vm/oops/constantPoolOop.hpp @ 6197:d2a62e0f25eb

6995781: Native Memory Tracking (Phase 1) 7151532: DCmd for hotspot native memory tracking Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd Reviewed-by: acorn, coleenp, fparain
author zgu
date Thu, 28 Jun 2012 17:03:16 -0400
parents ddd894528dbc
children 1d7922586cf6
comparison
equal deleted inserted replaced
6174:74533f63b116 6197:d2a62e0f25eb
762 int copy_cpool_bytes(int cpool_size, 762 int copy_cpool_bytes(int cpool_size,
763 SymbolHashMap* tbl, 763 SymbolHashMap* tbl,
764 unsigned char *bytes); 764 unsigned char *bytes);
765 }; 765 };
766 766
767 class SymbolHashMapEntry : public CHeapObj { 767 class SymbolHashMapEntry : public CHeapObj<mtSymbol> {
768 private: 768 private:
769 unsigned int _hash; // 32-bit hash for item 769 unsigned int _hash; // 32-bit hash for item
770 SymbolHashMapEntry* _next; // Next element in the linked list for this bucket 770 SymbolHashMapEntry* _next; // Next element in the linked list for this bucket
771 Symbol* _symbol; // 1-st part of the mapping: symbol => value 771 Symbol* _symbol; // 1-st part of the mapping: symbol => value
772 u2 _value; // 2-nd part of the mapping: symbol => value 772 u2 _value; // 2-nd part of the mapping: symbol => value
788 : _hash(hash), _symbol(symbol), _value(value), _next(NULL) {} 788 : _hash(hash), _symbol(symbol), _value(value), _next(NULL) {}
789 789
790 }; // End SymbolHashMapEntry class 790 }; // End SymbolHashMapEntry class
791 791
792 792
793 class SymbolHashMapBucket : public CHeapObj { 793 class SymbolHashMapBucket : public CHeapObj<mtSymbol> {
794 794
795 private: 795 private:
796 SymbolHashMapEntry* _entry; 796 SymbolHashMapEntry* _entry;
797 797
798 public: 798 public:
801 void clear() { _entry = NULL; } 801 void clear() { _entry = NULL; }
802 802
803 }; // End SymbolHashMapBucket class 803 }; // End SymbolHashMapBucket class
804 804
805 805
806 class SymbolHashMap: public CHeapObj { 806 class SymbolHashMap: public CHeapObj<mtSymbol> {
807 807
808 private: 808 private:
809 // Default number of entries in the table 809 // Default number of entries in the table
810 enum SymbolHashMap_Constants { 810 enum SymbolHashMap_Constants {
811 _Def_HashMap_Size = 256 811 _Def_HashMap_Size = 256
814 int _table_size; 814 int _table_size;
815 SymbolHashMapBucket* _buckets; 815 SymbolHashMapBucket* _buckets;
816 816
817 void initialize_table(int table_size) { 817 void initialize_table(int table_size) {
818 _table_size = table_size; 818 _table_size = table_size;
819 _buckets = NEW_C_HEAP_ARRAY(SymbolHashMapBucket, table_size); 819 _buckets = NEW_C_HEAP_ARRAY(SymbolHashMapBucket, table_size, mtSymbol);
820 for (int index = 0; index < table_size; index++) { 820 for (int index = 0; index < table_size; index++) {
821 _buckets[index].clear(); 821 _buckets[index].clear();
822 } 822 }
823 } 823 }
824 824