Merge

Mon, 22 Jan 2018 15:10:36 -0800

author
asaha
date
Mon, 22 Jan 2018 15:10:36 -0800
changeset 9093
e481feb718cb
parent 9069
dce201107e3e
parent 9092
5587cde50bbc
child 9095
16be38cadc00

Merge

.hgtags file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Thu Jan 18 06:01:19 2018 +0000
     1.2 +++ b/.hgtags	Mon Jan 22 15:10:36 2018 -0800
     1.3 @@ -1035,6 +1035,11 @@
     1.4  0a9d8db98fc5f0302da6520ba329f41baa092ae0 jdk8u152-b14
     1.5  c1bf165d3b27e864a9f8eec5bb0c1e746a972ad5 jdk8u152-b15
     1.6  98b4b0661837817cc39047000e1a7efa6015af7c jdk8u152-b16
     1.7 +91894ffc746c1681172aaa37e2cf5bff69560f20 jdk8u152-b31
     1.8 +d278f122e65dfb5d239ed420a534df75f527a504 jdk8u152-b32
     1.9 +c066fe30d0a141b14ab7788cbbd35eba11196e72 jdk8u152-b33
    1.10 +12a0cebfae93a638dc69a34f8276e1ef43b11b7a jdk8u152-b34
    1.11 +f6719c3d02787da6e232703f61efc931ead7683b jdk8u152-b35
    1.12  2d5100bddeb80cf767485b787fc3051311e3d7b9 jdk8u151-b00
    1.13  596b584c68b73ec635347807571463580deb955f jdk8u151-b01
    1.14  1f6f436360d5cd375b806aec1c78abb8fcb4e5f6 jdk8u151-b02
    1.15 @@ -1125,6 +1130,10 @@
    1.16  c3618e1cdefdda6c262f082791bfd988e0e9d9c9 jdk8u162-b10
    1.17  39e2895b795aded8b584626fb019d35f12e9d1e7 jdk8u162-b11
    1.18  69aec2ca5d905dde1d0f29a89076d02a531808a3 jdk8u162-b12
    1.19 +caac74fe3cfa9a8c859c28c97d1046a58252af27 jdk8u162-b31
    1.20 +a17bab9405474602b18cd62e060a09b17d6413ac jdk8u171-b00
    1.21 +ebfd57cc21e6b7f0c22b17c666b6b28c9340e207 jdk8u171-b01
    1.22 +1acd7c1b80241def8fac90f70b0df16356adad47 jdk8u171-b02
    1.23  f299cf0b7baea1ae85f139f97adb9ab5499f402a jdk8u172-b00
    1.24  d10254debf7c1342416062bf1ba5258f16a8ce00 jdk8u172-b01
    1.25  653d9e0cd3f4023675c9eece7f0d563287f1d34f jdk8u172-b02
     2.1 --- a/src/share/vm/classfile/verificationType.cpp	Thu Jan 18 06:01:19 2018 +0000
     2.2 +++ b/src/share/vm/classfile/verificationType.cpp	Mon Jan 22 15:10:36 2018 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -63,6 +63,7 @@
    2.11          name(), Handle(THREAD, klass->class_loader()),
    2.12          Handle(THREAD, klass->protection_domain()), true, CHECK_false);
    2.13      KlassHandle this_class(THREAD, obj);
    2.14 +    klass->class_loader_data()->record_dependency(obj, CHECK_false);
    2.15  
    2.16      if (this_class->is_interface() && (!from_field_is_protected ||
    2.17          from.name() != vmSymbols::java_lang_Object())) {
    2.18 @@ -74,6 +75,7 @@
    2.19        Klass* from_class = SystemDictionary::resolve_or_fail(
    2.20            from.name(), Handle(THREAD, klass->class_loader()),
    2.21            Handle(THREAD, klass->protection_domain()), true, CHECK_false);
    2.22 +      klass->class_loader_data()->record_dependency(from_class, CHECK_false);
    2.23        bool result = InstanceKlass::cast(from_class)->is_subclass_of(this_class());
    2.24        if (result && DumpSharedSpaces) {
    2.25          if (klass()->is_subclass_of(from_class) && klass()->is_subclass_of(this_class())) {
     3.1 --- a/src/share/vm/classfile/verifier.cpp	Thu Jan 18 06:01:19 2018 +0000
     3.2 +++ b/src/share/vm/classfile/verifier.cpp	Mon Jan 22 15:10:36 2018 -0800
     3.3 @@ -1949,9 +1949,11 @@
     3.4    oop loader = current_class()->class_loader();
     3.5    oop protection_domain = current_class()->protection_domain();
     3.6  
     3.7 -  return SystemDictionary::resolve_or_fail(
     3.8 +  Klass* kls = SystemDictionary::resolve_or_fail(
     3.9      name, Handle(THREAD, loader), Handle(THREAD, protection_domain),
    3.10      true, CHECK_NULL);
    3.11 +  current_class()->class_loader_data()->record_dependency(kls, CHECK_NULL);
    3.12 +  return kls;
    3.13  }
    3.14  
    3.15  bool ClassVerifier::is_protected_access(instanceKlassHandle this_class,
     4.1 --- a/src/share/vm/code/dependencies.cpp	Thu Jan 18 06:01:19 2018 +0000
     4.2 +++ b/src/share/vm/code/dependencies.cpp	Mon Jan 22 15:10:36 2018 -0800
     4.3 @@ -793,6 +793,14 @@
     4.4      _signature = NULL;
     4.5      initialize(participant);
     4.6    }
     4.7 +  ClassHierarchyWalker(Klass* participants[], int num_participants) {
     4.8 +    _name      = NULL;
     4.9 +    _signature = NULL;
    4.10 +    initialize(NULL);
    4.11 +    for (int i = 0; i < num_participants; ++i) {
    4.12 +      add_participant(participants[i]);
    4.13 +    }
    4.14 +  }
    4.15  
    4.16    // This is common code for two searches:  One for concrete subtypes,
    4.17    // the other for concrete method implementations and overrides.
    4.18 @@ -891,6 +899,24 @@
    4.19        // Search class hierarchy first.
    4.20        Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature);
    4.21        if (!Dependencies::is_concrete_method(m, k)) {
    4.22 +        // Check for re-abstraction of method
    4.23 +        if (!k->is_interface() && m != NULL && m->is_abstract()) {
    4.24 +          // Found a matching abstract method 'm' in the class hierarchy.
    4.25 +          // This is fine iff 'k' is an abstract class and all concrete subtypes
    4.26 +          // of 'k' override 'm' and are participates of the current search.
    4.27 +          ClassHierarchyWalker wf(_participants, _num_participants);
    4.28 +          Klass* w = wf.find_witness_subtype(k);
    4.29 +          if (w != NULL) {
    4.30 +            Method* wm = InstanceKlass::cast(w)->find_instance_method(_name, _signature);
    4.31 +            if (!Dependencies::is_concrete_method(wm, w)) {
    4.32 +              // Found a concrete subtype 'w' which does not override abstract method 'm'.
    4.33 +              // Bail out because 'm' could be called with 'w' as receiver (leading to an
    4.34 +              // AbstractMethodError) and thus the method we are looking for is not unique.
    4.35 +              _found_methods[_num_participants] = m;
    4.36 +              return true;
    4.37 +            }
    4.38 +          }
    4.39 +        }
    4.40          // Check interface defaults also, if any exist.
    4.41          Array<Method*>* default_methods = InstanceKlass::cast(k)->default_methods();
    4.42          if (default_methods == NULL)
     5.1 --- a/src/share/vm/oops/cpCache.cpp	Thu Jan 18 06:01:19 2018 +0000
     5.2 +++ b/src/share/vm/oops/cpCache.cpp	Mon Jan 22 15:10:36 2018 -0800
     5.3 @@ -226,14 +226,13 @@
     5.4        // virtual method in java.lang.Object. This is a corner case in the spec
     5.5        // but is presumably legal. javac does not generate this code.
     5.6        //
     5.7 -      // We set bytecode_1() to _invokeinterface, because that is the
     5.8 -      // bytecode # used by the interpreter to see if it is resolved.
     5.9 +      // We do not set bytecode_1() to _invokeinterface, because that is the
    5.10 +      // bytecode # used by the interpreter to see if it is resolved.  In this
    5.11 +      // case, the method gets reresolved with caller for each interface call
    5.12 +      // because the actual selected method may not be public.
    5.13 +      //
    5.14        // We set bytecode_2() to _invokevirtual.
    5.15        // See also interpreterRuntime.cpp. (8/25/2000)
    5.16 -      // Only set resolved for the invokeinterface case if method is public.
    5.17 -      // Otherwise, the method needs to be reresolved with caller for each
    5.18 -      // interface call.
    5.19 -      if (method->is_public()) set_bytecode_1(invoke_code);
    5.20      } else {
    5.21        assert(invoke_code == Bytecodes::_invokevirtual, "");
    5.22      }
     6.1 --- a/src/share/vm/prims/jvm.cpp	Thu Jan 18 06:01:19 2018 +0000
     6.2 +++ b/src/share/vm/prims/jvm.cpp	Mon Jan 22 15:10:36 2018 -0800
     6.3 @@ -24,6 +24,7 @@
     6.4  
     6.5  #include "precompiled.hpp"
     6.6  #include "classfile/classLoader.hpp"
     6.7 +#include "classfile/classLoaderData.inline.hpp"
     6.8  #include "classfile/classLoaderExt.hpp"
     6.9  #include "classfile/javaAssertions.hpp"
    6.10  #include "classfile/javaClasses.hpp"
    6.11 @@ -952,6 +953,12 @@
    6.12    Handle h_prot  (THREAD, protection_domain);
    6.13    jclass result = find_class_from_class_loader(env, h_name, init, h_loader,
    6.14                                                 h_prot, true, thread);
    6.15 +  if (result != NULL) {
    6.16 +    oop mirror = JNIHandles::resolve_non_null(result);
    6.17 +    Klass* to_class = java_lang_Class::as_Klass(mirror);
    6.18 +    ClassLoaderData* cld = ClassLoaderData::class_loader_data(h_loader());
    6.19 +    cld->record_dependency(to_class, CHECK_NULL);
    6.20 +  }
    6.21  
    6.22    if (TraceClassResolution && result != NULL) {
    6.23      // this function is generally only used for class loading during verification.
    6.24 @@ -3654,15 +3661,16 @@
    6.25  JVM_END
    6.26  
    6.27  
    6.28 -// Return the first non-null class loader up the execution stack, or null
    6.29 -// if only code from the null class loader is on the stack.
    6.30 +// Returns first non-privileged class loader on the stack (excluding reflection
    6.31 +// generated frames) or null if only classes loaded by the boot class loader
    6.32 +// and extension class loader are found on the stack.
    6.33  
    6.34  JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env))
    6.35    for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
    6.36      // UseNewReflection
    6.37      vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection
    6.38      oop loader = vfst.method()->method_holder()->class_loader();
    6.39 -    if (loader != NULL) {
    6.40 +    if (loader != NULL && !SystemDictionary::is_ext_class_loader(loader)) {
    6.41        return JNIHandles::make_local(env, loader);
    6.42      }
    6.43    }
     7.1 --- a/test/runtime/RedefineTests/RedefineInterfaceCall.java	Thu Jan 18 06:01:19 2018 +0000
     7.2 +++ b/test/runtime/RedefineTests/RedefineInterfaceCall.java	Mon Jan 22 15:10:36 2018 -0800
     7.3 @@ -25,16 +25,13 @@
     7.4   * @test
     7.5   * @bug 8174962
     7.6   * @summary Redefine class with interface method call
     7.7 - * @library /testlibrary /test/lib
     7.8 - * @modules java.base/jdk.internal.misc
     7.9 - * @modules java.compiler
    7.10 - *          java.instrument
    7.11 - *          jdk.jartool/sun.tools.jar
    7.12 + * @library /testlibrary
    7.13 + * @build RedefineClassHelper
    7.14   * @run main RedefineClassHelper
    7.15 - * @run main/othervm -javaagent:redefineagent.jar RedefineInterfaceCall
    7.16 + * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=3174407 RedefineInterfaceCall
    7.17   */
    7.18  
    7.19 -import static jdk.testlibrary.Asserts.assertEquals;
    7.20 +import static com.oracle.java.testlibrary.Asserts.assertEquals;
    7.21  
    7.22  interface I1 { default int m() { return 0; } }
    7.23  interface I2 extends I1 {}

mercurial