< prev index next >

src/hotspot/share/classfile/stringTable.hpp

Print this page


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


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


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


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