69 void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) { |
69 void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) { |
70 assert(mapping_granularity_in_bytes > 0, "just checking"); |
70 assert(mapping_granularity_in_bytes > 0, "just checking"); |
71 assert(is_power_of_2(mapping_granularity_in_bytes), |
71 assert(is_power_of_2(mapping_granularity_in_bytes), |
72 err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes)); |
72 err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes)); |
73 assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0, |
73 assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0, |
74 err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, |
74 err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT, |
75 mapping_granularity_in_bytes, p2i(bottom))); |
75 mapping_granularity_in_bytes, p2i(bottom))); |
76 assert((uintptr_t)end % mapping_granularity_in_bytes == 0, |
76 assert((uintptr_t)end % mapping_granularity_in_bytes == 0, |
77 err_msg("end mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, |
77 err_msg("end mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT, |
78 mapping_granularity_in_bytes, p2i(end))); |
78 mapping_granularity_in_bytes, p2i(end))); |
79 size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes); |
79 size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes); |
80 idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes; |
80 idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes; |
81 address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes); |
81 address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes); |
82 initialize_base(base, num_target_elems, bias, target_elem_size_in_bytes, log2_intptr(mapping_granularity_in_bytes)); |
82 initialize_base(base, num_target_elems, bias, target_elem_size_in_bytes, log2_intptr(mapping_granularity_in_bytes)); |