< prev index next >

src/share/vm/oops/method.hpp

Print this page




  86   };
  87   mutable u2 _flags;
  88 
  89   TRACE_DEFINE_FLAG;
  90 
  91 #ifndef PRODUCT
  92   int               _compiled_invocation_count;  // Number of nmethod invocations so far (for perf. debugging)
  93 #endif
  94   // Entry point for calling both from and to the interpreter.
  95   address _i2i_entry;           // All-args-on-stack calling convention
  96   // Entry point for calling from compiled code, to compiled code if it exists
  97   // or else the interpreter.
  98   volatile address _from_compiled_entry;        // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
  99   // The entry point for calling both from and to compiled code is
 100   // "_code->entry_point()".  Because of tiered compilation and de-opt, this
 101   // field can come and go.  It can transition from NULL to not-null at any
 102   // time (whenever a compile completes).  It can transition from not-null to
 103   // NULL only at safepoints (because of a de-opt).
 104   CompiledMethod* volatile _code;                       // Points to the corresponding piece of native code
 105   volatile address           _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry

 106 
 107 #if INCLUDE_AOT && defined(TIERED)
 108   CompiledMethod* _aot_code;
 109 #endif
 110 
 111   // Constructor
 112   Method(ConstMethod* xconst, AccessFlags access_flags);
 113  public:
 114 
 115   static Method* allocate(ClassLoaderData* loader_data,
 116                           int byte_code_size,
 117                           AccessFlags access_flags,
 118                           InlineTableSizes* sizes,
 119                           ConstMethod::MethodType method_type,
 120                           TRAPS);
 121 
 122   // CDS and vtbl checking can create an empty Method to get vtbl pointer.
 123   Method(){}
 124 
 125   bool is_method() const volatile { return true; }


 246   // code size
 247   int code_size() const                  { return constMethod()->code_size(); }
 248 
 249   // method size in words
 250   int method_size() const                { return sizeof(Method)/wordSize + ( is_native() ? 2 : 0 ); }
 251 
 252   // constant pool for Klass* holding this method
 253   ConstantPool* constants() const              { return constMethod()->constants(); }
 254   void set_constants(ConstantPool* c)          { constMethod()->set_constants(c); }
 255 
 256   // max stack
 257   // return original max stack size for method verification
 258   int  verifier_max_stack() const                { return constMethod()->max_stack(); }
 259   int           max_stack() const                { return constMethod()->max_stack() + extra_stack_entries(); }
 260   void      set_max_stack(int size)              {        constMethod()->set_max_stack(size); }
 261 
 262   // max locals
 263   int  max_locals() const                        { return constMethod()->max_locals(); }
 264   void set_max_locals(int size)                  { constMethod()->set_max_locals(size); }
 265 






 266   int highest_comp_level() const;
 267   void set_highest_comp_level(int level);
 268   int highest_osr_comp_level() const;
 269   void set_highest_osr_comp_level(int level);
 270 
 271 #if defined(COMPILER2) || INCLUDE_JVMCI
 272   // Count of times method was exited via exception while interpreting
 273   void interpreter_throwout_increment(TRAPS) {
 274     MethodCounters* mcs = get_method_counters(CHECK);
 275     if (mcs != NULL) {
 276       mcs->interpreter_throwout_increment();
 277     }
 278   }
 279 #endif
 280 
 281   int  interpreter_throwout_count() const        {
 282     MethodCounters* mcs = method_counters();
 283     if (mcs == NULL) {
 284       return 0;
 285     } else {


 687   static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }
 688   static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }
 689   static ByteSize method_data_offset()           {
 690     return byte_offset_of(Method, _method_data);
 691   }
 692   static ByteSize method_counters_offset()       {
 693     return byte_offset_of(Method, _method_counters);
 694   }
 695 #ifndef PRODUCT
 696   static ByteSize compiled_invocation_counter_offset() { return byte_offset_of(Method, _compiled_invocation_count); }
 697 #endif // not PRODUCT
 698   static ByteSize native_function_offset()       { return in_ByteSize(sizeof(Method));                 }
 699   static ByteSize from_interpreted_offset()      { return byte_offset_of(Method, _from_interpreted_entry ); }
 700   static ByteSize interpreter_entry_offset()     { return byte_offset_of(Method, _i2i_entry ); }
 701   static ByteSize signature_handler_offset()     { return in_ByteSize(sizeof(Method) + wordSize);      }
 702 
 703   // for code generation
 704   static int method_data_offset_in_bytes()       { return offset_of(Method, _method_data); }
 705   static int intrinsic_id_offset_in_bytes()      { return offset_of(Method, _intrinsic_id); }
 706   static int intrinsic_id_size_in_bytes()        { return sizeof(u2); }


 707 
 708   // Static methods that are used to implement member methods where an exposed this pointer
 709   // is needed due to possible GCs
 710   static objArrayHandle resolved_checked_exceptions_impl(Method* method, TRAPS);
 711 
 712   // Returns the byte code index from the byte code pointer
 713   int     bci_from(address bcp) const;
 714   address bcp_from(int bci) const;
 715   address bcp_from(address bcp) const;
 716   int validate_bci_from_bcp(address bcp) const;
 717   int validate_bci(int bci) const;
 718 
 719   // Returns the line number for a bci if debugging information for the method is prowided,
 720   // -1 is returned otherwise.
 721   int line_number_from_bci(int bci) const;
 722 
 723   // Reflection support
 724   bool is_overridden_in(Klass* k) const;
 725 
 726   // Stack walking support




  86   };
  87   mutable u2 _flags;
  88 
  89   TRACE_DEFINE_FLAG;
  90 
  91 #ifndef PRODUCT
  92   int               _compiled_invocation_count;  // Number of nmethod invocations so far (for perf. debugging)
  93 #endif
  94   // Entry point for calling both from and to the interpreter.
  95   address _i2i_entry;           // All-args-on-stack calling convention
  96   // Entry point for calling from compiled code, to compiled code if it exists
  97   // or else the interpreter.
  98   volatile address _from_compiled_entry;        // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
  99   // The entry point for calling both from and to compiled code is
 100   // "_code->entry_point()".  Because of tiered compilation and de-opt, this
 101   // field can come and go.  It can transition from NULL to not-null at any
 102   // time (whenever a compile completes).  It can transition from not-null to
 103   // NULL only at safepoints (because of a de-opt).
 104   CompiledMethod* volatile _code;                       // Points to the corresponding piece of native code
 105   volatile address           _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
 106   int _max_vt_buffer; // max number of VT buffer chunk to use before recycling
 107 
 108 #if INCLUDE_AOT && defined(TIERED)
 109   CompiledMethod* _aot_code;
 110 #endif
 111 
 112   // Constructor
 113   Method(ConstMethod* xconst, AccessFlags access_flags);
 114  public:
 115 
 116   static Method* allocate(ClassLoaderData* loader_data,
 117                           int byte_code_size,
 118                           AccessFlags access_flags,
 119                           InlineTableSizes* sizes,
 120                           ConstMethod::MethodType method_type,
 121                           TRAPS);
 122 
 123   // CDS and vtbl checking can create an empty Method to get vtbl pointer.
 124   Method(){}
 125 
 126   bool is_method() const volatile { return true; }


 247   // code size
 248   int code_size() const                  { return constMethod()->code_size(); }
 249 
 250   // method size in words
 251   int method_size() const                { return sizeof(Method)/wordSize + ( is_native() ? 2 : 0 ); }
 252 
 253   // constant pool for Klass* holding this method
 254   ConstantPool* constants() const              { return constMethod()->constants(); }
 255   void set_constants(ConstantPool* c)          { constMethod()->set_constants(c); }
 256 
 257   // max stack
 258   // return original max stack size for method verification
 259   int  verifier_max_stack() const                { return constMethod()->max_stack(); }
 260   int           max_stack() const                { return constMethod()->max_stack() + extra_stack_entries(); }
 261   void      set_max_stack(int size)              {        constMethod()->set_max_stack(size); }
 262 
 263   // max locals
 264   int  max_locals() const                        { return constMethod()->max_locals(); }
 265   void set_max_locals(int size)                  { constMethod()->set_max_locals(size); }
 266 
 267   // value type buffering
 268   void initialize_max_vt_buffer();
 269   int max_vt_buffer() const                      { return _max_vt_buffer; }
 270   void set_max_vt_buffer(int size)               { _max_vt_buffer = size; }
 271 
 272 
 273   int highest_comp_level() const;
 274   void set_highest_comp_level(int level);
 275   int highest_osr_comp_level() const;
 276   void set_highest_osr_comp_level(int level);
 277 
 278 #if defined(COMPILER2) || INCLUDE_JVMCI
 279   // Count of times method was exited via exception while interpreting
 280   void interpreter_throwout_increment(TRAPS) {
 281     MethodCounters* mcs = get_method_counters(CHECK);
 282     if (mcs != NULL) {
 283       mcs->interpreter_throwout_increment();
 284     }
 285   }
 286 #endif
 287 
 288   int  interpreter_throwout_count() const        {
 289     MethodCounters* mcs = method_counters();
 290     if (mcs == NULL) {
 291       return 0;
 292     } else {


 694   static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }
 695   static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }
 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 
 710   // for code generation
 711   static int method_data_offset_in_bytes()       { return offset_of(Method, _method_data); }
 712   static int intrinsic_id_offset_in_bytes()      { return offset_of(Method, _intrinsic_id); }
 713   static int intrinsic_id_size_in_bytes()        { return sizeof(u2); }
 714 
 715   static ByteSize max_vt_buffer_offset()         { return byte_offset_of(Method, _max_vt_buffer); }
 716 
 717   // Static methods that are used to implement member methods where an exposed this pointer
 718   // is needed due to possible GCs
 719   static objArrayHandle resolved_checked_exceptions_impl(Method* method, TRAPS);
 720 
 721   // Returns the byte code index from the byte code pointer
 722   int     bci_from(address bcp) const;
 723   address bcp_from(int bci) const;
 724   address bcp_from(address bcp) const;
 725   int validate_bci_from_bcp(address bcp) const;
 726   int validate_bci(int bci) const;
 727 
 728   // Returns the line number for a bci if debugging information for the method is prowided,
 729   // -1 is returned otherwise.
 730   int line_number_from_bci(int bci) const;
 731 
 732   // Reflection support
 733   bool is_overridden_in(Klass* k) const;
 734 
 735   // Stack walking support


< prev index next >