src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp

changeset 3416
2ace1c4ee8da
parent 2973
23d434c6290d
child 3454
2e966d967c5c
     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Tue Jan 10 20:02:41 2012 +0100
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Tue Jan 10 18:58:13 2012 -0500
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -153,4 +153,46 @@
    1.11    }
    1.12  }
    1.13  
    1.14 +inline void ConcurrentMark::markPrev(oop p) {
    1.15 +  assert(!_prevMarkBitMap->isMarked((HeapWord*) p), "sanity");
    1.16 +  // Note we are overriding the read-only view of the prev map here, via
    1.17 +  // the cast.
    1.18 +  ((CMBitMap*)_prevMarkBitMap)->mark((HeapWord*) p);
    1.19 +}
    1.20 +
    1.21 +inline void ConcurrentMark::markNext(oop p) {
    1.22 +  assert(!_nextMarkBitMap->isMarked((HeapWord*) p), "sanity");
    1.23 +  _nextMarkBitMap->mark((HeapWord*) p);
    1.24 +}
    1.25 +
    1.26 +inline void ConcurrentMark::grayRoot(oop obj, size_t word_size) {
    1.27 +  HeapWord* addr = (HeapWord*) obj;
    1.28 +
    1.29 +  // Currently we don't do anything with word_size but we will use it
    1.30 +  // in the very near future in the liveness calculation piggy-backing
    1.31 +  // changes.
    1.32 +
    1.33 +#ifdef ASSERT
    1.34 +  HeapRegion* hr = _g1h->heap_region_containing(addr);
    1.35 +  assert(hr != NULL, "sanity");
    1.36 +  assert(!hr->is_survivor(), "should not allocate survivors during IM");
    1.37 +  assert(addr < hr->next_top_at_mark_start(),
    1.38 +         err_msg("addr: "PTR_FORMAT" hr: "HR_FORMAT" NTAMS: "PTR_FORMAT,
    1.39 +                 addr, HR_FORMAT_PARAMS(hr), hr->next_top_at_mark_start()));
    1.40 +  // We cannot assert that word_size == obj->size() given that obj
    1.41 +  // might not be in a consistent state (another thread might be in
    1.42 +  // the process of copying it). So the best thing we can do is to
    1.43 +  // assert that word_size is under an upper bound which is its
    1.44 +  // containing region's capacity.
    1.45 +  assert(word_size * HeapWordSize <= hr->capacity(),
    1.46 +         err_msg("size: "SIZE_FORMAT" capacity: "SIZE_FORMAT" "HR_FORMAT,
    1.47 +                 word_size * HeapWordSize, hr->capacity(),
    1.48 +                 HR_FORMAT_PARAMS(hr)));
    1.49 +#endif // ASSERT
    1.50 +
    1.51 +  if (!_nextMarkBitMap->isMarked(addr)) {
    1.52 +    _nextMarkBitMap->parMark(addr);
    1.53 +  }
    1.54 +}
    1.55 +
    1.56  #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP

mercurial