1 /*
2 * Copyright (c) 2001, 2018, 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 *
102 bool atomic_discovery,
103 BoolObjectClosure* is_alive_non_header,
104 bool adjust_no_of_processing_threads) :
105 _is_subject_to_discovery(is_subject_to_discovery),
106 _discovering_refs(false),
107 _enqueuing_is_done(false),
108 _processing_is_mt(mt_processing),
109 _next_id(0),
110 _adjust_no_of_processing_threads(adjust_no_of_processing_threads),
111 _is_alive_non_header(is_alive_non_header)
112 {
113 assert(is_subject_to_discovery != NULL, "must be set");
114
115 _discovery_is_atomic = atomic_discovery;
116 _discovery_is_mt = mt_discovery;
117 _num_queues = MAX2(1U, mt_processing_degree);
118 _max_num_queues = MAX2(_num_queues, mt_discovery_degree);
119 _discovered_refs = NEW_C_HEAP_ARRAY(DiscoveredList,
120 _max_num_queues * number_of_subclasses_of_ref(), mtGC);
121
122 if (_discovered_refs == NULL) {
123 vm_exit_during_initialization("Could not allocated RefProc Array");
124 }
125 _discoveredSoftRefs = &_discovered_refs[0];
126 _discoveredWeakRefs = &_discoveredSoftRefs[_max_num_queues];
127 _discoveredFinalRefs = &_discoveredWeakRefs[_max_num_queues];
128 _discoveredPhantomRefs = &_discoveredFinalRefs[_max_num_queues];
129
130 // Initialize all entries to NULL
131 for (uint i = 0; i < _max_num_queues * number_of_subclasses_of_ref(); i++) {
132 _discovered_refs[i].clear();
133 }
134
135 setup_policy(false /* default soft ref policy */);
136 }
137
138 #ifndef PRODUCT
139 void ReferenceProcessor::verify_no_references_recorded() {
140 guarantee(!_discovering_refs, "Discovering refs?");
141 for (uint i = 0; i < _max_num_queues * number_of_subclasses_of_ref(); i++) {
142 guarantee(_discovered_refs[i].is_empty(),
143 "Found non-empty discovered list at %u", i);
144 }
|
1 /*
2 * Copyright (c) 2001, 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 *
102 bool atomic_discovery,
103 BoolObjectClosure* is_alive_non_header,
104 bool adjust_no_of_processing_threads) :
105 _is_subject_to_discovery(is_subject_to_discovery),
106 _discovering_refs(false),
107 _enqueuing_is_done(false),
108 _processing_is_mt(mt_processing),
109 _next_id(0),
110 _adjust_no_of_processing_threads(adjust_no_of_processing_threads),
111 _is_alive_non_header(is_alive_non_header)
112 {
113 assert(is_subject_to_discovery != NULL, "must be set");
114
115 _discovery_is_atomic = atomic_discovery;
116 _discovery_is_mt = mt_discovery;
117 _num_queues = MAX2(1U, mt_processing_degree);
118 _max_num_queues = MAX2(_num_queues, mt_discovery_degree);
119 _discovered_refs = NEW_C_HEAP_ARRAY(DiscoveredList,
120 _max_num_queues * number_of_subclasses_of_ref(), mtGC);
121
122 _discoveredSoftRefs = &_discovered_refs[0];
123 _discoveredWeakRefs = &_discoveredSoftRefs[_max_num_queues];
124 _discoveredFinalRefs = &_discoveredWeakRefs[_max_num_queues];
125 _discoveredPhantomRefs = &_discoveredFinalRefs[_max_num_queues];
126
127 // Initialize all entries to NULL
128 for (uint i = 0; i < _max_num_queues * number_of_subclasses_of_ref(); i++) {
129 _discovered_refs[i].clear();
130 }
131
132 setup_policy(false /* default soft ref policy */);
133 }
134
135 #ifndef PRODUCT
136 void ReferenceProcessor::verify_no_references_recorded() {
137 guarantee(!_discovering_refs, "Discovering refs?");
138 for (uint i = 0; i < _max_num_queues * number_of_subclasses_of_ref(); i++) {
139 guarantee(_discovered_refs[i].is_empty(),
140 "Found non-empty discovered list at %u", i);
141 }
|