< prev index next >

src/share/vm/utilities/hashtable.hpp

Print this page




  42 
  43 
  44 template <MEMFLAGS F> class BasicHashtableEntry : public CHeapObj<F> {
  45   friend class VMStructs;
  46 private:
  47   unsigned int         _hash;           // 32-bit hash for item
  48 
  49   // Link to next element in the linked list for this bucket.  EXCEPT
  50   // bit 0 set indicates that this entry is shared and must not be
  51   // unlinked from the table. Bit 0 is set during the dumping of the
  52   // archive. Since shared entries are immutable, _next fields in the
  53   // shared entries will not change.  New entries will always be
  54   // unshared and since pointers are align, bit 0 will always remain 0
  55   // with no extra effort.
  56   BasicHashtableEntry<F>* _next;
  57 
  58   // Windows IA64 compiler requires subclasses to be able to access these
  59 protected:
  60   // Entry objects should not be created, they should be taken from the
  61   // free list with BasicHashtable.new_entry().
  62   BasicHashtableEntry() { ShouldNotReachHere(); }
  63   // Entry objects should not be destroyed.  They should be placed on
  64   // the free list instead with BasicHashtable.free_entry().
  65   ~BasicHashtableEntry() { ShouldNotReachHere(); }
  66 
  67 public:
  68 
  69   unsigned int hash() const             { return _hash; }
  70   void set_hash(unsigned int hash)      { _hash = hash; }
  71   unsigned int* hash_addr()             { return &_hash; }
  72 
  73   static BasicHashtableEntry<F>* make_ptr(BasicHashtableEntry<F>* p) {
  74     return (BasicHashtableEntry*)((intptr_t)p & -2);
  75   }
  76 
  77   BasicHashtableEntry<F>* next() const {
  78     return make_ptr(_next);
  79   }
  80 
  81   void set_next(BasicHashtableEntry<F>* next) {
  82     _next = next;
  83   }
  84 
  85   BasicHashtableEntry<F>** next_addr() {




  42 
  43 
  44 template <MEMFLAGS F> class BasicHashtableEntry : public CHeapObj<F> {
  45   friend class VMStructs;
  46 private:
  47   unsigned int         _hash;           // 32-bit hash for item
  48 
  49   // Link to next element in the linked list for this bucket.  EXCEPT
  50   // bit 0 set indicates that this entry is shared and must not be
  51   // unlinked from the table. Bit 0 is set during the dumping of the
  52   // archive. Since shared entries are immutable, _next fields in the
  53   // shared entries will not change.  New entries will always be
  54   // unshared and since pointers are align, bit 0 will always remain 0
  55   // with no extra effort.
  56   BasicHashtableEntry<F>* _next;
  57 
  58   // Windows IA64 compiler requires subclasses to be able to access these
  59 protected:
  60   // Entry objects should not be created, they should be taken from the
  61   // free list with BasicHashtable.new_entry().
  62   BasicHashtableEntry()  { guarantee(false, "Should not be called"); }
  63   // Entry objects should not be destroyed.  They should be placed on
  64   // the free list instead with BasicHashtable.free_entry().
  65   ~BasicHashtableEntry() { guarantee(false, "Should not be called"); }
  66 
  67 public:
  68 
  69   unsigned int hash() const             { return _hash; }
  70   void set_hash(unsigned int hash)      { _hash = hash; }
  71   unsigned int* hash_addr()             { return &_hash; }
  72 
  73   static BasicHashtableEntry<F>* make_ptr(BasicHashtableEntry<F>* p) {
  74     return (BasicHashtableEntry*)((intptr_t)p & -2);
  75   }
  76 
  77   BasicHashtableEntry<F>* next() const {
  78     return make_ptr(_next);
  79   }
  80 
  81   void set_next(BasicHashtableEntry<F>* next) {
  82     _next = next;
  83   }
  84 
  85   BasicHashtableEntry<F>** next_addr() {


< prev index next >