61 _table_size = table_size; 62 _entry_size = entry_size; 63 _free_list = NULL; 64 _first_free_entry = NULL; 65 _end_block = NULL; 66 _number_of_entries = number_of_entries; 67 } 68 69 70 // The following method is MT-safe and may be used with caution. 71 template <MEMFLAGS F> inline BasicHashtableEntry<F>* BasicHashtable<F>::bucket(int i) const { 72 return _buckets[i].get_entry(); 73 } 74 75 76 template <MEMFLAGS F> inline void HashtableBucket<F>::set_entry(BasicHashtableEntry<F>* l) { 77 // Warning: Preserve store ordering. The PackageEntryTable, ModuleEntryTable and 78 // SystemDictionary are read without locks. The new entry must be 79 // complete before other threads can be allowed to see it 80 // via a store to _buckets[index]. 81 OrderAccess::release_store_ptr(&_entry, l); 82 } 83 84 85 template <MEMFLAGS F> inline BasicHashtableEntry<F>* HashtableBucket<F>::get_entry() const { 86 // Warning: Preserve load ordering. The PackageEntryTable, ModuleEntryTable and 87 // SystemDictionary are read without locks. The new entry must be 88 // complete before other threads can be allowed to see it 89 // via a store to _buckets[index]. 90 return (BasicHashtableEntry<F>*) OrderAccess::load_ptr_acquire(&_entry); 91 } 92 93 94 template <MEMFLAGS F> inline void BasicHashtable<F>::set_entry(int index, BasicHashtableEntry<F>* entry) { 95 _buckets[index].set_entry(entry); 96 } 97 98 99 template <MEMFLAGS F> inline void BasicHashtable<F>::add_entry(int index, BasicHashtableEntry<F>* entry) { 100 entry->set_next(bucket(index)); 101 _buckets[index].set_entry(entry); 102 ++_number_of_entries; 103 } 104 105 template <MEMFLAGS F> inline void BasicHashtable<F>::free_entry(BasicHashtableEntry<F>* entry) { 106 entry->set_next(_free_list); 107 _free_list = entry; 108 --_number_of_entries; 109 } 110 | 61 _table_size = table_size; 62 _entry_size = entry_size; 63 _free_list = NULL; 64 _first_free_entry = NULL; 65 _end_block = NULL; 66 _number_of_entries = number_of_entries; 67 } 68 69 70 // The following method is MT-safe and may be used with caution. 71 template <MEMFLAGS F> inline BasicHashtableEntry<F>* BasicHashtable<F>::bucket(int i) const { 72 return _buckets[i].get_entry(); 73 } 74 75 76 template <MEMFLAGS F> inline void HashtableBucket<F>::set_entry(BasicHashtableEntry<F>* l) { 77 // Warning: Preserve store ordering. The PackageEntryTable, ModuleEntryTable and 78 // SystemDictionary are read without locks. The new entry must be 79 // complete before other threads can be allowed to see it 80 // via a store to _buckets[index]. 81 OrderAccess::release_store(&_entry, l); 82 } 83 84 85 template <MEMFLAGS F> inline BasicHashtableEntry<F>* HashtableBucket<F>::get_entry() const { 86 // Warning: Preserve load ordering. The PackageEntryTable, ModuleEntryTable and 87 // SystemDictionary are read without locks. The new entry must be 88 // complete before other threads can be allowed to see it 89 // via a store to _buckets[index]. 90 return OrderAccess::load_acquire(&_entry); 91 } 92 93 94 template <MEMFLAGS F> inline void BasicHashtable<F>::set_entry(int index, BasicHashtableEntry<F>* entry) { 95 _buckets[index].set_entry(entry); 96 } 97 98 99 template <MEMFLAGS F> inline void BasicHashtable<F>::add_entry(int index, BasicHashtableEntry<F>* entry) { 100 entry->set_next(bucket(index)); 101 _buckets[index].set_entry(entry); 102 ++_number_of_entries; 103 } 104 105 template <MEMFLAGS F> inline void BasicHashtable<F>::free_entry(BasicHashtableEntry<F>* entry) { 106 entry->set_next(_free_list); 107 _free_list = entry; 108 --_number_of_entries; 109 } 110 |