Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/cardTableModRefBS.cpp @ 10969:a837fa3d3f86
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
Summary: Detect mmap() commit failures in Linux and Solaris os::commit_memory() impls and call vm_exit_out_of_memory(). Add os::commit_memory_or_exit(). Also tidy up some NMT accounting and some mmap() return value checking.
Reviewed-by: zgu, stefank, dholmes, dsamersoff
author | dcubed |
---|---|
date | Thu, 13 Jun 2013 11:16:38 -0700 |
parents | f9be75d21404 |
children | ef57c43512d6 |
comparison
equal
deleted
inserted
replaced
10405:f2110083203d | 10969:a837fa3d3f86 |
---|---|
108 assert(byte_for(high_bound-1) <= &_byte_map[_last_valid_index], "Checking end of map"); | 108 assert(byte_for(high_bound-1) <= &_byte_map[_last_valid_index], "Checking end of map"); |
109 | 109 |
110 jbyte* guard_card = &_byte_map[_guard_index]; | 110 jbyte* guard_card = &_byte_map[_guard_index]; |
111 uintptr_t guard_page = align_size_down((uintptr_t)guard_card, _page_size); | 111 uintptr_t guard_page = align_size_down((uintptr_t)guard_card, _page_size); |
112 _guard_region = MemRegion((HeapWord*)guard_page, _page_size); | 112 _guard_region = MemRegion((HeapWord*)guard_page, _page_size); |
113 if (!os::commit_memory((char*)guard_page, _page_size, _page_size)) { | 113 os::commit_memory_or_exit((char*)guard_page, _page_size, _page_size, |
114 // Do better than this for Merlin | 114 !ExecMem, "card table last card"); |
115 vm_exit_out_of_memory(_page_size, OOM_MMAP_ERROR, "card table last card"); | |
116 } | |
117 | |
118 *guard_card = last_card; | 115 *guard_card = last_card; |
119 | 116 |
120 _lowest_non_clean = | 117 _lowest_non_clean = |
121 NEW_C_HEAP_ARRAY(CardArr, max_covered_regions, mtGC); | 118 NEW_C_HEAP_ARRAY(CardArr, max_covered_regions, mtGC); |
122 _lowest_non_clean_chunk_size = | 119 _lowest_non_clean_chunk_size = |
310 // Must commit new pages. | 307 // Must commit new pages. |
311 MemRegion const new_committed = | 308 MemRegion const new_committed = |
312 MemRegion(cur_committed.end(), new_end_for_commit); | 309 MemRegion(cur_committed.end(), new_end_for_commit); |
313 | 310 |
314 assert(!new_committed.is_empty(), "Region should not be empty here"); | 311 assert(!new_committed.is_empty(), "Region should not be empty here"); |
315 if (!os::commit_memory((char*)new_committed.start(), | 312 os::commit_memory_or_exit((char*)new_committed.start(), |
316 new_committed.byte_size(), _page_size)) { | 313 new_committed.byte_size(), _page_size, |
317 // Do better than this for Merlin | 314 !ExecMem, "card table expansion"); |
318 vm_exit_out_of_memory(new_committed.byte_size(), OOM_MMAP_ERROR, | |
319 "card table expansion"); | |
320 } | |
321 // Use new_end_aligned (as opposed to new_end_for_commit) because | 315 // Use new_end_aligned (as opposed to new_end_for_commit) because |
322 // the cur_committed region may include the guard region. | 316 // the cur_committed region may include the guard region. |
323 } else if (new_end_aligned < cur_committed.end()) { | 317 } else if (new_end_aligned < cur_committed.end()) { |
324 // Must uncommit pages. | 318 // Must uncommit pages. |
325 MemRegion const uncommit_region = | 319 MemRegion const uncommit_region = |