< prev index next >

src/hotspot/share/code/compiledIC.hpp

Print this page

244   bool is_call_to_interpreted() const;
245 
246   bool is_icholder_call() const;
247 
248   address end_of_call() const { return  _call->return_address(); }
249 
250   // MT-safe patching of inline caches. Note: Only safe to call is_xxx when holding the CompiledIC_ock
251   // so you are guaranteed that no patching takes place. The same goes for verify.
252   //
253   // Note: We do not provide any direct access to the stub code, to prevent parts of the code
254   // to manipulate the inline cache in MT-unsafe ways.
255   //
256   // They all takes a TRAP argument, since they can cause a GC if the inline-cache buffer is full.
257   //
258   bool set_to_clean(bool in_use = true);
259   bool set_to_monomorphic(CompiledICInfo& info);
260   void clear_ic_stub();
261 
262   // Returns true if successful and false otherwise. The call can fail if memory
263   // allocation in the code cache fails, or ic stub refill is required.
264   bool set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, bool& needs_ic_stub_refill, TRAPS);
265 
266   static void compute_monomorphic_entry(const methodHandle& method, Klass* receiver_klass,
267                                         bool is_optimized, bool static_bound, bool caller_is_nmethod,
268                                         CompiledICInfo& info, TRAPS);
269 
270   // Location
271   address instruction_address() const { return _call->instruction_address(); }
272 
273   // Misc
274   void print()             PRODUCT_RETURN;
275   void print_compiled_ic() PRODUCT_RETURN;
276   void verify()            PRODUCT_RETURN;
277 };
278 
279 inline CompiledIC* CompiledIC_before(CompiledMethod* nm, address return_addr) {
280   CompiledIC* c_ic = new CompiledIC(nm, nativeCall_before(return_addr));
281   c_ic->verify();
282   return c_ic;
283 }
284 
285 inline CompiledIC* CompiledIC_at(CompiledMethod* nm, address call_site) {
286   CompiledIC* c_ic = new CompiledIC(nm, nativeCall_at(call_site));
287   c_ic->verify();
288   return c_ic;

296   return c_ic;
297 }
298 
299 inline CompiledIC* CompiledIC_at(RelocIterator* reloc_iter) {
300   assert(reloc_iter->type() == relocInfo::virtual_call_type ||
301       reloc_iter->type() == relocInfo::opt_virtual_call_type, "wrong reloc. info");
302   CompiledIC* c_ic = new CompiledIC(reloc_iter);
303   c_ic->verify();
304   return c_ic;
305 }
306 
307 //-----------------------------------------------------------------------------
308 // The CompiledStaticCall represents a call to a static method in the compiled
309 //
310 // Transition diagram of a static call site is somewhat simpler than for an inlined cache:
311 //
312 //
313 //           -----<----- Clean ----->-----
314 //          /                             \
315 //         /                               \
316 //    compilled code <------------> interpreted code
317 //
318 //  Clean:            Calls directly to runtime method for fixup
319 //  Compiled code:    Calls directly to compiled code
320 //  Interpreted code: Calls to stub that set Method* reference
321 //
322 //
323 
324 class StaticCallInfo {
325  private:
326   address      _entry;          // Entrypoint
327   methodHandle _callee;         // Callee (used when calling interpreter)
328   bool         _to_interpreter; // call to interpreted method (otherwise compiled)
329 
330   friend class CompiledStaticCall;
331   friend class CompiledDirectStaticCall;
332   friend class CompiledPltStaticCall;
333  public:
334   address      entry() const    { return _entry;  }
335   methodHandle callee() const   { return _callee; }
336 };
337 
338 class CompiledStaticCall : public ResourceObj {
339  public:
340   // Code
341 
342   // Returns null if CodeBuffer::expand fails
343   static address emit_to_interp_stub(CodeBuffer &cbuf, address mark = nullptr);
344   static int to_interp_stub_size();
345   static int to_trampoline_stub_size();
346   static int reloc_to_interp_stub();
347 
348   // Compute entry point given a method
349   static void compute_entry(const methodHandle& m, bool caller_is_nmethod, StaticCallInfo& info);
350   void compute_entry_for_continuation_entry(const methodHandle& m, StaticCallInfo& info);
351 
352 public:
353   // Clean static call (will force resolving on next use)
354   virtual address destination() const = 0;
355 
356   // Clean static call (will force resolving on next use)
357   bool set_to_clean(bool in_use = true);
358 
359   // Set state. The entry must be the same, as computed by compute_entry.
360   // Computation and setting is split up, since the actions are separate during
361   // a OptoRuntime::resolve_xxx.
362   void set(const StaticCallInfo& info);
363 
364   // State
365   bool is_clean() const;
366   bool is_call_to_compiled() const;
367   virtual bool is_call_to_interpreted() const = 0;
368 
369   virtual address instruction_address() const = 0;

244   bool is_call_to_interpreted() const;
245 
246   bool is_icholder_call() const;
247 
248   address end_of_call() const { return  _call->return_address(); }
249 
250   // MT-safe patching of inline caches. Note: Only safe to call is_xxx when holding the CompiledIC_ock
251   // so you are guaranteed that no patching takes place. The same goes for verify.
252   //
253   // Note: We do not provide any direct access to the stub code, to prevent parts of the code
254   // to manipulate the inline cache in MT-unsafe ways.
255   //
256   // They all takes a TRAP argument, since they can cause a GC if the inline-cache buffer is full.
257   //
258   bool set_to_clean(bool in_use = true);
259   bool set_to_monomorphic(CompiledICInfo& info);
260   void clear_ic_stub();
261 
262   // Returns true if successful and false otherwise. The call can fail if memory
263   // allocation in the code cache fails, or ic stub refill is required.
264   bool set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, bool& needs_ic_stub_refill, bool caller_is_c1, TRAPS);
265 
266   static void compute_monomorphic_entry(const methodHandle& method, Klass* receiver_klass,
267                                         bool is_optimized, bool static_bound, bool caller_is_nmethod,
268                                         bool caller_is_c1, CompiledICInfo& info, TRAPS);
269 
270   // Location
271   address instruction_address() const { return _call->instruction_address(); }
272 
273   // Misc
274   void print()             PRODUCT_RETURN;
275   void print_compiled_ic() PRODUCT_RETURN;
276   void verify()            PRODUCT_RETURN;
277 };
278 
279 inline CompiledIC* CompiledIC_before(CompiledMethod* nm, address return_addr) {
280   CompiledIC* c_ic = new CompiledIC(nm, nativeCall_before(return_addr));
281   c_ic->verify();
282   return c_ic;
283 }
284 
285 inline CompiledIC* CompiledIC_at(CompiledMethod* nm, address call_site) {
286   CompiledIC* c_ic = new CompiledIC(nm, nativeCall_at(call_site));
287   c_ic->verify();
288   return c_ic;

296   return c_ic;
297 }
298 
299 inline CompiledIC* CompiledIC_at(RelocIterator* reloc_iter) {
300   assert(reloc_iter->type() == relocInfo::virtual_call_type ||
301       reloc_iter->type() == relocInfo::opt_virtual_call_type, "wrong reloc. info");
302   CompiledIC* c_ic = new CompiledIC(reloc_iter);
303   c_ic->verify();
304   return c_ic;
305 }
306 
307 //-----------------------------------------------------------------------------
308 // The CompiledStaticCall represents a call to a static method in the compiled
309 //
310 // Transition diagram of a static call site is somewhat simpler than for an inlined cache:
311 //
312 //
313 //           -----<----- Clean ----->-----
314 //          /                             \
315 //         /                               \
316 //    compiled code <------------> interpreted code
317 //
318 //  Clean:            Calls directly to runtime method for fixup
319 //  Compiled code:    Calls directly to compiled code
320 //  Interpreted code: Calls to stub that set Method* reference
321 //
322 //
323 
324 class StaticCallInfo {
325  private:
326   address      _entry;          // Entrypoint
327   methodHandle _callee;         // Callee (used when calling interpreter)
328   bool         _to_interpreter; // call to interpreted method (otherwise compiled)
329 
330   friend class CompiledStaticCall;
331   friend class CompiledDirectStaticCall;
332   friend class CompiledPltStaticCall;
333  public:
334   address      entry() const    { return _entry;  }
335   methodHandle callee() const   { return _callee; }
336 };
337 
338 class CompiledStaticCall : public ResourceObj {
339  public:
340   // Code
341 
342   // Returns null if CodeBuffer::expand fails
343   static address emit_to_interp_stub(CodeBuffer &cbuf, address mark = nullptr);
344   static int to_interp_stub_size();
345   static int to_trampoline_stub_size();
346   static int reloc_to_interp_stub();
347 
348   // Compute entry point given a method
349   static void compute_entry(const methodHandle& m, CompiledMethod* caller_nm, StaticCallInfo& info);
350   void compute_entry_for_continuation_entry(const methodHandle& m, StaticCallInfo& info);
351 
352 public:
353   // Clean static call (will force resolving on next use)
354   virtual address destination() const = 0;
355 
356   // Clean static call (will force resolving on next use)
357   bool set_to_clean(bool in_use = true);
358 
359   // Set state. The entry must be the same, as computed by compute_entry.
360   // Computation and setting is split up, since the actions are separate during
361   // a OptoRuntime::resolve_xxx.
362   void set(const StaticCallInfo& info);
363 
364   // State
365   bool is_clean() const;
366   bool is_call_to_compiled() const;
367   virtual bool is_call_to_interpreted() const = 0;
368 
369   virtual address instruction_address() const = 0;
< prev index next >