< prev index next >

src/hotspot/share/utilities/hashtable.inline.hpp

Print this page




  71   _entry_size = entry_size;
  72   _free_list = NULL;
  73   _first_free_entry = NULL;
  74   _end_block = NULL;
  75   _number_of_entries = number_of_entries;
  76   _entry_blocks = new(ResourceObj::C_HEAP, F) GrowableArray<char*>(4, true, F);
  77 }
  78 
  79 
  80 // The following method is MT-safe and may be used with caution.
  81 template <MEMFLAGS F> inline BasicHashtableEntry<F>* BasicHashtable<F>::bucket(int i) const {
  82   return _buckets[i].get_entry();
  83 }
  84 
  85 
  86 template <MEMFLAGS F> inline void HashtableBucket<F>::set_entry(BasicHashtableEntry<F>* l) {
  87   // Warning: Preserve store ordering.  The PackageEntryTable, ModuleEntryTable and
  88   //          SystemDictionary are read without locks.  The new entry must be
  89   //          complete before other threads can be allowed to see it
  90   //          via a store to _buckets[index].
  91   OrderAccess::release_store(&_entry, l);
  92 }
  93 
  94 
  95 template <MEMFLAGS F> inline BasicHashtableEntry<F>* HashtableBucket<F>::get_entry() const {
  96   // Warning: Preserve load ordering.  The PackageEntryTable, ModuleEntryTable and
  97   //          SystemDictionary are read without locks.  The new entry must be
  98   //          complete before other threads can be allowed to see it
  99   //          via a store to _buckets[index].
 100   return OrderAccess::load_acquire(&_entry);
 101 }
 102 
 103 
 104 template <MEMFLAGS F> inline void BasicHashtable<F>::set_entry(int index, BasicHashtableEntry<F>* entry) {
 105   _buckets[index].set_entry(entry);
 106   if (entry != NULL) {
 107     JFR_ONLY(_stats_rate.add();)
 108   } else {
 109     JFR_ONLY(_stats_rate.remove();)
 110   }
 111 }
 112 
 113 
 114 template <MEMFLAGS F> inline void BasicHashtable<F>::add_entry(int index, BasicHashtableEntry<F>* entry) {
 115   entry->set_next(bucket(index));
 116   _buckets[index].set_entry(entry);
 117   ++_number_of_entries;
 118   JFR_ONLY(_stats_rate.add();)
 119 }
 120 


  71   _entry_size = entry_size;
  72   _free_list = NULL;
  73   _first_free_entry = NULL;
  74   _end_block = NULL;
  75   _number_of_entries = number_of_entries;
  76   _entry_blocks = new(ResourceObj::C_HEAP, F) GrowableArray<char*>(4, true, F);
  77 }
  78 
  79 
  80 // The following method is MT-safe and may be used with caution.
  81 template <MEMFLAGS F> inline BasicHashtableEntry<F>* BasicHashtable<F>::bucket(int i) const {
  82   return _buckets[i].get_entry();
  83 }
  84 
  85 
  86 template <MEMFLAGS F> inline void HashtableBucket<F>::set_entry(BasicHashtableEntry<F>* l) {
  87   // Warning: Preserve store ordering.  The PackageEntryTable, ModuleEntryTable and
  88   //          SystemDictionary are read without locks.  The new entry must be
  89   //          complete before other threads can be allowed to see it
  90   //          via a store to _buckets[index].
  91   Atomic::release_store(&_entry, l);
  92 }
  93 
  94 
  95 template <MEMFLAGS F> inline BasicHashtableEntry<F>* HashtableBucket<F>::get_entry() const {
  96   // Warning: Preserve load ordering.  The PackageEntryTable, ModuleEntryTable and
  97   //          SystemDictionary are read without locks.  The new entry must be
  98   //          complete before other threads can be allowed to see it
  99   //          via a store to _buckets[index].
 100   return Atomic::load_acquire(&_entry);
 101 }
 102 
 103 
 104 template <MEMFLAGS F> inline void BasicHashtable<F>::set_entry(int index, BasicHashtableEntry<F>* entry) {
 105   _buckets[index].set_entry(entry);
 106   if (entry != NULL) {
 107     JFR_ONLY(_stats_rate.add();)
 108   } else {
 109     JFR_ONLY(_stats_rate.remove();)
 110   }
 111 }
 112 
 113 
 114 template <MEMFLAGS F> inline void BasicHashtable<F>::add_entry(int index, BasicHashtableEntry<F>* entry) {
 115   entry->set_next(bucket(index));
 116   _buckets[index].set_entry(entry);
 117   ++_number_of_entries;
 118   JFR_ONLY(_stats_rate.add();)
 119 }
 120 
< prev index next >