src/share/vm/memory/barrierSet.inline.hpp

changeset 1526
6aa7255741f3
parent 1280
df6caf649ff7
child 1680
6484c4ee11cb
     1.1 --- a/src/share/vm/memory/barrierSet.inline.hpp	Tue Nov 24 15:19:30 2009 -0800
     1.2 +++ b/src/share/vm/memory/barrierSet.inline.hpp	Thu Dec 03 15:01:57 2009 -0800
     1.3 @@ -43,6 +43,8 @@
     1.4  }
     1.5  
     1.6  void BarrierSet::write_ref_array(MemRegion mr) {
     1.7 +  assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start() , "Unaligned start");
     1.8 +  assert((HeapWord*)align_size_up  ((uintptr_t)mr.end(),   HeapWordSize) == mr.end(),    "Unaligned end"  );
     1.9    if (kind() == CardTableModRef) {
    1.10      ((CardTableModRefBS*)this)->inline_write_ref_array(mr);
    1.11    } else {
    1.12 @@ -50,6 +52,34 @@
    1.13    }
    1.14  }
    1.15  
    1.16 +// count is number of array elements being written
    1.17 +void BarrierSet::write_ref_array(HeapWord* start, size_t count) {
    1.18 +  assert(count <= (size_t)max_intx, "count too large");
    1.19 +  HeapWord* end = (HeapWord*)((char*)start + (count*heapOopSize));
    1.20 +  // In the case of compressed oops, start and end may potentially be misaligned;
    1.21 +  // so we need to conservatively align the first downward (this is not
    1.22 +  // strictly necessary for current uses, but a case of good hygiene and,
    1.23 +  // if you will, aesthetics) and the second upward (this is essential for
    1.24 +  // current uses) to a HeapWord boundary, so we mark all cards overlapping
    1.25 +  // this write. In the event that this evolves in the future to calling a
    1.26 +  // logging barrier of narrow oop granularity, like the pre-barrier for G1
    1.27 +  // (mentioned here merely by way of example), we will need to change this
    1.28 +  // interface, much like the pre-barrier one above, so it is "exactly precise"
    1.29 +  // (if i may be allowed the adverbial redundancy for emphasis) and does not
    1.30 +  // include narrow oop slots not included in the original write interval.
    1.31 +  HeapWord* aligned_start = (HeapWord*)align_size_down((uintptr_t)start, HeapWordSize);
    1.32 +  HeapWord* aligned_end   = (HeapWord*)align_size_up  ((uintptr_t)end,   HeapWordSize);
    1.33 +  // If compressed oops were not being used, these should already be aligned
    1.34 +  assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
    1.35 +         "Expected heap word alignment of start and end");
    1.36 +#if 0
    1.37 +  warning("Post:\t" INTPTR_FORMAT "[" SIZE_FORMAT "] : [" INTPTR_FORMAT","INTPTR_FORMAT")\t",
    1.38 +                   start,            count,              aligned_start,   aligned_end);
    1.39 +#endif
    1.40 +  write_ref_array_work(MemRegion(aligned_start, aligned_end));
    1.41 +}
    1.42 +
    1.43 +
    1.44  void BarrierSet::write_region(MemRegion mr) {
    1.45    if (kind() == CardTableModRef) {
    1.46      ((CardTableModRefBS*)this)->inline_write_region(mr);

mercurial