# HG changeset patch # User dcubed # Date 1376087769 25200 # Node ID 7b03590c334bf5ae3d6818a1afe0138e1e747a6a # Parent 98aa538fd97e6a989c129c81190c7e8eb1ded06d# Parent ed7c17e7d45bf6f73897a31ff5250b60eee848e1 Merge diff -r 98aa538fd97e -r 7b03590c334b .hgtags --- a/.hgtags Fri Aug 09 09:51:21 2013 -0700 +++ b/.hgtags Fri Aug 09 15:36:09 2013 -0700 @@ -365,3 +365,5 @@ 46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43 f6921c876db192bba389cec062855a66372da01c jdk8-b101 530fe88b3b2c710f42810b3580d86a0d83ad6c1c hs25-b44 +c4697c1c448416108743b59118b4a2498b339d0c jdk8-b102 +7f55137d6aa81efc6eb0035813709f2cb6a26b8b hs25-b45 diff -r 98aa538fd97e -r 7b03590c334b make/hotspot_version --- a/make/hotspot_version Fri Aug 09 09:51:21 2013 -0700 +++ b/make/hotspot_version Fri Aug 09 15:36:09 2013 -0700 @@ -35,7 +35,7 @@ HS_MAJOR_VER=25 HS_MINOR_VER=0 -HS_BUILD_NUMBER=45 +HS_BUILD_NUMBER=46 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 diff -r 98aa538fd97e -r 7b03590c334b src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp Fri Aug 09 09:51:21 2013 -0700 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Fri Aug 09 15:36:09 2013 -0700 @@ -2295,7 +2295,7 @@ if (gen_type_check) { // We have determined that offset == referent_offset && src != null. // if (src->_klass->_reference_type == REF_NONE) -> continue - __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), UseCompressedKlassPointers ? T_OBJECT : T_ADDRESS), src_klass); + __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass); LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE); LIR_Opr reference_type = new_register(T_INT); __ move(reference_type_addr, reference_type); diff -r 98aa538fd97e -r 7b03590c334b src/share/vm/classfile/classLoader.cpp --- a/src/share/vm/classfile/classLoader.cpp Fri Aug 09 09:51:21 2013 -0700 +++ b/src/share/vm/classfile/classLoader.cpp Fri Aug 09 15:36:09 2013 -0700 @@ -878,7 +878,7 @@ instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) { ResourceMark rm(THREAD); - EventMark m("loading class " INTPTR_FORMAT, (address)h_name); + EventMark m("loading class %s", h_name->as_C_string()); ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion); stringStream st; diff -r 98aa538fd97e -r 7b03590c334b src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Fri Aug 09 09:51:21 2013 -0700 +++ b/src/share/vm/runtime/arguments.cpp Fri Aug 09 15:36:09 2013 -0700 @@ -60,6 +60,28 @@ #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" #define DEFAULT_JAVA_LAUNCHER "generic" +// Disable options not supported in this release, with a warning if they +// were explicitly requested on the command-line +#define UNSUPPORTED_OPTION(opt, description) \ +do { \ + if (opt) { \ + if (FLAG_IS_CMDLINE(opt)) { \ + warning(description " is disabled in this release."); \ + } \ + FLAG_SET_DEFAULT(opt, false); \ + } \ +} while(0) + +#define UNSUPPORTED_GC_OPTION(gc) \ +do { \ + if (gc) { \ + if (FLAG_IS_CMDLINE(gc)) { \ + warning(#gc " is not supported in this VM. Using Serial GC."); \ + } \ + FLAG_SET_DEFAULT(gc, false); \ + } \ +} while(0) + char** Arguments::_jvm_flags_array = NULL; int Arguments::_num_jvm_flags = 0; char** Arguments::_jvm_args_array = NULL; @@ -3128,14 +3150,17 @@ FLAG_SET_DEFAULT(UseLargePages, false); } - // Tiered compilation is undefined with C1. - TieredCompilation = false; #else if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); } #endif +#ifndef TIERED + // Tiered compilation is undefined. + UNSUPPORTED_OPTION(TieredCompilation, "TieredCompilation"); +#endif + // If we are running in a headless jre, force java.awt.headless property // to be true unless the property has already been set. // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state. @@ -3278,29 +3303,6 @@ } } -// Disable options not supported in this release, with a warning if they -// were explicitly requested on the command-line -#define UNSUPPORTED_OPTION(opt, description) \ -do { \ - if (opt) { \ - if (FLAG_IS_CMDLINE(opt)) { \ - warning(description " is disabled in this release."); \ - } \ - FLAG_SET_DEFAULT(opt, false); \ - } \ -} while(0) - - -#define UNSUPPORTED_GC_OPTION(gc) \ -do { \ - if (gc) { \ - if (FLAG_IS_CMDLINE(gc)) { \ - warning(#gc " is not supported in this VM. Using Serial GC."); \ - } \ - FLAG_SET_DEFAULT(gc, false); \ - } \ -} while(0) - #if !INCLUDE_ALL_GCS static void force_serial_gc() { FLAG_SET_DEFAULT(UseSerialGC, true); diff -r 98aa538fd97e -r 7b03590c334b src/share/vm/utilities/exceptions.cpp --- a/src/share/vm/utilities/exceptions.cpp Fri Aug 09 09:51:21 2013 -0700 +++ b/src/share/vm/utilities/exceptions.cpp Fri Aug 09 15:36:09 2013 -0700 @@ -125,13 +125,13 @@ } void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) { + ResourceMark rm; assert(h_exception() != NULL, "exception should not be NULL"); // tracing (do this up front - so it works during boot strapping) if (TraceExceptions) { ttyLocker ttyl; - ResourceMark rm; - tty->print_cr("Exception <%s>%s%s (" INTPTR_FORMAT " ) \n" + tty->print_cr("Exception <%s%s%s> (" INTPTR_FORMAT ") \n" "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT, h_exception->print_value_string(), message ? ": " : "", message ? message : "", @@ -141,7 +141,9 @@ NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message)); // Check for special boot-strapping/vm-thread handling - if (special_exception(thread, file, line, h_exception)) return; + if (special_exception(thread, file, line, h_exception)) { + return; + } assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable"); @@ -149,7 +151,9 @@ thread->set_pending_exception(h_exception(), file, line); // vm log - Events::log_exception(thread, "Threw " INTPTR_FORMAT " at %s:%d", (address)h_exception(), file, line); + Events::log_exception(thread, "Exception <%s%s%s> (" INTPTR_FORMAT ") thrown at [%s, line %d]", + h_exception->print_value_string(), message ? ": " : "", message ? message : "", + (address)h_exception(), file, line); } diff -r 98aa538fd97e -r 7b03590c334b src/share/vm/utilities/taskqueue.hpp --- a/src/share/vm/utilities/taskqueue.hpp Fri Aug 09 09:51:21 2013 -0700 +++ b/src/share/vm/utilities/taskqueue.hpp Fri Aug 09 15:36:09 2013 -0700 @@ -395,7 +395,13 @@ template bool GenericTaskQueue::pop_global(E& t) { Age oldAge = _age.get(); - uint localBot = _bottom; + // Architectures with weak memory model require a barrier here + // to guarantee that bottom is not older than age, + // which is crucial for the correctness of the algorithm. +#if !(defined SPARC || defined IA32 || defined AMD64) + OrderAccess::fence(); +#endif + uint localBot = OrderAccess::load_acquire((volatile juint*)&_bottom); uint n_elems = size(localBot, oldAge.top()); if (n_elems == 0) { return false; @@ -644,7 +650,7 @@ template inline bool GenericTaskQueue::push(E t) { uint localBot = _bottom; - assert((localBot >= 0) && (localBot < N), "_bottom out of range."); + assert(localBot < N, "_bottom out of range."); idx_t top = _age.top(); uint dirty_n_elems = dirty_size(localBot, top); assert(dirty_n_elems < N, "n_elems out of range."); diff -r 98aa538fd97e -r 7b03590c334b test/compiler/codecache/CheckUpperLimit.java --- a/test/compiler/codecache/CheckUpperLimit.java Fri Aug 09 09:51:21 2013 -0700 +++ b/test/compiler/codecache/CheckUpperLimit.java Fri Aug 09 15:36:09 2013 -0700 @@ -35,10 +35,6 @@ ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2048m", "-version"); - out = new OutputAnalyzer(pb.start()); - out.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version"); out = new OutputAnalyzer(pb.start()); out.shouldContain("Invalid ReservedCodeCacheSize="); diff -r 98aa538fd97e -r 7b03590c334b test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java Fri Aug 09 15:36:09 2013 -0700 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2013, 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 + * @bug 8016474 + * @summary The bug only happens with C1 and G1 using a different ObjectAlignmentInBytes than KlassAlignmentInBytes (which is 8) + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 GetUnsafeObjectG1PreBarrier + */ + +import java.lang.reflect.Field; + +import sun.misc.Unsafe; + +public class GetUnsafeObjectG1PreBarrier { + private static final Unsafe unsafe; + private static final int N = 100_000; + + static { + try { + Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); + theUnsafe.setAccessible(true); + unsafe = (Unsafe) theUnsafe.get(null); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new IllegalStateException(e); + } + } + + public Object a; + + public static void main(String[] args) throws Throwable { + new GetUnsafeObjectG1PreBarrier(); + } + + public GetUnsafeObjectG1PreBarrier() throws Throwable { + doit(); + } + + private void doit() throws Throwable { + Field field = GetUnsafeObjectG1PreBarrier.class.getField("a"); + long fieldOffset = unsafe.objectFieldOffset(field); + + for (int i = 0; i < N; i++) { + readField(this, fieldOffset); + } + } + + private void readField(Object o, long fieldOffset) { + unsafe.getObject(o, fieldOffset); + } +}