changeset 23676:a6a7657877fe

Merge
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 09 Jun 2016 18:57:51 -0700
parents d995c88d9cd9 (diff) c4e6710aa7e0 (current diff)
children eb166b568645
files
diffstat 5 files changed, 11 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java	Wed Jun 08 01:06:48 2016 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java	Thu Jun 09 18:57:51 2016 -0700
@@ -196,9 +196,7 @@
      */
     @SuppressWarnings("unused")
     private static HotSpotConstantPool fromMetaspace(long metaspaceConstantPool) {
-        HotSpotConstantPool cp = new HotSpotConstantPool(metaspaceConstantPool);
-        runtime().metaAccessContext.add(cp);
-        return cp;
+        return new HotSpotConstantPool(metaspaceConstantPool);
     }
 
     private HotSpotConstantPool(long metaspaceConstantPool) {
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java	Wed Jun 08 01:06:48 2016 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java	Thu Jun 09 18:57:51 2016 -0700
@@ -135,7 +135,6 @@
              */
             metadataRoots = list.getHead();
         }
-        assert isRegistered(metaspaceObject);
     }
 
     protected ResolvedJavaType createClass(Class<?> javaClass) {
@@ -209,7 +208,7 @@
             ChunkIterator() {
                 currentChunk = head;
                 currentIndex = -1;
-                next = findNext();
+                findNext();
             }
 
             Object[] currentChunk;
@@ -246,13 +245,4 @@
         }
 
     }
-
-    synchronized boolean isRegistered(MetaspaceWrapperObject wrapper) {
-        for (WeakReference<MetaspaceWrapperObject> m : list) {
-            if (m != null && m.get() == wrapper) {
-                return true;
-            }
-        }
-        return false;
-    }
 }
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Wed Jun 08 01:06:48 2016 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Thu Jun 09 18:57:51 2016 -0700
@@ -132,20 +132,10 @@
         return UNSAFE.getInt(javaClass, (long) config().klassOffset) & 0xFFFFFFFFL;
     }
 
-    @Override
     public long getMetaspacePointer() {
         return getMetaspaceKlass();
     }
 
-    /**
-     * The Klass* for this object is kept alive by the direct reference to {@link #javaClass} so no
-     * extra work is required.
-     */
-    @Override
-    public boolean isRegistered() {
-        return true;
-    }
-
     @Override
     public int getModifiers() {
         if (isArray()) {
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java	Wed Jun 08 01:06:48 2016 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java	Thu Jun 09 18:57:51 2016 -0700
@@ -23,8 +23,7 @@
 package jdk.vm.ci.hotspot;
 
 /**
- * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object that
- * requires GC interaction to keep alive.
+ * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object.
  *
  * It would preferable if this were the base class containing the pointer but that would require
  * mixins since most of the wrapper types have complex supertype hierarchies.
@@ -32,18 +31,4 @@
 interface MetaspaceWrapperObject {
 
     long getMetaspacePointer();
-
-    /**
-     * Check if this object is properly registered for metadata tracking. All classes which
-     * implement this interface must be registered with the
-     * {@link HotSpotJVMCIMetaAccessContext#add} unless they are kept alive through other means.
-     * Currently the only type which doesn't require explicit registration is
-     * {@link HotSpotResolvedObjectTypeImpl} since it's kept alive by references to the
-     * {@link Class}.
-     *
-     * @return true if this object is properly registered for meta data tracking.
-     */
-    default boolean isRegistered() {
-        return HotSpotJVMCIRuntime.runtime().metaAccessContext.isRegistered(this);
-    }
 }
--- a/src/share/vm/prims/jvmtiEnv.cpp	Wed Jun 08 01:06:48 2016 +0200
+++ b/src/share/vm/prims/jvmtiEnv.cpp	Thu Jun 09 18:57:51 2016 -0700
@@ -226,7 +226,6 @@
                             NEW_RESOURCE_ARRAY(jvmtiClassDefinition, class_count);
   NULL_CHECK(class_definitions, JVMTI_ERROR_OUT_OF_MEMORY);
 
-  int redef_index = 0;
   for (index = 0; index < class_count; index++) {
     HandleMark hm(current_thread);
 
@@ -254,11 +253,6 @@
       return JVMTI_ERROR_UNMODIFIABLE_CLASS;
     }
 
-    if (klass->oop_is_instance() && InstanceKlass::cast(klass())->is_anonymous()) {
-      // return JVMTI_ERROR_UNMODIFIABLE_CLASS;
-      continue;
-    }
-
     instanceKlassHandle ikh(current_thread, k_oop);
     if (ikh->get_cached_class_file_bytes() == NULL) {
       // Not cached, we need to reconstitute the class file from the
@@ -273,24 +267,19 @@
         return reconstituter.get_error();
       }
 
-      class_definitions[redef_index].class_byte_count = (jint)reconstituter.class_file_size();
-      class_definitions[redef_index].class_bytes      = (unsigned char*)
+      class_definitions[index].class_byte_count = (jint)reconstituter.class_file_size();
+      class_definitions[index].class_bytes      = (unsigned char*)
                                                        reconstituter.class_file_bytes();
     } else {
       // it is cached, get it from the cache
-      class_definitions[redef_index].class_byte_count = ikh->get_cached_class_file_len();
-      class_definitions[redef_index].class_bytes      = ikh->get_cached_class_file_bytes();
+      class_definitions[index].class_byte_count = ikh->get_cached_class_file_len();
+      class_definitions[index].class_bytes      = ikh->get_cached_class_file_bytes();
     }
-    class_definitions[redef_index].klass              = jcls;
-    redef_index++;
+    class_definitions[index].klass              = jcls;
   }
-  if (redef_index > 0) {
-    VM_RedefineClasses op(redef_index, class_definitions, jvmti_class_load_kind_retransform);
-    VMThread::execute(&op);
-    return (op.check_error());
-  } else {
-    return JVMTI_ERROR_NONE;
-  }
+  VM_RedefineClasses op(class_count, class_definitions, jvmti_class_load_kind_retransform);
+  VMThread::execute(&op);
+  return (op.check_error());
 } /* end RetransformClasses */