< prev index next >

src/hotspot/share/classfile/stringTable.hpp

Print this page
rev 50505 : imported patch 8204613-stringtable-unclean-fix


  66   StringTableHash* _local_table;
  67   size_t _current_size;
  68   volatile bool _has_work;
  69   volatile bool _needs_rehashing;
  70 
  71   OopStorage* _weak_handles;
  72 
  73   volatile size_t _items;
  74   DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
  75   volatile size_t _uncleaned_items;
  76   DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
  77 
  78   double get_load_factor();
  79   double get_dead_factor();
  80 
  81   void check_concurrent_work();
  82   void trigger_concurrent_work();
  83 
  84   static uintx item_added();
  85   static void item_removed();
  86   static size_t items_to_clean(size_t ncl);
  87 
  88   StringTable();
  89 
  90   static oop intern(Handle string_or_null_h, jchar* name, int len, TRAPS);
  91   oop do_intern(Handle string_or_null, jchar* name, int len, uintx hash, TRAPS);
  92   oop do_lookup(jchar* name, int len, uintx hash);
  93 
  94   void concurrent_work(JavaThread* jt);
  95   void print_table_statistics(outputStream* st, const char* table_name);
  96 
  97   void try_rehash_table();
  98   bool do_rehash();
  99 
 100  public:
 101   // The string table
 102   static StringTable* the_table() { return _the_table; }
 103   size_t table_size(Thread* thread = NULL);
 104 
 105   static OopStorage* weak_storage() { return the_table()->_weak_handles; }
 106 
 107   static void create_table() {
 108     assert(_the_table == NULL, "One string table allowed.");
 109     _the_table = new StringTable();
 110   }
 111 
 112   static void do_concurrent_work(JavaThread* jt);
 113   static bool has_work() { return the_table()->_has_work; }
 114 
 115   // GC support

















 116   //   Delete pointers to otherwise-unreachable objects.
 117   static void unlink(BoolObjectClosure* cl) {
 118     unlink_or_oops_do(cl);
 119   }
 120   static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f = NULL,
 121                                 int* processed = NULL, int* removed = NULL);
 122 
 123   // Serially invoke "f->do_oop" on the locations of all oops in the table.
 124   static void oops_do(OopClosure* f);
 125 
 126   // Possibly parallel versions of the above
 127   static void possibly_parallel_unlink(
 128      OopStorage::ParState<false /* concurrent */, false /* const*/>* par_state_string,
 129      BoolObjectClosure* cl, int* processed, int* removed);
 130   static void possibly_parallel_oops_do(
 131      OopStorage::ParState<false /* concurrent */, false /* const*/>* par_state_string,
 132      OopClosure* f);
 133 
 134   // Probing
 135   static oop lookup(Symbol* symbol);
 136   static oop lookup(jchar* chars, int length);
 137 
 138   // Interning
 139   static oop intern(Symbol* symbol, TRAPS);
 140   static oop intern(oop string, TRAPS);
 141   static oop intern(const char *utf8_string, TRAPS);
 142 
 143   // Rehash the string table if it gets out of balance
 144   static void rehash_table();
 145   static bool needs_rehashing()
 146     { return StringTable::the_table()->_needs_rehashing; }
 147 
 148   // Sharing
 149  private:
 150   oop lookup_shared(jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 151   static void copy_shared_string_table(CompactStringTableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN;
 152  public:
 153   static oop create_archived_string(oop s, Thread* THREAD);
 154   static void set_shared_string_mapped() { _shared_string_mapped = true; }
 155   static bool shared_string_mapped()       { return _shared_string_mapped; }
 156   static void shared_oops_do(OopClosure* f) NOT_CDS_JAVA_HEAP_RETURN;
 157   static void write_to_archive() NOT_CDS_JAVA_HEAP_RETURN;
 158   static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
 159 
 160   // Jcmd
 161   static void dump(outputStream* st, bool verbose=false);
 162   // Debugging
 163   static size_t verify_and_compare_entries();
 164   static void verify();
 165 };
 166 
 167 #endif // SHARE_VM_CLASSFILE_STRINGTABLE_HPP


  66   StringTableHash* _local_table;
  67   size_t _current_size;
  68   volatile bool _has_work;
  69   volatile bool _needs_rehashing;
  70 
  71   OopStorage* _weak_handles;
  72 
  73   volatile size_t _items;
  74   DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
  75   volatile size_t _uncleaned_items;
  76   DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
  77 
  78   double get_load_factor();
  79   double get_dead_factor();
  80 
  81   void check_concurrent_work();
  82   void trigger_concurrent_work();
  83 
  84   static uintx item_added();
  85   static void item_removed();
  86   size_t add_items_to_clean(size_t ndead);
  87 
  88   StringTable();
  89 
  90   static oop intern(Handle string_or_null_h, jchar* name, int len, TRAPS);
  91   oop do_intern(Handle string_or_null, jchar* name, int len, uintx hash, TRAPS);
  92   oop do_lookup(jchar* name, int len, uintx hash);
  93 
  94   void concurrent_work(JavaThread* jt);
  95   void print_table_statistics(outputStream* st, const char* table_name);
  96 
  97   void try_rehash_table();
  98   bool do_rehash();
  99 
 100  public:
 101   // The string table
 102   static StringTable* the_table() { return _the_table; }
 103   size_t table_size(Thread* thread = NULL);
 104 
 105   static OopStorage* weak_storage() { return the_table()->_weak_handles; }
 106 
 107   static void create_table() {
 108     assert(_the_table == NULL, "One string table allowed.");
 109     _the_table = new StringTable();
 110   }
 111 
 112   static void do_concurrent_work(JavaThread* jt);
 113   static bool has_work() { return the_table()->_has_work; }
 114 
 115   // GC support
 116 
 117   // Must be called before a parallel walk where strings might die.
 118   static void reset_dead_counter() {
 119     the_table()->_uncleaned_items = 0;
 120   }
 121   // After the parallel walk this method must be called to trigger
 122   // cleaning. Note it might trigger a resize instead.
 123   static void finish_dead_counter() {
 124     the_table()->check_concurrent_work();
 125   }
 126 
 127   // If GC uses ParState directly it should add the number of cleared
 128   // string to this method.
 129   static void inc_dead_counter(size_t ndead) {
 130     the_table()->add_items_to_clean(ndead);
 131   }
 132 
 133   //   Delete pointers to otherwise-unreachable objects.
 134   static void unlink(BoolObjectClosure* cl) {
 135     unlink_or_oops_do(cl);
 136   }
 137   static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f = NULL,
 138                                 int* processed = NULL, int* removed = NULL);
 139 
 140   // Serially invoke "f->do_oop" on the locations of all oops in the table.
 141   static void oops_do(OopClosure* f);
 142 
 143   // Possibly parallel versions of the above
 144   static void possibly_parallel_unlink(
 145      OopStorage::ParState<false /* concurrent */, false /* const*/>* par_state_string,
 146      BoolObjectClosure* cl, int* processed, int* removed);
 147   static void possibly_parallel_oops_do(
 148      OopStorage::ParState<false /* concurrent */, false /* const*/>* par_state_string,
 149      OopClosure* f);
 150 
 151   // Probing
 152   static oop lookup(Symbol* symbol);
 153   static oop lookup(jchar* chars, int length);
 154 
 155   // Interning
 156   static oop intern(Symbol* symbol, TRAPS);
 157   static oop intern(oop string, TRAPS);
 158   static oop intern(const char *utf8_string, TRAPS);
 159 
 160   // Rehash the string table if it gets out of balance
 161   static void rehash_table();
 162   static bool needs_rehashing()
 163     { return StringTable::the_table()->_needs_rehashing; }
 164 
 165   // Sharing
 166  private:
 167   oop lookup_shared(jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 168   static void copy_shared_string_table(CompactStringTableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN;
 169  public:
 170   static oop create_archived_string(oop s, Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 171   static void set_shared_string_mapped() { _shared_string_mapped = true; }
 172   static bool shared_string_mapped()     { return _shared_string_mapped; }
 173   static void shared_oops_do(OopClosure* f) NOT_CDS_JAVA_HEAP_RETURN;
 174   static void write_to_archive() NOT_CDS_JAVA_HEAP_RETURN;
 175   static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
 176 
 177   // Jcmd
 178   static void dump(outputStream* st, bool verbose=false);
 179   // Debugging
 180   static size_t verify_and_compare_entries();
 181   static void verify();
 182 };
 183 
 184 #endif // SHARE_VM_CLASSFILE_STRINGTABLE_HPP
< prev index next >