106 int _num_value_only_buckets; 107 int _num_other_buckets; 108 GrowableArray<Entry>** _buckets; 109 CompactHashtableStats* _stats; 110 Array<u4>* _compact_buckets; 111 Array<u4>* _compact_entries; 112 113 public: 114 // This is called at dump-time only 115 CompactHashtableWriter(int num_buckets, CompactHashtableStats* stats); 116 ~CompactHashtableWriter(); 117 118 void add(unsigned int hash, u4 value); 119 120 private: 121 void allocate_table(); 122 void dump_table(NumberSeq* summary); 123 124 public: 125 void dump(SimpleCompactHashtable *cht, const char* table_name); 126 }; 127 #endif // INCLUDE_CDS 128 129 #define REGULAR_BUCKET_TYPE 0 130 #define VALUE_ONLY_BUCKET_TYPE 1 131 #define TABLEEND_BUCKET_TYPE 3 132 #define BUCKET_OFFSET_MASK 0x3FFFFFFF 133 #define BUCKET_OFFSET(info) ((info) & BUCKET_OFFSET_MASK) 134 #define BUCKET_TYPE_SHIFT 30 135 #define BUCKET_TYPE(info) (((info) & ~BUCKET_OFFSET_MASK) >> BUCKET_TYPE_SHIFT) 136 #define BUCKET_INFO(offset, type) (((type) << BUCKET_TYPE_SHIFT) | ((offset) & BUCKET_OFFSET_MASK)) 137 138 ///////////////////////////////////////////////////////////////////////////// 139 // 140 // CompactHashtable is used to store the CDS archive's symbol/string tables. 141 // 142 // Because these tables are read-only (no entries can be added/deleted) at run-time 143 // and tend to have large number of entries, we try to minimize the footprint 144 // cost per entry. 145 // | 106 int _num_value_only_buckets; 107 int _num_other_buckets; 108 GrowableArray<Entry>** _buckets; 109 CompactHashtableStats* _stats; 110 Array<u4>* _compact_buckets; 111 Array<u4>* _compact_entries; 112 113 public: 114 // This is called at dump-time only 115 CompactHashtableWriter(int num_buckets, CompactHashtableStats* stats); 116 ~CompactHashtableWriter(); 117 118 void add(unsigned int hash, u4 value); 119 120 private: 121 void allocate_table(); 122 void dump_table(NumberSeq* summary); 123 124 public: 125 void dump(SimpleCompactHashtable *cht, const char* table_name); 126 127 static int default_num_buckets(size_t num_entries) { 128 return default_num_buckets((int)num_entries); 129 } 130 static int default_num_buckets(int num_entries) { 131 int num_buckets = num_entries / SharedSymbolTableBucketSize; 132 // calculation of num_buckets can result in zero buckets, we need at least one 133 return (num_buckets < 1) ? 1 : num_buckets; 134 } 135 }; 136 #endif // INCLUDE_CDS 137 138 #define REGULAR_BUCKET_TYPE 0 139 #define VALUE_ONLY_BUCKET_TYPE 1 140 #define TABLEEND_BUCKET_TYPE 3 141 #define BUCKET_OFFSET_MASK 0x3FFFFFFF 142 #define BUCKET_OFFSET(info) ((info) & BUCKET_OFFSET_MASK) 143 #define BUCKET_TYPE_SHIFT 30 144 #define BUCKET_TYPE(info) (((info) & ~BUCKET_OFFSET_MASK) >> BUCKET_TYPE_SHIFT) 145 #define BUCKET_INFO(offset, type) (((type) << BUCKET_TYPE_SHIFT) | ((offset) & BUCKET_OFFSET_MASK)) 146 147 ///////////////////////////////////////////////////////////////////////////// 148 // 149 // CompactHashtable is used to store the CDS archive's symbol/string tables. 150 // 151 // Because these tables are read-only (no entries can be added/deleted) at run-time 152 // and tend to have large number of entries, we try to minimize the footprint 153 // cost per entry. 154 // |