src/share/vm/gc_implementation/concurrentMarkSweep/cmsPermGen.cpp

changeset 574
c0492d52d55b
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
     1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsPermGen.cpp	Thu Mar 27 17:22:06 2008 -0700
     1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsPermGen.cpp	Tue Apr 01 15:13:47 2008 +0400
     1.3 @@ -44,52 +44,12 @@
     1.4    bool lock_owned = lock->owned_by_self();
     1.5    if (lock_owned) {
     1.6      MutexUnlocker mul(lock);
     1.7 -    return mem_allocate_work(size);
     1.8 +    return mem_allocate_in_gen(size, _gen);
     1.9    } else {
    1.10 -    return mem_allocate_work(size);
    1.11 +    return mem_allocate_in_gen(size, _gen);
    1.12    }
    1.13  }
    1.14  
    1.15 -HeapWord* CMSPermGen::mem_allocate_work(size_t size) {
    1.16 -  assert(!_gen->freelistLock()->owned_by_self(), "Potetntial deadlock");
    1.17 -
    1.18 -  MutexLocker ml(Heap_lock);
    1.19 -  HeapWord* obj = NULL;
    1.20 -
    1.21 -  obj = _gen->allocate(size, false);
    1.22 -  // Since we want to minimize pause times, we will prefer
    1.23 -  // expanding the perm gen rather than doing a stop-world
    1.24 -  // collection to satisfy the allocation request.
    1.25 -  if (obj == NULL) {
    1.26 -    // Try to expand the perm gen and allocate space.
    1.27 -    obj = _gen->expand_and_allocate(size, false, false);
    1.28 -    if (obj == NULL) {
    1.29 -      // Let's see if a normal stop-world full collection will
    1.30 -      // free up enough space.
    1.31 -      SharedHeap::heap()->collect_locked(GCCause::_permanent_generation_full);
    1.32 -      obj = _gen->allocate(size, false);
    1.33 -      if (obj == NULL) {
    1.34 -        // The collection above may have shrunk the space, so try
    1.35 -        // to expand again and allocate space.
    1.36 -        obj = _gen->expand_and_allocate(size, false, false);
    1.37 -      }
    1.38 -      if (obj == NULL) {
    1.39 -        // We have not been able to allocate space despite a
    1.40 -        // full stop-world collection. We now make a last-ditch collection
    1.41 -        // attempt (in which soft refs are all aggressively freed)
    1.42 -        // that will try to reclaim as much space as possible.
    1.43 -        SharedHeap::heap()->collect_locked(GCCause::_last_ditch_collection);
    1.44 -        obj = _gen->allocate(size, false);
    1.45 -        if (obj == NULL) {
    1.46 -          // Expand generation in case it was shrunk following the collection.
    1.47 -          obj = _gen->expand_and_allocate(size, false, false);
    1.48 -        }
    1.49 -      }
    1.50 -    }
    1.51 -  }
    1.52 -  return obj;
    1.53 -}
    1.54 -
    1.55  void CMSPermGen::compute_new_size() {
    1.56    _gen->compute_new_size();
    1.57  }

mercurial