src/hotspot/share/gc/g1/heapRegion.inline.hpp
author sjohanss
Tue, 14 Nov 2017 11:33:23 +0100
changeset 47885 5caa1d5f74c1
parent 47678 c84eeb55c55e
child 49664 9a04cc89dde0
permissions -rw-r--r--
8186571: Implementation: JEP 307: Parallel Full GC for G1 Summary: Improve G1 worst-case latencies by making the full GC parallel. Reviewed-by: tschatzl, sangheki, ehelin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     1
/*
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
     2
 * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     4
 *
4c24294029a9 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
4c24294029a9 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
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     8
 *
4c24294029a9 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
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4c24294029a9 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
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    13
 * accompanied this code).
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    14
 *
4c24294029a9 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
4c24294029a9 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,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    21
 * questions.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    22
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    23
 */
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29470
diff changeset
    25
#ifndef SHARE_VM_GC_G1_HEAPREGION_INLINE_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29470
diff changeset
    26
#define SHARE_VM_GC_G1_HEAPREGION_INLINE_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29470
diff changeset
    28
#include "gc/g1/g1BlockOffsetTable.inline.hpp"
32185
49a57ff2c3cb 8073052: Rename and clean up the allocation manager hierarchy in g1Allocator.?pp
tschatzl
parents: 31592
diff changeset
    29
#include "gc/g1/g1CollectedHeap.inline.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
    30
#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29470
diff changeset
    31
#include "gc/g1/heapRegion.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29470
diff changeset
    32
#include "gc/shared/space.hpp"
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents: 25908
diff changeset
    33
#include "oops/oop.inline.hpp"
40655
9f644073d3a0 8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents: 39698
diff changeset
    34
#include "runtime/atomic.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
    35
#include "runtime/prefetch.inline.hpp"
46625
edefffab74e2 8183552: Move align functions to align.hpp
stefank
parents: 46517
diff changeset
    36
