< prev index next >

src/share/vm/gc/g1/g1StringDedupQueue.hpp

Print this page
rev 8362 : 8079792: GC directory structure cleanup
Reviewed-by:
   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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_GC_IMPLEMENTATION_G1_G1STRINGDEDUPQUEUE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPQUEUE_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "oops/oop.hpp"
  30 #include "utilities/stack.hpp"
  31 
  32 class G1StringDedupUnlinkOrOopsDoClosure;
  33 
  34 //
  35 // The deduplication queue acts as the communication channel between the stop-the-world
  36 // mark/evacuation phase and the concurrent deduplication phase. Deduplication candidates
  37 // found during mark/evacuation are placed on this queue for later processing in the
  38 // deduplication thread. A queue entry is an oop pointing to a String object (as opposed
  39 // to entries in the deduplication hashtable which points to character arrays).
  40 //
  41 // While users of the queue treat it as a single queue, it is implemented as a set of
  42 // queues, one queue per GC worker thread, to allow lock-free and cache-friendly enqueue
  43 // operations by the GC workers.
  44 //
  45 // The oops in the queue are treated as weak pointers, meaning the objects they point to
  46 // can become unreachable and pruned (cleared) before being popped by the deduplication


  81 
  82   // Blocks and waits for the queue to become non-empty.
  83   static void wait();
  84 
  85   // Wakes up any thread blocked waiting for the queue to become non-empty.
  86   static void cancel_wait();
  87 
  88   // Pushes a deduplication candidate onto a specific GC worker queue.
  89   static void push(uint worker_id, oop java_string);
  90 
  91   // Pops a deduplication candidate from any queue, returns NULL if
  92   // all queues are empty.
  93   static oop pop();
  94 
  95   static void unlink_or_oops_do(G1StringDedupUnlinkOrOopsDoClosure* cl);
  96 
  97   static void print_statistics(outputStream* st);
  98   static void verify();
  99 };
 100 
 101 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPQUEUE_HPP
   1 /*
   2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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_GC_G1_G1STRINGDEDUPQUEUE_HPP
  26 #define SHARE_VM_GC_G1_G1STRINGDEDUPQUEUE_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "oops/oop.hpp"
  30 #include "utilities/stack.hpp"
  31 
  32 class G1StringDedupUnlinkOrOopsDoClosure;
  33 
  34 //
  35 // The deduplication queue acts as the communication channel between the stop-the-world
  36 // mark/evacuation phase and the concurrent deduplication phase. Deduplication candidates
  37 // found during mark/evacuation are placed on this queue for later processing in the
  38 // deduplication thread. A queue entry is an oop pointing to a String object (as opposed
  39 // to entries in the deduplication hashtable which points to character arrays).
  40 //
  41 // While users of the queue treat it as a single queue, it is implemented as a set of
  42 // queues, one queue per GC worker thread, to allow lock-free and cache-friendly enqueue
  43 // operations by the GC workers.
  44 //
  45 // The oops in the queue are treated as weak pointers, meaning the objects they point to
  46 // can become unreachable and pruned (cleared) before being popped by the deduplication


  81 
  82   // Blocks and waits for the queue to become non-empty.
  83   static void wait();
  84 
  85   // Wakes up any thread blocked waiting for the queue to become non-empty.
  86   static void cancel_wait();
  87 
  88   // Pushes a deduplication candidate onto a specific GC worker queue.
  89   static void push(uint worker_id, oop java_string);
  90 
  91   // Pops a deduplication candidate from any queue, returns NULL if
  92   // all queues are empty.
  93   static oop pop();
  94 
  95   static void unlink_or_oops_do(G1StringDedupUnlinkOrOopsDoClosure* cl);
  96 
  97   static void print_statistics(outputStream* st);
  98   static void verify();
  99 };
 100 
 101 #endif // SHARE_VM_GC_G1_G1STRINGDEDUPQUEUE_HPP
< prev index next >