54 assert(bits % (BitsPerWord * 2) == 0, "region size unaligned");
55
56 const size_t words = bits / BitsPerWord;
57 const size_t raw_bytes = words * sizeof(idx_t);
58 const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10);
59 const size_t granularity = os::vm_allocation_granularity();
60 _reserved_byte_size = align_size_up(raw_bytes, MAX2(page_sz, granularity));
61
62 const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 :
63 MAX2(page_sz, granularity);
64 ReservedSpace rs(_reserved_byte_size, rs_align, rs_align > 0);
65 os::trace_page_sizes("par bitmap", raw_bytes, raw_bytes, page_sz,
66 rs.base(), rs.size());
67
68 MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
69
70 _virtual_space = new PSVirtualSpace(rs, page_sz);
71 if (_virtual_space != NULL && _virtual_space->expand_by(_reserved_byte_size)) {
72 _region_start = covered_region.start();
73 _region_size = covered_region.word_size();
74 idx_t* map = (idx_t*)_virtual_space->reserved_low_addr();
75 _beg_bits.set_map(map);
76 _beg_bits.set_size(bits / 2);
77 _end_bits.set_map(map + words / 2);
78 _end_bits.set_size(bits / 2);
79 return true;
80 }
81
82 _region_start = 0;
83 _region_size = 0;
84 if (_virtual_space != NULL) {
85 delete _virtual_space;
86 _virtual_space = NULL;
87 // Release memory reserved in the space.
88 rs.release();
89 }
90 return false;
91 }
92
93 #ifdef ASSERT
94 extern size_t mark_bitmap_count;
|
54 assert(bits % (BitsPerWord * 2) == 0, "region size unaligned");
55
56 const size_t words = bits / BitsPerWord;
57 const size_t raw_bytes = words * sizeof(idx_t);
58 const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10);
59 const size_t granularity = os::vm_allocation_granularity();
60 _reserved_byte_size = align_size_up(raw_bytes, MAX2(page_sz, granularity));
61
62 const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 :
63 MAX2(page_sz, granularity);
64 ReservedSpace rs(_reserved_byte_size, rs_align, rs_align > 0);
65 os::trace_page_sizes("par bitmap", raw_bytes, raw_bytes, page_sz,
66 rs.base(), rs.size());
67
68 MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
69
70 _virtual_space = new PSVirtualSpace(rs, page_sz);
71 if (_virtual_space != NULL && _virtual_space->expand_by(_reserved_byte_size)) {
72 _region_start = covered_region.start();
73 _region_size = covered_region.word_size();
74 BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr();
75 _beg_bits.set_map(map);
76 _beg_bits.set_size(bits / 2);
77 _end_bits.set_map(map + words / 2);
78 _end_bits.set_size(bits / 2);
79 return true;
80 }
81
82 _region_start = 0;
83 _region_size = 0;
84 if (_virtual_space != NULL) {
85 delete _virtual_space;
86 _virtual_space = NULL;
87 // Release memory reserved in the space.
88 rs.release();
89 }
90 return false;
91 }
92
93 #ifdef ASSERT
94 extern size_t mark_bitmap_count;
|