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