OpenJDK / jdk / hs
changeset 36431:914e854b228e
Merge
author | amurillo |
---|---|
date | Tue, 08 Mar 2016 19:03:30 -0800 |
parents | bf90c6348632 953635dbec06 |
children | cb9e462e049a |
files | jdk/make/mapfiles/libjfr/mapfile-vers jdk/make/src/classes/build/tools/module/boot.modules jdk/src/java.base/share/classes/java/lang/String.java |
diffstat | 12 files changed, 475 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/make/mapfiles/libjfr/mapfile-vers Tue Mar 08 11:36:42 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -# -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. -# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - Java_oracle_jrockit_jfr_Process_getpid; - Java_oracle_jrockit_jfr_Timing_counterTime; - Java_oracle_jrockit_jfr_Timing_init; - Java_oracle_jrockit_jfr_Logger_output0; - Java_oracle_jrockit_jfr_JFR_isCommercialFeaturesUnlocked; - Java_oracle_jrockit_jfr_JFR_isStarted; - Java_oracle_jrockit_jfr_JFR_isSupportedInVM; - Java_oracle_jrockit_jfr_JFR_startFlightRecorder; - Java_oracle_jrockit_jfr_JFR_isDisabledOnCommandLine; - Java_oracle_jrockit_jfr_JFR_isEnabled; - Java_oracle_jrockit_jfr_VMJFR_options; - Java_oracle_jrockit_jfr_VMJFR_init; - Java_oracle_jrockit_jfr_VMJFR_addConstPool; - Java_oracle_jrockit_jfr_VMJFR_removeConstPool; - Java_oracle_jrockit_jfr_VMJFR_storeConstPool; - Java_oracle_jrockit_jfr_VMJFR_classID0; - Java_oracle_jrockit_jfr_VMJFR_stackTraceID; - Java_oracle_jrockit_jfr_VMJFR_threadID; - Java_oracle_jrockit_jfr_VMJFR_rotate; - Java_oracle_jrockit_jfr_VMJFR_shutdown; - Java_oracle_jrockit_jfr_VMJFR_start; - Java_oracle_jrockit_jfr_VMJFR_stop; - Java_oracle_jrockit_jfr_VMJFR_buffer; - Java_oracle_jrockit_jfr_VMJFR_flush; - Java_oracle_jrockit_jfr_VMJFR_write; - Java_oracle_jrockit_jfr_VMJFR_add; - Java_oracle_jrockit_jfr_VMJFR_remove; - Java_oracle_jrockit_jfr_VMJFR_setThreshold; - Java_oracle_jrockit_jfr_VMJFR_setPeriod; - Java_oracle_jrockit_jfr_VMJFR_getPeriod; - Java_oracle_jrockit_jfr_VMJFR_descriptors; - Java_oracle_jrockit_jfr_VMJFR_retransformClasses0; - JNI_OnLoad; - local: - *; -};
--- a/jdk/make/src/classes/build/tools/module/boot.modules Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/make/src/classes/build/tools/module/boot.modules Tue Mar 08 19:03:30 2016 -0800 @@ -27,6 +27,7 @@ jdk.vm.ci jdk.management jdk.management.cmm +jdk.management.jfr jdk.management.resource jdk.naming.rmi jdk.sctp
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Tue Mar 08 19:03:30 2016 -0800 @@ -81,9 +81,8 @@ ThreadGroup systemThreadGroup = tg; ThreadFactory threadFactory = grimReaper -> { - // Our thread stack requirement is quite modest. - Thread t = new Thread(systemThreadGroup, grimReaper, - "process reaper", 32768); + long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize") ? 0 : 32768; + Thread t = new Thread(systemThreadGroup, grimReaper, "process reaper", stackSize); t.setDaemon(true); // A small attempt (probably futile) to avoid priority inversion t.setPriority(Thread.MAX_PRIORITY);
--- a/jdk/src/java.base/share/classes/java/lang/String.java Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/src/java.base/share/classes/java/lang/String.java Tue Mar 08 19:03:30 2016 -0800 @@ -42,6 +42,7 @@ import java.util.stream.IntStream; import java.util.stream.StreamSupport; import jdk.internal.HotSpotIntrinsicCandidate; +import jdk.internal.vm.annotation.Stable; /** * The {@code String} class represents character strings. All @@ -119,7 +120,18 @@ public final class String implements java.io.Serializable, Comparable<String>, CharSequence { - /** The value is used for character storage. */ + /** + * The value is used for character storage. + * + * @implNote This field is trusted by the VM, and is a subject to + * constant folding if String instance is constant. Overwriting this + * field after construction will cause problems. + * + * Additionally, it is marked with {@link Stable} to trust the contents + * of the array. No other facility in JDK provides this functionality (yet). + * {@link Stable} is safe here, because value is never null. + */ + @Stable private final byte[] value; /** @@ -129,6 +141,9 @@ * LATIN1 * UTF16 * + * @implNote This field is trusted by the VM, and is a subject to + * constant folding if String instance is constant. Overwriting this + * field after construction will cause problems. */ private final byte coder;
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Tue Mar 08 19:03:30 2016 -0800 @@ -782,6 +782,46 @@ Object expected, Object x); + @HotSpotIntrinsicCandidate + public final native Object compareAndExchangeObjectVolatile(Object o, long offset, + Object expected, + Object x); + + @HotSpotIntrinsicCandidate + public final Object compareAndExchangeObjectAcquire(Object o, long offset, + Object expected, + Object x) { + return compareAndExchangeObjectVolatile(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final Object compareAndExchangeObjectRelease(Object o, long offset, + Object expected, + Object x) { + return compareAndExchangeObjectVolatile(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapObject(Object o, long offset, + Object expected, + Object x) { + return compareAndSwapObject(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapObjectAcquire(Object o, long offset, + Object expected, + Object x) { + return compareAndSwapObject(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapObjectRelease(Object o, long offset, + Object expected, + Object x) { + return compareAndSwapObject(o, offset, expected, x); + } + /** * Atomically updates Java variable to {@code x} if it is currently * holding {@code expected}. @@ -796,6 +836,46 @@ int expected, int x); + @HotSpotIntrinsicCandidate + public final native int compareAndExchangeIntVolatile(Object o, long offset, + int expected, + int x); + + @HotSpotIntrinsicCandidate + public final int compareAndExchangeIntAcquire(Object o, long offset, + int expected, + int x) { + return compareAndExchangeIntVolatile(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final int compareAndExchangeIntRelease(Object o, long offset, + int expected, + int x) { + return compareAndExchangeIntVolatile(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapInt(Object o, long offset, + int expected, + int x) { + return compareAndSwapInt(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapIntAcquire(Object o, long offset, + int expected, + int x) { + return compareAndSwapInt(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapIntRelease(Object o, long offset, + int expected, + int x) { + return compareAndSwapInt(o, offset, expected, x); + } + /** * Atomically updates Java variable to {@code x} if it is currently * holding {@code expected}. @@ -810,6 +890,46 @@ long expected, long x); + @HotSpotIntrinsicCandidate + public final native long compareAndExchangeLongVolatile(Object o, long offset, + long expected, + long x); + + @HotSpotIntrinsicCandidate + public final long compareAndExchangeLongAcquire(Object o, long offset, + long expected, + long x) { + return compareAndExchangeLongVolatile(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final long compareAndExchangeLongRelease(Object o, long offset, + long expected, + long x) { + return compareAndExchangeLongVolatile(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapLong(Object o, long offset, + long expected, + long x) { + return compareAndSwapLong(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapLongAcquire(Object o, long offset, + long expected, + long x) { + return compareAndSwapLong(o, offset, expected, x); + } + + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapLongRelease(Object o, long offset, + long expected, + long x) { + return compareAndSwapLong(o, offset, expected, x); + } + /** * Fetches a reference value from a given Java variable, with volatile * load semantics. Otherwise identical to {@link #getObject(Object, long)} @@ -908,6 +1028,224 @@ @HotSpotIntrinsicCandidate public native void putOrderedLong(Object o, long offset, long x); + /** Acquire version of {@link #getObjectVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final Object getObjectAcquire(Object o, long offset) { + return getObjectVolatile(o, offset); + } + + /** Acquire version of {@link #getBooleanVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final boolean getBooleanAcquire(Object o, long offset) { + return getBooleanVolatile(o, offset); + } + + /** Acquire version of {@link #getByteVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final byte getByteAcquire(Object o, long offset) { + return getByteVolatile(o, offset); + } + + /** Acquire version of {@link #getShortVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final short getShortAcquire(Object o, long offset) { + return getShortVolatile(o, offset); + } + + /** Acquire version of {@link #getCharVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final char getCharAcquire(Object o, long offset) { + return getCharVolatile(o, offset); + } + + /** Acquire version of {@link #getIntVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final int getIntAcquire(Object o, long offset) { + return getIntVolatile(o, offset); + } + + /** Acquire version of {@link #getFloatVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final float getFloatAcquire(Object o, long offset) { + return getFloatVolatile(o, offset); + } + + /** Acquire version of {@link #getLongVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final long getLongAcquire(Object o, long offset) { + return getLongVolatile(o, offset); + } + + /** Acquire version of {@link #getDoubleVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final double getDoubleAcquire(Object o, long offset) { + return getDoubleVolatile(o, offset); + } + + /** Release version of {@link #putObjectVolatile(Object, long, Object)} */ + @HotSpotIntrinsicCandidate + public final void putObjectRelease(Object o, long offset, Object x) { + putObjectVolatile(o, offset, x); + } + + /** Release version of {@link #putBooleanVolatile(Object, long, boolean)} */ + @HotSpotIntrinsicCandidate + public final void putBooleanRelease(Object o, long offset, boolean x) { + putBooleanVolatile(o, offset, x); + } + + /** Release version of {@link #putByteVolatile(Object, long, byte)} */ + @HotSpotIntrinsicCandidate + public final void putByteRelease(Object o, long offset, byte x) { + putByteVolatile(o, offset, x); + } + + /** Release version of {@link #putShortVolatile(Object, long, short)} */ + @HotSpotIntrinsicCandidate + public final void putShortRelease(Object o, long offset, short x) { + putShortVolatile(o, offset, x); + } + + /** Release version of {@link #putCharVolatile(Object, long, char)} */ + @HotSpotIntrinsicCandidate + public final void putCharRelease(Object o, long offset, char x) { + putCharVolatile(o, offset, x); + } + + /** Release version of {@link #putIntVolatile(Object, long, int)} */ + @HotSpotIntrinsicCandidate + public final void putIntRelease(Object o, long offset, int x) { + putIntVolatile(o, offset, x); + } + + /** Release version of {@link #putFloatVolatile(Object, long, float)} */ + @HotSpotIntrinsicCandidate + public final void putFloatRelease(Object o, long offset, float x) { + putFloatVolatile(o, offset, x); + } + + /** Release version of {@link #putLongVolatile(Object, long, long)} */ + @HotSpotIntrinsicCandidate + public final void putLongRelease(Object o, long offset, long x) { + putLongVolatile(o, offset, x); + } + + /** Release version of {@link #putDoubleVolatile(Object, long, double)} */ + @HotSpotIntrinsicCandidate + public final void putDoubleRelease(Object o, long offset, double x) { + putDoubleVolatile(o, offset, x); + } + + // ------------------------------ Opaque -------------------------------------- + + /** Opaque version of {@link #getObjectVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final Object getObjectOpaque(Object o, long offset) { + return getObjectVolatile(o, offset); + } + + /** Opaque version of {@link #getBooleanVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final boolean getBooleanOpaque(Object o, long offset) { + return getBooleanVolatile(o, offset); + } + + /** Opaque version of {@link #getByteVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final byte getByteOpaque(Object o, long offset) { + return getByteVolatile(o, offset); + } + + /** Opaque version of {@link #getShortVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final short getShortOpaque(Object o, long offset) { + return getShortVolatile(o, offset); + } + + /** Opaque version of {@link #getCharVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final char getCharOpaque(Object o, long offset) { + return getCharVolatile(o, offset); + } + + /** Opaque version of {@link #getIntVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final int getIntOpaque(Object o, long offset) { + return getIntVolatile(o, offset); + } + + /** Opaque version of {@link #getFloatVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final float getFloatOpaque(Object o, long offset) { + return getFloatVolatile(o, offset); + } + + /** Opaque version of {@link #getLongVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final long getLongOpaque(Object o, long offset) { + return getLongVolatile(o, offset); + } + + /** Opaque version of {@link #getDoubleVolatile(Object, long)} */ + @HotSpotIntrinsicCandidate + public final double getDoubleOpaque(Object o, long offset) { + return getDoubleVolatile(o, offset); + } + + /** Opaque version of {@link #putObjectVolatile(Object, long, Object)} */ + @HotSpotIntrinsicCandidate + public final void putObjectOpaque(Object o, long offset, Object x) { + putObjectVolatile(o, offset, x); + } + + /** Opaque version of {@link #putBooleanVolatile(Object, long, boolean)} */ + @HotSpotIntrinsicCandidate + public final void putBooleanOpaque(Object o, long offset, boolean x) { + putBooleanVolatile(o, offset, x); + } + + /** Opaque version of {@link #putByteVolatile(Object, long, byte)} */ + @HotSpotIntrinsicCandidate + public final void putByteOpaque(Object o, long offset, byte x) { + putByteVolatile(o, offset, x); + } + + /** Opaque version of {@link #putShortVolatile(Object, long, short)} */ + @HotSpotIntrinsicCandidate + public final void putShortOpaque(Object o, long offset, short x) { + putShortVolatile(o, offset, x); + } + + /** Opaque version of {@link #putCharVolatile(Object, long, char)} */ + @HotSpotIntrinsicCandidate + public final void putCharOpaque(Object o, long offset, char x) { + putCharVolatile(o, offset, x); + } + + /** Opaque version of {@link #putIntVolatile(Object, long, int)} */ + @HotSpotIntrinsicCandidate + public final void putIntOpaque(Object o, long offset, int x) { + putIntVolatile(o, offset, x); + } + + /** Opaque version of {@link #putFloatVolatile(Object, long, float)} */ + @HotSpotIntrinsicCandidate + public final void putFloatOpaque(Object o, long offset, float x) { + putFloatVolatile(o, offset, x); + } + + /** Opaque version of {@link #putLongVolatile(Object, long, long)} */ + @HotSpotIntrinsicCandidate + public final void putLongOpaque(Object o, long offset, long x) { + putLongVolatile(o, offset, x); + } + + /** Opaque version of {@link #putDoubleVolatile(Object, long, double)} */ + @HotSpotIntrinsicCandidate + public final void putDoubleOpaque(Object o, long offset, double x) { + putDoubleVolatile(o, offset, x); + } + /** * Unblocks the given thread blocked on {@code park}, or, if it is * not blocked, causes the subsequent call to {@code park} not to @@ -1101,6 +1439,23 @@ public native void fullFence(); /** + * Ensures that loads before the fence will not be reordered with + * loads after the fence. + */ + public final void loadLoadFence() { + loadFence(); + } + + /** + * Ensures that stores before the fence will not be reordered with + * stores after the fence. + */ + public final void storeStoreFence() { + storeFence(); + } + + + /** * Throws IllegalAccessError; for use by the VM for access control * error support. * @since 1.8
--- a/jdk/src/java.base/share/native/include/jni.h Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/src/java.base/share/native/include/jni.h Tue Mar 08 19:03:30 2016 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -1952,6 +1952,7 @@ #define JNI_VERSION_1_4 0x00010004 #define JNI_VERSION_1_6 0x00010006 #define JNI_VERSION_1_8 0x00010008 +#define JNI_VERSION_9 0x00090000 #ifdef __cplusplus } /* extern "C" */
--- a/jdk/src/java.base/windows/native/libjava/java_props_md.c Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/src/java.base/windows/native/libjava/java_props_md.c Tue Mar 08 19:03:30 2016 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, 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 @@ -469,7 +469,9 @@ * Windows Server 2008 R2 6 1 (!VER_NT_WORKSTATION) * Windows 8 6 2 (VER_NT_WORKSTATION) * Windows Server 2012 6 2 (!VER_NT_WORKSTATION) + * Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION) * Windows 10 10 0 (VER_NT_WORKSTATION) + * Windows Server 2016 10 0 (!VER_NT_WORKSTATION) * * This mapping will presumably be augmented as new Windows * versions are released. @@ -543,6 +545,7 @@ } } else { switch (minorVersion) { + case 0: sprops.os_name = "Windows Server 2016"; break; default: sprops.os_name = "Windows NT (unknown)"; } }
--- a/jdk/test/ProblemList.txt Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/test/ProblemList.txt Tue Mar 08 19:03:30 2016 -0800 @@ -334,9 +334,6 @@ # jdk_time -# 8134979 -java/time/tck/java/time/chrono/TCKJapaneseChronology.java generic-all - ############################################################################ # jdk_tools
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/com/sun/jdi/RedefineAddPrivateMethod.sh Tue Mar 08 19:03:30 2016 -0800 @@ -0,0 +1,79 @@ +#!/bin/sh + +# +# Copyright (c) 2016, 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 8149743 +# @summary crash when adding a breakpoint after redefining to add a private static method +# @run shell RedefineAddPrivateMethod.sh + +compileOptions=-g + +createJavaFile() +{ + cat <<EOF > $1.java.1 +public class $1 { + static public void main(String[] args) { + System.out.println("@1 breakpoint"); + System.out.println("@2 breakpoint"); + } + + // @1 uncomment private static void test() {} +} +EOF +} + +# This is called to feed cmds to jdb. +dojdbCmds() +{ + setBkpts @1 + runToBkpt @1 + redefineClass @1 + setBkpts @2 + runToBkpt @2 + cmd exitJdb +} + + +mysetup() +{ + if [ -z "$TESTSRC" ] ; then + TESTSRC=. + fi + + for ii in . $TESTSRC $TESTSRC/.. ; do + if [ -r "$ii/ShellScaffold.sh" ] ; then + . $ii/ShellScaffold.sh + break + fi + done +} + +# You could replace this next line with the contents +# of ShellScaffold.sh and this script will run just the same. +mysetup + +runit +debuggeeFailIfPresent "Internal exception:" +pass
--- a/jdk/test/com/sun/jdi/TestScaffold.java Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/test/com/sun/jdi/TestScaffold.java Tue Mar 08 19:03:30 2016 -0800 @@ -752,6 +752,7 @@ sr.addClassExclusionFilter("com.oracle.*"); sr.addClassExclusionFilter("oracle.*"); sr.addClassExclusionFilter("jdk.internal.*"); + sr.addClassExclusionFilter("jdk.jfr.*"); sr.addCountFilter(1); sr.enable(); StepEvent retEvent = (StepEvent)waitForRequestedEvent(sr);
--- a/jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java Tue Mar 08 19:03:30 2016 -0800 @@ -31,7 +31,7 @@ * java.management * java.instrument * @run shell/timeout=240 MakeJAR2.sh NativeMethodPrefixAgent NativeMethodPrefixApp 'Can-Retransform-Classes: true' 'Can-Set-Native-Method-Prefix: true' - * @run main/othervm -javaagent:NativeMethodPrefixAgent.jar NativeMethodPrefixApp + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-CheckIntrinsics -javaagent:NativeMethodPrefixAgent.jar NativeMethodPrefixApp */ import java.lang.instrument.*;
--- a/jdk/test/java/lang/ref/FinalizeOverride.java Tue Mar 08 11:36:42 2016 -0800 +++ b/jdk/test/java/lang/ref/FinalizeOverride.java Tue Mar 08 19:03:30 2016 -0800 @@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger; /* @test - * @bug 8027351 + * @bug 8027351 8148940 * @summary Basic test of the finalize method */ @@ -63,6 +63,19 @@ while (finalizedCount.get() != (count+1)) { System.gc(); System.runFinalization(); + // Running System.gc() and System.runFinalization() in a + // tight loop can trigger frequent safepointing that slows + // down the VM and, as a result, the test. (With the + // HotSpot VM, the effect of frequent safepointing is + // especially noticeable if the test is run with the + // -Xcomp flag.) Sleeping for a second after every + // garbage collection and finalization cycle gives the VM + // time to make progress. + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + System.out.println("Main thread interrupted, continuing execution."); + } } if (privateFinalizeInvoked) {