< prev index next >

src/hotspot/share/classfile/compactHashtable.hpp

Print this page

*** 133,143 **** #define BUCKET_TYPE(info) (((info) & ~BUCKET_OFFSET_MASK) >> BUCKET_TYPE_SHIFT) #define BUCKET_INFO(offset, type) (((type) << BUCKET_TYPE_SHIFT) | ((offset) & BUCKET_OFFSET_MASK)) ///////////////////////////////////////////////////////////////////////////// // ! // CompactHashtable is used to stored the CDS archive's symbol/string tables. // // Because these tables are read-only (no entries can be added/deleted) at run-time // and tend to have large number of entries, we try to minimize the footprint // cost per entry. // --- 133,143 ---- #define BUCKET_TYPE(info) (((info) & ~BUCKET_OFFSET_MASK) >> BUCKET_TYPE_SHIFT) #define BUCKET_INFO(offset, type) (((type) << BUCKET_TYPE_SHIFT) | ((offset) & BUCKET_OFFSET_MASK)) ///////////////////////////////////////////////////////////////////////////// // ! // CompactHashtable is used to store the CDS archive's symbol/string tables. // // Because these tables are read-only (no entries can be added/deleted) at run-time // and tend to have large number of entries, we try to minimize the footprint // cost per entry. //
*** 209,220 **** _entry_count = entry_count; _buckets = buckets; _entries = entries; } - bool exists(u4 value); - // For reading from/writing to the CDS archive void serialize(SerializeClosure* soc); inline bool empty() { return (_entry_count == 0); --- 209,218 ----
*** 228,244 **** bool (*EQUALS)(V value, K key, int len) > class CompactHashtable : public SimpleCompactHashtable { friend class VMStructs; ! V if_equals(const K key, int len, u4 offset) const { ! V value = DECODE(_base_address, offset); ! if (EQUALS(value, key, len)) { ! return value; ! } else { ! return NULL; ! } } public: CompactHashtable() : SimpleCompactHashtable() {} --- 226,237 ---- bool (*EQUALS)(V value, K key, int len) > class CompactHashtable : public SimpleCompactHashtable { friend class VMStructs; ! V decode(u4 offset) const { ! return DECODE(_base_address, offset); } public: CompactHashtable() : SimpleCompactHashtable() {}
*** 250,274 **** u4 bucket_offset = BUCKET_OFFSET(bucket_info); int bucket_type = BUCKET_TYPE(bucket_info); u4* entry = _entries + bucket_offset; if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { ! V res = if_equals(key, len, entry[0]); ! if (res != NULL) { ! return res; } } else { // This is a regular bucket, which has more than one // entries. Each entry is a pair of entry (hash, offset). // Seek until the end of the bucket. u4* entry_max = _entries + BUCKET_OFFSET(_buckets[index + 1]); while (entry < entry_max) { unsigned int h = (unsigned int)(entry[0]); if (h == hash) { ! V res = if_equals(key, len, entry[1]); ! if (res != NULL) { ! return res; } } entry += 2; } } --- 243,267 ---- u4 bucket_offset = BUCKET_OFFSET(bucket_info); int bucket_type = BUCKET_TYPE(bucket_info); u4* entry = _entries + bucket_offset; if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { ! V value = decode(entry[0]); ! if (EQUALS(value, key, len)) { ! return value; } } else { // This is a regular bucket, which has more than one // entries. Each entry is a pair of entry (hash, offset). // Seek until the end of the bucket. u4* entry_max = _entries + BUCKET_OFFSET(_buckets[index + 1]); while (entry < entry_max) { unsigned int h = (unsigned int)(entry[0]); if (h == hash) { ! V value = decode(entry[1]); ! if (EQUALS(value, key, len)) { ! return value; } } entry += 2; } }
*** 283,297 **** u4 bucket_offset = BUCKET_OFFSET(bucket_info); int bucket_type = BUCKET_TYPE(bucket_info); u4* entry = _entries + bucket_offset; if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { ! iter->do_value(DECODE(_base_address, entry[0])); } else { u4*entry_max = _entries + BUCKET_OFFSET(_buckets[i + 1]); while (entry < entry_max) { ! iter->do_value(DECODE(_base_address, entry[1])); entry += 2; } } } } --- 276,290 ---- u4 bucket_offset = BUCKET_OFFSET(bucket_info); int bucket_type = BUCKET_TYPE(bucket_info); u4* entry = _entries + bucket_offset; if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { ! iter->do_value(decode(entry[0])); } else { u4*entry_max = _entries + BUCKET_OFFSET(_buckets[i + 1]); while (entry < entry_max) { ! iter->do_value(decode(entry[1])); entry += 2; } } } }
< prev index next >