annotate src/share/vm/gc_implementation/g1/g1StringDedupQueue.hpp @ 20504:6948da6d7c13

8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set Summary: Remove -XX:-G1DeferredRSUpdate functionality as it is racy. During evacuation failure handling, threads where evacuation failure handling occurred may try to add remembered sets to regions which remembered sets are currently being scanned. The iterator to handle the remembered set scan does not support addition of entries during scan and so may skip valid references. Reviewed-by: iveresov, brutisso, mgerdin
author tschatzl
date Tue, 30 Sep 2014 09:44:36 +0200
parents 1772223a25a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
1 /*
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
4 *
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
7 * published by the Free Software Foundation.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
8 *
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
13 * accompanied this code).
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
14 *
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
18 *
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
21 * questions.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
22 *
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
23 */
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
24
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPQUEUE_HPP
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPQUEUE_HPP
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
27
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
28 #include "memory/allocation.hpp"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
29 #include "oops/oop.hpp"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
30 #include "utilities/stack.hpp"
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
31
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
32 class G1StringDedupUnlinkOrOopsDoClosure;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
33
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
34 //
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
35 // The deduplication queue acts as the communication channel between the stop-the-world
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
36 // mark/evacuation phase and the concurrent deduplication phase. Deduplication candidates
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
37 // found during mark/evacuation are placed on this queue for later processing in the
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
38 // deduplication thread. A queue entry is an oop pointing to a String object (as opposed
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
39 // to entries in the deduplication hashtable which points to character arrays).
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
40 //
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
41 // While users of the queue treat it as a single queue, it is implemented as a set of
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
42 // queues, one queue per GC worker thread, to allow lock-free and cache-friendly enqueue
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
43 // operations by the GC workers.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
44 //
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
45 // The oops in the queue are treated as weak pointers, meaning the objects they point to
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
46 // can become unreachable and pruned (cleared) before being popped by the deduplication
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
47 // thread.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
48 //
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
49 // Pushing to the queue is thread safe (this relies on each thread using a unique worker
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
50 // id), but only allowed during a safepoint. Popping from the queue is NOT thread safe
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
51 // and can only be done by the deduplication thread outside a safepoint.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
52 //
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
53 // The StringDedupQueue_lock is only used for blocking and waking up the deduplication
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
54 // thread in case the queue is empty or becomes non-empty, respectively. This lock does
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
55 // not otherwise protect the queue content.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
56 //
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
57 class G1StringDedupQueue : public CHeapObj<mtGC> {
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
58 private:
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
59 typedef Stack<oop, mtGC> G1StringDedupWorkerQueue;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
60
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
61 static G1StringDedupQueue* _queue;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
62 static const size_t _max_size;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
63 static const size_t _max_cache_size;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
64
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
65 G1StringDedupWorkerQueue* _queues;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
66 size_t _nqueues;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
67 size_t _cursor;
17947
1772223a25a2 8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents: 17764
diff changeset
68 bool _cancel;
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
69 volatile bool _empty;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
70
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
71 // Statistics counter, only used for logging.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
72 uintx _dropped;
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
73
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
74 G1StringDedupQueue();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
75 ~G1StringDedupQueue();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
76
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
77 static void unlink_or_oops_do(G1StringDedupUnlinkOrOopsDoClosure* cl, size_t queue);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
78
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
79 public:
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
80 static void create();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
81
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
82 // Blocks and waits for the queue to become non-empty.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
83 static void wait();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
84
17947
1772223a25a2 8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents: 17764
diff changeset
85 // Wakes up any thread blocked waiting for the queue to become non-empty.
1772223a25a2 8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents: 17764
diff changeset
86 static void cancel_wait();
1772223a25a2 8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents: 17764
diff changeset
87
17764
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
88 // Pushes a deduplication candidate onto a specific GC worker queue.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
89 static void push(uint worker_id, oop java_string);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
90
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
91 // Pops a deduplication candidate from any queue, returns NULL if
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
92 // all queues are empty.
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
93 static oop pop();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
94
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
95 static void unlink_or_oops_do(G1StringDedupUnlinkOrOopsDoClosure* cl);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
96
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
97 static void print_statistics(outputStream* st);
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
98 static void verify();
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
99 };
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
100
595c0f60d50d 8029075: String deduplication in G1
pliden
parents:
diff changeset
101 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPQUEUE_HPP