# HG changeset patch # User dcubed # Date 1392065933 28800 # Node ID 7865629d6f225e0c27c1f953b56d5dc78b08bc8a # Parent 5eee9a9aeb7ad17745ee8f3e35446f1f73ec03f9# Parent 4802ce6fbff66b26f4a91152b66c069f8439e064 Merge diff -r 5eee9a9aeb7a -r 7865629d6f22 .hgtags --- a/.hgtags Mon Feb 10 12:38:34 2014 -0800 +++ b/.hgtags Mon Feb 10 12:58:53 2014 -0800 @@ -403,3 +403,4 @@ 05fedd51e40da22c9460bf17c7185889e435db3d hs25-b62 fca262db9c4309f99d2f5542ab0780e45c2f1578 jdk8-b120 ce2d7e46f3c7e41241f3b407705a4071323a11ab jdk9-b00 +050a626a88951140df874f7b163e304d07b6c296 jdk9-b01 diff -r 5eee9a9aeb7a -r 7865629d6f22 make/bsd/makefiles/jsig.make --- a/make/bsd/makefiles/jsig.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/bsd/makefiles/jsig.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -91,13 +91,13 @@ install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" ifeq ($(OS_VENDOR), Darwin) - $(QUIETLY) test -d $(LIBJSIG_DEBUGINFO) && \ + $(QUIETLY) test ! -d $(LIBJSIG_DEBUGINFO) || \ cp -f -r $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) else - $(QUIETLY) test -f $(LIBJSIG_DEBUGINFO) && \ + $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) endif - $(QUIETLY) test -f $(LIBJSIG_DIZ) && \ + $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) $(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" diff -r 5eee9a9aeb7a -r 7865629d6f22 make/bsd/makefiles/saproc.make --- a/make/bsd/makefiles/saproc.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/bsd/makefiles/saproc.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -153,13 +153,13 @@ install_saproc: $(BUILDLIBSAPROC) @echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)" ifeq ($(OS_VENDOR), Darwin) - $(QUIETLY) test -d $(LIBSAPROC_DEBUGINFO) && \ + $(QUIETLY) test ! -d $(LIBSAPROC_DEBUGINFO) || \ cp -f -r $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO) else - $(QUIETLY) test -f $(LIBSAPROC_DEBUGINFO) && \ + $(QUIETLY) test ! -f $(LIBSAPROC_DEBUGINFO) || \ cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO) endif - $(QUIETLY) test -f $(LIBSAPROC_DIZ) && \ + $(QUIETLY) test ! -f $(LIBSAPROC_DIZ) || \ cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ) $(QUIETLY) cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done" diff -r 5eee9a9aeb7a -r 7865629d6f22 make/bsd/makefiles/vm.make --- a/make/bsd/makefiles/vm.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/bsd/makefiles/vm.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2014, 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 @@ -367,13 +367,13 @@ install_jvm: $(LIBJVM) @echo "Copying $(LIBJVM) to $(DEST_JVM)" ifeq ($(OS_VENDOR), Darwin) - $(QUIETLY) test -d $(LIBJVM_DEBUGINFO) && \ + $(QUIETLY) test ! -d $(LIBJVM_DEBUGINFO) || \ cp -f -r $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) else - $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \ + $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) endif - $(QUIETLY) test -f $(LIBJVM_DIZ) && \ + $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" diff -r 5eee9a9aeb7a -r 7865629d6f22 make/linux/makefiles/jsig.make --- a/make/linux/makefiles/jsig.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/linux/makefiles/jsig.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -74,9 +74,9 @@ install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" - $(QUIETLY) test -f $(LIBJSIG_DEBUGINFO) && \ + $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) - $(QUIETLY) test -f $(LIBJSIG_DIZ) && \ + $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) $(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" diff -r 5eee9a9aeb7a -r 7865629d6f22 make/linux/makefiles/saproc.make --- a/make/linux/makefiles/saproc.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/linux/makefiles/saproc.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -113,13 +113,13 @@ endif install_saproc: $(BUILDLIBSAPROC) - $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \ - echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ - test -f $(LIBSAPROC_DEBUGINFO) && \ + $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \ + echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ + test ! -f $(LIBSAPROC_DEBUGINFO) || \ cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ - test -f $(LIBSAPROC_DIZ) && \ - cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ - cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ + test ! -f $(LIBSAPROC_DIZ) || \ + cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ + cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ fi .PHONY: install_saproc diff -r 5eee9a9aeb7a -r 7865629d6f22 make/linux/makefiles/vm.make --- a/make/linux/makefiles/vm.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/linux/makefiles/vm.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2014, 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 @@ -366,9 +366,9 @@ install_jvm: $(LIBJVM) @echo "Copying $(LIBJVM) to $(DEST_JVM)" - $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \ + $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) - $(QUIETLY) test -f $(LIBJVM_DIZ) && \ + $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" diff -r 5eee9a9aeb7a -r 7865629d6f22 make/solaris/makefiles/jsig.make --- a/make/solaris/makefiles/jsig.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/solaris/makefiles/jsig.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -79,9 +79,9 @@ install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" - $(QUIETLY) test -f $(LIBJSIG_DEBUGINFO) && \ + $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) - $(QUIETLY) test -f $(LIBJSIG_DIZ) && \ + $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) $(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" diff -r 5eee9a9aeb7a -r 7865629d6f22 make/solaris/makefiles/saproc.make --- a/make/solaris/makefiles/saproc.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/solaris/makefiles/saproc.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -147,13 +147,13 @@ endif install_saproc: $(BULDLIBSAPROC) - $(QUIETLY) if [ -f $(LIBSAPROC) ] ; then \ - echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ - test -f $(LIBSAPROC_DEBUGINFO) && \ + $(QUIETLY) if [ -f $(LIBSAPROC) ] ; then \ + echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ + test ! -f $(LIBSAPROC_DEBUGINFO) || \ cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ - test -f $(LIBSAPROC_DIZ) && \ - cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ - cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ + test ! -f $(LIBSAPROC_DIZ) || \ + cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ + cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ fi .PHONY: install_saproc diff -r 5eee9a9aeb7a -r 7865629d6f22 make/solaris/makefiles/vm.make --- a/make/solaris/makefiles/vm.make Mon Feb 10 12:38:34 2014 -0800 +++ b/make/solaris/makefiles/vm.make Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 2014, 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 @@ -333,9 +333,9 @@ install_jvm: $(LIBJVM) @echo "Copying $(LIBJVM) to $(DEST_JVM)" - $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \ + $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) - $(QUIETLY) test -f $(LIBJVM_DIZ) && \ + $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" diff -r 5eee9a9aeb7a -r 7865629d6f22 src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp Mon Feb 10 12:38:34 2014 -0800 +++ b/src/os/linux/vm/os_linux.cpp Mon Feb 10 12:58:53 2014 -0800 @@ -3002,7 +3002,7 @@ unsigned imin = 1, imax = pages + 1, imid; int mincore_return_value = 0; - assert(imin < imax, "Unexpected page size"); + assert(imin <= imax, "Unexpected page size"); while (imin < imax) { imid = (imax + imin) / 2; diff -r 5eee9a9aeb7a -r 7865629d6f22 src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp Mon Feb 10 12:38:34 2014 -0800 +++ b/src/share/vm/classfile/classFileParser.cpp Mon Feb 10 12:58:53 2014 -0800 @@ -3746,18 +3746,24 @@ Exceptions::fthrow( THREAD_AND_LOCATION, vmSymbols::java_lang_UnsupportedClassVersionError(), - "Unsupported major.minor version %u.%u", + "Unsupported class file version %u.%u, " + "this version of the Java Runtime only recognizes class file versions up to %u.%u", major_version, - minor_version); + minor_version, + JAVA_MAX_SUPPORTED_VERSION, + JAVA_MAX_SUPPORTED_MINOR_VERSION); } else { ResourceMark rm(THREAD); Exceptions::fthrow( THREAD_AND_LOCATION, vmSymbols::java_lang_UnsupportedClassVersionError(), - "%s : Unsupported major.minor version %u.%u", + "%s has been compiled by a more recent version of the Java Runtime (class file version %u.%u), " + "this version of the Java Runtime only recognizes class file versions up to %u.%u", name->as_C_string(), major_version, - minor_version); + minor_version, + JAVA_MAX_SUPPORTED_VERSION, + JAVA_MAX_SUPPORTED_MINOR_VERSION); } return nullHandle; } diff -r 5eee9a9aeb7a -r 7865629d6f22 src/share/vm/interpreter/rewriter.cpp --- a/src/share/vm/interpreter/rewriter.cpp Mon Feb 10 12:38:34 2014 -0800 +++ b/src/share/vm/interpreter/rewriter.cpp Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -250,8 +250,8 @@ // We will reverse the bytecode rewriting _after_ adjusting them. // Adjust the cache index by offset to the invokedynamic entries in the // cpCache plus the delta if the invokedynamic bytecodes were adjusted. - cache_index = cp_cache_delta() + _first_iteration_cp_cache_limit; - int cp_index = invokedynamic_cp_cache_entry_pool_index(cache_index); + int adjustment = cp_cache_delta() + _first_iteration_cp_cache_limit; + int cp_index = invokedynamic_cp_cache_entry_pool_index(cache_index - adjustment); assert(_pool->tag_at(cp_index).is_invoke_dynamic(), "wrong index"); // zero out 4 bytes Bytes::put_Java_u4(p, 0); @@ -453,18 +453,7 @@ return method; } -void Rewriter::rewrite(instanceKlassHandle klass, TRAPS) { - ResourceMark rm(THREAD); - Rewriter rw(klass, klass->constants(), klass->methods(), CHECK); - // (That's all, folks.) -} - - -Rewriter::Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, Array* methods, TRAPS) - : _klass(klass), - _pool(cpool), - _methods(methods) -{ +void Rewriter::rewrite_bytecodes(TRAPS) { assert(_pool->cache() == NULL, "constant pool cache must not be set yet"); // determine index maps for Method* rewriting @@ -508,6 +497,29 @@ // May have to fix invokedynamic bytecodes if invokestatic/InterfaceMethodref // entries had to be added. patch_invokedynamic_bytecodes(); +} + +void Rewriter::rewrite(instanceKlassHandle klass, TRAPS) { + ResourceMark rm(THREAD); + Rewriter rw(klass, klass->constants(), klass->methods(), CHECK); + // (That's all, folks.) +} + + +Rewriter::Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, Array* methods, TRAPS) + : _klass(klass), + _pool(cpool), + _methods(methods) +{ + + // Rewrite bytecodes - exception here exits. + rewrite_bytecodes(CHECK); + + // Stress restoring bytecodes + if (StressRewriter) { + restore_bytecodes(); + rewrite_bytecodes(CHECK); + } // allocate constant pool cache, now that we've seen all the bytecodes make_constant_pool_cache(THREAD); @@ -523,6 +535,7 @@ // so methods with jsrs in custom class lists in aren't attempted to be // rewritten in the RO section of the shared archive. // Relocated bytecodes don't have to be restored, only the cp cache entries + int len = _methods->length(); for (int i = len-1; i >= 0; i--) { methodHandle m(THREAD, _methods->at(i)); diff -r 5eee9a9aeb7a -r 7865629d6f22 src/share/vm/interpreter/rewriter.hpp --- a/src/share/vm/interpreter/rewriter.hpp Mon Feb 10 12:38:34 2014 -0800 +++ b/src/share/vm/interpreter/rewriter.hpp Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -199,6 +199,9 @@ void patch_invokedynamic_bytecodes(); + // Do all the work. + void rewrite_bytecodes(TRAPS); + // Revert bytecodes in case of an exception. void restore_bytecodes(); diff -r 5eee9a9aeb7a -r 7865629d6f22 src/share/vm/oops/constantPool.cpp --- a/src/share/vm/oops/constantPool.cpp Mon Feb 10 12:38:34 2014 -0800 +++ b/src/share/vm/oops/constantPool.cpp Mon Feb 10 12:58:53 2014 -0800 @@ -82,6 +82,9 @@ void ConstantPool::deallocate_contents(ClassLoaderData* loader_data) { MetadataFactory::free_metadata(loader_data, cache()); set_cache(NULL); + MetadataFactory::free_array(loader_data, reference_map()); + set_reference_map(NULL); + MetadataFactory::free_array(loader_data, operands()); set_operands(NULL); diff -r 5eee9a9aeb7a -r 7865629d6f22 src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Mon Feb 10 12:38:34 2014 -0800 +++ b/src/share/vm/runtime/globals.hpp Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -1260,6 +1260,9 @@ develop(bool, TraceJNICalls, false, \ "Trace JNI calls") \ \ + develop(bool, StressRewriter, false, \ + "Stress linktime bytecode rewriting") \ + \ notproduct(bool, TraceJVMCalls, false, \ "Trace JVM calls") \ \ diff -r 5eee9a9aeb7a -r 7865629d6f22 src/share/vm/utilities/array.hpp --- a/src/share/vm/utilities/array.hpp Mon Feb 10 12:38:34 2014 -0800 +++ b/src/share/vm/utilities/array.hpp Mon Feb 10 12:58:53 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -58,7 +58,7 @@ void initialize(size_t esize, int length) { assert(length >= 0, "illegal length"); - assert(_data == NULL, "must be new object"); + assert(StressRewriter || _data == NULL, "must be new object"); _length = length; _data = resource_allocate_bytes(esize * length); DEBUG_ONLY(init_nesting();) diff -r 5eee9a9aeb7a -r 7865629d6f22 test/runtime/ClassFile/UnsupportedClassFileVersion.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/runtime/ClassFile/UnsupportedClassFileVersion.java Mon Feb 10 12:58:53 2014 -0800 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2014, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @library /testlibrary + * @compile -XDignore.symbol.file UnsupportedClassFileVersion.java + * @run main UnsupportedClassFileVersion + */ + +import java.io.File; +import java.io.FileOutputStream; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.Opcodes; +import com.oracle.java.testlibrary.*; + +public class UnsupportedClassFileVersion implements Opcodes { + public static void main(String... args) throws Exception { + writeClassFile(); + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-cp", ".", "ClassFile"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("ClassFile has been compiled by a more recent version of the " + + "Java Runtime (class file version 99.0), this version of " + + "the Java Runtime only recognizes class file versions up to " + + System.getProperty("java.class.version")); + + output.shouldHaveExitValue(1); + } + + public static void writeClassFile() throws Exception { + ClassWriter cw = new ClassWriter(0); + MethodVisitor mv; + + cw.visit(99, ACC_PUBLIC + ACC_SUPER, "ClassFile", null, "java/lang/Object", null); + mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V", false); + mv.visitInsn(RETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + cw.visitEnd(); + + try (FileOutputStream fos = new FileOutputStream(new File("ClassFile.class"))) { + fos.write(cw.toByteArray()); + } + } +} diff -r 5eee9a9aeb7a -r 7865629d6f22 test/runtime/lambda-features/InvokespecialInterface.java --- a/test/runtime/lambda-features/InvokespecialInterface.java Mon Feb 10 12:38:34 2014 -0800 +++ b/test/runtime/lambda-features/InvokespecialInterface.java Mon Feb 10 12:58:53 2014 -0800 @@ -26,8 +26,9 @@ * @test * @bug 8032024 * @bug 8025937 + * @bug 8033528 * @summary [JDK 8] Test invokespecial and invokeinterface with the same JVM_CONSTANT_InterfaceMethodref - * @run main InvokespecialInterface + * @run main/othervm -XX:+StressRewriter InvokespecialInterface */ import java.util.function.*; import java.util.*; diff -r 5eee9a9aeb7a -r 7865629d6f22 test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java --- a/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java Mon Feb 10 12:38:34 2014 -0800 +++ b/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java Mon Feb 10 12:58:53 2014 -0800 @@ -142,11 +142,23 @@ * with any platform specific arguments prepended */ public static ProcessBuilder createJavaProcessBuilder(String... command) throws Exception { + return createJavaProcessBuilder(false, command); + } + + public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmOptions, String... command) throws Exception { String javapath = JDKToolFinder.getJDKTool("java"); ArrayList args = new ArrayList<>(); args.add(javapath); Collections.addAll(args, getPlatformSpecificVMArgs()); + + if (addTestVmOptions) { + String vmopts = System.getProperty("test.vm.opts"); + if (vmopts != null) { + Collections.addAll(args, vmopts.split("\\s")); + } + } + Collections.addAll(args, command); // Reporting @@ -157,5 +169,4 @@ return new ProcessBuilder(args.toArray(new String[args.size()])); } - }