From: Ivan Dubrov Date: Thu, 27 Aug 2015 20:42:12 +0000 (-0700) Subject: Fixing issue when lambda method could not be found X-Git-Tag: light-jdk8u51+3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=089a8a01852467414314592ba342713e2b71ad6d;p=dcevm.git Fixing issue when lambda method could not be found closes #81 --- diff --git a/dcevm/src/test/java8/com/github/dcevm/test/lambdas/LambdaTest.java b/dcevm/src/test/java8/com/github/dcevm/test/lambdas/LambdaTest.java index efacdbbc..90134954 100644 --- a/dcevm/src/test/java8/com/github/dcevm/test/lambdas/LambdaTest.java +++ b/dcevm/src/test/java8/com/github/dcevm/test/lambdas/LambdaTest.java @@ -24,16 +24,15 @@ package com.github.dcevm.test.lambdas; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.*; import java.util.concurrent.Callable; +import java.util.function.Consumer; import static com.github.dcevm.test.util.HotSwapTestHelper.__toVersion__; import static com.github.dcevm.test.util.HotSwapTestHelper.__version__; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; /** * Tests for lambda expressions. @@ -66,4 +65,78 @@ public class LambdaTest { assertEquals(30, (int) lambda.call()); assertEquals(40, (int) lambda2.call()); } + + // version 0 + public static class LambdaC2 { + public int i = 0; + + public void doit() { + LambdaTest.methodWithLambdaParam(integer -> i += integer); + } + } + + // version 1 + public static class LambdaC2___1 { + int i = 0; + + public void doit() { + LambdaTest.methodWithLambdaParam(integer -> i -= integer); + } + } + + public static void methodWithLambdaParam(Consumer consumer) { + consumer.accept(1); + } + + @Test + public void testMethodLambda2() throws Exception { + assert __version__() == 0; + + final LambdaC2 instance = new LambdaC2(); + instance.doit(); + Assert.assertEquals(1, instance.i); + + __toVersion__(1); + + instance.doit(); + Assert.assertEquals(0, instance.i); + } + + // version 0 + public static class LambdaC3 { + public int i = 0; + public Consumer l = x -> i += x; + + public void doit() { + LambdaTest.methodWithLambdaParam(l); + } + } + + // version 1 + public static class LambdaC3___1 { + int i = 0; + public Consumer l = null; + + public void doit() { + LambdaTest.methodWithLambdaParam(l); + } + } + + @Test + public void testMethodLambda3() throws Exception { + assert __version__() == 0; + + final LambdaC3 instance = new LambdaC3(); + instance.doit(); + Assert.assertEquals(1, instance.i); + + __toVersion__(1); + + try { + instance.doit(); + fail("Should get NoSuchMethodError as method implementing lambda should be gone in version 1"); + } catch (NoSuchMethodError e) { + // Ok! + } + } } \ No newline at end of file diff --git a/hotspot/.hg/patches/light-jdk8u40-b25.patch b/hotspot/.hg/patches/light-jdk8u40-b25.patch index 0241fcf0..971c4f96 100644 --- a/hotspot/.hg/patches/light-jdk8u40-b25.patch +++ b/hotspot/.hg/patches/light-jdk8u40-b25.patch @@ -1,9 +1,9 @@ # HG changeset patch -# Parent c74d3ac35e1551bed71856ff2fae65d4e8e27f0b +# Parent 650a14c7d908ab3e6cefad21c6c63d1892408648 -diff -r c74d3ac35e15 src/share/vm/ci/ciObjectFactory.cpp ---- a/src/share/vm/ci/ciObjectFactory.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/ci/ciObjectFactory.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/ci/ciObjectFactory.cpp +--- a/src/share/vm/ci/ciObjectFactory.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/ci/ciObjectFactory.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -799,3 +799,27 @@ _unloaded_instances->length(), _unloaded_klasses->length()); @@ -32,9 +32,9 @@ diff -r c74d3ac35e15 src/share/vm/ci/ciObjectFactory.cpp +#endif // ASSERT +} + -diff -r c74d3ac35e15 src/share/vm/ci/ciObjectFactory.hpp ---- a/src/share/vm/ci/ciObjectFactory.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/ci/ciObjectFactory.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/ci/ciObjectFactory.hpp +--- a/src/share/vm/ci/ciObjectFactory.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/ci/ciObjectFactory.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -92,6 +92,7 @@ ciInstance* get_unloaded_instance(ciInstanceKlass* klass); @@ -52,9 +52,9 @@ diff -r c74d3ac35e15 src/share/vm/ci/ciObjectFactory.hpp }; #endif // SHARE_VM_CI_CIOBJECTFACTORY_HPP -diff -r c74d3ac35e15 src/share/vm/classfile/classFileParser.cpp ---- a/src/share/vm/classfile/classFileParser.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/classFileParser.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/classFileParser.cpp +--- a/src/share/vm/classfile/classFileParser.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/classFileParser.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -763,6 +763,7 @@ Array* ClassFileParser::parse_interfaces(int length, Handle protection_domain, @@ -226,9 +226,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/classFileParser.cpp k->set_is_cloneable(); } } -diff -r c74d3ac35e15 src/share/vm/classfile/classFileParser.hpp ---- a/src/share/vm/classfile/classFileParser.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/classFileParser.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/classFileParser.hpp +--- a/src/share/vm/classfile/classFileParser.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/classFileParser.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -218,11 +218,12 @@ Array* parse_interfaces(int length, Handle protection_domain, @@ -274,9 +274,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/classFileParser.hpp TempNewSymbol& parsed_name, bool verify, TRAPS); -diff -r c74d3ac35e15 src/share/vm/classfile/classLoader.cpp ---- a/src/share/vm/classfile/classLoader.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/classLoader.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/classLoader.cpp +--- a/src/share/vm/classfile/classLoader.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/classLoader.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -1124,6 +1124,7 @@ instanceKlassHandle result = parser.parseClassFile(h_name, loader_data, @@ -285,9 +285,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/classLoader.cpp parsed_name, context.should_verify(classpath_index), THREAD); -diff -r c74d3ac35e15 src/share/vm/classfile/dictionary.cpp ---- a/src/share/vm/classfile/dictionary.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/dictionary.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/dictionary.cpp +--- a/src/share/vm/classfile/dictionary.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/dictionary.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -145,7 +145,7 @@ InstanceKlass* ik = InstanceKlass::cast(e); @@ -357,9 +357,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/dictionary.cpp } -diff -r c74d3ac35e15 src/share/vm/classfile/dictionary.hpp ---- a/src/share/vm/classfile/dictionary.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/dictionary.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/dictionary.hpp +--- a/src/share/vm/classfile/dictionary.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/dictionary.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -78,6 +78,10 @@ void add_klass(Symbol* class_name, ClassLoaderData* loader_data,KlassHandle obj); @@ -383,9 +383,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/dictionary.hpp // Unload (that is, break root links to) all unmarked classes and loaders. void do_unloading(); -diff -r c74d3ac35e15 src/share/vm/classfile/javaClasses.cpp ---- a/src/share/vm/classfile/javaClasses.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/javaClasses.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/javaClasses.cpp +--- a/src/share/vm/classfile/javaClasses.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/javaClasses.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -1679,6 +1679,8 @@ skip_throwableInit_check = true; } @@ -395,9 +395,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/javaClasses.cpp if (method->is_hidden()) { if (skip_hidden) continue; } -diff -r c74d3ac35e15 src/share/vm/classfile/loaderConstraints.cpp ---- a/src/share/vm/classfile/loaderConstraints.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/loaderConstraints.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/loaderConstraints.cpp +--- a/src/share/vm/classfile/loaderConstraints.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/loaderConstraints.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -446,7 +446,7 @@ if (k != NULL) { // We found the class in the system dictionary, so we should @@ -407,9 +407,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/loaderConstraints.cpp } else { // If we don't find the class in the system dictionary, it // has to be in the placeholders table. -diff -r c74d3ac35e15 src/share/vm/classfile/systemDictionary.cpp ---- a/src/share/vm/classfile/systemDictionary.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/systemDictionary.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/systemDictionary.cpp +--- a/src/share/vm/classfile/systemDictionary.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/systemDictionary.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -182,6 +182,7 @@ // can return a null klass klass = handle_resolution_exception(class_name, class_loader, protection_domain, throw_error, k_h, THREAD); @@ -561,9 +561,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/systemDictionary.cpp linkage_error = "loader (instance of %s): attempted duplicate class " "definition for name: \"%s\""; } else { -diff -r c74d3ac35e15 src/share/vm/classfile/systemDictionary.hpp ---- a/src/share/vm/classfile/systemDictionary.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/systemDictionary.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/systemDictionary.hpp +--- a/src/share/vm/classfile/systemDictionary.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/systemDictionary.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -284,7 +284,7 @@ // Resolve from stream (called by jni_DefineClass and JVM_DefineClass) static Klass* resolve_from_stream(Symbol* class_name, Handle class_loader, @@ -602,9 +602,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/systemDictionary.hpp static instanceKlassHandle find_or_define_instance_class(Symbol* class_name, Handle class_loader, instanceKlassHandle k, TRAPS); -diff -r c74d3ac35e15 src/share/vm/classfile/verifier.cpp ---- a/src/share/vm/classfile/verifier.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/verifier.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/verifier.cpp +--- a/src/share/vm/classfile/verifier.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/verifier.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -189,7 +189,7 @@ Symbol* name = klass->name(); Klass* refl_magic_klass = SystemDictionary::reflect_MagicAccessorImpl_klass(); @@ -632,9 +632,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/verifier.cpp int num_methods = methods->length(); for (int index = 0; index < num_methods; index++) { -diff -r c74d3ac35e15 src/share/vm/classfile/verifier.hpp ---- a/src/share/vm/classfile/verifier.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/classfile/verifier.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/classfile/verifier.hpp +--- a/src/share/vm/classfile/verifier.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/classfile/verifier.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -343,6 +343,7 @@ VerificationType object_type() const; @@ -643,9 +643,9 @@ diff -r c74d3ac35e15 src/share/vm/classfile/verifier.hpp instanceKlassHandle _klass; // the class being verified methodHandle _method; // current method being verified VerificationType _this_type; // the verification type of the current class -diff -r c74d3ac35e15 src/share/vm/interpreter/linkResolver.cpp ---- a/src/share/vm/interpreter/linkResolver.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/interpreter/linkResolver.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/interpreter/linkResolver.cpp +--- a/src/share/vm/interpreter/linkResolver.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/interpreter/linkResolver.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -215,8 +215,8 @@ // Klass resolution @@ -684,9 +684,9 @@ diff -r c74d3ac35e15 src/share/vm/interpreter/linkResolver.cpp selected_method = methodHandle(THREAD, inst->method_at_vtable(vtable_index)); } } -diff -r c74d3ac35e15 src/share/vm/memory/universe.cpp ---- a/src/share/vm/memory/universe.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/memory/universe.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/memory/universe.cpp +--- a/src/share/vm/memory/universe.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/memory/universe.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -168,6 +168,43 @@ f(doubleArrayKlassObj()); } @@ -731,9 +731,9 @@ diff -r c74d3ac35e15 src/share/vm/memory/universe.cpp void Universe::oops_do(OopClosure* f, bool do_all) { f->do_oop((oop*) &_int_mirror); -diff -r c74d3ac35e15 src/share/vm/memory/universe.hpp ---- a/src/share/vm/memory/universe.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/memory/universe.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/memory/universe.hpp +--- a/src/share/vm/memory/universe.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/memory/universe.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -415,6 +415,7 @@ static void run_finalizers_on_exit(); @@ -742,9 +742,9 @@ diff -r c74d3ac35e15 src/share/vm/memory/universe.hpp // Apply "f" to the addresses of all the direct heap pointers maintained // as static fields of "Universe". -diff -r c74d3ac35e15 src/share/vm/oops/cpCache.cpp ---- a/src/share/vm/oops/cpCache.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/cpCache.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/cpCache.cpp +--- a/src/share/vm/oops/cpCache.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/cpCache.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -338,7 +338,8 @@ if (has_appendix) { const int appendix_index = f2_as_index() + _indy_resolved_references_appendix_offset; @@ -803,9 +803,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/cpCache.cpp #endif // INCLUDE_JVMTI -diff -r c74d3ac35e15 src/share/vm/oops/cpCache.hpp ---- a/src/share/vm/oops/cpCache.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/cpCache.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/cpCache.hpp +--- a/src/share/vm/oops/cpCache.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/cpCache.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -178,6 +178,8 @@ tos_state_bits = 4, tos_state_mask = right_n_bits(tos_state_bits), @@ -853,9 +853,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/cpCache.hpp #endif // INCLUDE_JVMTI // Deallocate - no fields to deallocate -diff -r c74d3ac35e15 src/share/vm/oops/instanceKlass.cpp ---- a/src/share/vm/oops/instanceKlass.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/instanceKlass.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/instanceKlass.cpp +--- a/src/share/vm/oops/instanceKlass.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/instanceKlass.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -725,7 +725,8 @@ } #endif @@ -999,9 +999,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/instanceKlass.cpp } // end has_previous_version() -diff -r c74d3ac35e15 src/share/vm/oops/instanceKlass.hpp ---- a/src/share/vm/oops/instanceKlass.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/instanceKlass.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/instanceKlass.hpp +--- a/src/share/vm/oops/instanceKlass.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/instanceKlass.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -139,6 +139,7 @@ friend class VMStructs; friend class ClassFileParser; @@ -1046,9 +1046,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/instanceKlass.hpp void methods_do(void f(Method* method)); void array_klasses_do(void f(Klass* k)); void array_klasses_do(void f(Klass* k, TRAPS), TRAPS); -diff -r c74d3ac35e15 src/share/vm/oops/klass.cpp ---- a/src/share/vm/oops/klass.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/klass.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/klass.cpp +--- a/src/share/vm/oops/klass.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/klass.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -186,6 +186,13 @@ set_next_link(NULL); TRACE_INIT_ID(this); @@ -1088,9 +1088,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/klass.cpp bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { #ifdef ASSERT // The class is alive iff the class loader is alive. -diff -r c74d3ac35e15 src/share/vm/oops/klass.hpp ---- a/src/share/vm/oops/klass.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/klass.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/klass.hpp +--- a/src/share/vm/oops/klass.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/klass.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -149,6 +149,10 @@ oop _java_mirror; // Superclass @@ -1198,9 +1198,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/klass.hpp // Compiler support static ByteSize super_offset() { return in_ByteSize(offset_of(Klass, _super)); } -diff -r c74d3ac35e15 src/share/vm/oops/klassVtable.cpp ---- a/src/share/vm/oops/klassVtable.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/klassVtable.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/klassVtable.cpp +--- a/src/share/vm/oops/klassVtable.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/klassVtable.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -1453,6 +1453,8 @@ void klassVtable::verify_against(outputStream* st, klassVtable* vt, int index) { @@ -1230,9 +1230,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/klassVtable.cpp } } -diff -r c74d3ac35e15 src/share/vm/oops/method.cpp ---- a/src/share/vm/oops/method.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/method.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/method.cpp +--- a/src/share/vm/oops/method.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/method.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -1207,6 +1207,8 @@ // Reset correct method/const method, method size, and parameter info @@ -1253,9 +1253,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/method.cpp ClassLoaderData* cld = loader_data; if (!SafepointSynchronize::is_at_safepoint()) { -diff -r c74d3ac35e15 src/share/vm/oops/method.hpp ---- a/src/share/vm/oops/method.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/oops/method.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/oops/method.hpp +--- a/src/share/vm/oops/method.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/oops/method.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -105,6 +105,10 @@ AccessFlags _access_flags; // Access flags int _vtable_index; // vtable index of this method (see VtableIndexFlag) @@ -1291,9 +1291,9 @@ diff -r c74d3ac35e15 src/share/vm/oops/method.hpp // signature Symbol* signature() const { return constants()->symbol_at(signature_index()); } int signature_index() const { return constMethod()->signature_index(); } -diff -r c74d3ac35e15 src/share/vm/prims/jni.cpp ---- a/src/share/vm/prims/jni.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/prims/jni.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/prims/jni.cpp +--- a/src/share/vm/prims/jni.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/prims/jni.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -399,6 +399,7 @@ } Klass* k = SystemDictionary::resolve_from_stream(class_name, class_loader, @@ -1302,9 +1302,9 @@ diff -r c74d3ac35e15 src/share/vm/prims/jni.cpp CHECK_NULL); if (TraceClassResolution && k != NULL) { -diff -r c74d3ac35e15 src/share/vm/prims/jvm.cpp ---- a/src/share/vm/prims/jvm.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/prims/jvm.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/prims/jvm.cpp +--- a/src/share/vm/prims/jvm.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/prims/jvm.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -1029,6 +1029,7 @@ Klass* k = SystemDictionary::resolve_from_stream(class_name, class_loader, protection_domain, &st, @@ -1313,9 +1313,9 @@ diff -r c74d3ac35e15 src/share/vm/prims/jvm.cpp CHECK_NULL); if (TraceClassResolution && k != NULL) { -diff -r c74d3ac35e15 src/share/vm/prims/jvmtiEnv.cpp ---- a/src/share/vm/prims/jvmtiEnv.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/prims/jvmtiEnv.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/prims/jvmtiEnv.cpp +--- a/src/share/vm/prims/jvmtiEnv.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/prims/jvmtiEnv.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -43,6 +43,7 @@ #include "prims/jvmtiManageCapabilities.hpp" #include "prims/jvmtiRawMonitor.hpp" @@ -1361,9 +1361,9 @@ diff -r c74d3ac35e15 src/share/vm/prims/jvmtiEnv.cpp VM_RedefineClasses op(class_count, class_definitions, jvmti_class_load_kind_redefine); VMThread::execute(&op); return (op.check_error()); -diff -r c74d3ac35e15 src/share/vm/prims/jvmtiExport.hpp ---- a/src/share/vm/prims/jvmtiExport.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/prims/jvmtiExport.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/prims/jvmtiExport.hpp +--- a/src/share/vm/prims/jvmtiExport.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/prims/jvmtiExport.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -188,6 +188,7 @@ // systems as needed to relax invariant checks. static bool _has_redefined_a_class; @@ -1372,9 +1372,9 @@ diff -r c74d3ac35e15 src/share/vm/prims/jvmtiExport.hpp inline static void set_has_redefined_a_class() { JVMTI_ONLY(_has_redefined_a_class = true;) } -diff -r c74d3ac35e15 src/share/vm/prims/jvmtiImpl.cpp ---- a/src/share/vm/prims/jvmtiImpl.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/prims/jvmtiImpl.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/prims/jvmtiImpl.cpp +--- a/src/share/vm/prims/jvmtiImpl.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/prims/jvmtiImpl.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -289,6 +289,11 @@ Symbol* m_name = _method->name(); Symbol* m_signature = _method->signature(); @@ -1387,10 +1387,10 @@ diff -r c74d3ac35e15 src/share/vm/prims/jvmtiImpl.cpp // search previous versions if they exist PreviousVersionWalker pvw(thread, (InstanceKlass *)ikh()); for (PreviousVersionNode * pv_node = pvw.next_previous_version(); -diff -r c74d3ac35e15 src/share/vm/prims/jvmtiRedefineClasses2.cpp +diff -r 650a14c7d908 src/share/vm/prims/jvmtiRedefineClasses2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/src/share/vm/prims/jvmtiRedefineClasses2.cpp Wed Jul 08 12:51:26 2015 -0700 -@@ -0,0 +1,2104 @@ ++++ b/src/share/vm/prims/jvmtiRedefineClasses2.cpp Thu Aug 27 13:41:51 2015 -0700 +@@ -0,0 +1,2108 @@ +/* + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -2450,9 +2450,13 @@ diff -r c74d3ac35e15 src/share/vm/prims/jvmtiRedefineClasses2.cpp + InstanceKlass* newest = InstanceKlass::cast(m->method_holder()->newest_version()); + Method* new_method = newest->find_method(m->name(), m->signature()); + -+ // Note: we might set NULL at this point, which should force AbstractMethodError at runtime -+ CallInfo info(new_method, newest); -+ MethodHandles::init_method_MemberName(obj, info, true); ++ if (new_method != NULL) { ++ // Note: we might set NULL at this point, which should force AbstractMethodError at runtime ++ CallInfo info(new_method, newest); ++ MethodHandles::init_method_MemberName(obj, info, true); ++ } else { ++ java_lang_invoke_MemberName::set_vmtarget(obj, NULL); ++ } + } + } else if (MethodHandles::ref_kind_is_field(ref_kind)) { + Klass* k = (Klass*) java_lang_invoke_MemberName::vmtarget(obj); @@ -3495,9 +3499,9 @@ diff -r c74d3ac35e15 src/share/vm/prims/jvmtiRedefineClasses2.cpp + transfer.transfer_registrations(old_klass, _deleted_methods, _deleted_methods_length); + transfer.transfer_registrations(old_klass, _matching_old_methods, _matching_methods_length); +} -diff -r c74d3ac35e15 src/share/vm/prims/jvmtiRedefineClasses2.hpp +diff -r 650a14c7d908 src/share/vm/prims/jvmtiRedefineClasses2.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/src/share/vm/prims/jvmtiRedefineClasses2.hpp Wed Jul 08 12:51:26 2015 -0700 ++++ b/src/share/vm/prims/jvmtiRedefineClasses2.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. @@ -3658,9 +3662,9 @@ diff -r c74d3ac35e15 src/share/vm/prims/jvmtiRedefineClasses2.hpp +}; + +#endif // SHARE_VM_PRIMS_JVMTIENHANCEDREDEFINECLASSES_HPP -diff -r c74d3ac35e15 src/share/vm/prims/methodHandles.cpp ---- a/src/share/vm/prims/methodHandles.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/prims/methodHandles.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/prims/methodHandles.cpp +--- a/src/share/vm/prims/methodHandles.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/prims/methodHandles.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -172,7 +172,7 @@ return NULL; } @@ -3680,9 +3684,9 @@ diff -r c74d3ac35e15 src/share/vm/prims/methodHandles.cpp return mname(); } else { // Redefinition caused this to fail. Return NULL (and an exception?) -diff -r c74d3ac35e15 src/share/vm/prims/methodHandles.hpp ---- a/src/share/vm/prims/methodHandles.hpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/prims/methodHandles.hpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/prims/methodHandles.hpp +--- a/src/share/vm/prims/methodHandles.hpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/prims/methodHandles.hpp Thu Aug 27 13:41:51 2015 -0700 @@ -60,7 +60,7 @@ static Handle new_MemberName(TRAPS); // must be followed by init_MemberName static oop init_MemberName(Handle mname_h, Handle target_h); // compute vmtarget/vmindex from target @@ -3692,9 +3696,9 @@ diff -r c74d3ac35e15 src/share/vm/prims/methodHandles.hpp static int method_ref_kind(Method* m, bool do_dispatch_if_possible = true); static int find_MemberNames(KlassHandle k, Symbol* name, Symbol* sig, int mflags, KlassHandle caller, -diff -r c74d3ac35e15 src/share/vm/runtime/reflection.cpp ---- a/src/share/vm/runtime/reflection.cpp Fri Jul 03 12:54:07 2015 -0700 -+++ b/src/share/vm/runtime/reflection.cpp Wed Jul 08 12:51:26 2015 -0700 +diff -r 650a14c7d908 src/share/vm/runtime/reflection.cpp +--- a/src/share/vm/runtime/reflection.cpp Wed Jul 22 13:32:20 2015 -0700 ++++ b/src/share/vm/runtime/reflection.cpp Thu Aug 27 13:41:51 2015 -0700 @@ -519,6 +519,12 @@ AccessFlags access, bool classloader_only,