222 u4 bucket_offset = BUCKET_OFFSET(bucket_info);
223 int bucket_type = BUCKET_TYPE(bucket_info);
224 u4* entry = _entries + bucket_offset;
225
226 if (bucket_type == VALUE_ONLY_BUCKET_TYPE) {
227 return (entry[0] == value);
228 } else {
229 u4*entry_max = _entries + BUCKET_OFFSET(_buckets[index + 1]);
230 while (entry <entry_max) {
231 if (entry[1] == value) {
232 return true;
233 }
234 entry += 2;
235 }
236 return false;
237 }
238 }
239
240 template <class I>
241 inline void SimpleCompactHashtable::iterate(const I& iterator) {
242 assert(!DumpSharedSpaces, "run-time only");
243 for (u4 i = 0; i < _bucket_count; i++) {
244 u4 bucket_info = _buckets[i];
245 u4 bucket_offset = BUCKET_OFFSET(bucket_info);
246 int bucket_type = BUCKET_TYPE(bucket_info);
247 u4* entry = _entries + bucket_offset;
248
249 if (bucket_type == VALUE_ONLY_BUCKET_TYPE) {
250 iterator.do_value(_base_address, entry[0]);
251 } else {
252 u4*entry_max = _entries + BUCKET_OFFSET(_buckets[i + 1]);
253 while (entry < entry_max) {
254 iterator.do_value(_base_address, entry[1]);
255 entry += 2;
256 }
257 }
258 }
259 }
260
261 template <class T, class N> void CompactHashtable<T, N>::serialize(SerializeClosure* soc) {
262 SimpleCompactHashtable::serialize(soc);
|
222 u4 bucket_offset = BUCKET_OFFSET(bucket_info);
223 int bucket_type = BUCKET_TYPE(bucket_info);
224 u4* entry = _entries + bucket_offset;
225
226 if (bucket_type == VALUE_ONLY_BUCKET_TYPE) {
227 return (entry[0] == value);
228 } else {
229 u4*entry_max = _entries + BUCKET_OFFSET(_buckets[index + 1]);
230 while (entry <entry_max) {
231 if (entry[1] == value) {
232 return true;
233 }
234 entry += 2;
235 }
236 return false;
237 }
238 }
239
240 template <class I>
241 inline void SimpleCompactHashtable::iterate(const I& iterator) {
242 for (u4 i = 0; i < _bucket_count; i++) {
243 u4 bucket_info = _buckets[i];
244 u4 bucket_offset = BUCKET_OFFSET(bucket_info);
245 int bucket_type = BUCKET_TYPE(bucket_info);
246 u4* entry = _entries + bucket_offset;
247
248 if (bucket_type == VALUE_ONLY_BUCKET_TYPE) {
249 iterator.do_value(_base_address, entry[0]);
250 } else {
251 u4*entry_max = _entries + BUCKET_OFFSET(_buckets[i + 1]);
252 while (entry < entry_max) {
253 iterator.do_value(_base_address, entry[1]);
254 entry += 2;
255 }
256 }
257 }
258 }
259
260 template <class T, class N> void CompactHashtable<T, N>::serialize(SerializeClosure* soc) {
261 SimpleCompactHashtable::serialize(soc);
|