46 enum { cache_size = 16 }; |
46 enum { cache_size = 16 }; |
47 Klass* _exception_type; |
47 Klass* _exception_type; |
48 address _pc[cache_size]; |
48 address _pc[cache_size]; |
49 address _handler[cache_size]; |
49 address _handler[cache_size]; |
50 volatile int _count; |
50 volatile int _count; |
51 ExceptionCache* _next; |
51 ExceptionCache* volatile _next; |
|
52 ExceptionCache* _purge_list_next; |
52 |
53 |
53 inline address pc_at(int index); |
54 inline address pc_at(int index); |
54 void set_pc_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _pc[index] = a; } |
55 void set_pc_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _pc[index] = a; } |
55 |
56 |
56 inline address handler_at(int index); |
57 inline address handler_at(int index); |
63 public: |
64 public: |
64 |
65 |
65 ExceptionCache(Handle exception, address pc, address handler); |
66 ExceptionCache(Handle exception, address pc, address handler); |
66 |
67 |
67 Klass* exception_type() { return _exception_type; } |
68 Klass* exception_type() { return _exception_type; } |
68 ExceptionCache* next() { return _next; } |
69 ExceptionCache* next(); |
69 void set_next(ExceptionCache *ec) { _next = ec; } |
70 void set_next(ExceptionCache *ec); |
|
71 ExceptionCache* purge_list_next() { return _purge_list_next; } |
|
72 void set_purge_list_next(ExceptionCache *ec) { _purge_list_next = ec; } |
70 |
73 |
71 address match(Handle exception, address pc); |
74 address match(Handle exception, address pc); |
72 bool match_exception_with_space(Handle exception) ; |
75 bool match_exception_with_space(Handle exception) ; |
73 address test_address(address addr); |
76 address test_address(address addr); |
74 bool add_address_and_handler(address addr, address handler) ; |
77 bool add_address_and_handler(address addr, address handler) ; |
291 |
294 |
292 virtual oop* oop_addr_at(int index) const = 0; |
295 virtual oop* oop_addr_at(int index) const = 0; |
293 virtual Metadata** metadata_addr_at(int index) const = 0; |
296 virtual Metadata** metadata_addr_at(int index) const = 0; |
294 virtual void set_original_pc(const frame* fr, address pc) = 0; |
297 virtual void set_original_pc(const frame* fr, address pc) = 0; |
295 |
298 |
|
299 protected: |
296 // Exception cache support |
300 // Exception cache support |
297 // Note: _exception_cache may be read concurrently. We rely on memory_order_consume here. |
301 // Note: _exception_cache may be read and cleaned concurrently. |
298 ExceptionCache* exception_cache() const { return _exception_cache; } |
302 ExceptionCache* exception_cache() const { return _exception_cache; } |
|
303 ExceptionCache* exception_cache_acquire() const; |
299 void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; } |
304 void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; } |
300 void release_set_exception_cache(ExceptionCache *ec); |
305 |
|
306 public: |
301 address handler_for_exception_and_pc(Handle exception, address pc); |
307 address handler_for_exception_and_pc(Handle exception, address pc); |
302 void add_handler_for_exception_and_pc(Handle exception, address pc, address handler); |
308 void add_handler_for_exception_and_pc(Handle exception, address pc, address handler); |
303 void clean_exception_cache(); |
309 void clean_exception_cache(); |
304 |
310 |
305 void add_exception_cache_entry(ExceptionCache* new_entry); |
311 void add_exception_cache_entry(ExceptionCache* new_entry); |