311 Relocation* reloc = spec.reloc();
312 relocInfo::relocType rtype = (relocInfo::relocType) reloc->type();
313 if (rtype == relocInfo::none) return;
314
315 // The assertion below has been adjusted, to also work for
316 // relocation for fixup. Sometimes we want to put relocation
317 // information for the next instruction, since it will be patched
318 // with a call.
319 assert(start() <= at && at <= end()+1,
320 "cannot relocate data outside code boundaries");
321
322 if (!has_locs()) {
323 // no space for relocation information provided => code cannot be
324 // relocated. Make sure that relocate is only called with rtypes
325 // that can be ignored for this kind of code.
326 assert(rtype == relocInfo::none ||
327 rtype == relocInfo::runtime_call_type ||
328 rtype == relocInfo::internal_word_type||
329 rtype == relocInfo::section_word_type ||
330 rtype == relocInfo::external_word_type||
331 rtype == relocInfo::barrier_type,
332 "code needs relocation information");
333 // leave behind an indication that we attempted a relocation
334 DEBUG_ONLY(_locs_start = _locs_limit = (relocInfo*)badAddress);
335 return;
336 }
337
338 // Advance the point, noting the offset we'll have to record.
339 csize_t offset = at - locs_point();
340 set_locs_point(at);
341
342 // Test for a couple of overflow conditions; maybe expand the buffer.
343 relocInfo* end = locs_end();
344 relocInfo* req = end + relocInfo::length_limit;
345 // Check for (potential) overflow
346 if (req >= locs_limit() || offset >= relocInfo::offset_limit()) {
347 req += (uint)offset / (uint)relocInfo::offset_limit();
348 if (req >= locs_limit()) {
349 // Allocate or reallocate.
350 expand_locs(locs_count() + (req - end));
351 // reload pointer
|
311 Relocation* reloc = spec.reloc();
312 relocInfo::relocType rtype = (relocInfo::relocType) reloc->type();
313 if (rtype == relocInfo::none) return;
314
315 // The assertion below has been adjusted, to also work for
316 // relocation for fixup. Sometimes we want to put relocation
317 // information for the next instruction, since it will be patched
318 // with a call.
319 assert(start() <= at && at <= end()+1,
320 "cannot relocate data outside code boundaries");
321
322 if (!has_locs()) {
323 // no space for relocation information provided => code cannot be
324 // relocated. Make sure that relocate is only called with rtypes
325 // that can be ignored for this kind of code.
326 assert(rtype == relocInfo::none ||
327 rtype == relocInfo::runtime_call_type ||
328 rtype == relocInfo::internal_word_type||
329 rtype == relocInfo::section_word_type ||
330 rtype == relocInfo::external_word_type||
331 rtype == relocInfo::barrier_type ||
332 rtype == relocInfo::patchable_barrier_type,
333 "code needs relocation information");
334 // leave behind an indication that we attempted a relocation
335 DEBUG_ONLY(_locs_start = _locs_limit = (relocInfo*)badAddress);
336 return;
337 }
338
339 // Advance the point, noting the offset we'll have to record.
340 csize_t offset = at - locs_point();
341 set_locs_point(at);
342
343 // Test for a couple of overflow conditions; maybe expand the buffer.
344 relocInfo* end = locs_end();
345 relocInfo* req = end + relocInfo::length_limit;
346 // Check for (potential) overflow
347 if (req >= locs_limit() || offset >= relocInfo::offset_limit()) {
348 req += (uint)offset / (uint)relocInfo::offset_limit();
349 if (req >= locs_limit()) {
350 // Allocate or reallocate.
351 expand_locs(locs_count() + (req - end));
352 // reload pointer
|