58 // increment_count is only called under lock, but there may be concurrent readers. 59 void increment_count(); 60 61 public: 62 63 ExceptionCache(Handle exception, address pc, address handler); 64 65 Klass* exception_type() { return _exception_type; } 66 ExceptionCache* next() { return _next; } 67 void set_next(ExceptionCache *ec) { _next = ec; } 68 69 address match(Handle exception, address pc); 70 bool match_exception_with_space(Handle exception) ; 71 address test_address(address addr); 72 bool add_address_and_handler(address addr, address handler) ; 73 }; 74 75 class nmethod; 76 77 // cache pc descs found in earlier inquiries 78 class PcDescCache VALUE_OBJ_CLASS_SPEC { 79 friend class VMStructs; 80 private: 81 enum { cache_size = 4 }; 82 // The array elements MUST be volatile! Several threads may modify 83 // and read from the cache concurrently. find_pc_desc_internal has 84 // returned wrong results. C++ compiler (namely xlC12) may duplicate 85 // C++ field accesses if the elements are not volatile. 86 typedef PcDesc* PcDescPtr; 87 volatile PcDescPtr _pc_descs[cache_size]; // last cache_size pc_descs found 88 public: 89 PcDescCache() { debug_only(_pc_descs[0] = NULL); } 90 void reset_to(PcDesc* initial_pc_desc); 91 PcDesc* find_pc_desc(int pc_offset, bool approximate); 92 void add_pc_desc(PcDesc* pc_desc); 93 PcDesc* last_pc_desc() { return _pc_descs[0]; } 94 }; 95 96 class PcDescSearch { 97 private: 98 address _code_begin; 99 PcDesc* _lower; 100 PcDesc* _upper; 101 public: 102 PcDescSearch(address code, PcDesc* lower, PcDesc* upper) : 103 _code_begin(code), _lower(lower), _upper(upper) 104 { 105 } 106 107 address code_begin() const { return _code_begin; } 108 PcDesc* scopes_pcs_begin() const { return _lower; } 109 PcDesc* scopes_pcs_end() const { return _upper; } 110 }; 111 112 class PcDescContainer VALUE_OBJ_CLASS_SPEC { 113 private: 114 PcDescCache _pc_desc_cache; 115 public: 116 PcDescContainer() {} 117 118 PcDesc* find_pc_desc_internal(address pc, bool approximate, const PcDescSearch& search); 119 void reset_to(PcDesc* initial_pc_desc) { _pc_desc_cache.reset_to(initial_pc_desc); } 120 121 PcDesc* find_pc_desc(address pc, bool approximate, const PcDescSearch& search) { 122 address base_address = search.code_begin(); 123 PcDesc* desc = _pc_desc_cache.last_pc_desc(); 124 if (desc != NULL && desc->pc_offset() == pc - base_address) { 125 return desc; 126 } 127 return find_pc_desc_internal(pc, approximate, search); 128 } 129 }; 130 131 132 class CompiledMethod : public CodeBlob { | 58 // increment_count is only called under lock, but there may be concurrent readers. 59 void increment_count(); 60 61 public: 62 63 ExceptionCache(Handle exception, address pc, address handler); 64 65 Klass* exception_type() { return _exception_type; } 66 ExceptionCache* next() { return _next; } 67 void set_next(ExceptionCache *ec) { _next = ec; } 68 69 address match(Handle exception, address pc); 70 bool match_exception_with_space(Handle exception) ; 71 address test_address(address addr); 72 bool add_address_and_handler(address addr, address handler) ; 73 }; 74 75 class nmethod; 76 77 // cache pc descs found in earlier inquiries 78 class PcDescCache { 79 friend class VMStructs; 80 private: 81 enum { cache_size = 4 }; 82 // The array elements MUST be volatile! Several threads may modify 83 // and read from the cache concurrently. find_pc_desc_internal has 84 // returned wrong results. C++ compiler (namely xlC12) may duplicate 85 // C++ field accesses if the elements are not volatile. 86 typedef PcDesc* PcDescPtr; 87 volatile PcDescPtr _pc_descs[cache_size]; // last cache_size pc_descs found 88 public: 89 PcDescCache() { debug_only(_pc_descs[0] = NULL); } 90 void reset_to(PcDesc* initial_pc_desc); 91 PcDesc* find_pc_desc(int pc_offset, bool approximate); 92 void add_pc_desc(PcDesc* pc_desc); 93 PcDesc* last_pc_desc() { return _pc_descs[0]; } 94 }; 95 96 class PcDescSearch { 97 private: 98 address _code_begin; 99 PcDesc* _lower; 100 PcDesc* _upper; 101 public: 102 PcDescSearch(address code, PcDesc* lower, PcDesc* upper) : 103 _code_begin(code), _lower(lower), _upper(upper) 104 { 105 } 106 107 address code_begin() const { return _code_begin; } 108 PcDesc* scopes_pcs_begin() const { return _lower; } 109 PcDesc* scopes_pcs_end() const { return _upper; } 110 }; 111 112 class PcDescContainer { 113 private: 114 PcDescCache _pc_desc_cache; 115 public: 116 PcDescContainer() {} 117 118 PcDesc* find_pc_desc_internal(address pc, bool approximate, const PcDescSearch& search); 119 void reset_to(PcDesc* initial_pc_desc) { _pc_desc_cache.reset_to(initial_pc_desc); } 120 121 PcDesc* find_pc_desc(address pc, bool approximate, const PcDescSearch& search) { 122 address base_address = search.code_begin(); 123 PcDesc* desc = _pc_desc_cache.last_pc_desc(); 124 if (desc != NULL && desc->pc_offset() == pc - base_address) { 125 return desc; 126 } 127 return find_pc_desc_internal(pc, approximate, search); 128 } 129 }; 130 131 132 class CompiledMethod : public CodeBlob { |