6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHREFERENCEPROCESSOR_HPP
27 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHREFERENCEPROCESSOR_HPP
28
29 #include "gc/shared/referenceDiscoverer.hpp"
30 #include "gc/shared/referencePolicy.hpp"
31 #include "gc/shared/referenceProcessorStats.hpp"
32 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
33 #include "memory/allocation.hpp"
34
35 class ShenandoahMarkRefsSuperClosure;
36 class WorkerThreads;
37
38 static const size_t reference_type_count = REF_PHANTOM + 1;
39 typedef size_t Counters[reference_type_count];
40
41 /*
42 * Shenandoah concurrent reference processing
43 *
44 * Concurrent reference processing is made up of two main phases:
45 * 1. Concurrent reference marking: Discover all j.l.r.Reference objects and determine reachability of all live objects.
46 * 2. Concurrent reference processing: For all discoved j.l.r.References, determine whether to keep them alive or clean
47 * them. Also, clean and enqueue relevant references concurrently.
171
172 public:
173 ShenandoahReferenceProcessor(uint max_workers);
174
175 void reset_thread_locals();
176 void set_mark_closure(uint worker_id, ShenandoahMarkRefsSuperClosure* mark_closure);
177
178 void set_soft_reference_policy(bool clear);
179
180 bool discover_reference(oop obj, ReferenceType type) override;
181
182 void process_references(ShenandoahPhaseTimings::Phase phase, WorkerThreads* workers, bool concurrent);
183
184 const ReferenceProcessorStats& reference_process_stats() { return _stats; }
185
186 void work();
187
188 void abandon_partial_discovery();
189 };
190
191 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHREFERENCEPROCESSOR_HPP
|
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHREFERENCEPROCESSOR_HPP
27 #define SHARE_GC_SHENANDOAH_SHENANDOAHREFERENCEPROCESSOR_HPP
28
29 #include "gc/shared/referenceDiscoverer.hpp"
30 #include "gc/shared/referencePolicy.hpp"
31 #include "gc/shared/referenceProcessorStats.hpp"
32 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
33 #include "memory/allocation.hpp"
34
35 class ShenandoahMarkRefsSuperClosure;
36 class WorkerThreads;
37
38 static const size_t reference_type_count = REF_PHANTOM + 1;
39 typedef size_t Counters[reference_type_count];
40
41 /*
42 * Shenandoah concurrent reference processing
43 *
44 * Concurrent reference processing is made up of two main phases:
45 * 1. Concurrent reference marking: Discover all j.l.r.Reference objects and determine reachability of all live objects.
46 * 2. Concurrent reference processing: For all discoved j.l.r.References, determine whether to keep them alive or clean
47 * them. Also, clean and enqueue relevant references concurrently.
171
172 public:
173 ShenandoahReferenceProcessor(uint max_workers);
174
175 void reset_thread_locals();
176 void set_mark_closure(uint worker_id, ShenandoahMarkRefsSuperClosure* mark_closure);
177
178 void set_soft_reference_policy(bool clear);
179
180 bool discover_reference(oop obj, ReferenceType type) override;
181
182 void process_references(ShenandoahPhaseTimings::Phase phase, WorkerThreads* workers, bool concurrent);
183
184 const ReferenceProcessorStats& reference_process_stats() { return _stats; }
185
186 void work();
187
188 void abandon_partial_discovery();
189 };
190
191 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHREFERENCEPROCESSOR_HPP
|