Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/hotspot/share/code/relocInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ void relocInfo::change_reloc_info_for_address(RelocIterator *itr, address pc, re
// ----------------------------------------------------------------------------------------------------
// Implementation of RelocIterator

// A static dummy to serve as a safe pointer when there is no relocation info.
static relocInfo dummy_relocInfo = relocInfo(relocInfo::none, 0);

void RelocIterator::initialize(nmethod* nm, address begin, address limit) {
initialize_misc();

Expand All @@ -127,8 +130,14 @@ void RelocIterator::initialize(nmethod* nm, address begin, address limit) {
guarantee(nm != nullptr, "must be able to deduce nmethod from other arguments");

_code = nm;
_current = nm->relocation_begin() - 1;
_end = nm->relocation_end();
if (nm->relocation_size() == 0) {
_current = &dummy_relocInfo - 1;
_end = &dummy_relocInfo;
} else {
assert(((nm->relocation_begin() != nullptr) && (nm->relocation_end() != nullptr)), "valid start and end pointer");
_current = nm->relocation_begin() - 1;
_end = nm->relocation_end();
}
_addr = nm->content_begin();

// Initialize code sections.
Expand All @@ -150,7 +159,7 @@ void RelocIterator::initialize(nmethod* nm, address begin, address limit) {
RelocIterator::RelocIterator(CodeSection* cs, address begin, address limit) {
initialize_misc();
assert(((cs->locs_start() != nullptr) && (cs->locs_end() != nullptr)), "valid start and end pointer");
_current = cs->locs_start()-1;
_current = cs->locs_start() - 1;
_end = cs->locs_end();
_addr = cs->start();
_code = nullptr; // Not cb->blob();
Expand Down