23 */ |
23 */ |
24 |
24 |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP |
27 |
27 |
|
28 #include "memory/allocation.hpp" |
28 #include "utilities/debug.hpp" |
29 #include "utilities/debug.hpp" |
29 #include "memory/allocation.inline.hpp" |
|
30 |
30 |
31 // Implements the common base functionality for arrays that contain provisions |
31 // Implements the common base functionality for arrays that contain provisions |
32 // for accessing its elements using a biased index. |
32 // for accessing its elements using a biased index. |
33 // The element type is defined by the instantiating the template. |
33 // The element type is defined by the instantiating the template. |
34 class G1BiasedMappedArrayBase VALUE_OBJ_CLASS_SPEC { |
34 class G1BiasedMappedArrayBase VALUE_OBJ_CLASS_SPEC { |
46 |
46 |
47 G1BiasedMappedArrayBase() : _base(NULL), _length(0), _biased_base(NULL), |
47 G1BiasedMappedArrayBase() : _base(NULL), _length(0), _biased_base(NULL), |
48 _bias(0), _shift_by(0) { } |
48 _bias(0), _shift_by(0) { } |
49 |
49 |
50 // Allocate a new array, generic version. |
50 // Allocate a new array, generic version. |
51 static address create_new_base_array(size_t length, size_t elem_size) { |
51 static address create_new_base_array(size_t length, size_t elem_size); |
52 assert(length > 0, "just checking"); |
|
53 assert(elem_size > 0, "just checking"); |
|
54 return NEW_C_HEAP_ARRAY(u_char, length * elem_size, mtGC); |
|
55 } |
|
56 |
52 |
57 // Initialize the members of this class. The biased start address of this array |
53 // Initialize the members of this class. The biased start address of this array |
58 // is the bias (in elements) multiplied by the element size. |
54 // is the bias (in elements) multiplied by the element size. |
59 void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) { |
55 void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) { |
60 assert(base != NULL, "just checking"); |
56 assert(base != NULL, "just checking"); |