src/share/vm/oops/constMethod.hpp

changeset 4302
b2dbd323c668
parent 4245
4735d2c84362
child 4338
fd74228fd5ca
     1.1 --- a/src/share/vm/oops/constMethod.hpp	Fri Nov 16 09:43:43 2012 -0800
     1.2 +++ b/src/share/vm/oops/constMethod.hpp	Tue Nov 27 17:03:56 2012 -0500
     1.3 @@ -45,7 +45,7 @@
     1.4  // | constMethod_size                                     |
     1.5  // | interp_kind  | flags    | code_size                  |
     1.6  // | name index              | signature index            |
     1.7 -// | method_idnum            | generic_signature_index    |
     1.8 +// | method_idnum            | max_stack                  |
     1.9  // |------------------------------------------------------|
    1.10  // |                                                      |
    1.11  // | byte codes                                           |
    1.12 @@ -55,26 +55,29 @@
    1.13  // |  (see class CompressedLineNumberReadStream)          |
    1.14  // |  (note that length is unknown until decompressed)    |
    1.15  // |  (access flags bit tells whether table is present)   |
    1.16 -// |  (indexed from start of ConstMethod*)              |
    1.17 +// |  (indexed from start of ConstMethod*)                |
    1.18  // |  (elements not necessarily sorted!)                  |
    1.19  // |------------------------------------------------------|
    1.20  // | localvariable table elements + length (length last)  |
    1.21  // |  (length is u2, elements are 6-tuples of u2)         |
    1.22  // |  (see class LocalVariableTableElement)               |
    1.23  // |  (access flags bit tells whether table is present)   |
    1.24 -// |  (indexed from end of ConstMethod*)                |
    1.25 +// |  (indexed from end of ConstMethod*)                  |
    1.26  // |------------------------------------------------------|
    1.27  // | exception table + length (length last)               |
    1.28  // |  (length is u2, elements are 4-tuples of u2)         |
    1.29  // |  (see class ExceptionTableElement)                   |
    1.30  // |  (access flags bit tells whether table is present)   |
    1.31 -// |  (indexed from end of ConstMethod*)                |
    1.32 +// |  (indexed from end of ConstMethod*)                  |
    1.33  // |------------------------------------------------------|
    1.34  // | checked exceptions elements + length (length last)   |
    1.35  // |  (length is u2, elements are u2)                     |
    1.36  // |  (see class CheckedExceptionElement)                 |
    1.37  // |  (access flags bit tells whether table is present)   |
    1.38 -// |  (indexed from end of ConstMethod*)                |
    1.39 +// |  (indexed from end of ConstMethod*)                  |
    1.40 +// |------------------------------------------------------|
    1.41 +// | generic signature index (u2)                         |
    1.42 +// |  (indexed from start of constMethodOop)              |
    1.43  // |------------------------------------------------------|
    1.44  
    1.45  
    1.46 @@ -118,7 +121,8 @@
    1.47      _has_checked_exceptions = 2,
    1.48      _has_localvariable_table = 4,
    1.49      _has_exception_table = 8,
    1.50 -    _is_overpass = 16
    1.51 +    _has_generic_signature = 16,
    1.52 +    _is_overpass = 32
    1.53    };
    1.54  
    1.55    // Bit vector of signature
    1.56 @@ -145,7 +149,7 @@
    1.57    u2                _method_idnum;               // unique identification number for the method within the class
    1.58                                                   // initially corresponds to the index into the methods array.
    1.59                                                   // but this may change with redefinition
    1.60 -  u2                _generic_signature_index;    // Generic signature (index in constant pool, 0 if absent)
    1.61 +  u2                _max_stack;                  // Maximum number of entries on the expression stack
    1.62  
    1.63  
    1.64    // Constructor
    1.65 @@ -154,6 +158,7 @@
    1.66                int localvariable_table_length,
    1.67                int exception_table_length,
    1.68                int checked_exceptions_length,
    1.69 +              u2  generic_signature_index,
    1.70                MethodType is_overpass,
    1.71                int size);
    1.72  public:
    1.73 @@ -164,17 +169,22 @@
    1.74                                 int localvariable_table_length,
    1.75                                 int exception_table_length,
    1.76                                 int checked_exceptions_length,
    1.77 +                               u2  generic_signature_index,
    1.78                                 MethodType mt,
    1.79                                 TRAPS);
    1.80  
    1.81    bool is_constMethod() const { return true; }
    1.82  
    1.83    // Inlined tables
    1.84 -  void set_inlined_tables_length(int checked_exceptions_len,
    1.85 +  void set_inlined_tables_length(u2  generic_signature_index,
    1.86 +                                 int checked_exceptions_len,
    1.87                                   int compressed_line_number_size,
    1.88                                   int localvariable_table_len,
    1.89                                   int exception_table_len);
    1.90  
    1.91 +  bool has_generic_signature() const
    1.92 +    { return (_flags & _has_generic_signature) != 0; }
    1.93 +
    1.94    bool has_linenumber_table() const
    1.95      { return (_flags & _has_linenumber_table) != 0; }
    1.96  
    1.97 @@ -252,8 +262,18 @@
    1.98    void set_signature_index(int index)            { _signature_index = index; }
    1.99  
   1.100    // generics support
   1.101 -  int generic_signature_index() const            { return _generic_signature_index; }
   1.102 -  void set_generic_signature_index(int index)    { _generic_signature_index = index; }
   1.103 +  int generic_signature_index() const            {
   1.104 +    if (has_generic_signature()) {
   1.105 +      return *generic_signature_index_addr();
   1.106 +    } else {
   1.107 +      return 0;
   1.108 +    }
   1.109 +  }
   1.110 +  void set_generic_signature_index(u2 index)    {
   1.111 +    assert(has_generic_signature(), "");
   1.112 +    u2* addr = generic_signature_index_addr();
   1.113 +    *addr = index;
   1.114 +  }
   1.115  
   1.116    // Sizing
   1.117    static int header_size() {
   1.118 @@ -264,7 +284,8 @@
   1.119    static int size(int code_size, int compressed_line_number_size,
   1.120                           int local_variable_table_length,
   1.121                           int exception_table_length,
   1.122 -                         int checked_exceptions_length);
   1.123 +                         int checked_exceptions_length,
   1.124 +                         u2  generic_signature_index);
   1.125  
   1.126    int size() const                    { return _constMethod_size;}
   1.127    void set_constMethod_size(int size)     { _constMethod_size = size; }
   1.128 @@ -281,6 +302,7 @@
   1.129    // linenumber table - note that length is unknown until decompression,
   1.130    // see class CompressedLineNumberReadStream.
   1.131    u_char* compressed_linenumber_table() const;         // not preserved by gc
   1.132 +  u2* generic_signature_index_addr() const;
   1.133    u2* checked_exceptions_length_addr() const;
   1.134    u2* localvariable_table_length_addr() const;
   1.135    u2* exception_table_length_addr() const;
   1.136 @@ -314,12 +336,19 @@
   1.137    static ByteSize constants_offset()
   1.138                              { return byte_offset_of(ConstMethod, _constants); }
   1.139  
   1.140 +  static ByteSize max_stack_offset()
   1.141 +                            { return byte_offset_of(ConstMethod, _max_stack); }
   1.142 +
   1.143    // Unique id for the method
   1.144    static const u2 MAX_IDNUM;
   1.145    static const u2 UNSET_IDNUM;
   1.146    u2 method_idnum() const                        { return _method_idnum; }
   1.147    void set_method_idnum(u2 idnum)                { _method_idnum = idnum; }
   1.148  
   1.149 +  // max stack
   1.150 +  int  max_stack() const                         { return _max_stack; }
   1.151 +  void set_max_stack(int size)                   { _max_stack = size; }
   1.152 +
   1.153    // Deallocation for RedefineClasses
   1.154    void deallocate_contents(ClassLoaderData* loader_data);
   1.155    bool is_klass() const { return false; }

mercurial