Mercurial > hg > graal-compiler
comparison src/share/vm/classfile/symbolTable.hpp @ 10991:01522ca68fc7
8015237: Parallelize string table scanning during strong root processing
Summary: Parallelize the scanning of the intern string table by having each GC worker claim a given number of buckets. Changes were also reviewed by Per Liden <per.liden@oracle.com>.
Reviewed-by: tschatzl, stefank, twisti
author | johnc |
---|---|
date | Tue, 18 Jun 2013 12:31:07 -0700 |
parents | 8dbc025ff709 |
children | 63147986a428 |
comparison
equal
deleted
inserted
replaced
10990:0abfeed51c9e | 10991:01522ca68fc7 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, 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. |
244 static StringTable* _the_table; | 244 static StringTable* _the_table; |
245 | 245 |
246 // Set if one bucket is out of balance due to hash algorithm deficiency | 246 // Set if one bucket is out of balance due to hash algorithm deficiency |
247 static bool _needs_rehashing; | 247 static bool _needs_rehashing; |
248 | 248 |
249 // Claimed high water mark for parallel chunked scanning | |
250 static volatile int _parallel_claimed_idx; | |
251 | |
249 static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); | 252 static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); |
250 oop basic_add(int index, Handle string_or_null, jchar* name, int len, | 253 oop basic_add(int index, Handle string_or_null, jchar* name, int len, |
251 unsigned int hashValue, TRAPS); | 254 unsigned int hashValue, TRAPS); |
252 | 255 |
253 oop lookup(int index, jchar* chars, int length, unsigned int hashValue); | 256 oop lookup(int index, jchar* chars, int length, unsigned int hashValue); |
257 | |
258 // Apply the give oop closure to the entries to the buckets | |
259 // in the range [start_idx, end_idx). | |
260 static void buckets_do(OopClosure* f, int start_idx, int end_idx); | |
254 | 261 |
255 StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize, | 262 StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize, |
256 sizeof (HashtableEntry<oop, mtSymbol>)) {} | 263 sizeof (HashtableEntry<oop, mtSymbol>)) {} |
257 | 264 |
258 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) | 265 StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries) |
275 static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f); | 282 static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f); |
276 static void unlink(BoolObjectClosure* cl) { | 283 static void unlink(BoolObjectClosure* cl) { |
277 unlink_or_oops_do(cl, NULL); | 284 unlink_or_oops_do(cl, NULL); |
278 } | 285 } |
279 | 286 |
280 // Invoke "f->do_oop" on the locations of all oops in the table. | 287 // Serially invoke "f->do_oop" on the locations of all oops in the table. |
281 static void oops_do(OopClosure* f); | 288 static void oops_do(OopClosure* f); |
289 | |
290 // Possibly parallel version of the above | |
291 static void possibly_parallel_oops_do(OopClosure* f); | |
282 | 292 |
283 // Hashing algorithm, used as the hash value used by the | 293 // Hashing algorithm, used as the hash value used by the |
284 // StringTable for bucket selection and comparison (stored in the | 294 // StringTable for bucket selection and comparison (stored in the |
285 // HashtableEntry structures). This is used in the String.intern() method. | 295 // HashtableEntry structures). This is used in the String.intern() method. |
286 static unsigned int hash_string(const jchar* s, int len); | 296 static unsigned int hash_string(const jchar* s, int len); |
313 } | 323 } |
314 | 324 |
315 // Rehash the symbol table if it gets out of balance | 325 // Rehash the symbol table if it gets out of balance |
316 static void rehash_table(); | 326 static void rehash_table(); |
317 static bool needs_rehashing() { return _needs_rehashing; } | 327 static bool needs_rehashing() { return _needs_rehashing; } |
328 | |
329 // Parallel chunked scanning | |
330 static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; } | |
318 }; | 331 }; |
319 #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP | 332 #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP |