298
299
300 bool ExceptionCache::add_address_and_handler(address addr, address handler) {
301 if (test_address(addr) == handler) return true;
302
303 int index = count();
304 if (index < cache_size) {
305 set_pc_at(index, addr);
306 set_handler_at(index, handler);
307 increment_count();
308 return true;
309 }
310 return false;
311 }
312
313 ExceptionCache* ExceptionCache::next() {
314 return Atomic::load(&_next);
315 }
316
317 void ExceptionCache::set_next(ExceptionCache *ec) {
318 Atomic::store(ec, &_next);
319 }
320
321 //-----------------------------------------------------------------------------
322
323
324 // Helper used by both find_pc_desc methods.
325 static inline bool match_desc(PcDesc* pc, int pc_offset, bool approximate) {
326 NOT_PRODUCT(++pc_nmethod_stats.pc_desc_tests);
327 if (!approximate)
328 return pc->pc_offset() == pc_offset;
329 else
330 return (pc-1)->pc_offset() < pc_offset && pc_offset <= pc->pc_offset();
331 }
332
333 void PcDescCache::reset_to(PcDesc* initial_pc_desc) {
334 if (initial_pc_desc == NULL) {
335 _pc_descs[0] = NULL; // native method; no PcDescs at all
336 return;
337 }
338 NOT_PRODUCT(++pc_nmethod_stats.pc_desc_resets);
|
298
299
300 bool ExceptionCache::add_address_and_handler(address addr, address handler) {
301 if (test_address(addr) == handler) return true;
302
303 int index = count();
304 if (index < cache_size) {
305 set_pc_at(index, addr);
306 set_handler_at(index, handler);
307 increment_count();
308 return true;
309 }
310 return false;
311 }
312
313 ExceptionCache* ExceptionCache::next() {
314 return Atomic::load(&_next);
315 }
316
317 void ExceptionCache::set_next(ExceptionCache *ec) {
318 Atomic::store(&_next, ec);
319 }
320
321 //-----------------------------------------------------------------------------
322
323
324 // Helper used by both find_pc_desc methods.
325 static inline bool match_desc(PcDesc* pc, int pc_offset, bool approximate) {
326 NOT_PRODUCT(++pc_nmethod_stats.pc_desc_tests);
327 if (!approximate)
328 return pc->pc_offset() == pc_offset;
329 else
330 return (pc-1)->pc_offset() < pc_offset && pc_offset <= pc->pc_offset();
331 }
332
333 void PcDescCache::reset_to(PcDesc* initial_pc_desc) {
334 if (initial_pc_desc == NULL) {
335 _pc_descs[0] = NULL; // native method; no PcDescs at all
336 return;
337 }
338 NOT_PRODUCT(++pc_nmethod_stats.pc_desc_resets);
|