1 /*
2 * Copyright (c) 2017, 2018, Red Hat, Inc. and/or its affiliates.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25
26 #include "classfile/altHashing.hpp"
27 #include "gc_implementation/shenandoah/brooksPointer.hpp"
28 #include "gc_implementation/shenandoah/shenandoahCollectionSet.hpp"
29 #include "gc_implementation/shenandoah/shenandoahCollectionSet.inline.hpp"
30 #include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"
31 #include "gc_implementation/shenandoah/shenandoahMarkingContext.inline.hpp"
32 #include "gc_implementation/shenandoah/shenandoahStrDedupQueue.inline.hpp"
33 #include "gc_implementation/shenandoah/shenandoahStrDedupTable.hpp"
34 #include "gc_implementation/shenandoah/shenandoahStrDedupThread.hpp"
35 #include "gc_implementation/shenandoah/shenandoahStringDedup.hpp"
36 #include "gc_implementation/shenandoah/shenandoahUtils.hpp"
37 #include "runtime/os.hpp"
38 #include "utilities/workgroup.hpp"
39
40 ShenandoahStrDedupQueueSet* ShenandoahStringDedup::_queues = NULL;
41 ShenandoahStrDedupTable* ShenandoahStringDedup::_table = NULL;
42 ShenandoahStrDedupThread* ShenandoahStringDedup::_thread = NULL;
43 ShenandoahStrDedupStats ShenandoahStringDedup::_stats;
44 bool ShenandoahStringDedup::_enabled = false;
45
46 void ShenandoahStringDedup::initialize() {
47 if (UseStringDeduplication) {
48 _queues = new ShenandoahStrDedupQueueSet(ShenandoahHeap::heap()->max_workers());
49 _table = new ShenandoahStrDedupTable();
50 _thread = new ShenandoahStrDedupThread(_queues);
51 _enabled = true;
52 }
53 }
54
55 /* Enqueue candidates for deduplication.
91 }
92 }
93 return deduped;
94 }
95
96 ShenandoahStrDedupQueue* ShenandoahStringDedup::queue(uint worker_id) {
97 assert(_queues != NULL, "QueueSet not initialized");
98 return _queues->queue_at(worker_id);
99 }
100
101 void ShenandoahStringDedup::threads_do(ThreadClosure* tc) {
102 assert(_thread != NULL, "Shenandoah Dedup Thread not initialized");
103 tc->do_thread(_thread);
104 }
105
106 void ShenandoahStringDedup::parallel_oops_do(OopClosure* cl) {
107 _queues->parallel_oops_do(cl);
108 _table->parallel_oops_do(cl);
109 _thread->parallel_oops_do(cl);
110 }
111
112
113 void ShenandoahStringDedup::oops_do_slow(OopClosure* cl) {
114 _queues->oops_do_slow(cl);
115 _table->oops_do_slow(cl);
116 _thread->oops_do_slow(cl);
117 }
118
119 class ShenandoahStrDedupCleanupTask : public AbstractGangTask {
120 private:
121 ShenandoahStrDedupQueueSet* _queues;
122 ShenandoahStrDedupThread* _thread;
123 ShenandoahStrDedupTable** _table;
124 ShenandoahStrDedupTable* _dest_table;
125
126 ShenandoahStrDedupTableCleanupTask* _dedup_table_cleanup_task;
127
128 public:
129 ShenandoahStrDedupCleanupTask(ShenandoahStrDedupQueueSet* qset,
130 ShenandoahStrDedupThread* thread, ShenandoahStrDedupTable** table)
131 : AbstractGangTask("Shenandoah dedup cleanup task"),
|
1 /*
2 * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25
26 #include "classfile/altHashing.hpp"
27 #include "gc_implementation/shenandoah/shenandoahBrooksPointer.hpp"
28 #include "gc_implementation/shenandoah/shenandoahCollectionSet.hpp"
29 #include "gc_implementation/shenandoah/shenandoahCollectionSet.inline.hpp"
30 #include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"
31 #include "gc_implementation/shenandoah/shenandoahMarkingContext.inline.hpp"
32 #include "gc_implementation/shenandoah/shenandoahStrDedupQueue.inline.hpp"
33 #include "gc_implementation/shenandoah/shenandoahStrDedupTable.hpp"
34 #include "gc_implementation/shenandoah/shenandoahStrDedupThread.hpp"
35 #include "gc_implementation/shenandoah/shenandoahStringDedup.hpp"
36 #include "gc_implementation/shenandoah/shenandoahTimingTracker.hpp"
37 #include "gc_implementation/shenandoah/shenandoahWorkGroup.hpp"
38 #include "gc_implementation/shenandoah/shenandoahUtils.hpp"
39 #include "runtime/os.hpp"
40 #include "utilities/workgroup.hpp"
41
42 ShenandoahStrDedupQueueSet* ShenandoahStringDedup::_queues = NULL;
43 ShenandoahStrDedupTable* ShenandoahStringDedup::_table = NULL;
44 ShenandoahStrDedupThread* ShenandoahStringDedup::_thread = NULL;
45 ShenandoahStrDedupStats ShenandoahStringDedup::_stats;
46 bool ShenandoahStringDedup::_enabled = false;
47
48 void ShenandoahStringDedup::initialize() {
49 if (UseStringDeduplication) {
50 _queues = new ShenandoahStrDedupQueueSet(ShenandoahHeap::heap()->max_workers());
51 _table = new ShenandoahStrDedupTable();
52 _thread = new ShenandoahStrDedupThread(_queues);
53 _enabled = true;
54 }
55 }
56
57 /* Enqueue candidates for deduplication.
93 }
94 }
95 return deduped;
96 }
97
98 ShenandoahStrDedupQueue* ShenandoahStringDedup::queue(uint worker_id) {
99 assert(_queues != NULL, "QueueSet not initialized");
100 return _queues->queue_at(worker_id);
101 }
102
103 void ShenandoahStringDedup::threads_do(ThreadClosure* tc) {
104 assert(_thread != NULL, "Shenandoah Dedup Thread not initialized");
105 tc->do_thread(_thread);
106 }
107
108 void ShenandoahStringDedup::parallel_oops_do(OopClosure* cl) {
109 _queues->parallel_oops_do(cl);
110 _table->parallel_oops_do(cl);
111 _thread->parallel_oops_do(cl);
112 }
113
114 void ShenandoahStringDedup::oops_do_slow(OopClosure* cl) {
115 _queues->oops_do_slow(cl);
116 _table->oops_do_slow(cl);
117 _thread->oops_do_slow(cl);
118 }
119
120 class ShenandoahStrDedupCleanupTask : public AbstractGangTask {
121 private:
122 ShenandoahStrDedupQueueSet* _queues;
123 ShenandoahStrDedupThread* _thread;
124 ShenandoahStrDedupTable** _table;
125 ShenandoahStrDedupTable* _dest_table;
126
127 ShenandoahStrDedupTableCleanupTask* _dedup_table_cleanup_task;
128
129 public:
130 ShenandoahStrDedupCleanupTask(ShenandoahStrDedupQueueSet* qset,
131 ShenandoahStrDedupThread* thread, ShenandoahStrDedupTable** table)
132 : AbstractGangTask("Shenandoah dedup cleanup task"),
|