src/share/vm/memory/heap.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
JDK-8015774 Cdiff src/share/vm/memory/heap.cpp
src/share/vm/memory/heap.cpp
Print this page
*** 33,50 ****
}
// Implementation of Heap
! CodeHeap::CodeHeap() {
_number_of_committed_segments = 0;
_number_of_reserved_segments = 0;
_segment_size = 0;
_log2_segment_size = 0;
_next_segment = 0;
_freelist = NULL;
_freelist_segments = 0;
}
void CodeHeap::mark_segmap_as_free(size_t beg, size_t end) {
assert(0 <= beg && beg < _number_of_committed_segments, "interval begin out of bounds");
--- 33,54 ----
}
// Implementation of Heap
! CodeHeap::CodeHeap(const char* name, const int code_blob_type)
! : _code_blob_type(code_blob_type) {
! _name = name;
_number_of_committed_segments = 0;
_number_of_reserved_segments = 0;
_segment_size = 0;
_log2_segment_size = 0;
_next_segment = 0;
_freelist = NULL;
_freelist_segments = 0;
+ _max_allocated_capacity = 0;
+ _was_full = false;
}
void CodeHeap::mark_segmap_as_free(size_t beg, size_t end) {
assert(0 <= beg && beg < _number_of_committed_segments, "interval begin out of bounds");
*** 85,116 ****
linux_wrap_code(base, size);
#endif
}
! bool CodeHeap::reserve(size_t reserved_size, size_t committed_size,
! size_t segment_size) {
! assert(reserved_size >= committed_size, "reserved < committed");
assert(segment_size >= sizeof(FreeBlock), "segment size is too small");
assert(is_power_of_2(segment_size), "segment_size must be a power of 2");
_segment_size = segment_size;
_log2_segment_size = exact_log2(segment_size);
// Reserve and initialize space for _memory.
const size_t page_size = os::can_execute_large_page_memory() ?
! os::page_size_for_region(committed_size, reserved_size, 8) :
os::vm_page_size();
const size_t granularity = os::vm_allocation_granularity();
- const size_t r_align = MAX2(page_size, granularity);
- const size_t r_size = align_size_up(reserved_size, r_align);
const size_t c_size = align_size_up(committed_size, page_size);
! const size_t rs_align = page_size == (size_t) os::vm_page_size() ? 0 :
! MAX2(page_size, granularity);
! ReservedCodeSpace rs(r_size, rs_align, rs_align > 0);
! os::trace_page_sizes("code heap", committed_size, reserved_size, page_size,
rs.base(), rs.size());
if (!_memory.initialize(rs, c_size)) {
return false;
}
--- 89,113 ----
linux_wrap_code(base, size);
#endif
}
! bool CodeHeap::reserve(ReservedSpace rs, size_t committed_size, size_t segment_size) {
assert(segment_size >= sizeof(FreeBlock), "segment size is too small");
assert(is_power_of_2(segment_size), "segment_size must be a power of 2");
_segment_size = segment_size;
_log2_segment_size = exact_log2(segment_size);
// Reserve and initialize space for _memory.
const size_t page_size = os::can_execute_large_page_memory() ?
! os::page_size_for_region(committed_size, rs.size(), 8) :
os::vm_page_size();
const size_t granularity = os::vm_allocation_granularity();
const size_t c_size = align_size_up(committed_size, page_size);
! os::trace_page_sizes(_name, committed_size, rs.size(), page_size,
rs.base(), rs.size());
if (!_memory.initialize(rs, c_size)) {
return false;
}
*** 191,200 ****
--- 188,198 ----
assert(block->length() >= number_of_segments && block->length() < number_of_segments + CodeCacheMinBlockLength, "sanity check");
assert(!block->free(), "must be marked free");
#ifdef ASSERT
memset((void *)block->allocated_space(), badCodeHeapNewVal, instance_size);
#endif
+ _max_allocated_capacity = MAX2(_max_allocated_capacity, allocated_capacity());
return block->allocated_space();
}
// Ensure minimum size for allocation to the heap.
if (number_of_segments < CodeCacheMinBlockLength) {
*** 216,225 ****
--- 214,224 ----
b->initialize(number_of_segments);
_next_segment += number_of_segments;
#ifdef ASSERT
memset((void *)b->allocated_space(), badCodeHeapNewVal, instance_size);
#endif
+ _max_allocated_capacity = MAX2(_max_allocated_capacity, allocated_capacity());
return b->allocated_space();
} else {
return NULL;
}
}
src/share/vm/memory/heap.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File