126 assert(nm != NULL, "must be able to deduce nmethod from other arguments"); |
126 assert(nm != NULL, "must be able to deduce nmethod from other arguments"); |
127 |
127 |
128 _code = nm; |
128 _code = nm; |
129 _current = nm->relocation_begin() - 1; |
129 _current = nm->relocation_begin() - 1; |
130 _end = nm->relocation_end(); |
130 _end = nm->relocation_end(); |
131 _addr = (address) nm->instructions_begin(); |
131 _addr = (address) nm->code_begin(); |
132 |
132 |
133 assert(!has_current(), "just checking"); |
133 assert(!has_current(), "just checking"); |
134 address code_end = nm->instructions_end(); |
134 assert(begin == NULL || begin >= nm->code_begin(), "in bounds"); |
135 |
135 assert(limit == NULL || limit <= nm->code_end(), "in bounds"); |
136 assert(begin == NULL || begin >= nm->instructions_begin(), "in bounds"); |
|
137 // FIX THIS assert(limit == NULL || limit <= code_end, "in bounds"); |
|
138 set_limits(begin, limit); |
136 set_limits(begin, limit); |
139 } |
137 } |
140 |
138 |
141 |
139 |
142 RelocIterator::RelocIterator(CodeSection* cs, address begin, address limit) { |
140 RelocIterator::RelocIterator(CodeSection* cs, address begin, address limit) { |
265 #endif // ASSERT |
263 #endif // ASSERT |
266 if (index_size > 0) { |
264 if (index_size > 0) { |
267 // skip ahead |
265 // skip ahead |
268 RelocIndexEntry* index = (RelocIndexEntry*)_end; |
266 RelocIndexEntry* index = (RelocIndexEntry*)_end; |
269 RelocIndexEntry* index_limit = (RelocIndexEntry*)((address)index + index_size); |
267 RelocIndexEntry* index_limit = (RelocIndexEntry*)((address)index + index_size); |
270 assert(_addr == _code->instructions_begin(), "_addr must be unadjusted"); |
268 assert(_addr == _code->code_begin(), "_addr must be unadjusted"); |
271 int card = (begin - _addr) / indexCardSize; |
269 int card = (begin - _addr) / indexCardSize; |
272 if (card > 0) { |
270 if (card > 0) { |
273 if (index+card-1 < index_limit) index += card-1; |
271 if (index+card-1 < index_limit) index += card-1; |
274 else index = index_limit - 1; |
272 else index = index_limit - 1; |
275 #ifdef ASSERT |
273 #ifdef ASSERT |
367 // memoizes it for later. |
365 // memoizes it for later. |
368 #define CACHE ((RelocIterator*)this)->_section_start[n] |
366 #define CACHE ((RelocIterator*)this)->_section_start[n] |
369 CodeBlob* cb = code(); |
367 CodeBlob* cb = code(); |
370 guarantee(cb != NULL, "must have a code blob"); |
368 guarantee(cb != NULL, "must have a code blob"); |
371 if (n == CodeBuffer::SECT_INSTS) |
369 if (n == CodeBuffer::SECT_INSTS) |
372 return CACHE = cb->instructions_begin(); |
370 return CACHE = cb->code_begin(); |
373 assert(cb->is_nmethod(), "only nmethods have these sections"); |
371 assert(cb->is_nmethod(), "only nmethods have these sections"); |
374 nmethod* nm = (nmethod*) cb; |
372 nmethod* nm = (nmethod*) cb; |
375 address res = NULL; |
373 address res = NULL; |
376 switch (n) { |
374 switch (n) { |
377 case CodeBuffer::SECT_STUBS: |
375 case CodeBuffer::SECT_STUBS: |