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 #include "gc/shared/gcHeapSummary.hpp"
26 #include "gc/shared/suspendibleThreadSet.hpp"
27 #include "gc/z/zCollectedHeap.hpp"
28 #include "gc/z/zGlobals.hpp"
29 #include "gc/z/zHeap.inline.hpp"
30 #include "gc/z/zNMethodTable.hpp"
31 #include "gc/z/zServiceability.hpp"
32 #include "gc/z/zStat.hpp"
33 #include "gc/z/zUtils.inline.hpp"
34 #include "runtime/mutexLocker.hpp"
35
36 ZCollectedHeap* ZCollectedHeap::heap() {
37 CollectedHeap* heap = Universe::heap();
38 assert(heap != NULL, "Uninitialized access to ZCollectedHeap::heap()");
39 assert(heap->kind() == CollectedHeap::Z, "Invalid name");
40 return (ZCollectedHeap*)heap;
41 }
42
43 ZCollectedHeap::ZCollectedHeap(ZCollectorPolicy* policy) :
44 _collector_policy(policy),
45 _soft_ref_policy(),
46 _barrier_set(),
47 _initialize(&_barrier_set),
48 _heap(),
49 _director(new ZDirector()),
50 _driver(new ZDriver()),
238 }
239
240 void ZCollectedHeap::safe_object_iterate(ObjectClosure* cl) {
241 _heap.object_iterate(cl, true /* visit_referents */);
242 }
243
244 HeapWord* ZCollectedHeap::block_start(const void* addr) const {
245 return (HeapWord*)_heap.block_start((uintptr_t)addr);
246 }
247
248 size_t ZCollectedHeap::block_size(const HeapWord* addr) const {
249 size_t size_in_bytes = _heap.block_size((uintptr_t)addr);
250 return ZUtils::bytes_to_words(size_in_bytes);
251 }
252
253 bool ZCollectedHeap::block_is_obj(const HeapWord* addr) const {
254 return _heap.block_is_obj((uintptr_t)addr);
255 }
256
257 void ZCollectedHeap::register_nmethod(nmethod* nm) {
258 ZNMethodTable::register_nmethod(nm);
259 }
260
261 void ZCollectedHeap::unregister_nmethod(nmethod* nm) {
262 ZNMethodTable::unregister_nmethod(nm);
263 }
264
265 void ZCollectedHeap::verify_nmethod(nmethod* nm) {
266 // Does nothing
267 }
268
269 WorkGang* ZCollectedHeap::get_safepoint_workers() {
270 return _runtime_workers.workers();
271 }
272
273 jlong ZCollectedHeap::millis_since_last_gc() {
274 return ZStatCycle::time_since_last() / MILLIUNITS;
275 }
276
277 void ZCollectedHeap::gc_threads_do(ThreadClosure* tc) const {
278 tc->do_thread(_director);
279 tc->do_thread(_driver);
280 tc->do_thread(_stat);
281 _heap.worker_threads_do(tc);
282 _runtime_workers.threads_do(tc);
|
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 #include "gc/shared/gcHeapSummary.hpp"
26 #include "gc/shared/suspendibleThreadSet.hpp"
27 #include "gc/z/zCollectedHeap.hpp"
28 #include "gc/z/zGlobals.hpp"
29 #include "gc/z/zHeap.inline.hpp"
30 #include "gc/z/zNMethod.hpp"
31 #include "gc/z/zServiceability.hpp"
32 #include "gc/z/zStat.hpp"
33 #include "gc/z/zUtils.inline.hpp"
34 #include "runtime/mutexLocker.hpp"
35
36 ZCollectedHeap* ZCollectedHeap::heap() {
37 CollectedHeap* heap = Universe::heap();
38 assert(heap != NULL, "Uninitialized access to ZCollectedHeap::heap()");
39 assert(heap->kind() == CollectedHeap::Z, "Invalid name");
40 return (ZCollectedHeap*)heap;
41 }
42
43 ZCollectedHeap::ZCollectedHeap(ZCollectorPolicy* policy) :
44 _collector_policy(policy),
45 _soft_ref_policy(),
46 _barrier_set(),
47 _initialize(&_barrier_set),
48 _heap(),
49 _director(new ZDirector()),
50 _driver(new ZDriver()),
238 }
239
240 void ZCollectedHeap::safe_object_iterate(ObjectClosure* cl) {
241 _heap.object_iterate(cl, true /* visit_referents */);
242 }
243
244 HeapWord* ZCollectedHeap::block_start(const void* addr) const {
245 return (HeapWord*)_heap.block_start((uintptr_t)addr);
246 }
247
248 size_t ZCollectedHeap::block_size(const HeapWord* addr) const {
249 size_t size_in_bytes = _heap.block_size((uintptr_t)addr);
250 return ZUtils::bytes_to_words(size_in_bytes);
251 }
252
253 bool ZCollectedHeap::block_is_obj(const HeapWord* addr) const {
254 return _heap.block_is_obj((uintptr_t)addr);
255 }
256
257 void ZCollectedHeap::register_nmethod(nmethod* nm) {
258 ZNMethod::register_nmethod(nm);
259 }
260
261 void ZCollectedHeap::unregister_nmethod(nmethod* nm) {
262 ZNMethod::unregister_nmethod(nm);
263 }
264
265 void ZCollectedHeap::verify_nmethod(nmethod* nm) {
266 // Does nothing
267 }
268
269 WorkGang* ZCollectedHeap::get_safepoint_workers() {
270 return _runtime_workers.workers();
271 }
272
273 jlong ZCollectedHeap::millis_since_last_gc() {
274 return ZStatCycle::time_since_last() / MILLIUNITS;
275 }
276
277 void ZCollectedHeap::gc_threads_do(ThreadClosure* tc) const {
278 tc->do_thread(_director);
279 tc->do_thread(_driver);
280 tc->do_thread(_stat);
281 _heap.worker_threads_do(tc);
282 _runtime_workers.threads_do(tc);
|