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