Merge

Thu, 17 Oct 2013 17:01:04 +0000

author
dsamersoff
date
Thu, 17 Oct 2013 17:01:04 +0000
changeset 5965
b942ac65ac86
parent 5961
1bee3014cf2a
parent 5964
d2db09f281ca
child 5966
d0453d2fd045

Merge

     1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Thu Oct 17 16:08:01 2013 +0400
     1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Thu Oct 17 17:01:04 2013 +0000
     1.3 @@ -51,6 +51,7 @@
     1.4    private static int HAS_GENERIC_SIGNATURE;
     1.5    private static int HAS_METHOD_ANNOTATIONS;
     1.6    private static int HAS_PARAMETER_ANNOTATIONS;
     1.7 +  private static int HAS_METHOD_PARAMETERS;
     1.8    private static int HAS_DEFAULT_ANNOTATIONS;
     1.9    private static int HAS_TYPE_ANNOTATIONS;
    1.10  
    1.11 @@ -70,6 +71,7 @@
    1.12      HAS_GENERIC_SIGNATURE     = db.lookupIntConstant("ConstMethod::_has_generic_signature").intValue();
    1.13      HAS_METHOD_ANNOTATIONS    = db.lookupIntConstant("ConstMethod::_has_method_annotations").intValue();
    1.14      HAS_PARAMETER_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_parameter_annotations").intValue();
    1.15 +    HAS_METHOD_PARAMETERS = db.lookupIntConstant("ConstMethod::_has_method_parameters").intValue();
    1.16      HAS_DEFAULT_ANNOTATIONS   = db.lookupIntConstant("ConstMethod::_has_default_annotations").intValue();
    1.17      HAS_TYPE_ANNOTATIONS      = db.lookupIntConstant("ConstMethod::_has_type_annotations").intValue();
    1.18  
    1.19 @@ -85,6 +87,9 @@
    1.20      // start of byte code
    1.21      bytecodeOffset = type.getSize();
    1.22  
    1.23 +    type                       = db.lookupType("MethodParametersElement");
    1.24 +    methodParametersElementSize = type.getSize();
    1.25 +
    1.26      type                       = db.lookupType("CheckedExceptionElement");
    1.27      checkedExceptionElementSize = type.getSize();
    1.28  
    1.29 @@ -113,7 +118,7 @@
    1.30  
    1.31    // start of bytecode
    1.32    private static long bytecodeOffset;
    1.33 -
    1.34 +  private static long methodParametersElementSize;
    1.35    private static long checkedExceptionElementSize;
    1.36    private static long localVariableTableElementSize;
    1.37    private static long exceptionTableElementSize;
    1.38 @@ -387,6 +392,10 @@
    1.39      return ret;
    1.40    }
    1.41  
    1.42 +  private boolean hasMethodParameters() {
    1.43 +    return (getFlags() & HAS_METHOD_PARAMETERS) != 0;
    1.44 +  }
    1.45 +
    1.46    private boolean hasGenericSignature() {
    1.47      return (getFlags() & HAS_GENERIC_SIGNATURE) != 0;
    1.48    }
    1.49 @@ -442,11 +451,41 @@
    1.50      return offsetOfLastU2Element();
    1.51    }
    1.52  
    1.53 -  private long offsetOfCheckedExceptionsLength() {
    1.54 +  private long offsetOfMethodParametersLength() {
    1.55 +    if (Assert.ASSERTS_ENABLED) {
    1.56 +      Assert.that(hasMethodParameters(), "should only be called if table is present");
    1.57 +    }
    1.58      return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
    1.59                                     offsetOfLastU2Element();
    1.60    }
    1.61  
    1.62 +  private int getMethodParametersLength() {
    1.63 +      if (hasMethodParameters())
    1.64 +          return (int) getAddress().getCIntegerAt(offsetOfMethodParametersLength(), 2, true);
    1.65 +      else
    1.66 +          return 0;
    1.67 +  }
    1.68 +
    1.69 +  // Offset of start of checked exceptions
    1.70 +  private long offsetOfMethodParameters() {
    1.71 +    long offset = offsetOfMethodParametersLength();
    1.72 +    long length = getMethodParametersLength();
    1.73 +    if (Assert.ASSERTS_ENABLED) {
    1.74 +      Assert.that(length > 0, "should only be called if method parameter information is present");
    1.75 +    }
    1.76 +    offset -= length * methodParametersElementSize;
    1.77 +    return offset;
    1.78 +  }
    1.79 +
    1.80 +  private long offsetOfCheckedExceptionsLength() {
    1.81 +    if (hasMethodParameters())
    1.82 +      return offsetOfMethodParameters() - sizeofShort;
    1.83 +    else {
    1.84 +      return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
    1.85 +                                     offsetOfLastU2Element();
    1.86 +    }
    1.87 +  }
    1.88 +
    1.89    private int getCheckedExceptionsLength() {
    1.90      if (hasCheckedExceptions()) {
    1.91        return (int) getAddress().getCIntegerAt(offsetOfCheckedExceptionsLength(), 2, true);
    1.92 @@ -496,6 +535,8 @@
    1.93        return offsetOfExceptionTable() - sizeofShort;
    1.94      } else if (hasCheckedExceptions()) {
    1.95        return offsetOfCheckedExceptions() - sizeofShort;
    1.96 +    } else if (hasMethodParameters()) {
    1.97 +      return offsetOfMethodParameters() - sizeofShort;
    1.98      } else {
    1.99        return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
   1.100                                       offsetOfLastU2Element();
   1.101 @@ -526,6 +567,8 @@
   1.102      }
   1.103      if (hasCheckedExceptions()) {
   1.104        return offsetOfCheckedExceptions() - sizeofShort;
   1.105 +    } else if (hasMethodParameters()) {
   1.106 +      return offsetOfMethodParameters() - sizeofShort;
   1.107      } else {
   1.108        return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
   1.109                                       offsetOfLastU2Element();
     2.1 --- a/src/share/vm/runtime/vmStructs.cpp	Thu Oct 17 16:08:01 2013 +0400
     2.2 +++ b/src/share/vm/runtime/vmStructs.cpp	Thu Oct 17 17:01:04 2013 +0000
     2.3 @@ -1465,6 +1465,7 @@
     2.4    declare_toplevel_type(CheckedExceptionElement)                          \
     2.5    declare_toplevel_type(LocalVariableTableElement)                        \
     2.6    declare_toplevel_type(ExceptionTableElement)                            \
     2.7 +  declare_toplevel_type(MethodParametersElement)                          \
     2.8                                                                            \
     2.9    declare_toplevel_type(ClassLoaderData)                                  \
    2.10    declare_toplevel_type(ClassLoaderDataGraph)                             \
    2.11 @@ -2337,6 +2338,7 @@
    2.12    declare_constant(ConstMethod::_has_localvariable_table)                 \
    2.13    declare_constant(ConstMethod::_has_exception_table)                     \
    2.14    declare_constant(ConstMethod::_has_generic_signature)                   \
    2.15 +  declare_constant(ConstMethod::_has_method_parameters)                   \
    2.16    declare_constant(ConstMethod::_has_method_annotations)                  \
    2.17    declare_constant(ConstMethod::_has_parameter_annotations)               \
    2.18    declare_constant(ConstMethod::_has_default_annotations)                 \

mercurial