< prev index next >

src/hotspot/share/classfile/stringTable.hpp

Print this page

 23  */
 24 
 25 #ifndef SHARE_CLASSFILE_STRINGTABLE_HPP
 26 #define SHARE_CLASSFILE_STRINGTABLE_HPP
 27 
 28 #include "memory/allStatic.hpp"
 29 #include "memory/padded.hpp"
 30 #include "oops/oop.hpp"
 31 #include "oops/oopHandle.hpp"
 32 #include "oops/weakHandle.hpp"
 33 #include "utilities/tableStatistics.hpp"
 34 
 35 class CompactHashtableWriter;
 36 class JavaThread;
 37 class SerializeClosure;
 38 
 39 class StringTableConfig;
 40 
 41 class StringTable : AllStatic {
 42   friend class StringTableConfig;
 43 
 44   static volatile bool _has_work;
 45 
 46   // Set if one bucket is out of balance due to hash algorithm deficiency
 47   static volatile bool _needs_rehashing;
 48 
 49   static OopStorage* _oop_storage;
 50 
 51   static void grow(JavaThread* jt);
 52   static void clean_dead_entries(JavaThread* jt);
 53 
 54   static double get_load_factor();
 55   static double get_dead_factor(size_t num_dead);
 56 
 57 public:
 58   typedef struct StringWrapperInternal StringWrapper;
 59 
 60   // Unnamed int needed to fit CompactHashtable's equals type signature
 61   static bool wrapped_string_equals(oop java_string, const StringWrapper& wrapped_str, int = 0);
 62 
 63 private:
 64   static const char* get_symbol_utf8(const StringWrapper& symbol_str);
 65   static unsigned int hash_wrapped_string(const StringWrapper& wrapped_str);
 66   static const jchar* to_unicode(const StringWrapper& wrapped_str, int &len, TRAPS);
 67   static Handle handle_from_wrapped_string(const StringWrapper& wrapped_str, TRAPS);
 68 
 69   // GC support
 70 
 71   // Callback for GC to notify of changes that might require cleaning or resize.
 72   static void gc_notification(size_t num_dead);
 73   static void trigger_concurrent_work();
 74 
 75   static void item_added();
 76   static void item_removed();

 77 
 78   static oop intern(const StringWrapper& name, TRAPS);
 79   static oop do_intern(const StringWrapper& name, uintx hash, TRAPS);
 80   static oop do_lookup(const StringWrapper& name, uintx hash);
 81 
 82   static void print_table_statistics(outputStream* st);
 83 
 84  public:
 85   static size_t table_size();
 86   static TableStatistics get_table_statistics();
 87 
 88   static void create_table();
 89 
 90   static void do_concurrent_work(JavaThread* jt);
 91   static bool has_work();
 92 
 93   // Probing
 94   static oop lookup(Symbol* symbol);
 95   static oop lookup(const jchar* chars, int length);
 96 

 23  */
 24 
 25 #ifndef SHARE_CLASSFILE_STRINGTABLE_HPP
 26 #define SHARE_CLASSFILE_STRINGTABLE_HPP
 27 
 28 #include "memory/allStatic.hpp"
 29 #include "memory/padded.hpp"
 30 #include "oops/oop.hpp"
 31 #include "oops/oopHandle.hpp"
 32 #include "oops/weakHandle.hpp"
 33 #include "utilities/tableStatistics.hpp"
 34 
 35 class CompactHashtableWriter;
 36 class JavaThread;
 37 class SerializeClosure;
 38 
 39 class StringTableConfig;
 40 
 41 class StringTable : AllStatic {
 42   friend class StringTableConfig;
 43   class VerifyCompStrings;
 44   static volatile bool _has_work;
 45 
 46   // Set if one bucket is out of balance due to hash algorithm deficiency
 47   static volatile bool _needs_rehashing;
 48 
 49   static OopStorage* _oop_storage;
 50 
 51   static void grow(JavaThread* jt);
 52   static void clean_dead_entries(JavaThread* jt);
 53 
 54   static double get_load_factor();
 55   static double get_dead_factor(size_t num_dead);
 56 
 57 public:
 58   typedef struct StringWrapperInternal StringWrapper;
 59 
 60   // Unnamed int needed to fit CompactHashtable's equals type signature
 61   static bool wrapped_string_equals(oop java_string, const StringWrapper& wrapped_str, int = 0);
 62 
 63 private:
 64   static const char* get_symbol_utf8(const StringWrapper& symbol_str);
 65   static unsigned int hash_wrapped_string(const StringWrapper& wrapped_str);
 66   static const jchar* to_unicode(const StringWrapper& wrapped_str, int &len, TRAPS);
 67   static Handle handle_from_wrapped_string(const StringWrapper& wrapped_str, TRAPS);
 68 
 69   // GC support
 70 
 71   // Callback for GC to notify of changes that might require cleaning or resize.
 72   static void gc_notification(size_t num_dead);
 73   static void trigger_concurrent_work();
 74 
 75   static void item_added();
 76   static void item_removed();
 77   static size_t items_count_acquire();
 78 
 79   static oop intern(const StringWrapper& name, TRAPS);
 80   static oop do_intern(const StringWrapper& name, uintx hash, TRAPS);
 81   static oop do_lookup(const StringWrapper& name, uintx hash);
 82 
 83   static void print_table_statistics(outputStream* st);
 84 
 85  public:
 86   static size_t table_size();
 87   static TableStatistics get_table_statistics();
 88 
 89   static void create_table();
 90 
 91   static void do_concurrent_work(JavaThread* jt);
 92   static bool has_work();
 93 
 94   // Probing
 95   static oop lookup(Symbol* symbol);
 96   static oop lookup(const jchar* chars, int length);
 97 
< prev index next >