diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp index 3af2d23b7d695586a5bc47317d72ed3a5e3bcd53..dbe3476aad9a44a3fd19619f0b3c12bd70c8dc80 100644 --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2295,7 +2295,7 @@ void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) { 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 --git a/src/share/vm/classfile/classLoader.cpp b/src/share/vm/classfile/classLoader.cpp index 650a299f346923f845fce244d891af47b451f523..32a4da05bb59267f8852e61b63c8e866c7c3ad50 100644 --- a/src/share/vm/classfile/classLoader.cpp +++ b/src/share/vm/classfile/classLoader.cpp @@ -878,7 +878,7 @@ objArrayOop ClassLoader::get_system_packages(TRAPS) { 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 --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp index a507c83a51186433cc1062e9bf675f59f9c1ea04..0662b6912b96971516aa35d74c68f7e9c04756c0 100644 --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -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 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req 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 @@ void Arguments::set_shared_spaces_flags() { } } -// 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 --git a/src/share/vm/utilities/exceptions.cpp b/src/share/vm/utilities/exceptions.cpp index 6083c555cbf66b378ba1989c9bfcf8a1b69279e4..af5f974f126988433db51843f9c9e5676e05c715 100644 --- a/src/share/vm/utilities/exceptions.cpp +++ b/src/share/vm/utilities/exceptions.cpp @@ -125,13 +125,13 @@ void Exceptions::_throw_oop(Thread* thread, const char* file, int line, oop exce } 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 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc 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 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc 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 --git a/test/compiler/codecache/CheckUpperLimit.java b/test/compiler/codecache/CheckUpperLimit.java index 5e4803226d54f6b4fdd3edcb64fc8f5ae19a246a..e2a2705b55478b388a620d3304566e004b4edb6e 100644 --- a/test/compiler/codecache/CheckUpperLimit.java +++ b/test/compiler/codecache/CheckUpperLimit.java @@ -35,10 +35,6 @@ public class CheckUpperLimit { 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 --git a/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java b/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java new file mode 100644 index 0000000000000000000000000000000000000000..c3f455274dd1d1e09034ddbcb4671df0faaf384b --- /dev/null +++ b/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java @@ -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); + } +}