174 *(adr(l) ) = exec_off; |
174 *(adr(l) ) = exec_off; |
175 *(adr(l)+1) = cont_off; |
175 *(adr(l)+1) = cont_off; |
176 _len = l+1; |
176 _len = l+1; |
177 }; |
177 }; |
178 |
178 |
179 uint ImplicitExceptionTable::at( uint exec_off ) const { |
179 uint ImplicitExceptionTable::continuation_offset( uint exec_off ) const { |
180 uint l = len(); |
180 uint l = len(); |
181 for( uint i=0; i<l; i++ ) |
181 for( uint i=0; i<l; i++ ) |
182 if( *adr(i) == exec_off ) |
182 if( *adr(i) == exec_off ) |
183 return *(adr(i)+1); |
183 return *(adr(i)+1); |
184 return 0; // Failed to find any execption offset |
184 return 0; // Failed to find any execption offset |
203 } else { |
203 } else { |
204 tty->print_cr("ImplicitExceptionTable is empty"); |
204 tty->print_cr("ImplicitExceptionTable is empty"); |
205 } |
205 } |
206 } |
206 } |
207 |
207 |
208 ImplicitExceptionTable::ImplicitExceptionTable(const nmethod* nm) { |
208 ImplicitExceptionTable::ImplicitExceptionTable(const CompiledMethod* nm) { |
209 if (nm->nul_chk_table_size() == 0) { |
209 if (nm->nul_chk_table_size() == 0) { |
210 _len = 0; |
210 _len = 0; |
211 _data = NULL; |
211 _data = NULL; |
212 } else { |
212 } else { |
213 // the first word is the length if non-zero, so read it out and |
213 // the first word is the length if non-zero, so read it out and |
219 _size = len(); |
219 _size = len(); |
220 assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect"); |
220 assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect"); |
221 } |
221 } |
222 |
222 |
223 void ImplicitExceptionTable::copy_to( nmethod* nm ) { |
223 void ImplicitExceptionTable::copy_to( nmethod* nm ) { |
224 assert(size_in_bytes() <= nm->nul_chk_table_size(), "size of space allocated in nmethod incorrect"); |
224 copy_bytes_to(nm->nul_chk_table_begin(), nm->nul_chk_table_size()); |
|
225 } |
|
226 |
|
227 void ImplicitExceptionTable::copy_bytes_to(address addr, int size) { |
|
228 assert(size_in_bytes() <= size, "size of space allocated in nmethod incorrect"); |
225 if (len() != 0) { |
229 if (len() != 0) { |
226 implicit_null_entry* nmdata = (implicit_null_entry*)nm->nul_chk_table_begin(); |
230 implicit_null_entry* nmdata = (implicit_null_entry*)addr; |
227 // store the length in the first uint |
231 // store the length in the first uint |
228 nmdata[0] = _len; |
232 nmdata[0] = _len; |
229 nmdata++; |
233 nmdata++; |
230 // copy the table after the length |
234 // copy the table after the length |
231 memmove( nmdata, _data, 2 * len() * sizeof(implicit_null_entry)); |
235 memmove( nmdata, _data, 2 * len() * sizeof(implicit_null_entry)); |
232 } else { |
236 } else { |
233 // zero length table takes zero bytes |
237 // zero length table takes zero bytes |
234 assert(size_in_bytes() == 0, "bad size"); |
238 assert(size_in_bytes() == 0, "bad size"); |
235 assert(nm->nul_chk_table_size() == 0, "bad size"); |
239 assert(size == 0, "bad size"); |
236 } |
240 } |
237 } |
241 } |
238 |
242 |
239 void ImplicitExceptionTable::verify(nmethod *nm) const { |
243 void ImplicitExceptionTable::verify(nmethod *nm) const { |
240 for (uint i = 0; i < len(); i++) { |
244 for (uint i = 0; i < len(); i++) { |