equal
deleted
inserted
replaced
2979 // First, let's check that the GC alloc region list is empty (it should) |
2979 // First, let's check that the GC alloc region list is empty (it should) |
2980 assert(_gc_alloc_region_list == NULL, "invariant"); |
2980 assert(_gc_alloc_region_list == NULL, "invariant"); |
2981 |
2981 |
2982 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { |
2982 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { |
2983 assert(_gc_alloc_regions[ap] == NULL, "invariant"); |
2983 assert(_gc_alloc_regions[ap] == NULL, "invariant"); |
|
2984 assert(_gc_alloc_region_counts[ap] == 0, "invariant"); |
2984 |
2985 |
2985 // Create new GC alloc regions. |
2986 // Create new GC alloc regions. |
2986 HeapRegion* alloc_region = _retained_gc_alloc_regions[ap]; |
2987 HeapRegion* alloc_region = _retained_gc_alloc_regions[ap]; |
2987 _retained_gc_alloc_regions[ap] = NULL; |
2988 _retained_gc_alloc_regions[ap] = NULL; |
2988 |
2989 |
3007 } |
3008 } |
3008 |
3009 |
3009 if (alloc_region == NULL) { |
3010 if (alloc_region == NULL) { |
3010 // we will get a new GC alloc region |
3011 // we will get a new GC alloc region |
3011 alloc_region = newAllocRegionWithExpansion(ap, 0); |
3012 alloc_region = newAllocRegionWithExpansion(ap, 0); |
|
3013 } else { |
|
3014 // the region was retained from the last collection |
|
3015 ++_gc_alloc_region_counts[ap]; |
3012 } |
3016 } |
3013 |
3017 |
3014 if (alloc_region != NULL) { |
3018 if (alloc_region != NULL) { |
3015 assert(_gc_alloc_regions[ap] == NULL, "pre-condition"); |
3019 assert(_gc_alloc_regions[ap] == NULL, "pre-condition"); |
3016 set_gc_alloc_region(ap, alloc_region); |
3020 set_gc_alloc_region(ap, alloc_region); |
3045 // The current alloc regions contain objs that have survived |
3049 // The current alloc regions contain objs that have survived |
3046 // collection. Make them no longer GC alloc regions. |
3050 // collection. Make them no longer GC alloc regions. |
3047 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { |
3051 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { |
3048 HeapRegion* r = _gc_alloc_regions[ap]; |
3052 HeapRegion* r = _gc_alloc_regions[ap]; |
3049 _retained_gc_alloc_regions[ap] = NULL; |
3053 _retained_gc_alloc_regions[ap] = NULL; |
|
3054 _gc_alloc_region_counts[ap] = 0; |
3050 |
3055 |
3051 if (r != NULL) { |
3056 if (r != NULL) { |
3052 // we retain nothing on _gc_alloc_regions between GCs |
3057 // we retain nothing on _gc_alloc_regions between GCs |
3053 set_gc_alloc_region(ap, NULL); |
3058 set_gc_alloc_region(ap, NULL); |
3054 _gc_alloc_region_counts[ap] = 0; |
|
3055 |
3059 |
3056 if (r->is_empty()) { |
3060 if (r->is_empty()) { |
3057 // we didn't actually allocate anything in it; let's just put |
3061 // we didn't actually allocate anything in it; let's just put |
3058 // it on the free list |
3062 // it on the free list |
3059 MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); |
3063 MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); |