changeset 4126:91ddf3008907

8150752: Share Class Data Reviewed-by: acorn, hseigel, mschoene
author iklam
date Fri, 12 Aug 2016 16:14:32 +0100
parents edbb67d8d46d
children 2b11876adba6
files src/share/vm/classfile/systemDictionary.cpp
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/systemDictionary.cpp	Wed May 11 12:03:46 2016 -0400
+++ b/src/share/vm/classfile/systemDictionary.cpp	Fri Aug 12 16:14:32 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -1220,8 +1220,13 @@
 
     if (ik->super() != NULL) {
       Symbol*  cn = ik->super()->klass_part()->name();
-      resolve_super_or_fail(class_name, cn,
-                            class_loader, Handle(), true, CHECK_(nh));
+      klassOop s = resolve_super_or_fail(class_name, cn,
+                                         class_loader, Handle(), true, CHECK_(nh));
+      if (s->klass_part() != ik->super()->klass_part()) {
+        // The dynamically resolved super class is not the same as the one we used during dump time,
+        // so we cannot use ik.
+        return nh;
+      }
     }
 
     objArrayHandle interfaces (THREAD, ik->local_interfaces());
@@ -1234,7 +1239,12 @@
       // reinitialized yet (they will be once the interface classes
       // are loaded)
       Symbol*  name  = k->klass_part()->name();
-      resolve_super_or_fail(class_name, name, class_loader, Handle(), false, CHECK_(nh));
+      klassOop i = resolve_super_or_fail(class_name, name, class_loader, Handle(), false, CHECK_(nh));
+      if (k->klass_part() != i->klass_part()) {
+        // The dynamically resolved interface class is not the same as the one we used during dump time,
+        // so we cannot use i.
+        return nh;
+      }
     }
 
     // Adjust methods to recover missing data.  They need addresses for