changeset 9268:4107aea57664 jdk8u242-b07-aarch32-200115

Merge
author snazarki
date Wed, 15 Jan 2020 12:13:39 +0300
parents 578ee8ededa9 7c9f6b5f8d11
children aa61e8688392
files .hgtags
diffstat 4 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jan 09 11:45:50 2020 +0300
+++ b/.hgtags	Wed Jan 15 12:13:39 2020 +0300
@@ -1330,3 +1330,4 @@
 bef484473621573ad55e1fc78aaa4881913a839f jdk8u242-b05-aarch32-191230
 81ddc1072b923330f84c0ace3124226f63877582 jdk8u242-b06
 0454850187f669aaf6d76161bb9098b12fa03b53 jdk8u242-b06-aarch32-200109
+8b80409d5840142a27e274d33948f483a6406a50 jdk8u242-b07
--- a/src/share/vm/oops/klassVtable.cpp	Thu Jan 09 11:45:50 2020 +0300
+++ b/src/share/vm/oops/klassVtable.cpp	Wed Jan 15 12:13:39 2020 +0300
@@ -289,22 +289,25 @@
                             int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
   InstanceKlass* superk = initialsuper;
   while (superk != NULL && superk->super() != NULL) {
-    InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super());
-    klassVtable* ssVtable = supersuperklass->vtable();
+    klassVtable* ssVtable = (superk->super())->vtable();
     if (vtable_index < ssVtable->length()) {
       Method* super_method = ssVtable->method_at(vtable_index);
+      // get the class holding the matching method
+      // make sure you use that class for is_override
+      InstanceKlass* supermethodholder = super_method->method_holder();
 #ifndef PRODUCT
       Symbol* name= target_method()->name();
       Symbol* signature = target_method()->signature();
       assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch");
 #endif
-      if (supersuperklass->is_override(super_method, target_loader, target_classname, THREAD)) {
+
+      if (supermethodholder->is_override(super_method, target_loader, target_classname, THREAD)) {
 #ifndef PRODUCT
         if (PrintVtables && Verbose) {
           ResourceMark rm(THREAD);
           char* sig = target_method()->name_and_sig_as_C_string();
           tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ",
-           supersuperklass->internal_name(),
+           supermethodholder->internal_name(),
            _klass->internal_name(), sig, vtable_index);
            super_method->access_flags().print_on(tty);
            if (super_method->is_default_method()) {
@@ -656,7 +659,7 @@
 
   // search through the super class hierarchy to see if we need
   // a new entry
-  ResourceMark rm;
+  ResourceMark rm(THREAD);
   Symbol* name = target_method()->name();
   Symbol* signature = target_method()->signature();
   Klass* k = super;
--- a/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java	Thu Jan 09 11:45:50 2020 +0300
+++ b/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java	Wed Jan 15 12:13:39 2020 +0300
@@ -22,9 +22,10 @@
  */
 
 import sun.hotspot.WhiteBox;
+import sun.misc.IOUtils;
 import sun.misc.Unsafe;
-import sun.misc.IOUtils;
 
+import java.io.IOException;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLConnection;
@@ -108,7 +109,13 @@
         // (1) Load an anonymous version of this class using the corresponding Unsafe method
         URL classUrl = TestAnonymousClassUnloading.class.getResource("TestAnonymousClassUnloading.class");
         URLConnection connection = classUrl.openConnection();
-        byte[] classBytes = IOUtils.readFully(connection.getInputStream(), connection.getContentLength(), true);
+
+        int length = connection.getContentLength();
+        byte[] classBytes = IOUtils.readAllBytes(connection.getInputStream());
+        if (length != -1 && classBytes.length != length) {
+            throw new IOException("Expected:" + length + ", actual: " + classBytes.length);
+        }
+
         Class<?> anonymousClass = UNSAFE.defineAnonymousClass(TestAnonymousClassUnloading.class, classBytes, null);
 
         // (2) Make sure all paths of doWork are profiled and compiled
--- a/test/runtime/8003720/VictimClassLoader.java	Thu Jan 09 11:45:50 2020 +0300
+++ b/test/runtime/8003720/VictimClassLoader.java	Wed Jan 15 12:13:39 2020 +0300
@@ -22,6 +22,8 @@
  *
  */
 
+import sun.misc.IOUtils;
+
 public class VictimClassLoader extends ClassLoader {
     public static long counter = 0;
 
@@ -72,8 +74,10 @@
     }
 
     static byte[] readFully(java.io.InputStream in, int len) throws java.io.IOException {
-        // Warning here:
-        return sun.misc.IOUtils.readFully(in, len, true);
+        byte[] b = IOUtils.readAllBytes(in);
+        if (len != -1 && b.length != len)
+            throw new java.io.IOException("Expected:" + len + ", actual:" + b.length);
+        return b;
     }
 
     public void finalize() {