< prev index next >

src/hotspot/share/code/compiledIC.hpp

Print this page

228   void* get_data() const {
229     return _call->get_data(_value);
230   }
231 
232   void set_data(intptr_t data) {
233     _call->set_data(_value, data);
234   }
235 
236   address ic_destination() const;
237 
238   bool is_optimized() const   { return _is_optimized; }
239 
240   // State
241   bool is_clean() const;
242   bool is_megamorphic() const;
243   bool is_call_to_compiled() const;
244   bool is_call_to_interpreted() const;
245 
246   bool is_icholder_call() const;
247 
248   address end_of_call() { 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);

347   static void compute_entry(const methodHandle& m, bool caller_is_nmethod, StaticCallInfo& info);
348 
349 public:
350   // Clean static call (will force resolving on next use)
351   virtual address destination() const = 0;
352 
353   // Clean static call (will force resolving on next use)
354   bool set_to_clean(bool in_use = true);
355 
356   // Set state. The entry must be the same, as computed by compute_entry.
357   // Computation and setting is split up, since the actions are separate during
358   // a OptoRuntime::resolve_xxx.
359   void set(const StaticCallInfo& info);
360 
361   // State
362   bool is_clean() const;
363   bool is_call_to_compiled() const;
364   virtual bool is_call_to_interpreted() const = 0;
365 
366   virtual address instruction_address() const = 0;

367 protected:
368   virtual address resolve_call_stub() const = 0;
369   virtual void set_destination_mt_safe(address dest) = 0;
370   virtual void set_to_interpreted(const methodHandle& callee, address entry) = 0;
371   virtual const char* name() const = 0;
372 
373   void set_to_compiled(address entry);
374 };
375 
376 class CompiledDirectStaticCall : public CompiledStaticCall {
377 private:
378   friend class CompiledIC;
379   friend class DirectNativeCallWrapper;
380 
381   // Also used by CompiledIC
382   void set_to_interpreted(const methodHandle& callee, address entry);
383   void verify_mt_safe(const methodHandle& callee, address entry,
384                       NativeMovConstReg* method_holder,
385                       NativeJump*        jump) PRODUCT_RETURN;
386   address instruction_address() const { return _call->instruction_address(); }

392 
393  public:
394   static inline CompiledDirectStaticCall* before(address return_addr) {
395     CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_before(return_addr));
396     st->verify();
397     return st;
398   }
399 
400   static inline CompiledDirectStaticCall* at(address native_call) {
401     CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_at(native_call));
402     st->verify();
403     return st;
404   }
405 
406   static inline CompiledDirectStaticCall* at(Relocation* call_site) {
407     return at(call_site->addr());
408   }
409 
410   // Delegation
411   address destination() const { return _call->destination(); }

412 
413   // State
414   virtual bool is_call_to_interpreted() const;
415 
416   // Stub support
417   static address find_stub_for(address instruction);
418   address find_stub();
419   static void set_stub_to_clean(static_stub_Relocation* static_stub);
420 
421   // Misc.
422   void print()  PRODUCT_RETURN;
423   void verify() PRODUCT_RETURN;
424 
425  protected:
426   virtual address resolve_call_stub() const;
427   virtual const char* name() const { return "CompiledDirectStaticCall"; }
428 };
429 
430 #endif // SHARE_CODE_COMPILEDIC_HPP

228   void* get_data() const {
229     return _call->get_data(_value);
230   }
231 
232   void set_data(intptr_t data) {
233     _call->set_data(_value, data);
234   }
235 
236   address ic_destination() const;
237 
238   bool is_optimized() const   { return _is_optimized; }
239 
240   // State
241   bool is_clean() const;
242   bool is_megamorphic() const;
243   bool is_call_to_compiled() const;
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);

347   static void compute_entry(const methodHandle& m, bool caller_is_nmethod, StaticCallInfo& info);
348 
349 public:
350   // Clean static call (will force resolving on next use)
351   virtual address destination() const = 0;
352 
353   // Clean static call (will force resolving on next use)
354   bool set_to_clean(bool in_use = true);
355 
356   // Set state. The entry must be the same, as computed by compute_entry.
357   // Computation and setting is split up, since the actions are separate during
358   // a OptoRuntime::resolve_xxx.
359   void set(const StaticCallInfo& info);
360 
361   // State
362   bool is_clean() const;
363   bool is_call_to_compiled() const;
364   virtual bool is_call_to_interpreted() const = 0;
365 
366   virtual address instruction_address() const = 0;
367   virtual address end_of_call() const = 0;
368 protected:
369   virtual address resolve_call_stub() const = 0;
370   virtual void set_destination_mt_safe(address dest) = 0;
371   virtual void set_to_interpreted(const methodHandle& callee, address entry) = 0;
372   virtual const char* name() const = 0;
373 
374   void set_to_compiled(address entry);
375 };
376 
377 class CompiledDirectStaticCall : public CompiledStaticCall {
378 private:
379   friend class CompiledIC;
380   friend class DirectNativeCallWrapper;
381 
382   // Also used by CompiledIC
383   void set_to_interpreted(const methodHandle& callee, address entry);
384   void verify_mt_safe(const methodHandle& callee, address entry,
385                       NativeMovConstReg* method_holder,
386                       NativeJump*        jump) PRODUCT_RETURN;
387   address instruction_address() const { return _call->instruction_address(); }

393 
394  public:
395   static inline CompiledDirectStaticCall* before(address return_addr) {
396     CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_before(return_addr));
397     st->verify();
398     return st;
399   }
400 
401   static inline CompiledDirectStaticCall* at(address native_call) {
402     CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_at(native_call));
403     st->verify();
404     return st;
405   }
406 
407   static inline CompiledDirectStaticCall* at(Relocation* call_site) {
408     return at(call_site->addr());
409   }
410 
411   // Delegation
412   address destination() const { return _call->destination(); }
413   address end_of_call() const { return _call->return_address(); }
414 
415   // State
416   virtual bool is_call_to_interpreted() const;
417 
418   // Stub support
419   static address find_stub_for(address instruction);
420   address find_stub();
421   static void set_stub_to_clean(static_stub_Relocation* static_stub);
422 
423   // Misc.
424   void print()  PRODUCT_RETURN;
425   void verify() PRODUCT_RETURN;
426 
427  protected:
428   virtual address resolve_call_stub() const;
429   virtual const char* name() const { return "CompiledDirectStaticCall"; }
430 };
431 
432 #endif // SHARE_CODE_COMPILEDIC_HPP
< prev index next >