#include "utilities/align.hpp"
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    37
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    38
inline HeapWord* G1ContiguousSpace::allocate_impl(size_t min_word_size,
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    39
                                                  size_t desired_word_size,
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    40
                                                  size_t* actual_size) {
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    41
  HeapWord* obj = top();
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    42
  size_t available = pointer_delta(end(), obj);
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    43
  size_t want_to_allocate = MIN2(available, desired_word_size);
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    44
  if (want_to_allocate >= min_word_size) {
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    45
    HeapWord* new_top = obj + want_to_allocate;
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    46
    set_top(new_top);
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    47
    assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    48
    *actual_size = want_to_allocate;
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    49
    return obj;
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    50
  } else {
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    51
    return NULL;
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    52
  }
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    53
}
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    54
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    55
inline HeapWord* G1ContiguousSpace::par_allocate_impl(size_t min_word_size,
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    56
                                                      size_t desired_word_size,
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    57
                                                      size_t* actual_size) {
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    58
  do {
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    59
    HeapWord* obj = top();
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    60
    size_t available = pointer_delta(end(), obj);
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    61
    size_t want_to_allocate = MIN2(available, desired_word_size);
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    62
    if (want_to_allocate >= min_word_size) {
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    63
      HeapWord* new_top = obj + want_to_allocate;
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47216
diff changeset
    64
      HeapWord* result = Atomic::cmpxchg(new_top, top_addr(), obj);
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    65
      // result can be one of two:
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    66
      //  the old top value: the exchange succeeded
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    67
      //  otherwise: the new value of the top is returned.
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    68
      if (result == obj) {
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    69
        assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    70
        *actual_size = want_to_allocate;
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    71
        return obj;
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    72
      }
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    73
    } else {
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    74
      return NULL;
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    75
    }
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    76
  } while (true);
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
    77
}
25361
5146d1e12a2f 8047820: G1 Block offset table does not need to support generic Space classes
mgerdin
parents: 12508
diff changeset
    78
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    79
inline HeapWord* G1ContiguousSpace::allocate(size_t min_word_size,
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    80
                                             size_t desired_word_size,
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    81
                                             size_t* actual_size) {
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    82
  HeapWord* res = allocate_impl(min_word_size, desired_word_size, actual_size);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    83
  if (res != NULL) {
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    84
    _bot_part.alloc_block(res, *actual_size);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    85
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    86
  return res;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    87
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    88
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    89
inline HeapWord* G1ContiguousSpace::allocate(size_t word_size) {
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    90
  size_t temp;
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    91
  return allocate(word_size, word_size, &temp);
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    92
}
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    93
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
    94
inline HeapWord* G1ContiguousSpace::par_allocate(size_t word_size) {
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    95
  size_t temp;
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    96
  return par_allocate(word_size, word_size, &temp);
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    97
}
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
    98
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    99
// Because of the requirement of keeping "_offsets" up to date with the
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   100
// allocations, we sequentialize these with a lock.  Therefore, best if
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   101
// this is used for larger LAB allocations only.
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
   102
inline HeapWord* G1ContiguousSpace::par_allocate(size_t min_word_size,
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
   103
                                                 size_t desired_word_size,
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
   104
                                                 size_t* actual_size) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   105
  MutexLocker x(&_par_alloc_lock);
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   106
  return allocate(min_word_size, desired_word_size, actual_size);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   107
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   108
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
   109
inline HeapWord* G1ContiguousSpace::block_start(const void* p) {
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
   110
  return _bot_part.block_start(p);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   111
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   112
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   113
inline HeapWord*
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
   114
G1ContiguousSpace::block_start_const(const void* p) const {
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 33786
diff changeset
   115
  return _bot_part.block_start_const(p);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   116
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   117
46750
bcab0128a16f 8184346: Clean up G1CMBitmap
tschatzl
parents: 46625
diff changeset
   118
inline bool HeapRegion::is_obj_dead_with_size(const oop obj, const G1CMBitMap* const prev_bitmap, size_t* size) const {
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   119
  HeapWord* addr = (HeapWord*) obj;
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   120
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   121
  assert(addr < top(), "must be");
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46750
diff changeset
   122
  assert(!is_closed_archive(),
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46750
diff changeset
   123
         "Closed archive regions should not have references into other regions");
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   124
  assert(!is_humongous(), "Humongous objects not handled here");
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   125
  bool obj_is_dead = is_obj_dead(obj, prev_bitmap);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   126
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   127
  if (ClassUnloadingWithConcurrentMark && obj_is_dead) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   128
    assert(!block_is_obj(addr), "must be");
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   129
    *size = block_size_using_bitmap(addr, prev_bitmap);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   130
  } else {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   131
    assert(block_is_obj(addr), "must be");
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   132
    *size = obj->size();
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   133
  }
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   134
  return obj_is_dead;
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   135
}
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   136
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   137
inline bool
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   138
HeapRegion::block_is_obj(const HeapWord* p) const {
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
   139
  G1CollectedHeap* g1h = G1CollectedHeap::heap();
33786
ac8da6513351 8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents: 33105
diff changeset
   140
ac8da6513351 8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents: 33105
diff changeset
   141
  if (!this->is_in(p)) {
ac8da6513351 8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents: 33105
diff changeset
   142
    assert(is_continues_humongous(), "This case can only happen for humongous regions");
ac8da6513351 8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents: 33105
diff changeset
   143
    return (p == humongous_start_region()->bottom());
ac8da6513351 8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents: 33105
diff changeset
   144
  }
25908
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   145
  if (ClassUnloadingWithConcurrentMark) {
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   146
    return !g1h->is_obj_dead(oop(p), this);
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   147
  }
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   148
  return p < top();
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   149
}
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   150
46750
bcab0128a16f 8184346: Clean up G1CMBitmap
tschatzl
parents: 46625
diff changeset
   151
inline size_t HeapRegion::block_size_using_bitmap(const HeapWord* addr, const G1CMBitMap* const prev_bitmap) const {
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   152
  assert(ClassUnloadingWithConcurrentMark,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   153
         "All blocks should be objects if class unloading isn't used, so this method should not be called. "
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   154
         "HR: [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ") "
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   155
         "addr: " PTR_FORMAT,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   156
         p2i(bottom()), p2i(top()), p2i(end()), p2i(addr));
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   157
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   158
  // Old regions' dead objects may have dead classes
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   159
  // We need to find the next live object using the bitmap
46750
bcab0128a16f 8184346: Clean up G1CMBitmap
tschatzl
parents: 46625
diff changeset
   160
  HeapWord* next = prev_bitmap->get_next_marked_addr(addr, prev_top_at_mark_start());
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   161
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   162
  assert(next > addr, "must get the next live object");
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   163
  return pointer_delta(next, addr);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   164
}
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   165
46750
bcab0128a16f 8184346: Clean up G1CMBitmap
tschatzl
parents: 46625
diff changeset
   166
inline bool HeapRegion::is_obj_dead(const oop obj, const G1CMBitMap* const prev_bitmap) const {
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   167
  assert(is_in_reserved(obj), "Object " PTR_FORMAT " must be in region", p2i(obj));
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46750
diff changeset
   168
  return !obj_allocated_since_prev_marking(obj) &&
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46750
diff changeset
   169
         !prev_bitmap->is_marked((HeapWord*)obj) &&
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46750
diff changeset
   170
         !is_open_archive();
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   171
}
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   172
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   173
inline size_t HeapRegion::block_size(const HeapWord *addr) const {
25908
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   174
  if (addr == top()) {
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   175
    return pointer_delta(end(), addr);
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   176
  }
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   177
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   178
  if (block_is_obj(addr)) {
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   179
    return oop(addr)->size();
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   180
  }
8adb2fb6fc3c 8048269: Add flag to turn off class unloading after G1 concurrent mark
stefank
parents: 25492
diff changeset
   181
47678
c84eeb55c55e 8184667: Clean up G1ConcurrentMark files
tschatzl
parents: 47634
diff changeset
   182
  return block_size_using_bitmap(addr, G1CollectedHeap::heap()->concurrent_mark()->prev_mark_bitmap());
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   183
}
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   184
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   185
inline void HeapRegion::complete_compaction() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   186
  // Reset space and bot after compaction is complete if needed.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   187
  reset_after_compaction();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   188
  if (used_region().is_empty()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   189
    reset_bot();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   190
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   191
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   192
  // After a compaction the mark bitmap is invalid, so we must
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   193
  // treat all objects as being inside the unmarked area.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   194
  zero_marked_bytes();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   195
  init_top_at_mark_start();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   196
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   197
  // Clear unused heap memory in debug builds.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   198
  if (ZapUnusedHeapArea) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   199
    mangle_unused_area();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   200
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   201
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   202
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   203
template<typename ApplyToMarkedClosure>
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   204
inline void HeapRegion::apply_to_marked_objects(G1CMBitMap* bitmap, ApplyToMarkedClosure* closure) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   205
  HeapWord* limit = scan_limit();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   206
  HeapWord* next_addr = bottom();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   207
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   208
  while (next_addr < limit) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   209
    Prefetch::write(next_addr, PrefetchScanIntervalInBytes);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   210
    // This explicit is_marked check is a way to avoid
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   211
    // some extra work done by get_next_marked_addr for
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   212
    // the case where next_addr is marked.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   213
    if (bitmap->is_marked(next_addr)) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   214
      oop current = oop(next_addr);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   215
      next_addr += closure->apply(current);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   216
    } else {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   217
      next_addr = bitmap->get_next_marked_addr(next_addr, limit);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   218
    }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   219
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   220
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   221
  assert(next_addr == limit, "Should stop the scan at the limit.");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   222
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47678
diff changeset
   223
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   224
inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t min_word_size,
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   225
                                                         size_t desired_word_size,
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   226
                                                         size_t* actual_word_size) {
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   227
  assert(is_young(), "we can only skip BOT updates on young regions");
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   228
  return par_allocate_impl(min_word_size, desired_word_size, actual_word_size);
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   229
}
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   230
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   231
inline HeapWord* HeapRegion::allocate_no_bot_updates(size_t word_size) {
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   232
  size_t temp;
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   233
  return allocate_no_bot_updates(word_size, word_size, &temp);
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   234
}
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   235
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   236
inline HeapWord* HeapRegion::allocate_no_bot_updates(size_t min_word_size,
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   237
                                                     size_t desired_word_size,
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   238
                                                     size_t* actual_word_size) {
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   239
  assert(is_young(), "we can only skip BOT updates on young regions");
32389
626f27450e12 8067336: Allow that PLAB allocations at the end of regions are flexible
tschatzl
parents: 32185
diff changeset
   240
  return allocate_impl(min_word_size, desired_word_size, actual_word_size);
25481
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   241
}
1427aa24638c 8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents: 25361
diff changeset
   242
11455
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   243
inline void HeapRegion::note_start_of_marking() {
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   244
  _next_marked_bytes = 0;
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   245
  _next_top_at_mark_start = top();
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   246
}
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   247
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   248
inline void HeapRegion::note_end_of_marking() {
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   249
  _prev_top_at_mark_start = _next_top_at_mark_start;
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   250
  _prev_marked_bytes = _next_marked_bytes;
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   251
  _next_marked_bytes = 0;
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   252
}
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   253
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   254
inline void HeapRegion::note_start_of_copying(bool during_initial_mark) {
11584
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   255
  if (is_survivor()) {
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   256
    // This is how we always allocate survivors.
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   257
    assert(_next_top_at_mark_start == bottom(), "invariant");
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   258
  } else {
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   259
    if (during_initial_mark) {
11455
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   260
      // During initial-mark we'll explicitly mark any objects on old
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   261
      // regions that are pointed to by roots. Given that explicit
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   262
      // marks only make sense under NTAMS it'd be nice if we could
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   263
      // check that condition if we wanted to. Given that we don't
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   264
      // know where the top of this region will end up, we simply set
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   265
      // NTAMS to the end of the region so all marks will be below
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   266
      // NTAMS. We'll set it to the actual top when we retire this region.
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   267
      _next_top_at_mark_start = end();
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   268
    } else {
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   269
      // We could have re-used this old region as to-space over a
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   270
      // couple of GCs since the start of the concurrent marking
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   271
      // cycle. This means that [bottom,NTAMS) will contain objects
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   272
      // copied up to and including initial-mark and [NTAMS, top)
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   273
      // will contain objects copied during the concurrent marking cycle.
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   274
      assert(top() >= _next_top_at_mark_start, "invariant");
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   275
    }
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   276
  }
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   277
}
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   278
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   279
inline void HeapRegion::note_end_of_copying(bool during_initial_mark) {
11584
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   280
  if (is_survivor()) {
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   281
    // This is how we always allocate survivors.
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   282
    assert(_next_top_at_mark_start == bottom(), "invariant");
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   283
  } else {
e1df4d08a1f4 7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents: 11455
diff changeset
   284
    if (during_initial_mark) {
11455
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   285
      // See the comment for note_start_of_copying() for the details
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   286
      // on this.
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   287
      assert(_next_top_at_mark_start == end(), "pre-condition");
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   288
      _next_top_at_mark_start = top();
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   289
    } else {
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   290
      // See the comment for note_start_of_copying() for the details
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   291
      // on this.
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   292
      assert(top() >= _next_top_at_mark_start, "invariant");
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   293
    }
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   294
  }
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   295
}
a6ab3d8b9a4c 6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents: 8928
diff changeset
   296
29470
e34bbcd36e53 8030646: track collection set membership in one place
ehelin
parents: 29081
diff changeset
   297
inline bool HeapRegion::in_collection_set() const {
e34bbcd36e53 8030646: track collection set membership in one place
ehelin
parents: 29081
diff changeset
   298
  return G1CollectedHeap::heap()->is_in_cset(this);
e34bbcd36e53 8030646: track collection set membership in one place
ehelin
parents: 29081
diff changeset
   299
}
e34bbcd36e53 8030646: track collection set membership in one place
ehelin
parents: 29081
diff changeset
   300
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   301
template <class Closure, bool is_gc_active>
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   302
bool HeapRegion::do_oops_on_card_in_humongous(MemRegion mr,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   303
                                              Closure* cl,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   304
                                              G1CollectedHeap* g1h) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   305
  assert(is_humongous(), "precondition");
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   306
  HeapRegion* sr = humongous_start_region();
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   307
  oop obj = oop(sr->bottom());
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   308
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   309
  // If concurrent and klass_or_null is NULL, then space has been
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   310
  // allocated but the object has not yet been published by setting
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   311
  // the klass.  That can only happen if the card is stale.  However,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   312
  // we've already set the card clean, so we must return failure,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   313
  // since the allocating thread could have performed a write to the
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   314
  // card that might be missed otherwise.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   315
  if (!is_gc_active && (obj->klass_or_null_acquire() == NULL)) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   316
    return false;
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   317
  }
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   318
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   319
  // We have a well-formed humongous object at the start of sr.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   320
  // Only filler objects follow a humongous object in the containing
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   321
  // regions, and we can ignore those.  So only process the one
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   322
  // humongous object.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   323
  if (!g1h->is_obj_dead(obj, sr)) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   324
    if (obj->is_objArray() || (sr->bottom() < mr.start())) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   325
      // objArrays are always marked precisely, so limit processing
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   326
      // with mr.  Non-objArrays might be precisely marked, and since
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   327
      // it's humongous it's worthwhile avoiding full processing.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   328
      // However, the card could be stale and only cover filler
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   329
      // objects.  That should be rare, so not worth checking for;
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   330
      // instead let it fall out from the bounded iteration.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   331
      obj->oop_iterate(cl, mr);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   332
    } else {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   333
      // If obj is not an objArray and mr contains the start of the
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   334
      // obj, then this could be an imprecise mark, and we need to
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   335
      // process the entire object.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   336
      obj->oop_iterate(cl);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   337
    }
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   338
  }
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   339
  return true;
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   340
}
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   341
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   342
template <bool is_gc_active, class Closure>
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   343
bool HeapRegion::oops_on_card_seq_iterate_careful(MemRegion mr,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   344
                                                  Closure* cl) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   345
  assert(MemRegion(bottom(), end()).contains(mr), "Card region not in heap region");
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   346
  G1CollectedHeap* g1h = G1CollectedHeap::heap();
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   347
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   348
  // Special handling for humongous regions.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   349
  if (is_humongous()) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   350
    return do_oops_on_card_in_humongous<Closure, is_gc_active>(mr, cl, g1h);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   351
  }
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   352
  assert(is_old(), "precondition");
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   353
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   354
  // Because mr has been trimmed to what's been allocated in this
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   355
  // region, the parts of the heap that are examined here are always
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   356
  // parsable; there's no need to use klass_or_null to detect
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   357
  // in-progress allocation.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   358
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   359
  // Cache the boundaries of the memory region in some const locals
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   360
  HeapWord* const start = mr.start();
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   361
  HeapWord* const end = mr.end();
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   362
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   363
  // Find the obj that extends onto mr.start().
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   364
  // Update BOT as needed while finding start of (possibly dead)
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   365
  // object containing the start of the region.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   366
  HeapWord* cur = block_start(start);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   367
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   368
#ifdef ASSERT
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   369
  {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   370
    assert(cur <= start,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   371
           "cur: " PTR_FORMAT ", start: " PTR_FORMAT, p2i(cur), p2i(start));
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   372
    HeapWord* next = cur + block_size(cur);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   373
    assert(start < next,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   374
           "start: " PTR_FORMAT ", next: " PTR_FORMAT, p2i(start), p2i(next));
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   375
  }
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   376
#endif
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   377
47678
c84eeb55c55e 8184667: Clean up G1ConcurrentMark files
tschatzl
parents: 47634
diff changeset
   378
  const G1CMBitMap* const bitmap = g1h->concurrent_mark()->prev_mark_bitmap();
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   379
  do {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   380
    oop obj = oop(cur);
46968
9119841280f4 8160399: is_oop_or_null involves undefined behavior
coleenp
parents: 46810
diff changeset
   381
    assert(oopDesc::is_oop(obj, true), "Not an oop at " PTR_FORMAT, p2i(cur));
46517
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   382
    assert(obj->klass_or_null() != NULL,
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   383
           "Unparsable heap at " PTR_FORMAT, p2i(cur));
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   384
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   385
    size_t size;
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   386
    bool is_dead = is_obj_dead_with_size(obj, bitmap, &size);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   387
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   388
    cur += size;
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   389
    if (!is_dead) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   390
      // Process live object's references.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   391
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   392
      // Non-objArrays are usually marked imprecise at the object
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   393
      // start, in which case we need to iterate over them in full.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   394
      // objArrays are precisely marked, but can still be iterated
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   395
      // over in full if completely covered.
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   396
      if (!obj->is_objArray() || (((HeapWord*)obj) >= start && cur <= end)) {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   397
        obj->oop_iterate(cl);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   398
      } else {
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   399
        obj->oop_iterate(cl, mr);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   400
      }
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   401
    }
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   402
  } while (cur < end);
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   403
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   404
  return true;
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   405
}
14de3e5151a9 8071280: Specialize HeapRegion::oops_on_card_seq_iterate_careful() for use during concurrent refinement and updating the rset
tschatzl
parents: 40655
diff changeset
   406
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29470
diff changeset
   407
#endif // SHARE_VM_GC_G1_HEAPREGION_INLINE_HPP