1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
122 |
122 |
123 static void initialize_symbols(int arena_alloc_size = 0); |
123 static void initialize_symbols(int arena_alloc_size = 0); |
124 |
124 |
125 static volatile int _parallel_claimed_idx; |
125 static volatile int _parallel_claimed_idx; |
126 |
126 |
127 // Release any dead symbols |
127 typedef SymbolTable::BucketUnlinkContext BucketUnlinkContext; |
128 static void buckets_unlink(int start_idx, int end_idx, int* processed, int* removed, size_t* memory_total); |
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); |
129 public: |
132 public: |
130 enum { |
133 enum { |
131 symbol_alloc_batch_size = 8, |
134 symbol_alloc_batch_size = 8, |
132 // Pick initial size based on java -version size measurements |
135 // Pick initial size based on java -version size measurements |
133 symbol_alloc_arena_size = 360*K |
136 symbol_alloc_arena_size = 360*K |
272 oop lookup(int index, jchar* chars, int length, unsigned int hashValue); |
275 oop lookup(int index, jchar* chars, int length, unsigned int hashValue); |
273 |
276 |
274 // Apply the give oop closure to the entries to the buckets |
277 // Apply the give oop closure to the entries to the buckets |
275 // in the range [start_idx, end_idx). |
278 // in the range [start_idx, end_idx). |
276 static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx); |
279 static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx); |
|
280 |
|
281 typedef StringTable::BucketUnlinkContext BucketUnlinkContext; |
277 // Unlink or apply the give oop closure to the entries to the buckets |
282 // Unlink or apply the give oop closure to the entries to the buckets |
278 // in the range [start_idx, end_idx). |
283 // in the range [start_idx, end_idx). Unlinked bucket entries are collected in the given |
279 static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed); |
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); |
280 |
287 |
281 StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, |
288 StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, |
282 sizeof (HashtableEntry<oop, mtSymbol>)) {} |
289 sizeof (HashtableEntry<oop, mtSymbol>)) {} |
283 |
290 |
284 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) |
291 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) |