2940 assert(purpose >= 0 && purpose < GCAllocPurposeCount, "invalid purpose"); |
2940 assert(purpose >= 0 && purpose < GCAllocPurposeCount, "invalid purpose"); |
2941 // make sure we don't call set_gc_alloc_region() multiple times on |
2941 // make sure we don't call set_gc_alloc_region() multiple times on |
2942 // the same region |
2942 // the same region |
2943 assert(r == NULL || !r->is_gc_alloc_region(), |
2943 assert(r == NULL || !r->is_gc_alloc_region(), |
2944 "shouldn't already be a GC alloc region"); |
2944 "shouldn't already be a GC alloc region"); |
|
2945 assert(r == NULL || !r->isHumongous(), |
|
2946 "humongous regions shouldn't be used as GC alloc regions"); |
|
2947 |
2945 HeapWord* original_top = NULL; |
2948 HeapWord* original_top = NULL; |
2946 if (r != NULL) |
2949 if (r != NULL) |
2947 original_top = r->top(); |
2950 original_top = r->top(); |
2948 |
2951 |
2949 // We will want to record the used space in r as being there before gc. |
2952 // We will want to record the used space in r as being there before gc. |
3082 // outside a GC operation |
3085 // outside a GC operation |
3083 assert(!alloc_region->is_gc_alloc_region(), "sanity"); |
3086 assert(!alloc_region->is_gc_alloc_region(), "sanity"); |
3084 |
3087 |
3085 if (alloc_region->in_collection_set() || |
3088 if (alloc_region->in_collection_set() || |
3086 alloc_region->top() == alloc_region->end() || |
3089 alloc_region->top() == alloc_region->end() || |
3087 alloc_region->top() == alloc_region->bottom()) { |
3090 alloc_region->top() == alloc_region->bottom() || |
3088 // we will discard the current GC alloc region if it's in the |
3091 alloc_region->isHumongous()) { |
3089 // collection set (it can happen!), if it's already full (no |
3092 // we will discard the current GC alloc region if |
3090 // point in using it), or if it's empty (this means that it |
3093 // * it's in the collection set (it can happen!), |
3091 // was emptied during a cleanup and it should be on the free |
3094 // * it's already full (no point in using it), |
3092 // list now). |
3095 // * it's empty (this means that it was emptied during |
|
3096 // a cleanup and it should be on the free list now), or |
|
3097 // * it's humongous (this means that it was emptied |
|
3098 // during a cleanup and was added to the free list, but |
|
3099 // has been subseqently used to allocate a humongous |
|
3100 // object that may be less than the region size). |
3093 |
3101 |
3094 alloc_region = NULL; |
3102 alloc_region = NULL; |
3095 } |
3103 } |
3096 } |
3104 } |
3097 |
3105 |