16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CLASSFILE_STRINGTABLE_HPP
26 #define SHARE_VM_CLASSFILE_STRINGTABLE_HPP
27
28 #include "gc/shared/oopStorage.hpp"
29 #include "gc/shared/oopStorageParState.hpp"
30 #include "memory/allocation.hpp"
31 #include "memory/padded.hpp"
32 #include "oops/oop.hpp"
33 #include "oops/weakHandle.hpp"
34 #include "utilities/concurrentHashTable.hpp"
35
36 class CompactStringTableWriter;
37 class SerializeClosure;
38
39 class StringTable;
40 class StringTableConfig;
41 typedef ConcurrentHashTable<WeakHandle<vm_string_table_data>,
42 StringTableConfig, mtSymbol> StringTableHash;
43
44 class StringTableCreateEntry;
45
46 class StringTable : public CHeapObj<mtSymbol>{
47 friend class VMStructs;
48 friend class Symbol;
49 friend class StringTableConfig;
50 friend class StringTableCreateEntry;
51
52 private:
53 void grow(JavaThread* jt);
54 void clean_dead_entries(JavaThread* jt);
55
56 // The string table
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
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CLASSFILE_STRINGTABLE_HPP
26 #define SHARE_VM_CLASSFILE_STRINGTABLE_HPP
27
28 #include "gc/shared/oopStorage.hpp"
29 #include "gc/shared/oopStorageParState.hpp"
30 #include "memory/allocation.hpp"
31 #include "memory/padded.hpp"
32 #include "oops/oop.hpp"
33 #include "oops/weakHandle.hpp"
34 #include "utilities/concurrentHashTable.hpp"
35
36 class CompactHashtableWriter;
37 class SerializeClosure;
38
39 class StringTable;
40 class StringTableConfig;
41 typedef ConcurrentHashTable<WeakHandle<vm_string_table_data>,
42 StringTableConfig, mtSymbol> StringTableHash;
43
44 class StringTableCreateEntry;
45
46 class StringTable : public CHeapObj<mtSymbol>{
47 friend class VMStructs;
48 friend class Symbol;
49 friend class StringTableConfig;
50 friend class StringTableCreateEntry;
51
52 private:
53 void grow(JavaThread* jt);
54 void clean_dead_entries(JavaThread* jt);
55
56 // The string table
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(CompactHashtableWriter* 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
|