< prev index next >

src/share/vm/classfile/stringTable.hpp

Print this page
rev 12679 : 8176593: Throwable::getStackTrace performance regression
Reviewed-by: jiangli, iklam
rev 12680 : [mq]: lookup_2


  39 
  40 private:
  41   // The string table
  42   static StringTable* _the_table;
  43 
  44   // Shared string table
  45   static CompactHashtable<oop, char> _shared_table;
  46   static bool _ignore_shared_strings;
  47 
  48   // Set if one bucket is out of balance due to hash algorithm deficiency
  49   static bool _needs_rehashing;
  50 
  51   // Claimed high water mark for parallel chunked scanning
  52   static volatile int _parallel_claimed_idx;
  53 
  54   static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
  55   oop basic_add(int index, Handle string_or_null, jchar* name, int len,
  56                 unsigned int hashValue, TRAPS);
  57 
  58   oop lookup_in_main_table(int index, jchar* chars, int length, unsigned int hashValue);
  59   static oop lookup_shared(jchar* name, int len);
  60 
  61   // Apply the give oop closure to the entries to the buckets
  62   // in the range [start_idx, end_idx).
  63   static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
  64   // Unlink or apply the give oop closure to the entries to the buckets
  65   // in the range [start_idx, end_idx).
  66   static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed);
  67 
  68   StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize,
  69                               sizeof (HashtableEntry<oop, mtSymbol>)) {}
  70 
  71   StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
  72     : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
  73                      number_of_entries) {}
  74 public:
  75   // The string table
  76   static StringTable* the_table() { return _the_table; }
  77 
  78   // Size of one bucket in the string table.  Used when checking for rollover.
  79   static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }


  97   }
  98   static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
  99   static void unlink(BoolObjectClosure* cl, int* processed, int* removed) {
 100     unlink_or_oops_do(cl, NULL, processed, removed);
 101   }
 102   // Serially invoke "f->do_oop" on the locations of all oops in the table.
 103   static void oops_do(OopClosure* f);
 104 
 105   // Possibly parallel versions of the above
 106   static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
 107   static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) {
 108     possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed);
 109   }
 110   static void possibly_parallel_oops_do(OopClosure* f);
 111 
 112   // Hashing algorithm, used as the hash value used by the
 113   //     StringTable for bucket selection and comparison (stored in the
 114   //     HashtableEntry structures).  This is used in the String.intern() method.
 115   static unsigned int hash_string(const jchar* s, int len);
 116   static unsigned int hash_string(oop string);

 117 
 118   // Internal test.
 119   static void test_alt_hash() PRODUCT_RETURN;
 120 
 121   // Probing
 122   static oop lookup(Symbol* symbol);
 123   static oop lookup(jchar* chars, int length);
 124 
 125   // Interning
 126   static oop intern(Symbol* symbol, TRAPS);
 127   static oop intern(oop string, TRAPS);
 128   static oop intern(const char *utf8_string, TRAPS);
 129 
 130   // Debugging
 131   static void verify();
 132   static void dump(outputStream* st, bool verbose=false);
 133 
 134   enum VerifyMesgModes {
 135     _verify_quietly    = 0,
 136     _verify_with_mesgs = 1




  39 
  40 private:
  41   // The string table
  42   static StringTable* _the_table;
  43 
  44   // Shared string table
  45   static CompactHashtable<oop, char> _shared_table;
  46   static bool _ignore_shared_strings;
  47 
  48   // Set if one bucket is out of balance due to hash algorithm deficiency
  49   static bool _needs_rehashing;
  50 
  51   // Claimed high water mark for parallel chunked scanning
  52   static volatile int _parallel_claimed_idx;
  53 
  54   static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
  55   oop basic_add(int index, Handle string_or_null, jchar* name, int len,
  56                 unsigned int hashValue, TRAPS);
  57 
  58   oop lookup_in_main_table(int index, jchar* chars, int length, unsigned int hashValue);
  59   static oop lookup_shared(jchar* name, int len, unsigned int hash);
  60 
  61   // Apply the give oop closure to the entries to the buckets
  62   // in the range [start_idx, end_idx).
  63   static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
  64   // Unlink or apply the give oop closure to the entries to the buckets
  65   // in the range [start_idx, end_idx).
  66   static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed);
  67 
  68   StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize,
  69                               sizeof (HashtableEntry<oop, mtSymbol>)) {}
  70 
  71   StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
  72     : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
  73                      number_of_entries) {}
  74 public:
  75   // The string table
  76   static StringTable* the_table() { return _the_table; }
  77 
  78   // Size of one bucket in the string table.  Used when checking for rollover.
  79   static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }


  97   }
  98   static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
  99   static void unlink(BoolObjectClosure* cl, int* processed, int* removed) {
 100     unlink_or_oops_do(cl, NULL, processed, removed);
 101   }
 102   // Serially invoke "f->do_oop" on the locations of all oops in the table.
 103   static void oops_do(OopClosure* f);
 104 
 105   // Possibly parallel versions of the above
 106   static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
 107   static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) {
 108     possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed);
 109   }
 110   static void possibly_parallel_oops_do(OopClosure* f);
 111 
 112   // Hashing algorithm, used as the hash value used by the
 113   //     StringTable for bucket selection and comparison (stored in the
 114   //     HashtableEntry structures).  This is used in the String.intern() method.
 115   static unsigned int hash_string(const jchar* s, int len);
 116   static unsigned int hash_string(oop string);
 117   static unsigned int alt_hash_string(const jchar* s, int len);
 118 
 119   // Internal test.
 120   static void test_alt_hash() PRODUCT_RETURN;
 121 
 122   // Probing
 123   static oop lookup(Symbol* symbol);
 124   static oop lookup(jchar* chars, int length);
 125 
 126   // Interning
 127   static oop intern(Symbol* symbol, TRAPS);
 128   static oop intern(oop string, TRAPS);
 129   static oop intern(const char *utf8_string, TRAPS);
 130 
 131   // Debugging
 132   static void verify();
 133   static void dump(outputStream* st, bool verbose=false);
 134 
 135   enum VerifyMesgModes {
 136     _verify_quietly    = 0,
 137     _verify_with_mesgs = 1


< prev index next >