src/share/vm/oops/method.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  84 // |                                                      |
  85 // |------------------------------------------------------|
  86 // |                  rate (tiered)                       |
  87 // |------------------------------------------------------|
  88 // | code                           (pointer)             |
  89 // | i2i                            (pointer)             |
  90 // | adapter                        (pointer)             |
  91 // | from_compiled_entry            (pointer)             |
  92 // | from_interpreted_entry         (pointer)             |
  93 // |------------------------------------------------------|
  94 // | native_function       (present only if native)       |
  95 // | signature_handler     (present only if native)       |
  96 // |------------------------------------------------------|
  97 
  98 
  99 class CheckedExceptionElement;
 100 class LocalVariableTableElement;
 101 class AdapterHandlerEntry;
 102 class MethodData;
 103 class ConstMethod;

 104 
 105 class Method : public Metadata {
 106  friend class VMStructs;
 107  private:
 108   ConstMethod*      _constMethod;                // Method read-only data.
 109   MethodData*       _method_data;
 110   int               _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
 111   AccessFlags       _access_flags;               // Access flags
 112   int               _vtable_index;               // vtable index of this method (see VtableIndexFlag)
 113                                                  // note: can have vtables with >2**16 elements (because of inheritance)
 114 #ifdef CC_INTERP
 115   int               _result_index;               // C++ interpreter needs for converting results to/from stack
 116 #endif
 117   u2                _method_size;                // size of this object
 118   u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
 119   u1                _jfr_towrite  : 1,           // Flags
 120                     _force_inline : 1,
 121                     _hidden       : 1,
 122                     _dont_inline  : 1,
 123                                   : 4;


 576 
 577   // returns true if the method is an initializer (<init> or <clinit>).
 578   bool is_initializer() const;
 579 
 580   // returns true if the method is static OR if the classfile version < 51
 581   bool has_valid_initializer_flags() const;
 582 
 583   // returns true if the method name is <clinit> and the method has
 584   // valid static initializer flags.
 585   bool is_static_initializer() const;
 586 
 587   // compiled code support
 588   // NOTE: code() is inherently racy as deopt can be clearing code
 589   // simultaneously. Use with caution.
 590   bool has_compiled_code() const                 { return code() != NULL; }
 591 
 592   // sizing
 593   static int header_size()                       { return sizeof(Method)/HeapWordSize; }
 594   static int size(bool is_native);
 595   int size() const                               { return method_size(); }



 596 
 597   // interpreter support
 598   static ByteSize const_offset()                 { return byte_offset_of(Method, _constMethod       ); }
 599   static ByteSize access_flags_offset()          { return byte_offset_of(Method, _access_flags      ); }
 600 #ifdef CC_INTERP
 601   static ByteSize result_index_offset()          { return byte_offset_of(Method, _result_index ); }
 602 #endif /* CC_INTERP */
 603   static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }
 604   static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }
 605   static ByteSize invocation_counter_offset()    { return byte_offset_of(Method, _invocation_counter); }
 606   static ByteSize backedge_counter_offset()      { return byte_offset_of(Method, _backedge_counter); }
 607   static ByteSize method_data_offset()           {
 608     return byte_offset_of(Method, _method_data);
 609   }
 610   static ByteSize interpreter_invocation_counter_offset() { return byte_offset_of(Method, _interpreter_invocation_count); }
 611 #ifndef PRODUCT
 612   static ByteSize compiled_invocation_counter_offset() { return byte_offset_of(Method, _compiled_invocation_count); }
 613 #endif // not PRODUCT
 614   static ByteSize native_function_offset()       { return in_ByteSize(sizeof(Method));                 }
 615   static ByteSize from_interpreted_offset()      { return byte_offset_of(Method, _from_interpreted_entry ); }


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  84 // |                                                      |
  85 // |------------------------------------------------------|
  86 // |                  rate (tiered)                       |
  87 // |------------------------------------------------------|
  88 // | code                           (pointer)             |
  89 // | i2i                            (pointer)             |
  90 // | adapter                        (pointer)             |
  91 // | from_compiled_entry            (pointer)             |
  92 // | from_interpreted_entry         (pointer)             |
  93 // |------------------------------------------------------|
  94 // | native_function       (present only if native)       |
  95 // | signature_handler     (present only if native)       |
  96 // |------------------------------------------------------|
  97 
  98 
  99 class CheckedExceptionElement;
 100 class LocalVariableTableElement;
 101 class AdapterHandlerEntry;
 102 class MethodData;
 103 class ConstMethod;
 104 class KlassSizeStats;
 105 
 106 class Method : public Metadata {
 107  friend class VMStructs;
 108  private:
 109   ConstMethod*      _constMethod;                // Method read-only data.
 110   MethodData*       _method_data;
 111   int               _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
 112   AccessFlags       _access_flags;               // Access flags
 113   int               _vtable_index;               // vtable index of this method (see VtableIndexFlag)
 114                                                  // note: can have vtables with >2**16 elements (because of inheritance)
 115 #ifdef CC_INTERP
 116   int               _result_index;               // C++ interpreter needs for converting results to/from stack
 117 #endif
 118   u2                _method_size;                // size of this object
 119   u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
 120   u1                _jfr_towrite  : 1,           // Flags
 121                     _force_inline : 1,
 122                     _hidden       : 1,
 123                     _dont_inline  : 1,
 124                                   : 4;


 577 
 578   // returns true if the method is an initializer (<init> or <clinit>).
 579   bool is_initializer() const;
 580 
 581   // returns true if the method is static OR if the classfile version < 51
 582   bool has_valid_initializer_flags() const;
 583 
 584   // returns true if the method name is <clinit> and the method has
 585   // valid static initializer flags.
 586   bool is_static_initializer() const;
 587 
 588   // compiled code support
 589   // NOTE: code() is inherently racy as deopt can be clearing code
 590   // simultaneously. Use with caution.
 591   bool has_compiled_code() const                 { return code() != NULL; }
 592 
 593   // sizing
 594   static int header_size()                       { return sizeof(Method)/HeapWordSize; }
 595   static int size(bool is_native);
 596   int size() const                               { return method_size(); }
 597 #if INCLUDE_SERVICES
 598   void collect_statistics(KlassSizeStats *sz) const;
 599 #endif
 600 
 601   // interpreter support
 602   static ByteSize const_offset()                 { return byte_offset_of(Method, _constMethod       ); }
 603   static ByteSize access_flags_offset()          { return byte_offset_of(Method, _access_flags      ); }
 604 #ifdef CC_INTERP
 605   static ByteSize result_index_offset()          { return byte_offset_of(Method, _result_index ); }
 606 #endif /* CC_INTERP */
 607   static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }
 608   static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }
 609   static ByteSize invocation_counter_offset()    { return byte_offset_of(Method, _invocation_counter); }
 610   static ByteSize backedge_counter_offset()      { return byte_offset_of(Method, _backedge_counter); }
 611   static ByteSize method_data_offset()           {
 612     return byte_offset_of(Method, _method_data);
 613   }
 614   static ByteSize interpreter_invocation_counter_offset() { return byte_offset_of(Method, _interpreter_invocation_count); }
 615 #ifndef PRODUCT
 616   static ByteSize compiled_invocation_counter_offset() { return byte_offset_of(Method, _compiled_invocation_count); }
 617 #endif // not PRODUCT
 618   static ByteSize native_function_offset()       { return in_ByteSize(sizeof(Method));                 }
 619   static ByteSize from_interpreted_offset()      { return byte_offset_of(Method, _from_interpreted_entry ); }