Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/g1/heapRegionSeq.hpp @ 2951:0c0e407faa39
another fix to debug info (on-stack parameters), DCE removes unnecessary merges and LoopBegins whose LoopEnd went away
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Tue, 14 Jun 2011 16:47:31 +0200 |
parents | 1216415d8e35 |
children | c3f1170908be |
rev | line source |
---|---|
342 | 1 /* |
2149 | 2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
342 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
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:
844
diff
changeset
|
21 * questions. |
342 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP | |
27 | |
28 #include "gc_implementation/g1/heapRegion.hpp" | |
29 #include "utilities/growableArray.hpp" | |
30 | |
342 | 31 class HeapRegion; |
32 class HeapRegionClosure; | |
33 | |
34 class HeapRegionSeq: public CHeapObj { | |
35 | |
36 // _regions is kept sorted by start address order, and no two regions are | |
37 // overlapping. | |
38 GrowableArray<HeapRegion*> _regions; | |
39 | |
40 // The index in "_regions" at which to start the next allocation search. | |
41 // (For efficiency only; private to obj_allocate after initialization.) | |
42 int _alloc_search_start; | |
43 | |
2152 | 44 // Finds a contiguous set of empty regions of length num, starting |
45 // from a given index. | |
46 int find_contiguous_from(int from, size_t num); | |
342 | 47 |
48 // Currently, we're choosing collection sets in a round-robin fashion, | |
49 // starting here. | |
50 int _next_rr_candidate; | |
51 | |
52 // The bottom address of the bottom-most region, or else NULL if there | |
53 // are no regions in the sequence. | |
54 char* _seq_bottom; | |
55 | |
56 public: | |
57 // Initializes "this" to the empty sequence of regions. | |
393 | 58 HeapRegionSeq(const size_t max_size); |
342 | 59 |
60 // Adds "hr" to "this" sequence. Requires "hr" not to overlap with | |
61 // any region already in "this". (Will perform better if regions are | |
62 // inserted in ascending address order.) | |
63 void insert(HeapRegion* hr); | |
64 | |
65 // Given a HeapRegion*, returns its index within _regions, | |
66 // or returns -1 if not found. | |
67 int find(HeapRegion* hr); | |
68 | |
69 // Requires the index to be valid, and return the region at the index. | |
70 HeapRegion* at(size_t i) { return _regions.at((int)i); } | |
71 | |
72 // Return the number of regions in the sequence. | |
73 size_t length(); | |
74 | |
75 // Returns the number of contiguous regions at the end of the sequence | |
76 // that are available for allocation. | |
77 size_t free_suffix(); | |
78 | |
2361 | 79 // Find a contiguous set of empty regions of length num and return |
80 // the index of the first region or -1 if the search was unsuccessful. | |
2152 | 81 int find_contiguous(size_t num); |
342 | 82 |
83 // Apply the "doHeapRegion" method of "blk" to all regions in "this", | |
84 // in address order, terminating the iteration early | |
85 // if the "doHeapRegion" method returns "true". | |
86 void iterate(HeapRegionClosure* blk); | |
87 | |
88 // Apply the "doHeapRegion" method of "blk" to all regions in "this", | |
89 // starting at "r" (or first region, if "r" is NULL), in a circular | |
90 // manner, terminating the iteration early if the "doHeapRegion" method | |
91 // returns "true". | |
92 void iterate_from(HeapRegion* r, HeapRegionClosure* blk); | |
93 | |
94 // As above, but start from a given index in the sequence | |
95 // instead of a given heap region. | |
96 void iterate_from(int idx, HeapRegionClosure* blk); | |
97 | |
98 // Requires "shrink_bytes" to be a multiple of the page size and heap | |
99 // region granularity. Deletes as many "rightmost" completely free heap | |
100 // regions from the sequence as comprise shrink_bytes bytes. Returns the | |
101 // MemRegion indicating the region those regions comprised, and sets | |
102 // "num_regions_deleted" to the number of regions deleted. | |
103 MemRegion shrink_by(size_t shrink_bytes, size_t& num_regions_deleted); | |
104 | |
105 // If "addr" falls within a region in the sequence, return that region, | |
106 // or else NULL. | |
2149 | 107 inline HeapRegion* addr_to_region(const void* addr); |
342 | 108 |
109 void print(); | |
110 | |
677 | 111 // Prints out runs of empty regions. |
112 void print_empty_runs(); | |
342 | 113 |
114 }; | |
1972 | 115 |
116 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP |