rev 57156 : imported patch 8234796-v3
1 /*
2 * Copyright (c) 2014, 2019, 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 #include "precompiled.hpp"
25
26 #include "gc/shared/stringdedup/stringDedup.hpp"
27 #include "gc/shared/stringdedup/stringDedupQueue.hpp"
28 #include "gc/shared/stringdedup/stringDedupTable.hpp"
29 #include "gc/shared/stringdedup/stringDedupThread.hpp"
30 #include "memory/iterator.hpp"
31
32 bool StringDedup::_enabled = false;
33
34 void StringDedup::gc_prologue(bool resize_and_rehash_table) {
35 assert(is_enabled(), "String deduplication not enabled");
36 StringDedupQueue::gc_prologue();
37 StringDedupTable::gc_prologue(resize_and_rehash_table);
38
39 }
40 void StringDedup::gc_epilogue() {
41 assert(is_enabled(), "String deduplication not enabled");
42 StringDedupQueue::gc_epilogue();
43 StringDedupTable::gc_epilogue();
44 }
45
46 void StringDedup::stop() {
47 assert(is_enabled(), "String deduplication not enabled");
48 StringDedupThread::thread()->stop();
49 }
50
51 void StringDedup::deduplicate(oop java_string) {
52 assert(is_enabled(), "String deduplication not enabled");
53 StringDedupStat dummy; // Statistics from this path is never used
54 StringDedupTable::deduplicate(java_string, &dummy);
55 }
56
57 void StringDedup::parallel_unlink(StringDedupUnlinkOrOopsDoClosure* unlink, uint worker_id) {
58 assert(is_enabled(), "String deduplication not enabled");
59 StringDedupQueue::unlink_or_oops_do(unlink);
60 StringDedupTable::unlink_or_oops_do(unlink, worker_id);
61 }
62
63 void StringDedup::threads_do(ThreadClosure* tc) {
64 assert(is_enabled(), "String deduplication not enabled");
65 tc->do_thread(StringDedupThread::thread());
66 }
67
68 void StringDedup::print_worker_threads_on(outputStream* st) {
69 assert(is_enabled(), "String deduplication not enabled");
70 StringDedupThread::thread()->print_on(st);
71 st->cr();
72 }
73
74 void StringDedup::verify() {
75 assert(is_enabled(), "String deduplication not enabled");
76 StringDedupQueue::verify();
77 StringDedupTable::verify();
78 }
79
80
81 StringDedupUnlinkOrOopsDoClosure::StringDedupUnlinkOrOopsDoClosure(BoolObjectClosure* is_alive,
82 OopClosure* keep_alive) :
83 _always_true(),
84 _do_nothing(),
85 _is_alive(is_alive != NULL ? is_alive : &_always_true),
86 _keep_alive(keep_alive != NULL ? keep_alive : &_do_nothing) {
87 }
--- EOF ---