1 /*
2 * Copyright (c) 2001, 2016, 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 *
2476
2477 jlong G1CollectedHeap::millis_since_last_gc() {
2478 // See the notes in GenCollectedHeap::millis_since_last_gc()
2479 // for more information about the implementation.
2480 jlong ret_val = (os::javaTimeNanos() / NANOSECS_PER_MILLISEC) -
2481 _g1_policy->collection_pause_end_millis();
2482 if (ret_val < 0) {
2483 log_warning(gc)("millis_since_last_gc() would return : " JLONG_FORMAT
2484 ". returning zero instead.", ret_val);
2485 return 0;
2486 }
2487 return ret_val;
2488 }
2489
2490 void G1CollectedHeap::prepare_for_verify() {
2491 _verifier->prepare_for_verify();
2492 }
2493
2494 void G1CollectedHeap::verify(VerifyOption vo) {
2495 _verifier->verify(vo);
2496 }
2497
2498 class PrintRegionClosure: public HeapRegionClosure {
2499 outputStream* _st;
2500 public:
2501 PrintRegionClosure(outputStream* st) : _st(st) {}
2502 bool doHeapRegion(HeapRegion* r) {
2503 r->print_on(_st);
2504 return false;
2505 }
2506 };
2507
2508 bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
2509 const HeapRegion* hr,
2510 const VerifyOption vo) const {
2511 switch (vo) {
2512 case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj, hr);
2513 case VerifyOption_G1UseNextMarking: return is_obj_ill(obj, hr);
2514 case VerifyOption_G1UseMarkWord: return !obj->is_gc_marked() && !hr->is_archive();
2515 default: ShouldNotReachHere();
|
1 /*
2 * Copyright (c) 2001, 2017, 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 *
2476
2477 jlong G1CollectedHeap::millis_since_last_gc() {
2478 // See the notes in GenCollectedHeap::millis_since_last_gc()
2479 // for more information about the implementation.
2480 jlong ret_val = (os::javaTimeNanos() / NANOSECS_PER_MILLISEC) -
2481 _g1_policy->collection_pause_end_millis();
2482 if (ret_val < 0) {
2483 log_warning(gc)("millis_since_last_gc() would return : " JLONG_FORMAT
2484 ". returning zero instead.", ret_val);
2485 return 0;
2486 }
2487 return ret_val;
2488 }
2489
2490 void G1CollectedHeap::prepare_for_verify() {
2491 _verifier->prepare_for_verify();
2492 }
2493
2494 void G1CollectedHeap::verify(VerifyOption vo) {
2495 _verifier->verify(vo);
2496 }
2497
2498 bool G1CollectedHeap::supports_concurrent_phase_control() const {
2499 return true;
2500 }
2501
2502 const char* const* G1CollectedHeap::concurrent_phases() const {
2503 return _cmThread->concurrent_phases();
2504 }
2505
2506 bool G1CollectedHeap::request_concurrent_phase(const char* phase) {
2507 return _cmThread->request_concurrent_phase(phase);
2508 }
2509
2510 class PrintRegionClosure: public HeapRegionClosure {
2511 outputStream* _st;
2512 public:
2513 PrintRegionClosure(outputStream* st) : _st(st) {}
2514 bool doHeapRegion(HeapRegion* r) {
2515 r->print_on(_st);
2516 return false;
2517 }
2518 };
2519
2520 bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
2521 const HeapRegion* hr,
2522 const VerifyOption vo) const {
2523 switch (vo) {
2524 case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj, hr);
2525 case VerifyOption_G1UseNextMarking: return is_obj_ill(obj, hr);
2526 case VerifyOption_G1UseMarkWord: return !obj->is_gc_marked() && !hr->is_archive();
2527 default: ShouldNotReachHere();
|