Merge
authorminqi
Thu, 15 Oct 2015 00:42:15 +0000
changeset 33211 966a1acb1243
parent 33208 5ec6ffa63c57 (current diff)
parent 33210 d38efbfe6947 (diff)
child 33212 906b3d079b13
child 33214 5a00fba36171
Merge
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Wed Oct 14 15:36:41 2015 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Thu Oct 15 00:42:15 2015 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,21 +52,19 @@
   }
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
-    Type type                  = db.lookupType("Method");
+    type                       = db.lookupType("Method");
     constMethod                = type.getAddressField("_constMethod");
     methodData                 = type.getAddressField("_method_data");
     methodCounters             = type.getAddressField("_method_counters");
-    methodSize                 = new CIntField(type.getCIntegerField("_method_size"), 0);
     accessFlags                = new CIntField(type.getCIntegerField("_access_flags"), 0);
     code                       = type.getAddressField("_code");
     vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
-    bytecodeOffset = type.getSize();
 
     /*
-    interpreterEntry           = type.getAddressField("_interpreter_entry");
     fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");
+    interpreterEntry           = type.getAddressField("_from_interpreted_entry");
+    */
 
-    */
     objectInitializerName = null;
     classInitializerName = null;
   }
@@ -77,16 +75,22 @@
 
   public boolean isMethod()            { return true; }
 
+  // Not a Method field, used to keep type.
+  private static Type type;
+
   // Fields
   private static AddressField  constMethod;
   private static AddressField  methodData;
   private static AddressField  methodCounters;
-  private static CIntField methodSize;
   private static CIntField accessFlags;
   private static CIntField vtableIndex;
-  private static long      bytecodeOffset;
 
   private static AddressField       code;
+  /*
+  private static AddressCField      fromCompiledCodeEntryPoint;
+  private static AddressField       interpreterEntry;
+  */
+
 
   // constant method names - <init>, <clinit>
   // Initialized lazily to avoid initialization ordering dependencies between Method and SymbolTable
@@ -106,11 +110,6 @@
   }
 
 
-  /*
-  private static AddressCField       interpreterEntry;
-  private static AddressCField       fromCompiledCodeEntryPoint;
-  */
-
   // Accessors for declared fields
   public ConstMethod  getConstMethod()                {
     Address addr = constMethod.getValue(getAddress());
@@ -128,7 +127,6 @@
     return (MethodCounters) VMObjectFactory.newObject(MethodCounters.class, addr);
   }
   /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
-  public long         getMethodSize()                 { return                methodSize.getValue(this);        }
   public long         getMaxStack()                   { return                getConstMethod().getMaxStack();   }
   public long         getMaxLocals()                  { return                getConstMethod().getMaxLocals();         }
   public long         getSizeOfParameters()           { return                getConstMethod().getSizeOfParameters();  }
@@ -265,7 +263,7 @@
   }
 
   public long getSize() {
-    return getMethodSize();
+    return type.getSize() + (isNative() ? 2: 0);
   }
 
   public void printValueOn(PrintStream tty) {
@@ -273,7 +271,6 @@
   }
 
   public void iterateFields(MetadataVisitor visitor) {
-      visitor.doCInt(methodSize, true);
       visitor.doCInt(accessFlags, true);
     }
 
--- a/hotspot/src/share/vm/oops/method.cpp	Wed Oct 14 15:36:41 2015 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp	Thu Oct 15 00:42:15 2015 +0000
@@ -72,17 +72,14 @@
                                           sizes,
                                           method_type,
                                           CHECK_NULL);
-
   int size = Method::size(access_flags.is_native());
-
-  return new (loader_data, size, false, MetaspaceObj::MethodType, THREAD) Method(cm, access_flags, size);
+  return new (loader_data, size, false, MetaspaceObj::MethodType, THREAD) Method(cm, access_flags);
 }
 
-Method::Method(ConstMethod* xconst, AccessFlags access_flags, int size) {
+Method::Method(ConstMethod* xconst, AccessFlags access_flags) {
   No_Safepoint_Verifier no_safepoint;
   set_constMethod(xconst);
   set_access_flags(access_flags);
-  set_method_size(size);
 #ifdef CC_INTERP
   set_result_index(T_VOID);
 #endif
@@ -1227,7 +1224,6 @@
                                       m->method_type(),
                                       CHECK_(methodHandle()));
   methodHandle newm (THREAD, newm_oop);
-  int new_method_size = newm->method_size();
 
   // Create a shallow copy of Method part, but be careful to preserve the new ConstMethod*
   ConstMethod* newcm = newm->constMethod();
@@ -1242,7 +1238,6 @@
   newm->set_constMethod(newcm);
   newm->constMethod()->set_code_size(new_code_length);
   newm->constMethod()->set_constMethod_size(new_const_method_size);
-  newm->set_method_size(new_method_size);
   assert(newm->code_size() == new_code_length, "check");
   assert(newm->method_parameters_length() == method_parameters_len, "check");
   assert(newm->checked_exceptions_length() == checked_exceptions_len, "check");
--- a/hotspot/src/share/vm/oops/method.hpp	Wed Oct 14 15:36:41 2015 -0700
+++ b/hotspot/src/share/vm/oops/method.hpp	Thu Oct 15 00:42:15 2015 +0000
@@ -71,7 +71,6 @@
 #ifdef CC_INTERP
   int               _result_index;               // C++ interpreter needs for converting results to/from stack
 #endif
-  u2                _method_size;                // size of this object
   u2                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
 
   // Flags
@@ -106,7 +105,7 @@
   volatile address           _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
 
   // Constructor
-  Method(ConstMethod* xconst, AccessFlags access_flags, int size);
+  Method(ConstMethod* xconst, AccessFlags access_flags);
  public:
 
   static Method* allocate(ClassLoaderData* loader_data,
@@ -241,12 +240,8 @@
   // code size
   int code_size() const                  { return constMethod()->code_size(); }
 
-  // method size
-  int method_size() const                        { return _method_size; }
-  void set_method_size(int size) {
-    assert(0 <= size && size < (1 << 16), "invalid method size");
-    _method_size = size;
-  }
+  // method size in words
+  int method_size() const                { return sizeof(Method)/wordSize + is_native() ? 2 : 0; }
 
   // constant pool for Klass* holding this method
   ConstantPool* constants() const              { return constMethod()->constants(); }
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Oct 14 15:36:41 2015 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Oct 15 00:42:15 2015 +0000
@@ -381,7 +381,6 @@
   nonstatic_field(Method,                      _method_counters,                              MethodCounters*)                       \
   nonstatic_field(Method,                      _access_flags,                                 AccessFlags)                           \
   nonstatic_field(Method,                      _vtable_index,                                 int)                                   \
-  nonstatic_field(Method,                      _method_size,                                  u2)                                    \
   nonstatic_field(Method,                      _intrinsic_id,                                 u2)                                    \
   nonproduct_nonstatic_field(Method,           _compiled_invocation_count,                    int)                                   \
   volatile_nonstatic_field(Method,             _code,                                         nmethod*)                              \