author | coleenp |
Thu, 10 Jan 2019 15:13:51 -0500 | |
changeset 53244 | 9807daeb47c4 |
parent 50574 | fa727a4d7934 |
child 53536 | 482109fae02b |
permissions | -rw-r--r-- |
23472 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50574
diff
changeset
|
2 |
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. |
23472 | 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 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50574
diff
changeset
|
25 |
#ifndef SHARE_GC_G1_G1STRINGDEDUP_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50574
diff
changeset
|
26 |
#define SHARE_GC_G1_G1STRINGDEDUP_HPP |
23472 | 27 |
|
28 |
// |
|
50574 | 29 |
// G1 string deduplication candidate selection |
23472 | 30 |
// |
31 |
// An object is considered a deduplication candidate if all of the following |
|
32 |
// statements are true: |
|
33 |
// |
|
34 |
// - The object is an instance of java.lang.String |
|
35 |
// |
|
36 |
// - The object is being evacuated from a young heap region |
|
37 |
// |
|
38 |
// - The object is being evacuated to a young/survivor heap region and the |
|
39 |
// object's age is equal to the deduplication age threshold |
|
40 |
// |
|
41 |
// or |
|
42 |
// |
|
43 |
// The object is being evacuated to an old heap region and the object's age is |
|
44 |
// less than the deduplication age threshold |
|
45 |
// |
|
46 |
// Once an string object has been promoted to an old region, or its age is higher |
|
47 |
// than the deduplication age threshold, is will never become a candidate again. |
|
48 |
// This approach avoids making the same object a candidate more than once. |
|
49 |
// |
|
50 |
||
50574 | 51 |
#include "gc/shared/stringdedup/stringDedup.hpp" |
23472 | 52 |
#include "memory/allocation.hpp" |
53 |
#include "oops/oop.hpp" |
|
54 |
||
55 |
class OopClosure; |
|
56 |
class BoolObjectClosure; |
|
50574 | 57 |
class G1GCPhaseTimes; |
46348
5803de68c14d
8171238: Unify cleanup code used in G1 Remark and Full GC marking
sjohanss
parents:
40655
diff
changeset
|
58 |
class G1StringDedupUnlinkOrOopsDoClosure; |
23472 | 59 |
|
60 |
// |
|
50574 | 61 |
// G1 interface for interacting with string deduplication. |
23472 | 62 |
// |
50574 | 63 |
class G1StringDedup : public StringDedup { |
23472 | 64 |
private: |
65 |
||
66 |
// Candidate selection policies, returns true if the given object is |
|
67 |
// candidate for string deduplication. |
|
68 |
static bool is_candidate_from_mark(oop obj); |
|
69 |
static bool is_candidate_from_evacuation(bool from_young, bool to_young, oop obj); |
|
70 |
||
71 |
public: |
|
24093
095cc0a63ed9
8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
pliden
parents:
23472
diff
changeset
|
72 |
// Initialize string deduplication. |
23472 | 73 |
static void initialize(); |
74 |
||
75 |
// Enqueues a deduplication candidate for later processing by the deduplication |
|
76 |
// thread. Before enqueuing, these functions apply the appropriate candidate |
|
77 |
// selection policy to filters out non-candidates. |
|
47885
5caa1d5f74c1
8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
47216
diff
changeset
|
78 |
static void enqueue_from_mark(oop java_string, uint worker_id); |
23472 | 79 |
static void enqueue_from_evacuation(bool from_young, bool to_young, |
80 |
unsigned int queue, oop java_string); |
|
81 |
||
82 |
static void oops_do(OopClosure* keep_alive); |
|
46348
5803de68c14d
8171238: Unify cleanup code used in G1 Remark and Full GC marking
sjohanss
parents:
40655
diff
changeset
|
83 |
static void parallel_unlink(G1StringDedupUnlinkOrOopsDoClosure* unlink, uint worker_id); |
23472 | 84 |
static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, |
29680
e5203ed6d805
8074037: Refactor the G1GCPhaseTime logging to make it easier to add new phases
brutisso
parents:
25351
diff
changeset
|
85 |
bool allow_resize_and_rehash, G1GCPhaseTimes* phase_times = NULL); |
23472 | 86 |
}; |
87 |
||
88 |
// |
|
89 |
// This closure encapsulates the state and the closures needed when scanning |
|
90 |
// the deduplication queue and table during the unlink_or_oops_do() operation. |
|
91 |
// A single instance of this closure is created and then shared by all worker |
|
50574 | 92 |
// threads participating in the scan. |
23472 | 93 |
// |
50574 | 94 |
class G1StringDedupUnlinkOrOopsDoClosure : public StringDedupUnlinkOrOopsDoClosure { |
23472 | 95 |
public: |
96 |
G1StringDedupUnlinkOrOopsDoClosure(BoolObjectClosure* is_alive, |
|
97 |
OopClosure* keep_alive, |
|
50574 | 98 |
bool allow_resize_and_rehash) : |
99 |
StringDedupUnlinkOrOopsDoClosure(is_alive, keep_alive) { |
|
100 |
if (G1StringDedup::is_enabled()) { |
|
101 |
G1StringDedup::gc_prologue(allow_resize_and_rehash); |
|
102 |
} |
|
103 |
} |
|
23472 | 104 |
|
50574 | 105 |
~G1StringDedupUnlinkOrOopsDoClosure() { |
106 |
if (G1StringDedup::is_enabled()) { |
|
107 |
G1StringDedup::gc_epilogue(); |
|
23472 | 108 |
} |
109 |
} |
|
110 |
}; |
|
111 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50574
diff
changeset
|
112 |
#endif // SHARE_GC_G1_G1STRINGDEDUP_HPP |