< prev index next >

src/hotspot/share/jfr/utilities/jfrHashtable.hpp

Print this page




  41  public:
  42   JfrBasicHashtableEntry(uintptr_t hash, const T& data) : _next(NULL), _literal(data), _hash(hash) {}
  43   uintptr_t hash() const { return _hash; }
  44   T literal() const { return _literal; }
  45   T* literal_addr() { return &_literal; }
  46   void set_literal(T s) { _literal = s; }
  47   void set_next(Entry* next) { _next = next; }
  48   Entry* next() const { return _next; }
  49   Entry** next_addr() { return &_next; }
  50 };
  51 
  52 template <typename T>
  53 class JfrHashtableBucket : public CHeapObj<mtTracing> {
  54   template <typename>
  55   friend class JfrBasicHashtable;
  56  private:
  57   typedef JfrBasicHashtableEntry<T> TableEntry;
  58   TableEntry* _entry;
  59 
  60   TableEntry* get_entry() const {
  61     return (TableEntry*)OrderAccess::load_acquire(&_entry);
  62   }
  63   void set_entry(TableEntry* entry) { OrderAccess::release_store(&_entry, entry);}
  64   TableEntry** entry_addr() { return &_entry; }
  65 };
  66 
  67 template <typename T>
  68 class JfrBasicHashtable : public CHeapObj<mtTracing> {
  69  private:
  70   typedef JfrHashtableBucket<T> Bucket;
  71   typedef JfrBasicHashtableEntry<T> TableEntry;
  72   Bucket* _buckets;
  73   uintptr_t _table_size;
  74   const size_t _entry_size;
  75   size_t _number_of_entries;
  76 
  77  protected:
  78   JfrBasicHashtable(uintptr_t table_size, size_t entry_size) :
  79     _buckets(NULL), _table_size(table_size), _entry_size(entry_size), _number_of_entries(0) {
  80     _buckets = NEW_C_HEAP_ARRAY2(Bucket, table_size, mtTracing, CURRENT_PC);
  81     memset((void*)_buckets, 0, table_size * sizeof(Bucket));
  82   }
  83 




  41  public:
  42   JfrBasicHashtableEntry(uintptr_t hash, const T& data) : _next(NULL), _literal(data), _hash(hash) {}
  43   uintptr_t hash() const { return _hash; }
  44   T literal() const { return _literal; }
  45   T* literal_addr() { return &_literal; }
  46   void set_literal(T s) { _literal = s; }
  47   void set_next(Entry* next) { _next = next; }
  48   Entry* next() const { return _next; }
  49   Entry** next_addr() { return &_next; }
  50 };
  51 
  52 template <typename T>
  53 class JfrHashtableBucket : public CHeapObj<mtTracing> {
  54   template <typename>
  55   friend class JfrBasicHashtable;
  56  private:
  57   typedef JfrBasicHashtableEntry<T> TableEntry;
  58   TableEntry* _entry;
  59 
  60   TableEntry* get_entry() const {
  61     return (TableEntry*)Atomic::load_acquire(&_entry);
  62   }
  63   void set_entry(TableEntry* entry) { Atomic::release_store(&_entry, entry);}
  64   TableEntry** entry_addr() { return &_entry; }
  65 };
  66 
  67 template <typename T>
  68 class JfrBasicHashtable : public CHeapObj<mtTracing> {
  69  private:
  70   typedef JfrHashtableBucket<T> Bucket;
  71   typedef JfrBasicHashtableEntry<T> TableEntry;
  72   Bucket* _buckets;
  73   uintptr_t _table_size;
  74   const size_t _entry_size;
  75   size_t _number_of_entries;
  76 
  77  protected:
  78   JfrBasicHashtable(uintptr_t table_size, size_t entry_size) :
  79     _buckets(NULL), _table_size(table_size), _entry_size(entry_size), _number_of_entries(0) {
  80     _buckets = NEW_C_HEAP_ARRAY2(Bucket, table_size, mtTracing, CURRENT_PC);
  81     memset((void*)_buckets, 0, table_size * sizeof(Bucket));
  82   }
  83 


< prev index next >