1 /* |
1 /* |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
341 // (c) cause == _g1_humongous_allocation |
341 // (c) cause == _g1_humongous_allocation |
342 bool should_do_concurrent_full_gc(GCCause::Cause cause); |
342 bool should_do_concurrent_full_gc(GCCause::Cause cause); |
343 |
343 |
344 // Keeps track of how many "old marking cycles" (i.e., Full GCs or |
344 // Keeps track of how many "old marking cycles" (i.e., Full GCs or |
345 // concurrent cycles) we have started. |
345 // concurrent cycles) we have started. |
346 volatile unsigned int _old_marking_cycles_started; |
346 volatile uint _old_marking_cycles_started; |
347 |
347 |
348 // Keeps track of how many "old marking cycles" (i.e., Full GCs or |
348 // Keeps track of how many "old marking cycles" (i.e., Full GCs or |
349 // concurrent cycles) we have completed. |
349 // concurrent cycles) we have completed. |
350 volatile unsigned int _old_marking_cycles_completed; |
350 volatile uint _old_marking_cycles_completed; |
351 |
351 |
352 bool _concurrent_cycle_started; |
352 bool _concurrent_cycle_started; |
353 bool _heap_summary_sent; |
353 bool _heap_summary_sent; |
354 |
354 |
355 // This is a non-product method that is helpful for testing. It is |
355 // This is a non-product method that is helpful for testing. It is |
513 |
513 |
514 // First-level mutator allocation attempt: try to allocate out of |
514 // First-level mutator allocation attempt: try to allocate out of |
515 // the mutator alloc region without taking the Heap_lock. This |
515 // the mutator alloc region without taking the Heap_lock. This |
516 // should only be used for non-humongous allocations. |
516 // should only be used for non-humongous allocations. |
517 inline HeapWord* attempt_allocation(size_t word_size, |
517 inline HeapWord* attempt_allocation(size_t word_size, |
518 unsigned int* gc_count_before_ret, |
518 uint* gc_count_before_ret, |
519 int* gclocker_retry_count_ret); |
519 uint* gclocker_retry_count_ret); |
520 |
520 |
521 // Second-level mutator allocation attempt: take the Heap_lock and |
521 // Second-level mutator allocation attempt: take the Heap_lock and |
522 // retry the allocation attempt, potentially scheduling a GC |
522 // retry the allocation attempt, potentially scheduling a GC |
523 // pause. This should only be used for non-humongous allocations. |
523 // pause. This should only be used for non-humongous allocations. |
524 HeapWord* attempt_allocation_slow(size_t word_size, |
524 HeapWord* attempt_allocation_slow(size_t word_size, |
525 AllocationContext_t context, |
525 AllocationContext_t context, |
526 unsigned int* gc_count_before_ret, |
526 uint* gc_count_before_ret, |
527 int* gclocker_retry_count_ret); |
527 uint* gclocker_retry_count_ret); |
528 |
528 |
529 // Takes the Heap_lock and attempts a humongous allocation. It can |
529 // Takes the Heap_lock and attempts a humongous allocation. It can |
530 // potentially schedule a GC pause. |
530 // potentially schedule a GC pause. |
531 HeapWord* attempt_allocation_humongous(size_t word_size, |
531 HeapWord* attempt_allocation_humongous(size_t word_size, |
532 unsigned int* gc_count_before_ret, |
532 uint* gc_count_before_ret, |
533 int* gclocker_retry_count_ret); |
533 uint* gclocker_retry_count_ret); |
534 |
534 |
535 // Allocation attempt that should be called during safepoints (e.g., |
535 // Allocation attempt that should be called during safepoints (e.g., |
536 // at the end of a successful GC). expect_null_mutator_alloc_region |
536 // at the end of a successful GC). expect_null_mutator_alloc_region |
537 // specifies whether the mutator alloc region is expected to be NULL |
537 // specifies whether the mutator alloc region is expected to be NULL |
538 // or not. |
538 // or not. |
699 // the FullGCCount_lock in case a Java thread is waiting for a full |
699 // the FullGCCount_lock in case a Java thread is waiting for a full |
700 // GC to happen (e.g., it called System.gc() with |
700 // GC to happen (e.g., it called System.gc() with |
701 // +ExplicitGCInvokesConcurrent). |
701 // +ExplicitGCInvokesConcurrent). |
702 void increment_old_marking_cycles_completed(bool concurrent); |
702 void increment_old_marking_cycles_completed(bool concurrent); |
703 |
703 |
704 unsigned int old_marking_cycles_completed() { |
704 uint old_marking_cycles_completed() { |
705 return _old_marking_cycles_completed; |
705 return _old_marking_cycles_completed; |
706 } |
706 } |
707 |
707 |
708 void register_concurrent_cycle_start(const Ticks& start_time); |
708 void register_concurrent_cycle_start(const Ticks& start_time); |
709 void register_concurrent_cycle_end(); |
709 void register_concurrent_cycle_end(); |
758 // gc_count_before (i.e., total_collections()) as a parameter since |
758 // gc_count_before (i.e., total_collections()) as a parameter since |
759 // it has to be read while holding the Heap_lock. Currently, both |
759 // it has to be read while holding the Heap_lock. Currently, both |
760 // methods that call do_collection_pause() release the Heap_lock |
760 // methods that call do_collection_pause() release the Heap_lock |
761 // before the call, so it's easy to read gc_count_before just before. |
761 // before the call, so it's easy to read gc_count_before just before. |
762 HeapWord* do_collection_pause(size_t word_size, |
762 HeapWord* do_collection_pause(size_t word_size, |
763 unsigned int gc_count_before, |
763 uint gc_count_before, |
764 bool* succeeded, |
764 bool* succeeded, |
765 GCCause::Cause gc_cause); |
765 GCCause::Cause gc_cause); |
766 |
766 |
767 // The guts of the incremental collection pause, executed by the vm |
767 // The guts of the incremental collection pause, executed by the vm |
768 // thread. It returns false if it is unable to do the collection due |
768 // thread. It returns false if it is unable to do the collection due |
981 // Time stamp to validate the regions recorded in the cache |
981 // Time stamp to validate the regions recorded in the cache |
982 // used by G1CollectedHeap::start_cset_region_for_worker(). |
982 // used by G1CollectedHeap::start_cset_region_for_worker(). |
983 // The heap region entry for a given worker is valid iff |
983 // The heap region entry for a given worker is valid iff |
984 // the associated time stamp value matches the current value |
984 // the associated time stamp value matches the current value |
985 // of G1CollectedHeap::_gc_time_stamp. |
985 // of G1CollectedHeap::_gc_time_stamp. |
986 unsigned int* _worker_cset_start_region_time_stamp; |
986 uint* _worker_cset_start_region_time_stamp; |
987 |
987 |
988 volatile bool _free_regions_coming; |
988 volatile bool _free_regions_coming; |
989 |
989 |
990 public: |
990 public: |
991 |
991 |