@@ -116,6 +116,9 @@ void relocInfo::change_reloc_info_for_address(RelocIterator *itr, address pc, re
116
116
// ----------------------------------------------------------------------------------------------------
117
117
// Implementation of RelocIterator
118
118
119
+ // A static dummy to serve as a safe pointer when there is no relocation info.
120
+ static relocInfo dummy_relocInfo = relocInfo(relocInfo::none, 0 );
121
+
119
122
void RelocIterator::initialize (nmethod* nm, address begin, address limit) {
120
123
initialize_misc ();
121
124
@@ -127,8 +130,14 @@ void RelocIterator::initialize(nmethod* nm, address begin, address limit) {
127
130
guarantee (nm != nullptr , " must be able to deduce nmethod from other arguments" );
128
131
129
132
_code = nm;
130
- _current = nm->relocation_begin () - 1 ;
131
- _end = nm->relocation_end ();
133
+ if (nm->relocation_size () == 0 ) {
134
+ _current = &dummy_relocInfo - 1 ;
135
+ _end = &dummy_relocInfo;
136
+ } else {
137
+ assert (((nm->relocation_begin () != nullptr ) && (nm->relocation_end () != nullptr )), " valid start and end pointer" );
138
+ _current = nm->relocation_begin () - 1 ;
139
+ _end = nm->relocation_end ();
140
+ }
132
141
_addr = nm->content_begin ();
133
142
134
143
// Initialize code sections.
@@ -150,7 +159,7 @@ void RelocIterator::initialize(nmethod* nm, address begin, address limit) {
150
159
RelocIterator::RelocIterator (CodeSection* cs, address begin, address limit) {
151
160
initialize_misc ();
152
161
assert (((cs->locs_start () != nullptr ) && (cs->locs_end () != nullptr )), " valid start and end pointer" );
153
- _current = cs->locs_start ()- 1 ;
162
+ _current = cs->locs_start () - 1 ;
154
163
_end = cs->locs_end ();
155
164
_addr = cs->start ();
156
165
_code = nullptr ; // Not cb->blob();
0 commit comments