< prev index next >

src/hotspot/share/ci/ciMethod.hpp

Print this page

 29 #include "ci/ciInstanceKlass.hpp"
 30 #include "ci/ciObject.hpp"
 31 #include "ci/ciSignature.hpp"
 32 #include "classfile/vmIntrinsics.hpp"
 33 #include "compiler/methodLiveness.hpp"
 34 #include "compiler/compilerOracle.hpp"
 35 #include "oops/method.hpp"
 36 #include "runtime/handles.hpp"
 37 #include "utilities/bitMap.hpp"
 38 
 39 class ciMethodBlocks;
 40 class MethodLiveness;
 41 class Arena;
 42 class BCEscapeAnalyzer;
 43 class InlineTree;
 44 class xmlStream;
 45 
 46 // Whether profiling found an oop to be always, never or sometimes
 47 // null
 48 enum ProfilePtrKind {

 49   ProfileAlwaysNull,
 50   ProfileNeverNull,
 51   ProfileMaybeNull
 52 };
 53 
 54 // ciMethod
 55 //
 56 // This class represents a Method* in the HotSpot virtual
 57 // machine.
 58 class ciMethod : public ciMetadata {
 59   friend class CompileBroker;
 60   CI_PACKAGE_ACCESS
 61   friend class ciEnv;
 62   friend class ciExceptionHandlerStream;
 63   friend class ciBytecodeStream;
 64   friend class ciMethodHandle;
 65   friend class ciReplay;
 66   friend class InlineTree;
 67 
 68  private:

185   int max_stack() const                          { check_is_loaded(); return _max_stack; }
186   int max_locals() const                         { check_is_loaded(); return _max_locals; }
187   vmIntrinsicID intrinsic_id() const             { check_is_loaded(); return _intrinsic_id; }
188   bool has_exception_handlers() const            { check_is_loaded(); return _handler_count > 0; }
189   int exception_table_length() const             { check_is_loaded(); return _handler_count; }
190   int interpreter_invocation_count() const       { check_is_loaded(); return _interpreter_invocation_count; }
191   int interpreter_throwout_count() const         { check_is_loaded(); return _interpreter_throwout_count; }
192   int size_of_parameters() const                 { check_is_loaded(); return _size_of_parameters; }
193   int nmethod_age() const                        { check_is_loaded(); return _nmethod_age; }
194 
195   // Should the method be compiled with an age counter?
196   bool profile_aging() const;
197 
198   // Code size for inlining decisions.
199   int code_size_for_inlining();
200 
201   bool caller_sensitive()      const { return get_Method()->caller_sensitive();      }
202   bool force_inline()          const { return get_Method()->force_inline();          }
203   bool dont_inline()           const { return get_Method()->dont_inline();           }
204   bool intrinsic_candidate()   const { return get_Method()->intrinsic_candidate();   }
205   bool is_static_initializer() const { return get_Method()->is_static_initializer(); }
206 
207   bool check_intrinsic_candidate() const {
208     if (intrinsic_id() == vmIntrinsics::_blackhole) {
209       // This is the intrinsic without an associated method, so no intrinsic_candidate
210       // flag is set. The intrinsic is still correct.
211       return true;
212     }
213     return (CheckIntrinsics ? intrinsic_candidate() : true);
214   }
215 
216   int highest_osr_comp_level();
217 
218   Bytecodes::Code java_code_at_bci(int bci) {
219     address bcp = code() + bci;
220     return Bytecodes::java_code_at(NULL, bcp);
221   }
222   Bytecodes::Code raw_code_at_bci(int bci) {
223     address bcp = code() + bci;
224     return Bytecodes::code_at(NULL, bcp);
225   }

254   // dead when those paths merge. Since the interpreter's viewpoint is
255   // used when gc'ing an interpreter frame we need to use its viewpoint
256   // during OSR when loading the locals.
257 
258   ResourceBitMap live_local_oops_at_bci(int bci);
259 
260   bool needs_clinit_barrier() const;
261 
262 #ifdef COMPILER1
263   const BitMap& bci_block_start();
264 #endif
265 
266   ciTypeFlow*   get_flow_analysis();
267   ciTypeFlow*   get_osr_flow_analysis(int osr_bci);  // alternate entry point
268   ciCallProfile call_profile_at_bci(int bci);
269 
270   // Does type profiling provide any useful information at this point?
271   bool          argument_profiled_type(int bci, int i, ciKlass*& type, ProfilePtrKind& ptr_kind);
272   bool          parameter_profiled_type(int i, ciKlass*& type, ProfilePtrKind& ptr_kind);
273   bool          return_profiled_type(int bci, ciKlass*& type, ProfilePtrKind& ptr_kind);
274 



275   ciField*      get_field_at_bci( int bci, bool &will_link);
276   ciMethod*     get_method_at_bci(int bci, bool &will_link, ciSignature* *declared_signature);
277   ciMethod*     get_method_at_bci(int bci) {
278     bool ignored_will_link;
279     ciSignature* ignored_declared_signature;
280     return get_method_at_bci(bci, ignored_will_link, &ignored_declared_signature);
281   }
282 
283   ciKlass*      get_declared_method_holder_at_bci(int bci);
284 
285   ciSignature*  get_declared_signature_at_bci(int bci) {
286     bool ignored_will_link;
287     ciSignature* declared_signature;
288     get_method_at_bci(bci, ignored_will_link, &declared_signature);
289     assert(declared_signature != NULL, "cannot be null");
290     return declared_signature;
291   }
292 
293   // Given a certain calling environment, find the monomorphic target
294   // for the call.  Return NULL if the call is not monomorphic in

325   bool is_ignored_by_security_stack_walk() const;
326 
327   // JSR 292 support
328   bool is_method_handle_intrinsic()  const;
329   bool is_compiled_lambda_form() const;
330   bool has_member_arg() const;
331 
332   // What kind of ciObject is this?
333   bool is_method() const                         { return true; }
334 
335   // Java access flags
336   bool is_public      () const                   { return flags().is_public(); }
337   bool is_private     () const                   { return flags().is_private(); }
338   bool is_protected   () const                   { return flags().is_protected(); }
339   bool is_static      () const                   { return flags().is_static(); }
340   bool is_final       () const                   { return flags().is_final(); }
341   bool is_synchronized() const                   { return flags().is_synchronized(); }
342   bool is_native      () const                   { return flags().is_native(); }
343   bool is_interface   () const                   { return flags().is_interface(); }
344   bool is_abstract    () const                   { return flags().is_abstract(); }

345 
346   // Other flags
347   bool is_final_method() const                   { return is_final() || holder()->is_final(); }
348   bool is_default_method() const                 { return !is_abstract() && !is_private() &&
349                                                           holder()->is_interface(); }
350   bool is_overpass    () const                   { check_is_loaded(); return _is_overpass; }
351   bool has_loops      () const;
352   bool has_jsrs       () const;
353   bool is_getter      () const;
354   bool is_setter      () const;
355   bool is_accessor    () const;
356   bool is_initializer () const;
357   bool is_empty       () const;
358   bool can_be_statically_bound() const           { return _can_be_statically_bound; }
359   bool has_reserved_stack_access() const         { return _has_reserved_stack_access; }
360   bool is_boxing_method() const;
361   bool is_unboxing_method() const;



362   bool is_vector_method() const;
363   bool is_object_initializer() const;
364 
365   bool can_be_statically_bound(ciInstanceKlass* context) const;
366 
367   // Replay data methods
368   static void dump_name_as_ascii(outputStream* st, Method* method);
369   void dump_name_as_ascii(outputStream* st);
370   void dump_replay_data(outputStream* st);
371 
372   // Print the bytecodes of this method.
373   void print_codes_on(outputStream* st);
374   void print_codes() {
375     print_codes_on(tty);
376   }
377   void print_codes_on(int from, int to, outputStream* st);
378 
379   // Print the name of this method in various incarnations.
380   void print_name(outputStream* st = tty);
381   void print_short_name(outputStream* st = tty);
382 
383   static bool is_consistent_info(ciMethod* declared_method, ciMethod* resolved_method);




384 };
385 
386 #endif // SHARE_CI_CIMETHOD_HPP

 29 #include "ci/ciInstanceKlass.hpp"
 30 #include "ci/ciObject.hpp"
 31 #include "ci/ciSignature.hpp"
 32 #include "classfile/vmIntrinsics.hpp"
 33 #include "compiler/methodLiveness.hpp"
 34 #include "compiler/compilerOracle.hpp"
 35 #include "oops/method.hpp"
 36 #include "runtime/handles.hpp"
 37 #include "utilities/bitMap.hpp"
 38 
 39 class ciMethodBlocks;
 40 class MethodLiveness;
 41 class Arena;
 42 class BCEscapeAnalyzer;
 43 class InlineTree;
 44 class xmlStream;
 45 
 46 // Whether profiling found an oop to be always, never or sometimes
 47 // null
 48 enum ProfilePtrKind {
 49   ProfileUnknownNull,
 50   ProfileAlwaysNull,
 51   ProfileNeverNull,
 52   ProfileMaybeNull
 53 };
 54 
 55 // ciMethod
 56 //
 57 // This class represents a Method* in the HotSpot virtual
 58 // machine.
 59 class ciMethod : public ciMetadata {
 60   friend class CompileBroker;
 61   CI_PACKAGE_ACCESS
 62   friend class ciEnv;
 63   friend class ciExceptionHandlerStream;
 64   friend class ciBytecodeStream;
 65   friend class ciMethodHandle;
 66   friend class ciReplay;
 67   friend class InlineTree;
 68 
 69  private:

186   int max_stack() const                          { check_is_loaded(); return _max_stack; }
187   int max_locals() const                         { check_is_loaded(); return _max_locals; }
188   vmIntrinsicID intrinsic_id() const             { check_is_loaded(); return _intrinsic_id; }
189   bool has_exception_handlers() const            { check_is_loaded(); return _handler_count > 0; }
190   int exception_table_length() const             { check_is_loaded(); return _handler_count; }
191   int interpreter_invocation_count() const       { check_is_loaded(); return _interpreter_invocation_count; }
192   int interpreter_throwout_count() const         { check_is_loaded(); return _interpreter_throwout_count; }
193   int size_of_parameters() const                 { check_is_loaded(); return _size_of_parameters; }
194   int nmethod_age() const                        { check_is_loaded(); return _nmethod_age; }
195 
196   // Should the method be compiled with an age counter?
197   bool profile_aging() const;
198 
199   // Code size for inlining decisions.
200   int code_size_for_inlining();
201 
202   bool caller_sensitive()      const { return get_Method()->caller_sensitive();      }
203   bool force_inline()          const { return get_Method()->force_inline();          }
204   bool dont_inline()           const { return get_Method()->dont_inline();           }
205   bool intrinsic_candidate()   const { return get_Method()->intrinsic_candidate();   }
206   bool is_class_initializer()  const { return get_Method()->is_class_initializer(); }
207 
208   bool check_intrinsic_candidate() const {
209     if (intrinsic_id() == vmIntrinsics::_blackhole) {
210       // This is the intrinsic without an associated method, so no intrinsic_candidate
211       // flag is set. The intrinsic is still correct.
212       return true;
213     }
214     return (CheckIntrinsics ? intrinsic_candidate() : true);
215   }
216 
217   int highest_osr_comp_level();
218 
219   Bytecodes::Code java_code_at_bci(int bci) {
220     address bcp = code() + bci;
221     return Bytecodes::java_code_at(NULL, bcp);
222   }
223   Bytecodes::Code raw_code_at_bci(int bci) {
224     address bcp = code() + bci;
225     return Bytecodes::code_at(NULL, bcp);
226   }

255   // dead when those paths merge. Since the interpreter's viewpoint is
256   // used when gc'ing an interpreter frame we need to use its viewpoint
257   // during OSR when loading the locals.
258 
259   ResourceBitMap live_local_oops_at_bci(int bci);
260 
261   bool needs_clinit_barrier() const;
262 
263 #ifdef COMPILER1
264   const BitMap& bci_block_start();
265 #endif
266 
267   ciTypeFlow*   get_flow_analysis();
268   ciTypeFlow*   get_osr_flow_analysis(int osr_bci);  // alternate entry point
269   ciCallProfile call_profile_at_bci(int bci);
270 
271   // Does type profiling provide any useful information at this point?
272   bool          argument_profiled_type(int bci, int i, ciKlass*& type, ProfilePtrKind& ptr_kind);
273   bool          parameter_profiled_type(int i, ciKlass*& type, ProfilePtrKind& ptr_kind);
274   bool          return_profiled_type(int bci, ciKlass*& type, ProfilePtrKind& ptr_kind);
275   bool          array_access_profiled_type(int bci, ciKlass*& array_type, ciKlass*& element_type, ProfilePtrKind& element_ptr, bool &flat_array, bool &null_free);
276   bool          acmp_profiled_type(int bci, ciKlass*& left_type, ciKlass*& right_type,
277                                    ProfilePtrKind& left_ptr, ProfilePtrKind& right_ptr,
278                                    bool &left_inline_type, bool &right_inline_type);
279   ciField*      get_field_at_bci( int bci, bool &will_link);
280   ciMethod*     get_method_at_bci(int bci, bool &will_link, ciSignature* *declared_signature);
281   ciMethod*     get_method_at_bci(int bci) {
282     bool ignored_will_link;
283     ciSignature* ignored_declared_signature;
284     return get_method_at_bci(bci, ignored_will_link, &ignored_declared_signature);
285   }
286 
287   ciKlass*      get_declared_method_holder_at_bci(int bci);
288 
289   ciSignature*  get_declared_signature_at_bci(int bci) {
290     bool ignored_will_link;
291     ciSignature* declared_signature;
292     get_method_at_bci(bci, ignored_will_link, &declared_signature);
293     assert(declared_signature != NULL, "cannot be null");
294     return declared_signature;
295   }
296 
297   // Given a certain calling environment, find the monomorphic target
298   // for the call.  Return NULL if the call is not monomorphic in

329   bool is_ignored_by_security_stack_walk() const;
330 
331   // JSR 292 support
332   bool is_method_handle_intrinsic()  const;
333   bool is_compiled_lambda_form() const;
334   bool has_member_arg() const;
335 
336   // What kind of ciObject is this?
337   bool is_method() const                         { return true; }
338 
339   // Java access flags
340   bool is_public      () const                   { return flags().is_public(); }
341   bool is_private     () const                   { return flags().is_private(); }
342   bool is_protected   () const                   { return flags().is_protected(); }
343   bool is_static      () const                   { return flags().is_static(); }
344   bool is_final       () const                   { return flags().is_final(); }
345   bool is_synchronized() const                   { return flags().is_synchronized(); }
346   bool is_native      () const                   { return flags().is_native(); }
347   bool is_interface   () const                   { return flags().is_interface(); }
348   bool is_abstract    () const                   { return flags().is_abstract(); }
349   bool has_vararg     () const                   { return flags().has_vararg(); }
350 
351   // Other flags
352   bool is_final_method() const                   { return is_final() || holder()->is_final(); }
353   bool is_default_method() const                 { return !is_abstract() && !is_private() &&
354                                                           holder()->is_interface(); }
355   bool is_overpass    () const                   { check_is_loaded(); return _is_overpass; }
356   bool has_loops      () const;
357   bool has_jsrs       () const;
358   bool is_getter      () const;
359   bool is_setter      () const;
360   bool is_accessor    () const;

361   bool is_empty       () const;
362   bool can_be_statically_bound() const           { return _can_be_statically_bound; }
363   bool has_reserved_stack_access() const         { return _has_reserved_stack_access; }
364   bool is_boxing_method() const;
365   bool is_unboxing_method() const;
366   bool is_object_constructor() const;
367   bool is_static_init_factory() const;
368   bool is_object_constructor_or_class_initializer() const;
369   bool is_vector_method() const;

370 
371   bool can_be_statically_bound(ciInstanceKlass* context) const;
372 
373   // Replay data methods
374   static void dump_name_as_ascii(outputStream* st, Method* method);
375   void dump_name_as_ascii(outputStream* st);
376   void dump_replay_data(outputStream* st);
377 
378   // Print the bytecodes of this method.
379   void print_codes_on(outputStream* st);
380   void print_codes() {
381     print_codes_on(tty);
382   }
383   void print_codes_on(int from, int to, outputStream* st);
384 
385   // Print the name of this method in various incarnations.
386   void print_name(outputStream* st = tty);
387   void print_short_name(outputStream* st = tty);
388 
389   static bool is_consistent_info(ciMethod* declared_method, ciMethod* resolved_method);
390 
391   // Support for the inline type calling convention
392   bool has_scalarized_args() const;
393   const GrowableArray<SigEntry>* get_sig_cc();
394 };
395 
396 #endif // SHARE_CI_CIMETHOD_HPP
< prev index next >