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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc_implementation/g1/heapRegion.hpp"
27 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
28 #include "gc_implementation/g1/heapRegionSets.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
30 #include "memory/allocation.hpp"
31
32 // Private
33
34 uint HeapRegionSeq::find_contiguous_from(uint from, uint num) {
35 uint len = length();
36 assert(num > 1, "use this only for sequences of length 2 or greater");
37 assert(from <= len,
38 err_msg("from: %u should be valid and <= than %u", from, len));
39
40 uint curr = from;
41 uint first = G1_NULL_HRS_INDEX;
42 uint num_so_far = 0;
43 while (curr < len && num_so_far < num) {
44 if (at(curr)->is_empty()) {
45 if (first == G1_NULL_HRS_INDEX) {
46 first = curr;
47 num_so_far = 1;
48 } else {
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc_implementation/g1/heapRegion.hpp"
27 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
28 #include "gc_implementation/g1/heapRegionSet.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
30 #include "memory/allocation.hpp"
31
32 // Private
33
34 uint HeapRegionSeq::find_contiguous_from(uint from, uint num) {
35 uint len = length();
36 assert(num > 1, "use this only for sequences of length 2 or greater");
37 assert(from <= len,
38 err_msg("from: %u should be valid and <= than %u", from, len));
39
40 uint curr = from;
41 uint first = G1_NULL_HRS_INDEX;
42 uint num_so_far = 0;
43 while (curr < len && num_so_far < num) {
44 if (at(curr)->is_empty()) {
45 if (first == G1_NULL_HRS_INDEX) {
46 first = curr;
47 num_so_far = 1;
48 } else {
|