< prev index next >

src/share/vm/gc/g1/g1CollectedHeap.cpp

Print this page




  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 
  25 #include "precompiled.hpp"
  26 #include "classfile/metadataOnStackMark.hpp"
  27 #include "classfile/stringTable.hpp"
  28 #include "classfile/symbolTable.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "code/icBuffer.hpp"
  31 #include "gc/g1/g1Analytics.hpp"
  32 #include "gc/g1/bufferingOopClosure.hpp"
  33 #include "gc/g1/concurrentG1Refine.hpp"
  34 #include "gc/g1/concurrentG1RefineThread.hpp"
  35 #include "gc/g1/concurrentMarkThread.inline.hpp"
  36 #include "gc/g1/g1Allocator.inline.hpp"
  37 #include "gc/g1/g1CollectedHeap.inline.hpp"
  38 #include "gc/g1/g1CollectionSet.hpp"
  39 #include "gc/g1/g1CollectorPolicy.hpp"
  40 #include "gc/g1/g1CollectorState.hpp"
  41 #include "gc/g1/g1EvacStats.inline.hpp"
  42 #include "gc/g1/g1GCPhaseTimes.hpp"
  43 #include "gc/g1/g1HeapSizingPolicy.hpp"
  44 #include "gc/g1/g1HeapTransition.hpp"
  45 #include "gc/g1/g1HeapVerifier.hpp"
  46 #include "gc/g1/g1HotCardCache.hpp"
  47 #include "gc/g1/g1MarkSweep.hpp"
  48 #include "gc/g1/g1OopClosures.inline.hpp"
  49 #include "gc/g1/g1ParScanThreadState.inline.hpp"
  50 #include "gc/g1/g1Policy.hpp"
  51 #include "gc/g1/g1RegionToSpaceMapper.hpp"


2457 size_t G1CollectedHeap::tlab_used(Thread* ignored) const {
2458   return _eden.length() * HeapRegion::GrainBytes;
2459 }
2460 
2461 // For G1 TLABs should not contain humongous objects, so the maximum TLAB size
2462 // must be equal to the humongous object limit.
2463 size_t G1CollectedHeap::max_tlab_size() const {
2464   return align_size_down(_humongous_object_threshold_in_words, MinObjAlignment);
2465 }
2466 
2467 size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const {
2468   AllocationContext_t context = AllocationContext::current();
2469   return _allocator->unsafe_max_tlab_alloc(context);
2470 }
2471 
2472 size_t G1CollectedHeap::max_capacity() const {
2473   return _hrm.reserved().byte_size();
2474 }
2475 
2476 jlong G1CollectedHeap::millis_since_last_gc() {
2477   jlong now = os::elapsed_counter() / NANOSECS_PER_MILLISEC;
2478   const G1Analytics* analytics = _g1_policy->analytics();
2479   double last = analytics->last_known_gc_end_time_sec();
2480   jlong ret_val = now - (last * 1000);
2481   if (ret_val < 0) {
2482     // See the notes in GenCollectedHeap::millis_since_last_gc()
2483     // for more information about the implementation.
2484     log_warning(gc)("Detected clock going backwards. "
2485       "Milliseconds since last GC would be " JLONG_FORMAT
2486       ". returning zero instead.", ret_val);
2487     return 0;
2488   }
2489   return ret_val;
2490 }
2491 
2492 void G1CollectedHeap::prepare_for_verify() {
2493   _verifier->prepare_for_verify();
2494 }
2495 
2496 void G1CollectedHeap::verify(VerifyOption vo) {
2497   _verifier->verify(vo);
2498 }
2499 
2500 class PrintRegionClosure: public HeapRegionClosure {
2501   outputStream* _st;
2502 public:
2503   PrintRegionClosure(outputStream* st) : _st(st) {}
2504   bool doHeapRegion(HeapRegion* r) {
2505     r->print_on(_st);
2506     return false;
2507   }
2508 };
2509 




  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 
  25 #include "precompiled.hpp"
  26 #include "classfile/metadataOnStackMark.hpp"
  27 #include "classfile/stringTable.hpp"
  28 #include "classfile/symbolTable.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "code/icBuffer.hpp"

  31 #include "gc/g1/bufferingOopClosure.hpp"
  32 #include "gc/g1/concurrentG1Refine.hpp"
  33 #include "gc/g1/concurrentG1RefineThread.hpp"
  34 #include "gc/g1/concurrentMarkThread.inline.hpp"
  35 #include "gc/g1/g1Allocator.inline.hpp"
  36 #include "gc/g1/g1CollectedHeap.inline.hpp"
  37 #include "gc/g1/g1CollectionSet.hpp"
  38 #include "gc/g1/g1CollectorPolicy.hpp"
  39 #include "gc/g1/g1CollectorState.hpp"
  40 #include "gc/g1/g1EvacStats.inline.hpp"
  41 #include "gc/g1/g1GCPhaseTimes.hpp"
  42 #include "gc/g1/g1HeapSizingPolicy.hpp"
  43 #include "gc/g1/g1HeapTransition.hpp"
  44 #include "gc/g1/g1HeapVerifier.hpp"
  45 #include "gc/g1/g1HotCardCache.hpp"
  46 #include "gc/g1/g1MarkSweep.hpp"
  47 #include "gc/g1/g1OopClosures.inline.hpp"
  48 #include "gc/g1/g1ParScanThreadState.inline.hpp"
  49 #include "gc/g1/g1Policy.hpp"
  50 #include "gc/g1/g1RegionToSpaceMapper.hpp"


2456 size_t G1CollectedHeap::tlab_used(Thread* ignored) const {
2457   return _eden.length() * HeapRegion::GrainBytes;
2458 }
2459 
2460 // For G1 TLABs should not contain humongous objects, so the maximum TLAB size
2461 // must be equal to the humongous object limit.
2462 size_t G1CollectedHeap::max_tlab_size() const {
2463   return align_size_down(_humongous_object_threshold_in_words, MinObjAlignment);
2464 }
2465 
2466 size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const {
2467   AllocationContext_t context = AllocationContext::current();
2468   return _allocator->unsafe_max_tlab_alloc(context);
2469 }
2470 
2471 size_t G1CollectedHeap::max_capacity() const {
2472   return _hrm.reserved().byte_size();
2473 }
2474 
2475 jlong G1CollectedHeap::millis_since_last_gc() {
2476   // assert(false, "NYI");
2477   return 0;











2478 }
2479 
2480 void G1CollectedHeap::prepare_for_verify() {
2481   _verifier->prepare_for_verify();
2482 }
2483 
2484 void G1CollectedHeap::verify(VerifyOption vo) {
2485   _verifier->verify(vo);
2486 }
2487 
2488 class PrintRegionClosure: public HeapRegionClosure {
2489   outputStream* _st;
2490 public:
2491   PrintRegionClosure(outputStream* st) : _st(st) {}
2492   bool doHeapRegion(HeapRegion* r) {
2493     r->print_on(_st);
2494     return false;
2495   }
2496 };
2497 


< prev index next >