91 bool is_initialized() const { return _is_initialized; }
92
93 // GC Support
94 void clean_metadata();
95 void metadata_do(MetadataClosure* cl);
96 };
97
98 class CompiledIC: public ResourceObj {
99 private:
100 nmethod* _method;
101 CompiledICData* _data;
102 NativeCall* _call;
103
104 CompiledIC(RelocIterator* iter);
105
106 // CompiledICData wrappers
107 void ensure_initialized(CallInfo* call_info, Klass* receiver_klass);
108 bool is_speculated_klass(Klass* receiver_klass);
109
110 // Inline cache states
111 void set_to_monomorphic();
112 void set_to_megamorphic(CallInfo* call_info);
113
114 public:
115 // conversion (machine PC to CompiledIC*)
116 friend CompiledIC* CompiledIC_before(nmethod* nm, address return_addr);
117 friend CompiledIC* CompiledIC_at(nmethod* nm, address call_site);
118 friend CompiledIC* CompiledIC_at(Relocation* call_site);
119 friend CompiledIC* CompiledIC_at(RelocIterator* reloc_iter);
120
121 CompiledICData* data() const;
122
123 // State
124 bool is_clean() const;
125 bool is_monomorphic() const;
126 bool is_megamorphic() const;
127
128 address end_of_call() const { return _call->return_address(); }
129
130 // MT-safe patching of inline caches. Note: Only safe to call is_xxx when holding the CompiledICLocker
131 // so you are guaranteed that no patching takes place. The same goes for verify.
132 void set_to_clean();
133 void update(CallInfo* call_info, Klass* receiver_klass);
134
135 // GC support
136 void clean_metadata();
137 void metadata_do(MetadataClosure* cl);
138
139 // Location
140 address instruction_address() const { return _call->instruction_address(); }
141 address destination() const { return _call->destination(); }
142
143 // Misc
144 void print() PRODUCT_RETURN;
145 void verify() PRODUCT_RETURN;
146 };
147
148 CompiledIC* CompiledIC_before(nmethod* nm, address return_addr);
149 CompiledIC* CompiledIC_at(nmethod* nm, address call_site);
150 CompiledIC* CompiledIC_at(Relocation* call_site);
151 CompiledIC* CompiledIC_at(RelocIterator* reloc_iter);
152
153 //-----------------------------------------------------------------------------
154 // The CompiledDirectCall represents a call to a method in the compiled code
155 //
156 //
157 // -----<----- Clean ----->-----
158 // / \
159 // / \
160 // compilled code <------------> interpreted code
161 //
162 // Clean: Calls directly to runtime method for fixup
163 // Compiled code: Calls directly to compiled code
164 // Interpreted code: Calls to stub that set Method* reference
165 //
166 //
167
168 class CompiledDirectCall : public ResourceObj {
169 private:
170 friend class CompiledIC;
171 friend class DirectNativeCallWrapper;
172
173 // Also used by CompiledIC
174 void set_to_interpreted(const methodHandle& callee, address entry);
175 void verify_mt_safe(const methodHandle& callee, address entry,
176 NativeMovConstReg* method_holder,
177 NativeJump* jump) PRODUCT_RETURN;
178 address instruction_address() const { return _call->instruction_address(); }
179 void set_destination_mt_safe(address dest) { _call->set_destination_mt_safe(dest); }
180
195 return st;
196 }
197
198 static inline CompiledDirectCall* at(address native_call) {
199 CompiledDirectCall* st = new CompiledDirectCall(nativeCall_at(native_call));
200 if (VerifyInlineCaches) st->verify();
201 return st;
202 }
203
204 static inline CompiledDirectCall* at(Relocation* call_site) {
205 return at(call_site->addr());
206 }
207
208 // Delegation
209 address destination() const { return _call->destination(); }
210 address end_of_call() const { return _call->return_address(); }
211
212 // Clean static call (will force resolving on next use)
213 void set_to_clean();
214
215 void set(const methodHandle& callee_method);
216
217 // State
218 bool is_clean() const;
219 bool is_call_to_interpreted() const;
220 bool is_call_to_compiled() const;
221
222 // Stub support
223 static address find_stub_for(address instruction);
224 address find_stub();
225 static void set_stub_to_clean(static_stub_Relocation* static_stub);
226
227 // Misc.
228 void print() PRODUCT_RETURN;
229 void verify() PRODUCT_RETURN;
230 };
231
232 #endif // SHARE_CODE_COMPILEDIC_HPP
|
91 bool is_initialized() const { return _is_initialized; }
92
93 // GC Support
94 void clean_metadata();
95 void metadata_do(MetadataClosure* cl);
96 };
97
98 class CompiledIC: public ResourceObj {
99 private:
100 nmethod* _method;
101 CompiledICData* _data;
102 NativeCall* _call;
103
104 CompiledIC(RelocIterator* iter);
105
106 // CompiledICData wrappers
107 void ensure_initialized(CallInfo* call_info, Klass* receiver_klass);
108 bool is_speculated_klass(Klass* receiver_klass);
109
110 // Inline cache states
111 void set_to_monomorphic(bool caller_is_c1);
112 void set_to_megamorphic(CallInfo* call_info, bool caller_is_c1);
113
114 public:
115 // conversion (machine PC to CompiledIC*)
116 friend CompiledIC* CompiledIC_before(nmethod* nm, address return_addr);
117 friend CompiledIC* CompiledIC_at(nmethod* nm, address call_site);
118 friend CompiledIC* CompiledIC_at(Relocation* call_site);
119 friend CompiledIC* CompiledIC_at(RelocIterator* reloc_iter);
120
121 CompiledICData* data() const;
122
123 // State
124 bool is_clean() const;
125 bool is_monomorphic() const;
126 bool is_megamorphic() const;
127
128 address end_of_call() const { return _call->return_address(); }
129
130 // MT-safe patching of inline caches. Note: Only safe to call is_xxx when holding the CompiledICLocker
131 // so you are guaranteed that no patching takes place. The same goes for verify.
132 void set_to_clean();
133 void update(CallInfo* call_info, Klass* receiver_klass, bool caller_is_c1);
134
135 // GC support
136 void clean_metadata();
137 void metadata_do(MetadataClosure* cl);
138
139 // Location
140 address instruction_address() const { return _call->instruction_address(); }
141 address destination() const { return _call->destination(); }
142
143 // Misc
144 void print() PRODUCT_RETURN;
145 void verify() PRODUCT_RETURN;
146 };
147
148 CompiledIC* CompiledIC_before(nmethod* nm, address return_addr);
149 CompiledIC* CompiledIC_at(nmethod* nm, address call_site);
150 CompiledIC* CompiledIC_at(Relocation* call_site);
151 CompiledIC* CompiledIC_at(RelocIterator* reloc_iter);
152
153 //-----------------------------------------------------------------------------
154 // The CompiledDirectCall represents a call to a method in the compiled code
155 //
156 //
157 // -----<----- Clean ----->-----
158 // / \
159 // / \
160 // compiled code <------------> interpreted code
161 //
162 // Clean: Calls directly to runtime method for fixup
163 // Compiled code: Calls directly to compiled code
164 // Interpreted code: Calls to stub that set Method* reference
165 //
166 //
167
168 class CompiledDirectCall : public ResourceObj {
169 private:
170 friend class CompiledIC;
171 friend class DirectNativeCallWrapper;
172
173 // Also used by CompiledIC
174 void set_to_interpreted(const methodHandle& callee, address entry);
175 void verify_mt_safe(const methodHandle& callee, address entry,
176 NativeMovConstReg* method_holder,
177 NativeJump* jump) PRODUCT_RETURN;
178 address instruction_address() const { return _call->instruction_address(); }
179 void set_destination_mt_safe(address dest) { _call->set_destination_mt_safe(dest); }
180
195 return st;
196 }
197
198 static inline CompiledDirectCall* at(address native_call) {
199 CompiledDirectCall* st = new CompiledDirectCall(nativeCall_at(native_call));
200 if (VerifyInlineCaches) st->verify();
201 return st;
202 }
203
204 static inline CompiledDirectCall* at(Relocation* call_site) {
205 return at(call_site->addr());
206 }
207
208 // Delegation
209 address destination() const { return _call->destination(); }
210 address end_of_call() const { return _call->return_address(); }
211
212 // Clean static call (will force resolving on next use)
213 void set_to_clean();
214
215 void set(const methodHandle& callee_method, bool caller_is_c1);
216
217 // State
218 bool is_clean() const;
219 bool is_call_to_interpreted() const;
220 bool is_call_to_compiled() const;
221
222 // Stub support
223 static address find_stub_for(address instruction);
224 address find_stub();
225 static void set_stub_to_clean(static_stub_Relocation* static_stub);
226
227 // Misc.
228 void print() PRODUCT_RETURN;
229 void verify() PRODUCT_RETURN;
230 };
231
232 #endif // SHARE_CODE_COMPILEDIC_HPP
|