< prev index next >

src/hotspot/share/classfile/compactHashtable.inline.hpp

Print this page


  31 #include "memory/filemap.hpp"
  32 #include "memory/heapShared.inline.hpp"
  33 #include "oops/oop.hpp"
  34 
  35 template <class T, class N>
  36 inline Symbol* CompactHashtable<T, N>::decode_entry(CompactHashtable<Symbol*, char>* const t,
  37                                                     u4 offset, const char* name, int len) {
  38   Symbol* sym = (Symbol*)(_base_address + offset);
  39   if (sym->equals(name, len)) {
  40     assert(sym->refcount() == PERM_REFCOUNT, "must be shared");
  41     return sym;
  42   }
  43 
  44   return NULL;
  45 }
  46 
  47 template <class T, class N>
  48 inline oop CompactHashtable<T, N>::decode_entry(CompactHashtable<oop, char>* const t,
  49                                                 u4 offset, const char* name, int len) {
  50   narrowOop v = (narrowOop)offset;
  51   oop string = HeapShared::decode_with_archived_oop_encoding_mode(v);
  52   if (java_lang_String::equals(string, (jchar*)name, len)) {
  53     return string;
  54   }
  55 
  56   return NULL;
  57 }
  58 
  59 template <class T, class N>
  60 inline T CompactHashtable<T,N>::lookup(const N* name, unsigned int hash, int len) {
  61   if (_entry_count > 0) {
  62     int index = hash % _bucket_count;
  63     u4 bucket_info = _buckets[index];
  64     u4 bucket_offset = BUCKET_OFFSET(bucket_info);
  65     int bucket_type = BUCKET_TYPE(bucket_info);
  66     u4* entry = _entries + bucket_offset;
  67 
  68     if (bucket_type == VALUE_ONLY_BUCKET_TYPE) {
  69       T res = decode_entry(this, entry[0], name, len);
  70       if (res != NULL) {
  71         return res;




  31 #include "memory/filemap.hpp"
  32 #include "memory/heapShared.inline.hpp"
  33 #include "oops/oop.hpp"
  34 
  35 template <class T, class N>
  36 inline Symbol* CompactHashtable<T, N>::decode_entry(CompactHashtable<Symbol*, char>* const t,
  37                                                     u4 offset, const char* name, int len) {
  38   Symbol* sym = (Symbol*)(_base_address + offset);
  39   if (sym->equals(name, len)) {
  40     assert(sym->refcount() == PERM_REFCOUNT, "must be shared");
  41     return sym;
  42   }
  43 
  44   return NULL;
  45 }
  46 
  47 template <class T, class N>
  48 inline oop CompactHashtable<T, N>::decode_entry(CompactHashtable<oop, char>* const t,
  49                                                 u4 offset, const char* name, int len) {
  50   narrowOop v = (narrowOop)offset;
  51   oop string = HeapShared::decode_from_archive(v);
  52   if (java_lang_String::equals(string, (jchar*)name, len)) {
  53     return string;
  54   }
  55 
  56   return NULL;
  57 }
  58 
  59 template <class T, class N>
  60 inline T CompactHashtable<T,N>::lookup(const N* name, unsigned int hash, int len) {
  61   if (_entry_count > 0) {
  62     int index = hash % _bucket_count;
  63     u4 bucket_info = _buckets[index];
  64     u4 bucket_offset = BUCKET_OFFSET(bucket_info);
  65     int bucket_type = BUCKET_TYPE(bucket_info);
  66     u4* entry = _entries + bucket_offset;
  67 
  68     if (bucket_type == VALUE_ONLY_BUCKET_TYPE) {
  69       T res = decode_entry(this, entry[0], name, len);
  70       if (res != NULL) {
  71         return res;


< prev index next >