< prev index next >

src/share/vm/memory/barrierSet.cpp

Print this page




  25 #include "precompiled.hpp"
  26 #include "gc_interface/collectedHeap.hpp"
  27 #include "memory/barrierSet.inline.hpp"
  28 #include "memory/universe.hpp"
  29 
  30 // count is number of array elements being written
  31 void BarrierSet::static_write_ref_array_pre(HeapWord* start, size_t count) {
  32   assert(count <= (size_t)max_intx, "count too large");
  33 #if 0
  34   warning("Pre: \t" INTPTR_FORMAT "[" SIZE_FORMAT "]\t",
  35                    start,            count);
  36 #endif
  37   if (UseCompressedOops) {
  38     Universe::heap()->barrier_set()->write_ref_array_pre((narrowOop*)start, (int)count, false);
  39   } else {
  40     Universe::heap()->barrier_set()->write_ref_array_pre(      (oop*)start, (int)count, false);
  41   }
  42 }
  43 
  44 // count is number of array elements being written



























  45 void BarrierSet::static_write_ref_array_post(HeapWord* start, size_t count) {
  46   // simply delegate to instance method
  47   Universe::heap()->barrier_set()->write_ref_array(start, count);
  48 }


  25 #include "precompiled.hpp"
  26 #include "gc_interface/collectedHeap.hpp"
  27 #include "memory/barrierSet.inline.hpp"
  28 #include "memory/universe.hpp"
  29 
  30 // count is number of array elements being written
  31 void BarrierSet::static_write_ref_array_pre(HeapWord* start, size_t count) {
  32   assert(count <= (size_t)max_intx, "count too large");
  33 #if 0
  34   warning("Pre: \t" INTPTR_FORMAT "[" SIZE_FORMAT "]\t",
  35                    start,            count);
  36 #endif
  37   if (UseCompressedOops) {
  38     Universe::heap()->barrier_set()->write_ref_array_pre((narrowOop*)start, (int)count, false);
  39   } else {
  40     Universe::heap()->barrier_set()->write_ref_array_pre(      (oop*)start, (int)count, false);
  41   }
  42 }
  43 
  44 // count is number of array elements being written
  45 void BarrierSet::write_ref_array(HeapWord* start, size_t count) {
  46   assert(count <= (size_t)max_intx, "count too large");
  47   HeapWord* end = (HeapWord*)((char*)start + (count*heapOopSize));
  48   // In the case of compressed oops, start and end may potentially be misaligned;
  49   // so we need to conservatively align the first downward (this is not
  50   // strictly necessary for current uses, but a case of good hygiene and,
  51   // if you will, aesthetics) and the second upward (this is essential for
  52   // current uses) to a HeapWord boundary, so we mark all cards overlapping
  53   // this write. If this evolves in the future to calling a
  54   // logging barrier of narrow oop granularity, like the pre-barrier for G1
  55   // (mentioned here merely by way of example), we will need to change this
  56   // interface, so it is "exactly precise" (if i may be allowed the adverbial
  57   // redundancy for emphasis) and does not include narrow oop slots not
  58   // included in the original write interval.
  59   HeapWord* aligned_start = (HeapWord*)align_size_down((uintptr_t)start, HeapWordSize);
  60   HeapWord* aligned_end   = (HeapWord*)align_size_up  ((uintptr_t)end,   HeapWordSize);
  61   // If compressed oops were not being used, these should already be aligned
  62   assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
  63          "Expected heap word alignment of start and end");
  64 #if 0
  65   warning("Post:\t" INTPTR_FORMAT "[" SIZE_FORMAT "] : [" INTPTR_FORMAT "," INTPTR_FORMAT ")\t",
  66                    start,            count,              aligned_start,   aligned_end);
  67 #endif
  68   write_ref_array_work(MemRegion(aligned_start, aligned_end));
  69 }
  70 
  71 // count is number of array elements being written
  72 void BarrierSet::static_write_ref_array_post(HeapWord* start, size_t count) {
  73   // simply delegate to instance method
  74   Universe::heap()->barrier_set()->write_ref_array(start, count);
  75 }
< prev index next >