src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp

changeset 548
ba764ed4b6f2
parent 435
a61af66fc99e
child 631
d1605aabd0a1
     1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Fri Apr 11 09:56:35 2008 -0400
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Sun Apr 13 17:43:42 2008 -0400
     1.3 @@ -182,7 +182,7 @@
     1.4      claimed_stack_depth()->initialize();
     1.5      queue_size = claimed_stack_depth()->max_elems();
     1.6      // We want the overflow stack to be permanent
     1.7 -    _overflow_stack_depth = new (ResourceObj::C_HEAP) GrowableArray<oop*>(10, true);
     1.8 +    _overflow_stack_depth = new (ResourceObj::C_HEAP) GrowableArray<StarTask>(10, true);
     1.9      _overflow_stack_breadth = NULL;
    1.10    } else {
    1.11      claimed_stack_breadth()->initialize();
    1.12 @@ -240,6 +240,7 @@
    1.13  #endif // PS_PM_STATS
    1.14  }
    1.15  
    1.16 +
    1.17  void PSPromotionManager::drain_stacks_depth(bool totally_drain) {
    1.18    assert(depth_first(), "invariant");
    1.19    assert(overflow_stack_depth() != NULL, "invariant");
    1.20 @@ -254,13 +255,15 @@
    1.21  #endif /* ASSERT */
    1.22  
    1.23    do {
    1.24 -    oop* p;
    1.25 +    StarTask p;
    1.26  
    1.27      // Drain overflow stack first, so other threads can steal from
    1.28      // claimed stack while we work.
    1.29      while(!overflow_stack_depth()->is_empty()) {
    1.30 -      p = overflow_stack_depth()->pop();
    1.31 -      process_popped_location_depth(p);
    1.32 +      // linux compiler wants different overloaded operator= in taskqueue to
    1.33 +      // assign to p that the other compilers don't like.
    1.34 +      StarTask ptr = overflow_stack_depth()->pop();
    1.35 +      process_popped_location_depth(ptr);
    1.36      }
    1.37  
    1.38      if (totally_drain) {
    1.39 @@ -365,7 +368,7 @@
    1.40  //
    1.41  
    1.42  oop PSPromotionManager::copy_to_survivor_space(oop o, bool depth_first) {
    1.43 -  assert(PSScavenge::should_scavenge(o), "Sanity");
    1.44 +  assert(PSScavenge::should_scavenge(&o), "Sanity");
    1.45  
    1.46    oop new_obj = NULL;
    1.47  
    1.48 @@ -530,16 +533,30 @@
    1.49    // This code must come after the CAS test, or it will print incorrect
    1.50    // information.
    1.51    if (TraceScavenge) {
    1.52 -    gclog_or_tty->print_cr("{%s %s 0x%x -> 0x%x (%d)}",
    1.53 -       PSScavenge::should_scavenge(new_obj) ? "copying" : "tenuring",
    1.54 +    gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (" SIZE_FORMAT ")}",
    1.55 +       PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
    1.56         new_obj->blueprint()->internal_name(), o, new_obj, new_obj->size());
    1.57 -
    1.58    }
    1.59  #endif
    1.60  
    1.61    return new_obj;
    1.62  }
    1.63  
    1.64 +template <class T> void PSPromotionManager::process_array_chunk_work(
    1.65 +                                                 oop obj,
    1.66 +                                                 int start, int end) {
    1.67 +  assert(start < end, "invariant");
    1.68 +  T* const base      = (T*)objArrayOop(obj)->base();
    1.69 +  T* p               = base + start;
    1.70 +  T* const chunk_end = base + end;
    1.71 +  while (p < chunk_end) {
    1.72 +    if (PSScavenge::should_scavenge(p)) {
    1.73 +      claim_or_forward_depth(p);
    1.74 +    }
    1.75 +    ++p;
    1.76 +  }
    1.77 +}
    1.78 +
    1.79  void PSPromotionManager::process_array_chunk(oop old) {
    1.80    assert(PSChunkLargeArrays, "invariant");
    1.81    assert(old->is_objArray(), "invariant");
    1.82 @@ -569,15 +586,10 @@
    1.83      arrayOop(old)->set_length(actual_length);
    1.84    }
    1.85  
    1.86 -  assert(start < end, "invariant");
    1.87 -  oop* const base      = objArrayOop(obj)->base();
    1.88 -  oop* p               = base + start;
    1.89 -  oop* const chunk_end = base + end;
    1.90 -  while (p < chunk_end) {
    1.91 -    if (PSScavenge::should_scavenge(*p)) {
    1.92 -      claim_or_forward_depth(p);
    1.93 -    }
    1.94 -    ++p;
    1.95 +  if (UseCompressedOops) {
    1.96 +    process_array_chunk_work<narrowOop>(obj, start, end);
    1.97 +  } else {
    1.98 +    process_array_chunk_work<oop>(obj, start, end);
    1.99    }
   1.100  }
   1.101  

mercurial