annotate src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents bb847e31b836
children 631f79e71e90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
4 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
7 * published by the Free Software Foundation.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
8 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
13 * accompanied this code).
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
14 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 752
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 752
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 752
diff changeset
21 * questions.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
22 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
23 */
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
28 #include "gc_implementation/g1/concurrentMark.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
30 #include "gc_implementation/g1/heapRegionSeq.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
31 #include "utilities/taskqueue.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
32
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
33 // Inline functions for G1CollectedHeap
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
34
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
35 inline HeapRegion*
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
36 G1CollectedHeap::heap_region_containing(const void* addr) const {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
37 HeapRegion* hr = _hrs->addr_to_region(addr);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
38 // hr can be null if addr in perm_gen
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
39 if (hr != NULL && hr->continuesHumongous()) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
40 hr = hr->humongous_start_region();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
41 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
42 return hr;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
43 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
44
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
45 inline HeapRegion*
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
46 G1CollectedHeap::heap_region_containing_raw(const void* addr) const {
526
818efdefcc99 6484956: G1: improve evacuation pause efficiency
tonyp
parents: 342
diff changeset
47 assert(_g1_reserved.contains(addr), "invariant");
752
a2957df801a1 6833576: G1: assert illegal index, growableArray.hpp:186
johnc
parents: 579
diff changeset
48 size_t index = pointer_delta(addr, _g1_reserved.start(), 1)
a2957df801a1 6833576: G1: assert illegal index, growableArray.hpp:186
johnc
parents: 579
diff changeset
49 >> HeapRegion::LogOfHRGrainBytes;
a2957df801a1 6833576: G1: assert illegal index, growableArray.hpp:186
johnc
parents: 579
diff changeset
50
526
818efdefcc99 6484956: G1: improve evacuation pause efficiency
tonyp
parents: 342
diff changeset
51 HeapRegion* res = _hrs->at(index);
818efdefcc99 6484956: G1: improve evacuation pause efficiency
tonyp
parents: 342
diff changeset
52 assert(res == _hrs->addr_to_region(addr), "sanity");
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
53 return res;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
54 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
55
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
56 inline bool G1CollectedHeap::obj_in_cs(oop obj) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
57 HeapRegion* r = _hrs->addr_to_region(obj);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
58 return r != NULL && r->in_collection_set();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
59 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
60
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
61 inline HeapWord* G1CollectedHeap::attempt_allocation(size_t word_size,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
62 bool permit_collection_pause) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
63 HeapWord* res = NULL;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
64
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
65 assert( SafepointSynchronize::is_at_safepoint() ||
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
66 Heap_lock->owned_by_self(), "pre-condition of the call" );
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
67
1718
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
68 // All humongous allocation requests should go through the slow path in
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
69 // attempt_allocation_slow().
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
70 if (!isHumongous(word_size) && _cur_alloc_region != NULL) {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
71 // If this allocation causes a region to become non empty,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
72 // then we need to update our free_regions count.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
73
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
74 if (_cur_alloc_region->is_empty()) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
75 res = _cur_alloc_region->allocate(word_size);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
76 if (res != NULL)
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
77 _free_regions--;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
78 } else {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
79 res = _cur_alloc_region->allocate(word_size);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
80 }
1718
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
81
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
82 if (res != NULL) {
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
83 if (!SafepointSynchronize::is_at_safepoint()) {
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
84 assert( Heap_lock->owned_by_self(), "invariant" );
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
85 Heap_lock->unlock();
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
86 }
bb847e31b836 6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents: 1709
diff changeset
87 return res;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
88 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
89 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
90 // attempt_allocation_slow will also unlock the heap lock when appropriate.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
91 return attempt_allocation_slow(word_size, permit_collection_pause);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
92 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
93
1709
5f429ee79634 6966222: G1: simplify TaskQueue overflow handling
jcoomes
parents: 1552
diff changeset
94 inline RefToScanQueue* G1CollectedHeap::task_queue(int i) const {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
95 return _task_queues->queue(i);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
96 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
97
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
98 inline bool G1CollectedHeap::isMarkedPrev(oop obj) const {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
99 return _cm->prevMarkBitMap()->isMarked((HeapWord *)obj);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
100 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
101
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
102 inline bool G1CollectedHeap::isMarkedNext(oop obj) const {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
103 return _cm->nextMarkBitMap()->isMarked((HeapWord *)obj);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
104 }
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
105
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1718
diff changeset
106 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP