hotspot/src/share/vm/oops/constMethod.hpp
changeset 23515 f4872ef5df09
parent 16588 7e90e795813e
child 27471 6e56277909f1
equal deleted inserted replaced
23514:8cc4189d9a2a 23515:f4872ef5df09
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    25 #ifndef SHARE_VM_OOPS_CONSTMETHODOOP_HPP
    25 #ifndef SHARE_VM_OOPS_CONSTMETHODOOP_HPP
    26 #define SHARE_VM_OOPS_CONSTMETHODOOP_HPP
    26 #define SHARE_VM_OOPS_CONSTMETHODOOP_HPP
    27 
    27 
    28 #include "oops/oop.hpp"
    28 #include "oops/oop.hpp"
    29 
    29 
    30 // An ConstMethod* represents portions of a Java method which
    30 // An ConstMethod represents portions of a Java method which are not written to after
    31 // do not vary.
    31 // the classfile is parsed(*see below).  This part of the method can be shared across
       
    32 // processes in a read-only section with Class Data Sharing (CDS).  It's important
       
    33 // that this class doesn't have virtual functions because the vptr cannot be shared
       
    34 // with CDS.
       
    35 //   (*)RewriteByteCodes and RewriteFrequentPairs is an exception but turned off in CDS
    32 //
    36 //
    33 // Memory layout (each line represents a word). Note that most
    37 // Note that most applications load thousands of methods, so keeping the size of this
    34 // applications load thousands of methods, so keeping the size of this
       
    35 // structure small has a big impact on footprint.
    38 // structure small has a big impact on footprint.
       
    39 
       
    40 // The actual bytecodes are inlined after the end of the ConstMethod struct.
    36 //
    41 //
    37 // |------------------------------------------------------|
    42 // The line number table is compressed and inlined following the byte codes. It is
    38 // | header                                               |
    43 // found as the first byte following the byte codes.  Note that accessing the line
    39 // | klass                                                |
    44 // number and local variable tables is not performance critical at all.
    40 // |------------------------------------------------------|
    45 //
    41 // | fingerprint 1                                        |
    46 // The checked exceptions table and the local variable table are inlined after the
    42 // | fingerprint 2                                        |
    47 // line number table, and indexed from the end of the method. We do not compress the
    43 // | constants                      (oop)                 |
    48 // checked exceptions table since the average length is less than 2, and it is used
    44 // | stackmap_data                  (oop)                 |
    49 // by reflection so access should be fast.  We do not bother to compress the local
    45 // | constMethod_size                                     |
    50 // variable table either since it is mostly absent.
    46 // | interp_kind  | flags    | code_size                  |
    51 //
    47 // | name index              | signature index            |
    52 //
    48 // | method_idnum            | max_stack                  |
    53 //  ConstMethod embedded field layout (after declared fields):
    49 // | max_locals              | size_of_parameters         |
    54 //    [EMBEDDED byte codes]
    50 // |------------------------------------------------------|
    55 //    [EMBEDDED compressed linenumber table]
    51 // |                                                      |
    56 //     (see class CompressedLineNumberReadStream)
    52 // | byte codes                                           |
    57 //     (note that length is unknown until decompressed)
    53 // |                                                      |
    58 //     (access flags bit tells whether table is present)
    54 // |------------------------------------------------------|
    59 //     (indexed from start of ConstMethod)
    55 // | compressed linenumber table                          |
    60 //     (elements not necessarily sorted!)
    56 // |  (see class CompressedLineNumberReadStream)          |
    61 //    [EMBEDDED localvariable table elements + length (length last)]
    57 // |  (note that length is unknown until decompressed)    |
    62 //     (length is u2, elements are 6-tuples of u2)
    58 // |  (access flags bit tells whether table is present)   |
    63 //     (see class LocalVariableTableElement)
    59 // |  (indexed from start of ConstMethod*)                |
    64 //     (access flags bit tells whether table is present)
    60 // |  (elements not necessarily sorted!)                  |
    65 //     (indexed from end of ConstMethod*)
    61 // |------------------------------------------------------|
    66 //    [EMBEDDED exception table + length (length last)]
    62 // | localvariable table elements + length (length last)  |
    67 //     (length is u2, elements are 4-tuples of u2)
    63 // |  (length is u2, elements are 6-tuples of u2)         |
    68 //     (see class ExceptionTableElement)
    64 // |  (see class LocalVariableTableElement)               |
    69 //     (access flags bit tells whether table is present)
    65 // |  (access flags bit tells whether table is present)   |
    70 //     (indexed from end of ConstMethod*)
    66 // |  (indexed from end of ConstMethod*)                  |
    71 //    [EMBEDDED checked exceptions elements + length (length last)]
    67 // |------------------------------------------------------|
    72 //     (length is u2, elements are u2)
    68 // | exception table + length (length last)               |
    73 //     (see class CheckedExceptionElement)
    69 // |  (length is u2, elements are 4-tuples of u2)         |
    74 //     (access flags bit tells whether table is present)
    70 // |  (see class ExceptionTableElement)                   |
    75 //     (indexed from end of ConstMethod*)
    71 // |  (access flags bit tells whether table is present)   |
    76 //    [EMBEDDED method parameters elements + length (length last)]
    72 // |  (indexed from end of ConstMethod*)                  |
    77 //     (length is u2, elements are u2, u4 structures)
    73 // |------------------------------------------------------|
    78 //     (see class MethodParametersElement)
    74 // | checked exceptions elements + length (length last)   |
    79 //     (access flags bit tells whether table is present)
    75 // |  (length is u2, elements are u2)                     |
    80 //     (indexed from end of ConstMethod*)
    76 // |  (see class CheckedExceptionElement)                 |
    81 //    [EMBEDDED generic signature index (u2)]
    77 // |  (access flags bit tells whether table is present)   |
    82 //     (indexed from end of constMethodOop)
    78 // |  (indexed from end of ConstMethod*)                  |
    83 //    [EMBEDDED annotations arrays - method, parameter, type, default]
    79 // |------------------------------------------------------|
    84 //      pointer to Array<u1> if annotation is present
    80 // | method parameters elements + length (length last)    |
       
    81 // |  (length is u2, elements are u2, u4 structures)      |
       
    82 // |  (see class MethodParametersElement)                 |
       
    83 // |  (access flags bit tells whether table is present)   |
       
    84 // |  (indexed from end of ConstMethod*)                  |
       
    85 // |------------------------------------------------------|
       
    86 // | generic signature index (u2)                         |
       
    87 // |  (indexed from start of constMethodOop)              |
       
    88 // |------------------------------------------------------|
       
    89 // | annotations arrays - method, parameter, type, default|
       
    90 // | pointer to Array<u1> if annotation is present        |
       
    91 // |------------------------------------------------------|
       
    92 //
    85 //
    93 // IMPORTANT: If anything gets added here, there need to be changes to
    86 // IMPORTANT: If anything gets added here, there need to be changes to
    94 // ensure that ServicabilityAgent doesn't get broken as a result!
    87 // ensure that ServicabilityAgent doesn't get broken as a result!
    95 
    88 
    96 
    89