comparison src/share/vm/memory/cardTableModRefBS.cpp @ 6197:d2a62e0f25eb

6995781: Native Memory Tracking (Phase 1) 7151532: DCmd for hotspot native memory tracking Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd Reviewed-by: acorn, coleenp, fparain
author zgu
date Thu, 28 Jun 2012 17:03:16 -0400
parents fd09f2d8283e
children b9a9ed0f8eeb
comparison
equal deleted inserted replaced
6174:74533f63b116 6197:d2a62e0f25eb
31 #include "memory/space.inline.hpp" 31 #include "memory/space.inline.hpp"
32 #include "memory/universe.hpp" 32 #include "memory/universe.hpp"
33 #include "runtime/java.hpp" 33 #include "runtime/java.hpp"
34 #include "runtime/mutexLocker.hpp" 34 #include "runtime/mutexLocker.hpp"
35 #include "runtime/virtualspace.hpp" 35 #include "runtime/virtualspace.hpp"
36 #include "services/memTracker.hpp"
36 #ifdef COMPILER1 37 #ifdef COMPILER1
37 #include "c1/c1_LIR.hpp" 38 #include "c1/c1_LIR.hpp"
38 #include "c1/c1_LIRGenerator.hpp" 39 #include "c1/c1_LIRGenerator.hpp"
39 #endif 40 #endif
40 41
88 _cur_covered_regions = 0; 89 _cur_covered_regions = 0;
89 90
90 const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 : 91 const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 :
91 MAX2(_page_size, (size_t) os::vm_allocation_granularity()); 92 MAX2(_page_size, (size_t) os::vm_allocation_granularity());
92 ReservedSpace heap_rs(_byte_map_size, rs_align, false); 93 ReservedSpace heap_rs(_byte_map_size, rs_align, false);
94
95 MemTracker::record_virtual_memory_type((address)heap_rs.base(), mtGC);
96
93 os::trace_page_sizes("card table", _guard_index + 1, _guard_index + 1, 97 os::trace_page_sizes("card table", _guard_index + 1, _guard_index + 1,
94 _page_size, heap_rs.base(), heap_rs.size()); 98 _page_size, heap_rs.base(), heap_rs.size());
95 if (!heap_rs.is_reserved()) { 99 if (!heap_rs.is_reserved()) {
96 vm_exit_during_initialization("Could not reserve enough space for the " 100 vm_exit_during_initialization("Could not reserve enough space for the "
97 "card marking array"); 101 "card marking array");
111 _guard_region = MemRegion((HeapWord*)guard_page, _page_size); 115 _guard_region = MemRegion((HeapWord*)guard_page, _page_size);
112 if (!os::commit_memory((char*)guard_page, _page_size, _page_size)) { 116 if (!os::commit_memory((char*)guard_page, _page_size, _page_size)) {
113 // Do better than this for Merlin 117 // Do better than this for Merlin
114 vm_exit_out_of_memory(_page_size, "card table last card"); 118 vm_exit_out_of_memory(_page_size, "card table last card");
115 } 119 }
120
116 *guard_card = last_card; 121 *guard_card = last_card;
117 122
118 _lowest_non_clean = 123 _lowest_non_clean =
119 NEW_C_HEAP_ARRAY(CardArr, max_covered_regions); 124 NEW_C_HEAP_ARRAY(CardArr, max_covered_regions, mtGC);
120 _lowest_non_clean_chunk_size = 125 _lowest_non_clean_chunk_size =
121 NEW_C_HEAP_ARRAY(size_t, max_covered_regions); 126 NEW_C_HEAP_ARRAY(size_t, max_covered_regions, mtGC);
122 _lowest_non_clean_base_chunk_index = 127 _lowest_non_clean_base_chunk_index =
123 NEW_C_HEAP_ARRAY(uintptr_t, max_covered_regions); 128 NEW_C_HEAP_ARRAY(uintptr_t, max_covered_regions, mtGC);
124 _last_LNC_resizing_collection = 129 _last_LNC_resizing_collection =
125 NEW_C_HEAP_ARRAY(int, max_covered_regions); 130 NEW_C_HEAP_ARRAY(int, max_covered_regions, mtGC);
126 if (_lowest_non_clean == NULL 131 if (_lowest_non_clean == NULL
127 || _lowest_non_clean_chunk_size == NULL 132 || _lowest_non_clean_chunk_size == NULL
128 || _lowest_non_clean_base_chunk_index == NULL 133 || _lowest_non_clean_base_chunk_index == NULL
129 || _last_LNC_resizing_collection == NULL) 134 || _last_LNC_resizing_collection == NULL)
130 vm_exit_during_initialization("couldn't allocate an LNC array."); 135 vm_exit_during_initialization("couldn't allocate an LNC array.");