122
123 static void initialize_symbols(int arena_alloc_size = 0);
124
125 static volatile int _parallel_claimed_idx;
126
127 typedef SymbolTable::BucketUnlinkContext BucketUnlinkContext;
128 // Release any dead symbols. Unlinked bucket entries are collected in the given
129 // context to be freed later.
130 // This allows multiple threads to work on the table at once.
131 static void buckets_unlink(int start_idx, int end_idx, BucketUnlinkContext* context, size_t* memory_total);
132 public:
133 enum {
134 symbol_alloc_batch_size = 8,
135 // Pick initial size based on java -version size measurements
136 symbol_alloc_arena_size = 360*K
137 };
138
139 // The symbol table
140 static SymbolTable* the_table() { return _the_table; }
141
142 // Size of one bucket in the string table. Used when checking for rollover.
143 static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
144
145 static void create_table() {
146 assert(_the_table == NULL, "One symbol table allowed.");
147 _the_table = new SymbolTable();
148 initialize_symbols(symbol_alloc_arena_size);
149 }
150
151 static void create_table(HashtableBucket<mtSymbol>* t, int length,
152 int number_of_entries) {
153 assert(_the_table == NULL, "One symbol table allowed.");
154
155 // If CDS archive used a different symbol table size, use that size instead
156 // which is better than giving an error.
157 SymbolTableSize = length/bucket_size();
158
159 _the_table = new SymbolTable(t, number_of_entries);
160 // if CDS give symbol table a default arena size since most symbols
161 // are already allocated in the shared misc section.
277 // Apply the give oop closure to the entries to the buckets
278 // in the range [start_idx, end_idx).
279 static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
280
281 typedef StringTable::BucketUnlinkContext BucketUnlinkContext;
282 // Unlink or apply the give oop closure to the entries to the buckets
283 // in the range [start_idx, end_idx). Unlinked bucket entries are collected in the given
284 // context to be freed later.
285 // This allows multiple threads to work on the table at once.
286 static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context);
287
288 StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize,
289 sizeof (HashtableEntry<oop, mtSymbol>)) {}
290
291 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
292 : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
293 number_of_entries) {}
294 public:
295 // The string table
296 static StringTable* the_table() { return _the_table; }
297
298 // Size of one bucket in the string table. Used when checking for rollover.
299 static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
300
301 static void create_table() {
302 assert(_the_table == NULL, "One string table allowed.");
303 _the_table = new StringTable();
304 }
305
306 // GC support
307 // Delete pointers to otherwise-unreachable objects.
308 static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) {
309 int processed = 0;
310 int removed = 0;
311 unlink_or_oops_do(cl, f, &processed, &removed);
312 }
313 static void unlink(BoolObjectClosure* cl) {
314 int processed = 0;
315 int removed = 0;
316 unlink_or_oops_do(cl, NULL, &processed, &removed);
|
122
123 static void initialize_symbols(int arena_alloc_size = 0);
124
125 static volatile int _parallel_claimed_idx;
126
127 typedef SymbolTable::BucketUnlinkContext BucketUnlinkContext;
128 // Release any dead symbols. Unlinked bucket entries are collected in the given
129 // context to be freed later.
130 // This allows multiple threads to work on the table at once.
131 static void buckets_unlink(int start_idx, int end_idx, BucketUnlinkContext* context, size_t* memory_total);
132 public:
133 enum {
134 symbol_alloc_batch_size = 8,
135 // Pick initial size based on java -version size measurements
136 symbol_alloc_arena_size = 360*K
137 };
138
139 // The symbol table
140 static SymbolTable* the_table() { return _the_table; }
141
142 TableStatistics get_table_statistics();
143
144 // Size of one bucket in the string table. Used when checking for rollover.
145 static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
146
147 static void create_table() {
148 assert(_the_table == NULL, "One symbol table allowed.");
149 _the_table = new SymbolTable();
150 initialize_symbols(symbol_alloc_arena_size);
151 }
152
153 static void create_table(HashtableBucket<mtSymbol>* t, int length,
154 int number_of_entries) {
155 assert(_the_table == NULL, "One symbol table allowed.");
156
157 // If CDS archive used a different symbol table size, use that size instead
158 // which is better than giving an error.
159 SymbolTableSize = length/bucket_size();
160
161 _the_table = new SymbolTable(t, number_of_entries);
162 // if CDS give symbol table a default arena size since most symbols
163 // are already allocated in the shared misc section.
279 // Apply the give oop closure to the entries to the buckets
280 // in the range [start_idx, end_idx).
281 static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
282
283 typedef StringTable::BucketUnlinkContext BucketUnlinkContext;
284 // Unlink or apply the give oop closure to the entries to the buckets
285 // in the range [start_idx, end_idx). Unlinked bucket entries are collected in the given
286 // context to be freed later.
287 // This allows multiple threads to work on the table at once.
288 static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context);
289
290 StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize,
291 sizeof (HashtableEntry<oop, mtSymbol>)) {}
292
293 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
294 : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
295 number_of_entries) {}
296 public:
297 // The string table
298 static StringTable* the_table() { return _the_table; }
299 TableStatistics get_table_statistics();
300
301 // Size of one bucket in the string table. Used when checking for rollover.
302 static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
303
304 static void create_table() {
305 assert(_the_table == NULL, "One string table allowed.");
306 _the_table = new StringTable();
307 }
308
309 // GC support
310 // Delete pointers to otherwise-unreachable objects.
311 static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) {
312 int processed = 0;
313 int removed = 0;
314 unlink_or_oops_do(cl, f, &processed, &removed);
315 }
316 static void unlink(BoolObjectClosure* cl) {
317 int processed = 0;
318 int removed = 0;
319 unlink_or_oops_do(cl, NULL, &processed, &removed);
|