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

changeset 3900
d2a62e0f25eb
parent 3865
e9140bf80b4a
child 6876
710a3c8b516e
child 6911
ce8f6bb717c9
     1.1 --- a/src/share/vm/utilities/hashtable.inline.hpp	Wed Jun 27 15:23:36 2012 +0200
     1.2 +++ b/src/share/vm/utilities/hashtable.inline.hpp	Thu Jun 28 17:03:16 2012 -0400
     1.3 @@ -27,6 +27,7 @@
     1.4  
     1.5  #include "memory/allocation.inline.hpp"
     1.6  #include "utilities/hashtable.hpp"
     1.7 +#include "utilities/dtrace.hpp"
     1.8  
     1.9  // Inline function definitions for hashtable.hpp.
    1.10  
    1.11 @@ -34,18 +35,18 @@
    1.12  
    1.13  // Initialize a table.
    1.14  
    1.15 -inline BasicHashtable::BasicHashtable(int table_size, int entry_size) {
    1.16 +template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size) {
    1.17    // Called on startup, no locking needed
    1.18    initialize(table_size, entry_size, 0);
    1.19 -  _buckets = NEW_C_HEAP_ARRAY(HashtableBucket, table_size);
    1.20 +  _buckets = NEW_C_HEAP_ARRAY2(HashtableBucket<F>, table_size, F, CURRENT_PC);
    1.21    for (int index = 0; index < _table_size; index++) {
    1.22      _buckets[index].clear();
    1.23    }
    1.24  }
    1.25  
    1.26  
    1.27 -inline BasicHashtable::BasicHashtable(int table_size, int entry_size,
    1.28 -                                      HashtableBucket* buckets,
    1.29 +template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size,
    1.30 +                                      HashtableBucket<F>* buckets,
    1.31                                        int number_of_entries) {
    1.32    // Called on startup, no locking needed
    1.33    initialize(table_size, entry_size, number_of_entries);
    1.34 @@ -53,7 +54,7 @@
    1.35  }
    1.36  
    1.37  
    1.38 -inline void BasicHashtable::initialize(int table_size, int entry_size,
    1.39 +template <MEMFLAGS F> inline void BasicHashtable<F>::initialize(int table_size, int entry_size,
    1.40                                         int number_of_entries) {
    1.41    // Called on startup, no locking needed
    1.42    _table_size = table_size;
    1.43 @@ -70,12 +71,12 @@
    1.44  
    1.45  
    1.46  // The following method is MT-safe and may be used with caution.
    1.47 -inline BasicHashtableEntry* BasicHashtable::bucket(int i) {
    1.48 +template <MEMFLAGS F> inline BasicHashtableEntry<F>* BasicHashtable<F>::bucket(int i) {
    1.49    return _buckets[i].get_entry();
    1.50  }
    1.51  
    1.52  
    1.53 -inline void HashtableBucket::set_entry(BasicHashtableEntry* l) {
    1.54 +template <MEMFLAGS F> inline void HashtableBucket<F>::set_entry(BasicHashtableEntry<F>* l) {
    1.55    // Warning: Preserve store ordering.  The SystemDictionary is read
    1.56    //          without locks.  The new SystemDictionaryEntry must be
    1.57    //          complete before other threads can be allowed to see it
    1.58 @@ -84,27 +85,27 @@
    1.59  }
    1.60  
    1.61  
    1.62 -inline BasicHashtableEntry* HashtableBucket::get_entry() const {
    1.63 +template <MEMFLAGS F> inline BasicHashtableEntry<F>* HashtableBucket<F>::get_entry() const {
    1.64    // Warning: Preserve load ordering.  The SystemDictionary is read
    1.65    //          without locks.  The new SystemDictionaryEntry must be
    1.66    //          complete before other threads can be allowed to see it
    1.67    //          via a store to _buckets[index].
    1.68 -  return (BasicHashtableEntry*) OrderAccess::load_ptr_acquire(&_entry);
    1.69 +  return (BasicHashtableEntry<F>*) OrderAccess::load_ptr_acquire(&_entry);
    1.70  }
    1.71  
    1.72  
    1.73 -inline void BasicHashtable::set_entry(int index, BasicHashtableEntry* entry) {
    1.74 +template <MEMFLAGS F> inline void BasicHashtable<F>::set_entry(int index, BasicHashtableEntry<F>* entry) {
    1.75    _buckets[index].set_entry(entry);
    1.76  }
    1.77  
    1.78  
    1.79 -inline void BasicHashtable::add_entry(int index, BasicHashtableEntry* entry) {
    1.80 +template <MEMFLAGS F> inline void BasicHashtable<F>::add_entry(int index, BasicHashtableEntry<F>* entry) {
    1.81    entry->set_next(bucket(index));
    1.82    _buckets[index].set_entry(entry);
    1.83    ++_number_of_entries;
    1.84  }
    1.85  
    1.86 -inline void BasicHashtable::free_entry(BasicHashtableEntry* entry) {
    1.87 +template <MEMFLAGS F> inline void BasicHashtable<F>::free_entry(BasicHashtableEntry<F>* entry) {
    1.88    entry->set_next(_free_list);
    1.89    _free_list = entry;
    1.90    --_number_of_entries;

mercurial