30
31 class Dependencies;
32 class ExceptionHandlerTable;
33 class ImplicitExceptionTable;
34 class AbstractCompiler;
35 class xmlStream;
36 class CompiledStaticCall;
37 class NativeCallWrapper;
38
39 // This class is used internally by nmethods, to cache
40 // exception/pc/handler information.
41
42 class ExceptionCache : public CHeapObj<mtCode> {
43 friend class VMStructs;
44 private:
45 enum { cache_size = 16 };
46 Klass* _exception_type;
47 address _pc[cache_size];
48 address _handler[cache_size];
49 volatile int _count;
50 ExceptionCache* _next;
51
52 inline address pc_at(int index);
53 void set_pc_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _pc[index] = a; }
54
55 inline address handler_at(int index);
56 void set_handler_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _handler[index] = a; }
57
58 inline int count();
59 // increment_count is only called under lock, but there may be concurrent readers.
60 void increment_count();
61
62 public:
63
64 ExceptionCache(Handle exception, address pc, address handler);
65
66 Klass* exception_type() { return _exception_type; }
67 ExceptionCache* next() { return _next; }
68 void set_next(ExceptionCache *ec) { _next = ec; }
69
70 address match(Handle exception, address pc);
71 bool match_exception_with_space(Handle exception) ;
72 address test_address(address addr);
73 bool add_address_and_handler(address addr, address handler) ;
74 };
75
76 class nmethod;
77
78 // cache pc descs found in earlier inquiries
79 class PcDescCache {
80 friend class VMStructs;
81 private:
82 enum { cache_size = 4 };
83 // The array elements MUST be volatile! Several threads may modify
84 // and read from the cache concurrently. find_pc_desc_internal has
85 // returned wrong results. C++ compiler (namely xlC12) may duplicate
86 // C++ field accesses if the elements are not volatile.
87 typedef PcDesc* PcDescPtr;
|
30
31 class Dependencies;
32 class ExceptionHandlerTable;
33 class ImplicitExceptionTable;
34 class AbstractCompiler;
35 class xmlStream;
36 class CompiledStaticCall;
37 class NativeCallWrapper;
38
39 // This class is used internally by nmethods, to cache
40 // exception/pc/handler information.
41
42 class ExceptionCache : public CHeapObj<mtCode> {
43 friend class VMStructs;
44 private:
45 enum { cache_size = 16 };
46 Klass* _exception_type;
47 address _pc[cache_size];
48 address _handler[cache_size];
49 volatile int _count;
50 ExceptionCache* volatile _next;
51 ExceptionCache* _purge_list_next;
52
53 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
56 inline address handler_at(int index);
57 void set_handler_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _handler[index] = a; }
58
59 inline int count();
60 // increment_count is only called under lock, but there may be concurrent readers.
61 void increment_count();
62
63 public:
64
65 ExceptionCache(Handle exception, address pc, address handler);
66
67 Klass* exception_type() { return _exception_type; }
68 ExceptionCache* next();
69 void set_next(ExceptionCache *ec);
70 ExceptionCache* purge_list_next() { return _purge_list_next; }
71 void set_purge_list_next(ExceptionCache *ec) { _purge_list_next = ec; }
72
73 address match(Handle exception, address pc);
74 bool match_exception_with_space(Handle exception) ;
75 address test_address(address addr);
76 bool add_address_and_handler(address addr, address handler) ;
77 };
78
79 class nmethod;
80
81 // cache pc descs found in earlier inquiries
82 class PcDescCache {
83 friend class VMStructs;
84 private:
85 enum { cache_size = 4 };
86 // The array elements MUST be volatile! Several threads may modify
87 // and read from the cache concurrently. find_pc_desc_internal has
88 // returned wrong results. C++ compiler (namely xlC12) may duplicate
89 // C++ field accesses if the elements are not volatile.
90 typedef PcDesc* PcDescPtr;
|
273 bool stub_contains(address addr) const { return stub_begin() <= addr && addr < stub_end(); }
274 int stub_size() const { return stub_end() - stub_begin(); }
275
276 virtual address handler_table_begin() const = 0;
277 virtual address handler_table_end() const = 0;
278 bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); }
279 int handler_table_size() const { return handler_table_end() - handler_table_begin(); }
280
281 virtual address exception_begin() const = 0;
282
283 virtual address nul_chk_table_begin() const = 0;
284 virtual address nul_chk_table_end() const = 0;
285 bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); }
286 int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); }
287
288 virtual oop* oop_addr_at(int index) const = 0;
289 virtual Metadata** metadata_addr_at(int index) const = 0;
290 virtual void set_original_pc(const frame* fr, address pc) = 0;
291
292 // Exception cache support
293 // Note: _exception_cache may be read concurrently. We rely on memory_order_consume here.
294 ExceptionCache* exception_cache() const { return _exception_cache; }
295 void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; }
296 void release_set_exception_cache(ExceptionCache *ec);
297 address handler_for_exception_and_pc(Handle exception, address pc);
298 void add_handler_for_exception_and_pc(Handle exception, address pc, address handler);
299 void clean_exception_cache();
300
301 void add_exception_cache_entry(ExceptionCache* new_entry);
302 ExceptionCache* exception_cache_entry_for_exception(Handle exception);
303
304 // MethodHandle
305 bool is_method_handle_return(address return_pc);
306 address deopt_mh_handler_begin() const { return _deopt_mh_handler_begin; }
307
308 address deopt_handler_begin() const { return _deopt_handler_begin; }
309 virtual address get_original_pc(const frame* fr) = 0;
310 // Deopt
311 // Return true is the PC is one would expect if the frame is being deopted.
312 inline bool is_deopt_pc(address pc);
313 bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); }
314 inline bool is_deopt_entry(address pc);
315
316 virtual bool can_convert_to_zombie() = 0;
317 virtual const char* compile_kind() const = 0;
318 virtual int get_state() const = 0;
|
276 bool stub_contains(address addr) const { return stub_begin() <= addr && addr < stub_end(); }
277 int stub_size() const { return stub_end() - stub_begin(); }
278
279 virtual address handler_table_begin() const = 0;
280 virtual address handler_table_end() const = 0;
281 bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); }
282 int handler_table_size() const { return handler_table_end() - handler_table_begin(); }
283
284 virtual address exception_begin() const = 0;
285
286 virtual address nul_chk_table_begin() const = 0;
287 virtual address nul_chk_table_end() const = 0;
288 bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); }
289 int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); }
290
291 virtual oop* oop_addr_at(int index) const = 0;
292 virtual Metadata** metadata_addr_at(int index) const = 0;
293 virtual void set_original_pc(const frame* fr, address pc) = 0;
294
295 // Exception cache support
296 // Note: _exception_cache may be read and cleaned concurrently.
297 ExceptionCache* exception_cache() const { return _exception_cache; }
298 ExceptionCache* exception_cache_acquire() const;
299 void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; }
300 void release_set_exception_cache(ExceptionCache *ec);
301 address handler_for_exception_and_pc(Handle exception, address pc);
302 void add_handler_for_exception_and_pc(Handle exception, address pc, address handler);
303 void clean_exception_cache();
304 static void purge_exception_cache_free_list();
305
306 void add_exception_cache_entry(ExceptionCache* new_entry);
307 ExceptionCache* exception_cache_entry_for_exception(Handle exception);
308
309 // MethodHandle
310 bool is_method_handle_return(address return_pc);
311 address deopt_mh_handler_begin() const { return _deopt_mh_handler_begin; }
312
313 address deopt_handler_begin() const { return _deopt_handler_begin; }
314 virtual address get_original_pc(const frame* fr) = 0;
315 // Deopt
316 // Return true is the PC is one would expect if the frame is being deopted.
317 inline bool is_deopt_pc(address pc);
318 bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); }
319 inline bool is_deopt_entry(address pc);
320
321 virtual bool can_convert_to_zombie() = 0;
322 virtual const char* compile_kind() const = 0;
323 virtual int get_state() const = 0;
|