@@ -131,6 +131,35 @@ address UnsafeMemoryAccess::page_error_continue_pc(address pc) {
131131 return nullptr ;
132132}
133133
134+ // Used to retrieve mark regions that lie within a generated stub so
135+ // they can be saved along with the stub and used to reinit the table
136+ // when the stub is reloaded.
137+
138+ void UnsafeMemoryAccess::collect_entries (address range_start, address range_end, GrowableArray<address>& entries)
139+ {
140+ for (int i = 0 ; i < _table_length; i++) {
141+ UnsafeMemoryAccess& e = _table[i];
142+ assert ((e._start_pc != nullptr &&
143+ e._end_pc != nullptr &&
144+ e._error_exit_pc != nullptr ),
145+ " search for entries found incomplete table entry" );
146+ if (e._start_pc >= range_start && e._end_pc <= range_end) {
147+ assert (((e._error_exit_pc >= range_start &&
148+ e._error_exit_pc <= range_end) ||
149+ e._error_exit_pc == _common_exit_stub_pc),
150+ " unexpected error exit pc" );
151+ entries.append (e._start_pc );
152+ entries.append (e._end_pc );
153+ // only return an exit pc when it is within the range of the stub
154+ if (e._error_exit_pc != _common_exit_stub_pc) {
155+ entries.append (e._error_exit_pc );
156+ } else {
157+ // an address outside the stub must be the common exit stub address
158+ entries.append (nullptr );
159+ }
160+ }
161+ }
162+ }
134163
135164static BufferBlob* initialize_stubs (BlobId blob_id,
136165 int code_size, int max_aligned_stubs,
0 commit comments