102 cur = next();
103 }
104 return cur;
105 }
106 };
107
108 class VMMemPointerIterator : public MemPointerIterator {
109 public:
110 VMMemPointerIterator(MemPointerArray* arr):
111 MemPointerIterator(arr) {
112 }
113
114 // locate an existing reserved memory region that contains specified address,
115 // or the reserved region just above this address, where the incoming
116 // reserved region should be inserted.
117 virtual MemPointer* locate(address addr) {
118 reset();
119 VMMemRegion* reg = (VMMemRegion*)current();
120 while (reg != NULL) {
121 if (reg->is_reserved_region()) {
122 if (reg->contains_address(addr) || addr < reg->base()) {
123 return reg;
124 }
125 }
126 reg = (VMMemRegion*)next();
127 }
128 return NULL;
129 }
130
131 // following methods update virtual memory in the context
132 // of 'current' position, which is properly positioned by
133 // callers via locate method.
134 bool add_reserved_region(MemPointerRecord* rec);
135 bool add_committed_region(MemPointerRecord* rec);
136 bool remove_uncommitted_region(MemPointerRecord* rec);
137 bool remove_released_region(MemPointerRecord* rec);
138
139 // split a reserved region to create a new memory region with specified base and size
140 bool split_reserved_region(VMMemRegion* rgn, address new_rgn_addr, size_t new_rgn_size);
141 private:
142 bool insert_record(MemPointerRecord* rec);
|
102 cur = next();
103 }
104 return cur;
105 }
106 };
107
108 class VMMemPointerIterator : public MemPointerIterator {
109 public:
110 VMMemPointerIterator(MemPointerArray* arr):
111 MemPointerIterator(arr) {
112 }
113
114 // locate an existing reserved memory region that contains specified address,
115 // or the reserved region just above this address, where the incoming
116 // reserved region should be inserted.
117 virtual MemPointer* locate(address addr) {
118 reset();
119 VMMemRegion* reg = (VMMemRegion*)current();
120 while (reg != NULL) {
121 if (reg->is_reserved_region()) {
122 if (reg->contain_address(addr) || addr < reg->base()) {
123 return reg;
124 }
125 }
126 reg = (VMMemRegion*)next();
127 }
128 return NULL;
129 }
130
131 // following methods update virtual memory in the context
132 // of 'current' position, which is properly positioned by
133 // callers via locate method.
134 bool add_reserved_region(MemPointerRecord* rec);
135 bool add_committed_region(MemPointerRecord* rec);
136 bool remove_uncommitted_region(MemPointerRecord* rec);
137 bool remove_released_region(MemPointerRecord* rec);
138
139 // split a reserved region to create a new memory region with specified base and size
140 bool split_reserved_region(VMMemRegion* rgn, address new_rgn_addr, size_t new_rgn_size);
141 private:
142 bool insert_record(MemPointerRecord* rec);
|