< prev index next >

src/hotspot/share/oops/method.hpp

Print this page

  74   // If you add a new field that points to any metaspace object, you
  75   // must add this field to Method::metaspace_pointers_do().
  76   ConstMethod*      _constMethod;                // Method read-only data.
  77   MethodData*       _method_data;
  78   MethodCounters*   _method_counters;
  79   AdapterHandlerEntry* _adapter;
  80   AccessFlags       _access_flags;               // Access flags
  81   int               _vtable_index;               // vtable index of this method (see VtableIndexFlag)
  82                                                  // note: can have vtables with >2**16 elements (because of inheritance)
  83   u2                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
  84 
  85   // Flags
  86   enum Flags {
  87     _caller_sensitive      = 1 << 0,
  88     _force_inline          = 1 << 1,
  89     _dont_inline           = 1 << 2,
  90     _hidden                = 1 << 3,
  91     _has_injected_profile  = 1 << 4,
  92     _intrinsic_candidate   = 1 << 5,
  93     _reserved_stack_access = 1 << 6,
  94     _scoped                = 1 << 7



  95   };
  96   mutable u2 _flags;
  97 
  98   JFR_ONLY(DEFINE_TRACE_FLAG;)
  99 
 100 #ifndef PRODUCT
 101   int64_t _compiled_invocation_count;
 102 
 103   Symbol* _name;
 104 #endif
 105   // Entry point for calling both from and to the interpreter.
 106   address _i2i_entry;           // All-args-on-stack calling convention
 107   // Entry point for calling from compiled code, to compiled code if it exists
 108   // or else the interpreter.
 109   volatile address _from_compiled_entry;        // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()


 110   // The entry point for calling both from and to compiled code is
 111   // "_code->entry_point()".  Because of tiered compilation and de-opt, this
 112   // field can come and go.  It can transition from NULL to not-null at any
 113   // time (whenever a compile completes).  It can transition from not-null to
 114   // NULL only at safepoints (because of a de-opt).
 115   CompiledMethod* volatile _code;                       // Points to the corresponding piece of native code
 116   volatile address           _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
 117 
 118   // Constructor
 119   Method(ConstMethod* xconst, AccessFlags access_flags, Symbol* name);
 120  public:
 121 
 122   static Method* allocate(ClassLoaderData* loader_data,
 123                           int byte_code_size,
 124                           AccessFlags access_flags,
 125                           InlineTableSizes* sizes,
 126                           ConstMethod::MethodType method_type,
 127                           Symbol* name,
 128                           TRAPS);
 129 
 130   // CDS and vtbl checking can create an empty Method to get vtbl pointer.
 131   Method(){}
 132 
 133   virtual bool is_method() const { return true; }
 134 
 135   void restore_unshareable_info(TRAPS);
 136 
 137   // accessors for instance variables
 138 
 139   ConstMethod* constMethod() const             { return _constMethod; }
 140   void set_constMethod(ConstMethod* xconst)    { _constMethod = xconst; }
 141 
 142 
 143   static address make_adapters(const methodHandle& mh, TRAPS);
 144   address from_compiled_entry() const;
 145   address from_compiled_entry_no_trampoline() const;


 146   address from_interpreted_entry() const;
 147 
 148   // access flag
 149   AccessFlags access_flags() const               { return _access_flags;  }
 150   void set_access_flags(AccessFlags flags)       { _access_flags = flags; }
 151 
 152   // name
 153   Symbol* name() const                           { return constants()->symbol_at(name_index()); }
 154   int name_index() const                         { return constMethod()->name_index();         }
 155   void set_name_index(int index)                 { constMethod()->set_name_index(index);       }
 156 
 157   // signature
 158   Symbol* signature() const                      { return constants()->symbol_at(signature_index()); }
 159   int signature_index() const                    { return constMethod()->signature_index();         }
 160   void set_signature_index(int index)            { constMethod()->set_signature_index(index);       }
 161 
 162   // generics support
 163   Symbol* generic_signature() const              { int idx = generic_signature_index(); return ((idx != 0) ? constants()->symbol_at(idx) : (Symbol*)NULL); }
 164   int generic_signature_index() const            { return constMethod()->generic_signature_index(); }
 165   void set_generic_signature_index(int index)    { constMethod()->set_generic_signature_index(index); }

 419   static void build_interpreter_method_data(const methodHandle& method, TRAPS);
 420 
 421   static MethodCounters* build_method_counters(Thread* current, Method* m);
 422 
 423   int interpreter_invocation_count()            { return invocation_count();          }
 424 
 425 #ifndef PRODUCT
 426   int64_t  compiled_invocation_count() const    { return _compiled_invocation_count;}
 427   void set_compiled_invocation_count(int count) { _compiled_invocation_count = (int64_t)count; }
 428 #else
 429   // for PrintMethodData in a product build
 430   int64_t  compiled_invocation_count() const    { return 0; }
 431 #endif // not PRODUCT
 432 
 433   // Clear (non-shared space) pointers which could not be relevant
 434   // if this (shared) method were mapped into another JVM.
 435   void remove_unshareable_info();
 436 
 437   // nmethod/verified compiler entry
 438   address verified_code_entry();


 439   bool check_code() const;      // Not inline to avoid circular ref
 440   CompiledMethod* volatile code() const;
 441 
 442   // Locks CompiledMethod_lock if not held.
 443   void unlink_code(CompiledMethod *compare);
 444   // Locks CompiledMethod_lock if not held.
 445   void unlink_code();
 446 
 447 private:
 448   // Either called with CompiledMethod_lock held or from constructor.
 449   void clear_code();
 450 
 451 public:
 452   static void set_code(const methodHandle& mh, CompiledMethod* code);
 453   void set_adapter_entry(AdapterHandlerEntry* adapter) {
 454     _adapter = adapter;
 455   }
 456   void set_from_compiled_entry(address entry) {
 457     _from_compiled_entry =  entry;






 458   }
 459 
 460   address get_i2c_entry();
 461   address get_c2i_entry();

 462   address get_c2i_unverified_entry();

 463   address get_c2i_no_clinit_check_entry();
 464   AdapterHandlerEntry* adapter() const {
 465     return _adapter;
 466   }
 467   // setup entry points
 468   void link_method(const methodHandle& method, TRAPS);
 469   // clear entry points. Used by sharing code during dump time
 470   void unlink_method() NOT_CDS_RETURN;
 471 
 472   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
 473   virtual MetaspaceObj::Type type() const { return MethodType; }
 474 
 475   // vtable index
 476   enum VtableIndexFlag {
 477     // Valid vtable indexes are non-negative (>= 0).
 478     // These few negative values are used as sentinels.
 479     itable_index_max        = -10, // first itable index, growing downward
 480     pending_itable_index    = -9,  // itable index will be assigned
 481     invalid_vtable_index    = -4,  // distinct from any valid vtable index
 482     garbage_vtable_index    = -3,  // not yet linked; no vtable layout yet

 553 
 554   // localvariable table
 555   bool has_localvariable_table() const
 556                           { return constMethod()->has_localvariable_table(); }
 557   int localvariable_table_length() const
 558                         { return constMethod()->localvariable_table_length(); }
 559   LocalVariableTableElement* localvariable_table_start() const
 560                          { return constMethod()->localvariable_table_start(); }
 561 
 562   bool has_linenumber_table() const
 563                               { return constMethod()->has_linenumber_table(); }
 564   u_char* compressed_linenumber_table() const
 565                        { return constMethod()->compressed_linenumber_table(); }
 566 
 567   // method holder (the Klass* holding this method)
 568   InstanceKlass* method_holder() const         { return constants()->pool_holder(); }
 569 
 570   Symbol* klass_name() const;                    // returns the name of the method holder
 571   BasicType result_type() const                  { return constMethod()->result_type(); }
 572   bool is_returning_oop() const                  { BasicType r = result_type(); return is_reference_type(r); }
 573   bool is_returning_fp() const                   { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); }
 574 
 575   // Checked exceptions thrown by this method (resolved to mirrors)
 576   objArrayHandle resolved_checked_exceptions(TRAPS) { return resolved_checked_exceptions_impl(this, THREAD); }
 577 
 578   // Access flags
 579   bool is_public() const                         { return access_flags().is_public();      }
 580   bool is_private() const                        { return access_flags().is_private();     }
 581   bool is_protected() const                      { return access_flags().is_protected();   }
 582   bool is_package_private() const                { return !is_public() && !is_private() && !is_protected(); }
 583   bool is_static() const                         { return access_flags().is_static();      }
 584   bool is_final() const                          { return access_flags().is_final();       }
 585   bool is_synchronized() const                   { return access_flags().is_synchronized();}
 586   bool is_native() const                         { return access_flags().is_native();      }
 587   bool is_abstract() const                       { return access_flags().is_abstract();    }
 588   bool is_synthetic() const                      { return access_flags().is_synthetic();   }
 589 
 590   // returns true if contains only return operation
 591   bool is_empty_method() const;
 592 
 593   // returns true if this is a vanilla constructor

 628   void set_has_monitor_bytecodes()               { _access_flags.set_has_monitor_bytecodes(); }
 629 
 630   // monitor matching. This returns a conservative estimate of whether the monitorenter/monitorexit bytecodes
 631   // propererly nest in the method. It might return false, even though they actually nest properly, since the info.
 632   // has not been computed yet.
 633   bool guaranteed_monitor_matching() const       { return access_flags().is_monitor_matching(); }
 634   void set_guaranteed_monitor_matching()         { _access_flags.set_monitor_matching(); }
 635 
 636   // returns true if the method is an accessor function (setter/getter).
 637   bool is_accessor() const;
 638 
 639   // returns true if the method is a getter
 640   bool is_getter() const;
 641 
 642   // returns true if the method is a setter
 643   bool is_setter() const;
 644 
 645   // returns true if the method does nothing but return a constant of primitive type
 646   bool is_constant_getter() const;
 647 
 648   // returns true if the method is an initializer (<init> or <clinit>).
 649   bool is_initializer() const;
 650 
 651   // returns true if the method is static OR if the classfile version < 51
 652   bool has_valid_initializer_flags() const;
 653 
 654   // returns true if the method name is <clinit> and the method has
 655   // valid static initializer flags.
 656   bool is_static_initializer() const;



 657 
 658   // returns true if the method name is <init>
 659   bool is_object_initializer() const;




 660 
 661   // compiled code support
 662   // NOTE: code() is inherently racy as deopt can be clearing code
 663   // simultaneously. Use with caution.
 664   bool has_compiled_code() const;
 665 
 666   bool needs_clinit_barrier() const;
 667 
 668   // sizing
 669   static int header_size()                       {
 670     return align_up((int)sizeof(Method), wordSize) / wordSize;
 671   }
 672   static int size(bool is_native);
 673   int size() const                               { return method_size(); }
 674   void log_touched(Thread* current);
 675   static void print_touched_methods(outputStream* out);
 676 
 677   // interpreter support
 678   static ByteSize const_offset()                 { return byte_offset_of(Method, _constMethod       ); }
 679   static ByteSize access_flags_offset()          { return byte_offset_of(Method, _access_flags      ); }
 680   static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }


 681   static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }

 682   static ByteSize method_data_offset()           {
 683     return byte_offset_of(Method, _method_data);
 684   }
 685   static ByteSize method_counters_offset()       {
 686     return byte_offset_of(Method, _method_counters);
 687   }
 688 #ifndef PRODUCT
 689   static ByteSize compiled_invocation_counter_offset() { return byte_offset_of(Method, _compiled_invocation_count); }
 690 #endif // not PRODUCT
 691   static ByteSize native_function_offset()       { return in_ByteSize(sizeof(Method));                 }
 692   static ByteSize from_interpreted_offset()      { return byte_offset_of(Method, _from_interpreted_entry ); }
 693   static ByteSize interpreter_entry_offset()     { return byte_offset_of(Method, _i2i_entry ); }
 694   static ByteSize signature_handler_offset()     { return in_ByteSize(sizeof(Method) + wordSize);      }
 695   static ByteSize itable_index_offset()          { return byte_offset_of(Method, _vtable_index ); }
 696 
 697   // for code generation
 698   static int method_data_offset_in_bytes()       { return offset_of(Method, _method_data); }
 699   static int intrinsic_id_offset_in_bytes()      { return offset_of(Method, _intrinsic_id); }
 700   static int intrinsic_id_size_in_bytes()        { return sizeof(u2); }
 701 

 856   }
 857   void set_intrinsic_candidate(bool x) {
 858     _flags = x ? (_flags | _intrinsic_candidate) : (_flags & ~_intrinsic_candidate);
 859   }
 860 
 861   bool has_injected_profile() {
 862     return (_flags & _has_injected_profile) != 0;
 863   }
 864   void set_has_injected_profile(bool x) {
 865     _flags = x ? (_flags | _has_injected_profile) : (_flags & ~_has_injected_profile);
 866   }
 867 
 868   bool has_reserved_stack_access() {
 869     return (_flags & _reserved_stack_access) != 0;
 870   }
 871 
 872   void set_has_reserved_stack_access(bool x) {
 873     _flags = x ? (_flags | _reserved_stack_access) : (_flags & ~_reserved_stack_access);
 874   }
 875 


























 876   JFR_ONLY(DEFINE_TRACE_FLAG_ACCESSOR;)
 877 
 878   ConstMethod::MethodType method_type() const {
 879       return _constMethod->method_type();
 880   }
 881   bool is_overpass() const { return method_type() == ConstMethod::OVERPASS; }
 882 
 883   // On-stack replacement support
 884   bool has_osr_nmethod(int level, bool match_level) {
 885    return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
 886   }
 887 
 888   int mark_osr_nmethods() {
 889     return method_holder()->mark_osr_nmethods(this);
 890   }
 891 
 892   nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) {
 893     return method_holder()->lookup_osr_nmethod(this, bci, level, match_level);
 894   }
 895 

  74   // If you add a new field that points to any metaspace object, you
  75   // must add this field to Method::metaspace_pointers_do().
  76   ConstMethod*      _constMethod;                // Method read-only data.
  77   MethodData*       _method_data;
  78   MethodCounters*   _method_counters;
  79   AdapterHandlerEntry* _adapter;
  80   AccessFlags       _access_flags;               // Access flags
  81   int               _vtable_index;               // vtable index of this method (see VtableIndexFlag)
  82                                                  // note: can have vtables with >2**16 elements (because of inheritance)
  83   u2                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
  84 
  85   // Flags
  86   enum Flags {
  87     _caller_sensitive      = 1 << 0,
  88     _force_inline          = 1 << 1,
  89     _dont_inline           = 1 << 2,
  90     _hidden                = 1 << 3,
  91     _has_injected_profile  = 1 << 4,
  92     _intrinsic_candidate   = 1 << 5,
  93     _reserved_stack_access = 1 << 6,
  94     _scalarized_args       = 1 << 7,
  95     _c1_needs_stack_repair = 1 << 8,
  96     _c2_needs_stack_repair = 1 << 9,
  97     _scoped                = 1 << 10
  98   };
  99   mutable u2 _flags;
 100 
 101   JFR_ONLY(DEFINE_TRACE_FLAG;)
 102 
 103 #ifndef PRODUCT
 104   int64_t _compiled_invocation_count;
 105 
 106   Symbol* _name;
 107 #endif
 108   // Entry point for calling both from and to the interpreter.
 109   address _i2i_entry;           // All-args-on-stack calling convention
 110   // Entry point for calling from compiled code, to compiled code if it exists
 111   // or else the interpreter.
 112   volatile address _from_compiled_entry;           // Cache of: _code ? _code->verified_entry_point()           : _adapter->c2i_entry()
 113   volatile address _from_compiled_inline_ro_entry; // Cache of: _code ? _code->verified_inline_ro_entry_point() : _adapter->c2i_inline_ro_entry()
 114   volatile address _from_compiled_inline_entry;    // Cache of: _code ? _code->verified_inline_entry_point()    : _adapter->c2i_inline_entry()
 115   // The entry point for calling both from and to compiled code is
 116   // "_code->entry_point()".  Because of tiered compilation and de-opt, this
 117   // field can come and go.  It can transition from NULL to not-null at any
 118   // time (whenever a compile completes).  It can transition from not-null to
 119   // NULL only at safepoints (because of a de-opt).
 120   CompiledMethod* volatile _code;                       // Points to the corresponding piece of native code
 121   volatile address           _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
 122 
 123   // Constructor
 124   Method(ConstMethod* xconst, AccessFlags access_flags, Symbol* name);
 125  public:
 126 
 127   static Method* allocate(ClassLoaderData* loader_data,
 128                           int byte_code_size,
 129                           AccessFlags access_flags,
 130                           InlineTableSizes* sizes,
 131                           ConstMethod::MethodType method_type,
 132                           Symbol* name,
 133                           TRAPS);
 134 
 135   // CDS and vtbl checking can create an empty Method to get vtbl pointer.
 136   Method(){}
 137 
 138   virtual bool is_method() const { return true; }
 139 
 140   void restore_unshareable_info(TRAPS);
 141 
 142   // accessors for instance variables
 143 
 144   ConstMethod* constMethod() const             { return _constMethod; }
 145   void set_constMethod(ConstMethod* xconst)    { _constMethod = xconst; }
 146 
 147 
 148   static address make_adapters(const methodHandle& mh, TRAPS);
 149   address from_compiled_entry() const;
 150   address from_compiled_inline_ro_entry() const;
 151   address from_compiled_inline_entry() const;
 152   address from_compiled_entry_no_trampoline(bool caller_is_c1) const;
 153   address from_interpreted_entry() const;
 154 
 155   // access flag
 156   AccessFlags access_flags() const               { return _access_flags;  }
 157   void set_access_flags(AccessFlags flags)       { _access_flags = flags; }
 158 
 159   // name
 160   Symbol* name() const                           { return constants()->symbol_at(name_index()); }
 161   int name_index() const                         { return constMethod()->name_index();         }
 162   void set_name_index(int index)                 { constMethod()->set_name_index(index);       }
 163 
 164   // signature
 165   Symbol* signature() const                      { return constants()->symbol_at(signature_index()); }
 166   int signature_index() const                    { return constMethod()->signature_index();         }
 167   void set_signature_index(int index)            { constMethod()->set_signature_index(index);       }
 168 
 169   // generics support
 170   Symbol* generic_signature() const              { int idx = generic_signature_index(); return ((idx != 0) ? constants()->symbol_at(idx) : (Symbol*)NULL); }
 171   int generic_signature_index() const            { return constMethod()->generic_signature_index(); }
 172   void set_generic_signature_index(int index)    { constMethod()->set_generic_signature_index(index); }

 426   static void build_interpreter_method_data(const methodHandle& method, TRAPS);
 427 
 428   static MethodCounters* build_method_counters(Thread* current, Method* m);
 429 
 430   int interpreter_invocation_count()            { return invocation_count();          }
 431 
 432 #ifndef PRODUCT
 433   int64_t  compiled_invocation_count() const    { return _compiled_invocation_count;}
 434   void set_compiled_invocation_count(int count) { _compiled_invocation_count = (int64_t)count; }
 435 #else
 436   // for PrintMethodData in a product build
 437   int64_t  compiled_invocation_count() const    { return 0; }
 438 #endif // not PRODUCT
 439 
 440   // Clear (non-shared space) pointers which could not be relevant
 441   // if this (shared) method were mapped into another JVM.
 442   void remove_unshareable_info();
 443 
 444   // nmethod/verified compiler entry
 445   address verified_code_entry();
 446   address verified_inline_code_entry();
 447   address verified_inline_ro_code_entry();
 448   bool check_code() const;      // Not inline to avoid circular ref
 449   CompiledMethod* volatile code() const;
 450 
 451   // Locks CompiledMethod_lock if not held.
 452   void unlink_code(CompiledMethod *compare);
 453   // Locks CompiledMethod_lock if not held.
 454   void unlink_code();
 455 
 456 private:
 457   // Either called with CompiledMethod_lock held or from constructor.
 458   void clear_code();
 459 
 460 public:
 461   static void set_code(const methodHandle& mh, CompiledMethod* code);
 462   void set_adapter_entry(AdapterHandlerEntry* adapter) {
 463     _adapter = adapter;
 464   }
 465   void set_from_compiled_entry(address entry) {
 466     _from_compiled_entry = entry;
 467   }
 468   void set_from_compiled_inline_ro_entry(address entry) {
 469     _from_compiled_inline_ro_entry = entry;
 470   }
 471   void set_from_compiled_inline_entry(address entry) {
 472     _from_compiled_inline_entry = entry;
 473   }
 474 
 475   address get_i2c_entry();
 476   address get_c2i_entry();
 477   address get_c2i_inline_entry();
 478   address get_c2i_unverified_entry();
 479   address get_c2i_unverified_inline_entry();
 480   address get_c2i_no_clinit_check_entry();
 481   AdapterHandlerEntry* adapter() const {
 482     return _adapter;
 483   }
 484   // setup entry points
 485   void link_method(const methodHandle& method, TRAPS);
 486   // clear entry points. Used by sharing code during dump time
 487   void unlink_method() NOT_CDS_RETURN;
 488 
 489   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
 490   virtual MetaspaceObj::Type type() const { return MethodType; }
 491 
 492   // vtable index
 493   enum VtableIndexFlag {
 494     // Valid vtable indexes are non-negative (>= 0).
 495     // These few negative values are used as sentinels.
 496     itable_index_max        = -10, // first itable index, growing downward
 497     pending_itable_index    = -9,  // itable index will be assigned
 498     invalid_vtable_index    = -4,  // distinct from any valid vtable index
 499     garbage_vtable_index    = -3,  // not yet linked; no vtable layout yet

 570 
 571   // localvariable table
 572   bool has_localvariable_table() const
 573                           { return constMethod()->has_localvariable_table(); }
 574   int localvariable_table_length() const
 575                         { return constMethod()->localvariable_table_length(); }
 576   LocalVariableTableElement* localvariable_table_start() const
 577                          { return constMethod()->localvariable_table_start(); }
 578 
 579   bool has_linenumber_table() const
 580                               { return constMethod()->has_linenumber_table(); }
 581   u_char* compressed_linenumber_table() const
 582                        { return constMethod()->compressed_linenumber_table(); }
 583 
 584   // method holder (the Klass* holding this method)
 585   InstanceKlass* method_holder() const         { return constants()->pool_holder(); }
 586 
 587   Symbol* klass_name() const;                    // returns the name of the method holder
 588   BasicType result_type() const                  { return constMethod()->result_type(); }
 589   bool is_returning_oop() const                  { BasicType r = result_type(); return is_reference_type(r); }
 590   InlineKlass* returns_inline_type(Thread* thread) const;
 591 
 592   // Checked exceptions thrown by this method (resolved to mirrors)
 593   objArrayHandle resolved_checked_exceptions(TRAPS) { return resolved_checked_exceptions_impl(this, THREAD); }
 594 
 595   // Access flags
 596   bool is_public() const                         { return access_flags().is_public();      }
 597   bool is_private() const                        { return access_flags().is_private();     }
 598   bool is_protected() const                      { return access_flags().is_protected();   }
 599   bool is_package_private() const                { return !is_public() && !is_private() && !is_protected(); }
 600   bool is_static() const                         { return access_flags().is_static();      }
 601   bool is_final() const                          { return access_flags().is_final();       }
 602   bool is_synchronized() const                   { return access_flags().is_synchronized();}
 603   bool is_native() const                         { return access_flags().is_native();      }
 604   bool is_abstract() const                       { return access_flags().is_abstract();    }
 605   bool is_synthetic() const                      { return access_flags().is_synthetic();   }
 606 
 607   // returns true if contains only return operation
 608   bool is_empty_method() const;
 609 
 610   // returns true if this is a vanilla constructor

 645   void set_has_monitor_bytecodes()               { _access_flags.set_has_monitor_bytecodes(); }
 646 
 647   // monitor matching. This returns a conservative estimate of whether the monitorenter/monitorexit bytecodes
 648   // propererly nest in the method. It might return false, even though they actually nest properly, since the info.
 649   // has not been computed yet.
 650   bool guaranteed_monitor_matching() const       { return access_flags().is_monitor_matching(); }
 651   void set_guaranteed_monitor_matching()         { _access_flags.set_monitor_matching(); }
 652 
 653   // returns true if the method is an accessor function (setter/getter).
 654   bool is_accessor() const;
 655 
 656   // returns true if the method is a getter
 657   bool is_getter() const;
 658 
 659   // returns true if the method is a setter
 660   bool is_setter() const;
 661 
 662   // returns true if the method does nothing but return a constant of primitive type
 663   bool is_constant_getter() const;
 664 






 665   // returns true if the method name is <clinit> and the method has
 666   // valid static initializer flags.
 667   bool is_class_initializer() const;
 668 
 669   // returns true if the method name is <init> and the method is not a static factory
 670   bool is_object_constructor() const;
 671 
 672   // returns true if the method is an object constructor or class initializer
 673   // (non-static <init> or <clinit>), but false for factories (static <init>).
 674   bool is_object_constructor_or_class_initializer() const;
 675 
 676   // returns true if the method name is <init> and the method is static
 677   bool is_static_init_factory() const;
 678 
 679   // compiled code support
 680   // NOTE: code() is inherently racy as deopt can be clearing code
 681   // simultaneously. Use with caution.
 682   bool has_compiled_code() const;
 683 
 684   bool needs_clinit_barrier() const;
 685 
 686   // sizing
 687   static int header_size()                       {
 688     return align_up((int)sizeof(Method), wordSize) / wordSize;
 689   }
 690   static int size(bool is_native);
 691   int size() const                               { return method_size(); }
 692   void log_touched(Thread* current);
 693   static void print_touched_methods(outputStream* out);
 694 
 695   // interpreter support
 696   static ByteSize const_offset()                 { return byte_offset_of(Method, _constMethod       ); }
 697   static ByteSize access_flags_offset()          { return byte_offset_of(Method, _access_flags      ); }
 698   static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }
 699   static ByteSize from_compiled_inline_offset()  { return byte_offset_of(Method, _from_compiled_inline_entry); }
 700   static ByteSize from_compiled_inline_ro_offset(){ return byte_offset_of(Method, _from_compiled_inline_ro_entry); }
 701   static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }
 702   static ByteSize flags_offset()                 { return byte_offset_of(Method, _flags); }
 703   static ByteSize method_data_offset()           {
 704     return byte_offset_of(Method, _method_data);
 705   }
 706   static ByteSize method_counters_offset()       {
 707     return byte_offset_of(Method, _method_counters);
 708   }
 709 #ifndef PRODUCT
 710   static ByteSize compiled_invocation_counter_offset() { return byte_offset_of(Method, _compiled_invocation_count); }
 711 #endif // not PRODUCT
 712   static ByteSize native_function_offset()       { return in_ByteSize(sizeof(Method));                 }
 713   static ByteSize from_interpreted_offset()      { return byte_offset_of(Method, _from_interpreted_entry ); }
 714   static ByteSize interpreter_entry_offset()     { return byte_offset_of(Method, _i2i_entry ); }
 715   static ByteSize signature_handler_offset()     { return in_ByteSize(sizeof(Method) + wordSize);      }
 716   static ByteSize itable_index_offset()          { return byte_offset_of(Method, _vtable_index ); }
 717 
 718   // for code generation
 719   static int method_data_offset_in_bytes()       { return offset_of(Method, _method_data); }
 720   static int intrinsic_id_offset_in_bytes()      { return offset_of(Method, _intrinsic_id); }
 721   static int intrinsic_id_size_in_bytes()        { return sizeof(u2); }
 722 

 877   }
 878   void set_intrinsic_candidate(bool x) {
 879     _flags = x ? (_flags | _intrinsic_candidate) : (_flags & ~_intrinsic_candidate);
 880   }
 881 
 882   bool has_injected_profile() {
 883     return (_flags & _has_injected_profile) != 0;
 884   }
 885   void set_has_injected_profile(bool x) {
 886     _flags = x ? (_flags | _has_injected_profile) : (_flags & ~_has_injected_profile);
 887   }
 888 
 889   bool has_reserved_stack_access() {
 890     return (_flags & _reserved_stack_access) != 0;
 891   }
 892 
 893   void set_has_reserved_stack_access(bool x) {
 894     _flags = x ? (_flags | _reserved_stack_access) : (_flags & ~_reserved_stack_access);
 895   }
 896 
 897   bool has_scalarized_args() const {
 898     return (_flags & _scalarized_args) != 0;
 899   }
 900 
 901   void set_has_scalarized_args(bool x) {
 902     _flags = x ? (_flags | _scalarized_args) : (_flags & ~_scalarized_args);
 903   }
 904 
 905   bool is_scalarized_arg(int idx) const;
 906 
 907   bool c1_needs_stack_repair() {
 908     return (_flags & _c1_needs_stack_repair) != 0;
 909   }
 910 
 911   bool c2_needs_stack_repair() {
 912     return (_flags & _c2_needs_stack_repair) != 0;
 913   }
 914 
 915   void set_c1_needs_stack_repair(bool x) {
 916     _flags = x ? (_flags | _c1_needs_stack_repair) : (_flags & ~_c1_needs_stack_repair);
 917   }
 918 
 919   void set_c2_needs_stack_repair(bool x) {
 920     _flags = x ? (_flags | _c2_needs_stack_repair) : (_flags & ~_c2_needs_stack_repair);
 921   }
 922 
 923   JFR_ONLY(DEFINE_TRACE_FLAG_ACCESSOR;)
 924 
 925   ConstMethod::MethodType method_type() const {
 926       return _constMethod->method_type();
 927   }
 928   bool is_overpass() const { return method_type() == ConstMethod::OVERPASS; }
 929 
 930   // On-stack replacement support
 931   bool has_osr_nmethod(int level, bool match_level) {
 932    return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
 933   }
 934 
 935   int mark_osr_nmethods() {
 936     return method_holder()->mark_osr_nmethods(this);
 937   }
 938 
 939   nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) {
 940     return method_holder()->lookup_osr_nmethod(this, bci, level, match_level);
 941   }
 942 
< prev index next >