265 SymbolClosure* const _closure;
266 public:
267 CompactHashtable_SymbolIterator(SymbolClosure *cl) : _closure(cl) {}
268 inline void do_value(address base_address, u4 offset) const {
269 Symbol* sym = (Symbol*)((void*)(base_address + offset));
270 _closure->do_symbol(&sym);
271 }
272 };
273
274 template <class T, class N> void CompactHashtable<T, N>::symbols_do(SymbolClosure *cl) {
275 CompactHashtable_SymbolIterator iterator(cl);
276 iterate(iterator);
277 }
278
279 class CompactHashtable_OopIterator {
280 OopClosure* const _closure;
281 public:
282 CompactHashtable_OopIterator(OopClosure *cl) : _closure(cl) {}
283 inline void do_value(address base_address, u4 offset) const {
284 narrowOop v = (narrowOop)offset;
285 oop obj = HeapShared::decode_with_archived_oop_encoding_mode(v);
286 _closure->do_oop(&obj);
287 }
288 };
289
290 template <class T, class N> void CompactHashtable<T, N>::oops_do(OopClosure* cl) {
291 assert(_type == _string_table || _bucket_count == 0, "sanity");
292 CompactHashtable_OopIterator iterator(cl);
293 iterate(iterator);
294 }
295
296 // Explicitly instantiate these types
297 template class CompactHashtable<Symbol*, char>;
298 template class CompactHashtable<oop, char>;
299
300 #ifndef O_BINARY // if defined (Win32) use binary files.
301 #define O_BINARY 0 // otherwise do nothing.
302 #endif
303
304 ////////////////////////////////////////////////////////
305 //
|
265 SymbolClosure* const _closure;
266 public:
267 CompactHashtable_SymbolIterator(SymbolClosure *cl) : _closure(cl) {}
268 inline void do_value(address base_address, u4 offset) const {
269 Symbol* sym = (Symbol*)((void*)(base_address + offset));
270 _closure->do_symbol(&sym);
271 }
272 };
273
274 template <class T, class N> void CompactHashtable<T, N>::symbols_do(SymbolClosure *cl) {
275 CompactHashtable_SymbolIterator iterator(cl);
276 iterate(iterator);
277 }
278
279 class CompactHashtable_OopIterator {
280 OopClosure* const _closure;
281 public:
282 CompactHashtable_OopIterator(OopClosure *cl) : _closure(cl) {}
283 inline void do_value(address base_address, u4 offset) const {
284 narrowOop v = (narrowOop)offset;
285 oop obj = HeapShared::decode_from_archive(v);
286 _closure->do_oop(&obj);
287 }
288 };
289
290 template <class T, class N> void CompactHashtable<T, N>::oops_do(OopClosure* cl) {
291 assert(_type == _string_table || _bucket_count == 0, "sanity");
292 CompactHashtable_OopIterator iterator(cl);
293 iterate(iterator);
294 }
295
296 // Explicitly instantiate these types
297 template class CompactHashtable<Symbol*, char>;
298 template class CompactHashtable<oop, char>;
299
300 #ifndef O_BINARY // if defined (Win32) use binary files.
301 #define O_BINARY 0 // otherwise do nothing.
302 #endif
303
304 ////////////////////////////////////////////////////////
305 //
|