--- old/src/share/vm/gc/g1/g1CollectedHeap.hpp 2015-06-11 15:13:01.888905002 -0400 +++ new/src/share/vm/gc/g1/g1CollectedHeap.hpp 2015-06-11 15:13:00.548828360 -0400 @@ -575,6 +575,10 @@ void retire_gc_alloc_region(HeapRegion* alloc_region, size_t allocated_bytes, InCSetState dest); + // Allocate the highest free region in the reserved heap. This will commit + // regions as necessary. + HeapRegion* alloc_highest_free_region(); + // - if explicit_gc is true, the GC is for a System.gc() or a heap // inspection request and should collect the entire heap // - if clear_all_soft_refs is true, all soft references should be @@ -733,33 +737,42 @@ FreeRegionList* free_list, bool par); - // Facility for allocating in 'archive' regions in high heap memory from - // the VM thread, and recording the allocated ranges. The end_ call - // optionally aligns the end address and returns the allocated ranges as - // an ascending array of MemRegions. This can be used to create and - // archive a heap region which can be mapped at the same fixed addresses - // in a future JVM instance. + // Facility for allocating in 'archive' regions in high heap memory and + // recording the allocated ranges. These should all be called from the + // VM thread at safepoints, without the heap lock held. They can be used + // to create and archive a set of heap regions which can be mapped at the + // same fixed addresses in a subsequent JVM invocation. void begin_archive_alloc_range(); - void end_archive_alloc_range(GrowableArray* ranges, - uint end_alignment = 0); + + // Check if the requested size would be too large for an archive allocation. bool is_archive_alloc_too_large(size_t word_size); + + // Allocate memory of the requested size from the archive region. This will + // return NULL if the size is too large or if no memory is available. It + // does not trigger a garbage collection. HeapWord* archive_mem_allocate(size_t word_size); - HeapRegion* alloc_highest_available_region(); - // Facility for allocating a fixed range within the heap and marking - // the containing regions as 'archive'. For use at JVM init time, when the caller - // may mmap archived heap data at the specified range(s). The check_ call - // verifies that the regions are within the reserved heap. The alloc_ call - // commits the appropriate regions and marks them as 'archive," after which - // the caller can perform the mmap. The fill_ call (which must occur after class - // loading) inserts any required filler objects around the specified ranges - // to make the regions parseable. - bool check_archive_addresses(MemRegion* range, uint count); - bool alloc_archive_regions(MemRegion* range, uint count); - void fill_archive_regions(MemRegion* range, uint count); + // Optionally aligns the end address and returns the allocated ranges in + // an array of MemRegions in order of ascending addresses. + void end_archive_alloc_range(GrowableArray* ranges, + size_t end_alignment_in_bytes = 0); - // Fill the requested space without creating any humongous objects. - static void fill_with_non_humongous_objects(HeapWord* base_address, size_t word_size); + // Facility for allocating a fixed range within the heap and marking + // the containing regions as 'archive'. For use at JVM init time, when the + // caller may mmap archived heap data at the specified range(s). + // Verify that the MemRegions specified in the argument array are within the + // reserved heap. + bool check_archive_addresses(MemRegion* range, size_t count); + + // Commit the appropriate G1 regions containing the specified MemRegions + // and mark them as 'archive' regions. The regions in the array must be + // non-overlapping and in order of ascending address. + bool alloc_archive_regions(MemRegion* range, size_t count); + + // Insert any required filler objects in the G1 regions around the specified + // ranges to make the regions parseable. This must be called after + // alloc_archive_regions, and after class loading has occurred. + void fill_archive_regions(MemRegion* range, size_t count); protected: