src/share/vm/memory/heap.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/memory/heap.cpp	Thu Oct 23 13:40:55 2014
--- new/src/share/vm/memory/heap.cpp	Thu Oct 23 13:40:54 2014

*** 169,185 **** --- 169,185 ---- _next_segment = 0; mark_segmap_as_free(0, _number_of_committed_segments); } - void* CodeHeap::allocate(size_t instance_size, bool is_critical) { size_t number_of_segments = size_to_segments(instance_size + header_size()); assert(segments_to_size(number_of_segments) >= sizeof(FreeBlock), "not enough room for FreeList"); // First check if we can satisfy request from freelist NOT_PRODUCT(verify()); - HeapBlock* block = search_freelist(number_of_segments, is_critical); NOT_PRODUCT(verify()); if (block != NULL) { assert(block->length() >= number_of_segments && block->length() < number_of_segments + CodeCacheMinBlockLength, "sanity check"); assert(!block->free(), "must be marked free");
*** 189,207 **** --- 189,198 ---- } // Ensure minimum size for allocation to the heap. number_of_segments = MAX2((int)CodeCacheMinBlockLength, (int)number_of_segments); if (!is_critical) { // Make sure the allocation fits in the unallocated heap without using // the CodeCacheMimimumFreeSpace that is reserved for critical allocations. if (segments_to_size(number_of_segments) > (heap_unallocated_capacity() - CodeCacheMinimumFreeSpace)) { // Fail allocation return NULL; } } if (_next_segment + number_of_segments <= _number_of_committed_segments) { mark_segmap_as_used(_next_segment, _next_segment + number_of_segments); HeapBlock* b = block_at(_next_segment); b->initialize(number_of_segments); _next_segment += number_of_segments;
*** 425,452 **** --- 416,436 ---- /** * Search freelist for an entry on the list with the best fit. * @return NULL, if no one was found */ - FreeBlock* CodeHeap::search_freelist(size_t length, bool is_critical) { FreeBlock* found_block = NULL; FreeBlock* found_prev = NULL; size_t found_length = 0; FreeBlock* prev = NULL; FreeBlock* cur = _freelist; const size_t critical_boundary = (size_t)high_boundary() - CodeCacheMinimumFreeSpace; // Search for first block that fits while(cur != NULL) { if (cur->length() >= length) { // Non critical allocations are not allowed to use the last part of the code heap. // Make sure the end of the allocation doesn't cross into the last part of the code heap. if (!is_critical && (((size_t)cur + length) > critical_boundary)) { // The freelist is sorted by address - if one fails, all consecutive will also fail. break; } // Remember block, its previous element, and its length found_block = cur; found_prev = prev; found_length = found_block->length();

src/share/vm/memory/heap.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File