Print this page
rev 4769 : 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.

@@ -1,7 +1,7 @@
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -244,16 +244,23 @@
   static StringTable* _the_table;
   // Set if one bucket is out of balance due to hash algorithm deficiency
   static bool _needs_rehashing;
+  // Claimed high water mark for parallel chunked scanning
+  static volatile int _par_claimed_idx;
   static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
   oop basic_add(int index, Handle string_or_null, jchar* name, int len,
                 unsigned int hashValue, TRAPS);
   oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
+  // Apply the give oop closure to the entries to the buckets
+  // in the range [start_idx, end_idx).
+  static void buckets_do(OopClosure* f, int start_idx, int end_idx);
   StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize,
                               sizeof (HashtableEntry<oop, mtSymbol>)) {}
   StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
     : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,

@@ -275,13 +282,16 @@
   static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f);
   static void unlink(BoolObjectClosure* cl) {
     unlink_or_oops_do(cl, NULL);
-  // Invoke "f->do_oop" on the locations of all oops in the table.
+  // Serially invoke "f->do_oop" on the locations of all oops in the table.
   static void oops_do(OopClosure* f);
+  // Possibly parallel version of the above
+  static void possibly_parallel_oops_do(OopClosure* f);
   // Hashing algorithm, used as the hash value used by the
   //     StringTable for bucket selection and comparison (stored in the
   //     HashtableEntry structures).  This is used in the String.intern() method.
   static unsigned int hash_string(const jchar* s, int len);

@@ -313,7 +323,10 @@
   // Rehash the symbol table if it gets out of balance
   static void rehash_table();
   static bool needs_rehashing() { return _needs_rehashing; }
+  // Parallel chunked scanning
+  static void clear_par_claimed_index() { _par_claimed_idx = 0; }