< prev index next >

src/hotspot/share/oops/method.hpp

Print this page

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



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


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


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

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


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






 454   }
 455 
 456   address get_i2c_entry();
 457   address get_c2i_entry();

 458   address get_c2i_unverified_entry();

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

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

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



 650 
 651   // returns true if the method name is <init>
 652   bool is_object_initializer() const;




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


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

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

 849   }
 850   void set_intrinsic_candidate(bool x) {
 851     _flags = x ? (_flags | _intrinsic_candidate) : (_flags & ~_intrinsic_candidate);
 852   }
 853 
 854   bool has_injected_profile() {
 855     return (_flags & _has_injected_profile) != 0;
 856   }
 857   void set_has_injected_profile(bool x) {
 858     _flags = x ? (_flags | _has_injected_profile) : (_flags & ~_has_injected_profile);
 859   }
 860 
 861   bool has_reserved_stack_access() {
 862     return (_flags & _reserved_stack_access) != 0;
 863   }
 864 
 865   void set_has_reserved_stack_access(bool x) {
 866     _flags = x ? (_flags | _reserved_stack_access) : (_flags & ~_reserved_stack_access);
 867   }
 868 
























 869   JFR_ONLY(DEFINE_TRACE_FLAG_ACCESSOR;)
 870 
 871   ConstMethod::MethodType method_type() const {
 872       return _constMethod->method_type();
 873   }
 874   bool is_overpass() const { return method_type() == ConstMethod::OVERPASS; }
 875 
 876   // On-stack replacement support
 877   bool has_osr_nmethod(int level, bool match_level) {
 878    return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
 879   }
 880 
 881   int mark_osr_nmethods() {
 882     return method_holder()->mark_osr_nmethods(this);
 883   }
 884 
 885   nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) {
 886     return method_holder()->lookup_osr_nmethod(this, bci, level, match_level);
 887   }
 888 

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

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

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

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






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

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