< prev index next >

src/hotspot/share/classfile/stringTable.hpp

Print this page
rev 48017 : [mq]: Access_strings


  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
  67   // in the range [start_idx, end_idx). Unlinked bucket entries are collected in the given
  68   // context to be freed later.
  69   // This allows multiple threads to work on the table at once.
  70   static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context);
  71 
  72   // Hashing algorithm, used as the hash value used by the
  73   //     StringTable for bucket selection and comparison (stored in the
  74   //     HashtableEntry structures).  This is used in the String.intern() method.
  75   static unsigned int hash_string(const jchar* s, int len);
  76   static unsigned int hash_string(oop string);
  77   static unsigned int alt_hash_string(const jchar* s, int len);
  78 







  79   StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize,
  80                               sizeof (HashtableEntry<oop, mtSymbol>)) {}
  81 
  82   StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
  83     : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
  84                      number_of_entries) {}
  85 public:
  86   // The string table
  87   static StringTable* the_table() { return _the_table; }
  88 
  89   // Size of one bucket in the string table.  Used when checking for rollover.
  90   static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
  91 
  92   static void create_table() {
  93     assert(_the_table == NULL, "One string table allowed.");
  94     _the_table = new StringTable();
  95   }
  96 
  97   // GC support
  98   //   Delete pointers to otherwise-unreachable objects.




  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
  67   // in the range [start_idx, end_idx). Unlinked bucket entries are collected in the given
  68   // context to be freed later.
  69   // This allows multiple threads to work on the table at once.
  70   static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context);
  71 
  72   // Hashing algorithm, used as the hash value used by the
  73   //     StringTable for bucket selection and comparison (stored in the
  74   //     HashtableEntry structures).  This is used in the String.intern() method.
  75   static unsigned int hash_string(const jchar* s, int len);
  76   static unsigned int hash_string(oop string);
  77   static unsigned int alt_hash_string(const jchar* s, int len);
  78 
  79   // Accessors for the string roots in the hashtable entries.
  80   // Use string_object_no_keepalive() only when the value is not returned
  81   // outside of a scope where a thread transition is possible.
  82   static oop string_object(HashtableEntry<oop, mtSymbol>* entry);
  83   static oop string_object_no_keepalive(HashtableEntry<oop, mtSymbol>* entry);
  84   static void set_string_object(HashtableEntry<oop, mtSymbol>* entry, oop string);
  85 
  86   StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize,
  87                               sizeof (HashtableEntry<oop, mtSymbol>)) {}
  88 
  89   StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
  90     : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
  91                      number_of_entries) {}
  92 public:
  93   // The string table
  94   static StringTable* the_table() { return _the_table; }
  95 
  96   // Size of one bucket in the string table.  Used when checking for rollover.
  97   static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
  98 
  99   static void create_table() {
 100     assert(_the_table == NULL, "One string table allowed.");
 101     _the_table = new StringTable();
 102   }
 103 
 104   // GC support
 105   //   Delete pointers to otherwise-unreachable objects.


< prev index next >