32 // A very simple data structure representing a contigous region |
32 // A very simple data structure representing a contigous region |
33 // region of address space. |
33 // region of address space. |
34 |
34 |
35 // Note that MemRegions are passed by value, not by reference. |
35 // Note that MemRegions are passed by value, not by reference. |
36 // The intent is that they remain very small and contain no |
36 // The intent is that they remain very small and contain no |
37 // objects. |
37 // objects. _ValueObj should never be allocated in heap but we do |
|
38 // create MemRegions (in CardTableModRefBS) in heap so operator |
|
39 // new and operator new [] added for this special case. |
38 |
40 |
39 class MetaWord; |
41 class MetaWord; |
40 |
42 |
41 class MemRegion VALUE_OBJ_CLASS_SPEC { |
43 class MemRegion VALUE_OBJ_CLASS_SPEC { |
42 friend class VMStructs; |
44 friend class VMStructs; |
90 |
92 |
91 size_t byte_size() const { return _word_size * sizeof(HeapWord); } |
93 size_t byte_size() const { return _word_size * sizeof(HeapWord); } |
92 size_t word_size() const { return _word_size; } |
94 size_t word_size() const { return _word_size; } |
93 |
95 |
94 bool is_empty() const { return word_size() == 0; } |
96 bool is_empty() const { return word_size() == 0; } |
|
97 void* operator new(size_t size); |
|
98 void* operator new [](size_t size); |
|
99 void operator delete(void* p); |
|
100 void operator delete [](void* p); |
95 }; |
101 }; |
96 |
102 |
97 // For iteration over MemRegion's. |
103 // For iteration over MemRegion's. |
98 |
104 |
99 class MemRegionClosure : public StackObj { |
105 class MemRegionClosure : public StackObj { |