< prev index next >

src/share/vm/classfile/stringTable.hpp

Print this page




  26 #define SHARE_VM_CLASSFILE_STRINGTABLE_HPP
  27 
  28 #include "memory/allocation.inline.hpp"
  29 #include "utilities/hashtable.hpp"
  30 
  31 template <class T, class N> class CompactHashtable;
  32 class CompactStringTableWriter;
  33 class FileMapInfo;
  34 class SerializeClosure;
  35 
  36 class StringTable : public RehashableHashtable<oop, mtSymbol> {
  37   friend class VMStructs;
  38   friend class Symbol;
  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 
  65   typedef StringTable::BucketUnlinkContext BucketUnlinkContext;
  66   // Unlink or apply the give oop closure to the entries to the buckets


 140     _verify_quietly    = 0,
 141     _verify_with_mesgs = 1
 142   };
 143 
 144   enum VerifyRetTypes {
 145     _verify_pass          = 0,
 146     _verify_fail_continue = 1,
 147     _verify_fail_done     = 2
 148   };
 149 
 150   static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
 151                                         HashtableEntry<oop, mtSymbol>* e_ptr1,
 152                                         int bkt2, int e_cnt2,
 153                                         HashtableEntry<oop, mtSymbol>* e_ptr2);
 154   static VerifyRetTypes verify_entry(int bkt, int e_cnt,
 155                                      HashtableEntry<oop, mtSymbol>* e_ptr,
 156                                      VerifyMesgModes mesg_mode);
 157   static int verify_and_compare_entries();
 158 
 159   // Sharing
 160   static void ignore_shared_strings(bool v) { _ignore_shared_strings = v; }
 161   static bool shared_string_ignored()       { return _ignore_shared_strings; }
 162   static void shared_oops_do(OopClosure* f);
 163   static bool copy_shared_string(GrowableArray<MemRegion> *string_space,
 164                                  CompactStringTableWriter* ch_table);
 165   static void write_to_archive(GrowableArray<MemRegion> *string_space);
 166   static void serialize(SerializeClosure* soc);

 167 
 168   // Rehash the symbol table if it gets out of balance
 169   static void rehash_table();
 170   static bool needs_rehashing() { return _needs_rehashing; }
 171 
 172   // Parallel chunked scanning
 173   static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; }
 174   static int parallel_claimed_index() { return _parallel_claimed_idx; }
 175 };
 176 #endif // SHARE_VM_CLASSFILE_STRINGTABLE_HPP


  26 #define SHARE_VM_CLASSFILE_STRINGTABLE_HPP
  27 
  28 #include "memory/allocation.inline.hpp"
  29 #include "utilities/hashtable.hpp"
  30 
  31 template <class T, class N> class CompactHashtable;
  32 class CompactStringTableWriter;
  33 class FileMapInfo;
  34 class SerializeClosure;
  35 
  36 class StringTable : public RehashableHashtable<oop, mtSymbol> {
  37   friend class VMStructs;
  38   friend class Symbol;
  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 _shared_string_mapped;
  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 
  65   typedef StringTable::BucketUnlinkContext BucketUnlinkContext;
  66   // Unlink or apply the give oop closure to the entries to the buckets


 140     _verify_quietly    = 0,
 141     _verify_with_mesgs = 1
 142   };
 143 
 144   enum VerifyRetTypes {
 145     _verify_pass          = 0,
 146     _verify_fail_continue = 1,
 147     _verify_fail_done     = 2
 148   };
 149 
 150   static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
 151                                         HashtableEntry<oop, mtSymbol>* e_ptr1,
 152                                         int bkt2, int e_cnt2,
 153                                         HashtableEntry<oop, mtSymbol>* e_ptr2);
 154   static VerifyRetTypes verify_entry(int bkt, int e_cnt,
 155                                      HashtableEntry<oop, mtSymbol>* e_ptr,
 156                                      VerifyMesgModes mesg_mode);
 157   static int verify_and_compare_entries();
 158 
 159   // Sharing
 160   static void set_shared_string_mapped() { _shared_string_mapped = true; }
 161   static bool shared_string_mapped()       { return _shared_string_mapped; }
 162   static void shared_oops_do(OopClosure* f) NOT_CDS_JAVA_HEAP_RETURN;
 163   static bool copy_shared_string(GrowableArray<MemRegion> *string_space,
 164                                  CompactStringTableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN_(false);
 165   static oop  archive_string(oop s, Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 166   static void write_to_archive(GrowableArray<MemRegion> *string_space) NOT_CDS_JAVA_HEAP_RETURN;
 167   static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
 168 
 169   // Rehash the symbol table if it gets out of balance
 170   static void rehash_table();
 171   static bool needs_rehashing() { return _needs_rehashing; }
 172 
 173   // Parallel chunked scanning
 174   static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; }
 175   static int parallel_claimed_index() { return _parallel_claimed_idx; }
 176 };
 177 #endif // SHARE_VM_CLASSFILE_STRINGTABLE_HPP
< prev index next >