# HG changeset patch # User amurillo # Date 1422382283 28800 # Node ID 5e7636bd2f6514f64de4e869b41d31ebccdf0927 # Parent 41e20ea91d56411c50a23801352a4cbf36f7f7b5# Parent bb9afe681988e96335cf1ee15c449b299780a6b5 Merge diff -r bb9afe681988 -r 5e7636bd2f65 jdk/src/java.base/share/classes/sun/misc/Unsafe.java --- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java Tue Jan 27 18:16:27 2015 +0800 +++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java Tue Jan 27 10:11:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -845,22 +845,6 @@ public native Object allocateInstance(Class cls) throws InstantiationException; - /** Lock the object. It must get unlocked via {@link #monitorExit}. */ - public native void monitorEnter(Object o); - - /** - * Unlock the object. It must have been locked via {@link - * #monitorEnter}. - */ - public native void monitorExit(Object o); - - /** - * Tries to lock the object. Returns true or false to indicate - * whether the lock succeeded. If it did, the object must be - * unlocked via {@link #monitorExit}. - */ - public native boolean tryMonitorEnter(Object o); - /** Throw the exception without telling the verifier. */ public native void throwException(Throwable ee); diff -r bb9afe681988 -r 5e7636bd2f65 jdk/test/ProblemList.txt --- a/jdk/test/ProblemList.txt Tue Jan 27 18:16:27 2015 +0800 +++ b/jdk/test/ProblemList.txt Tue Jan 27 10:11:23 2015 -0800 @@ -128,9 +128,6 @@ # jdk_instrument -# 8058536 -java/lang/instrument/NativeMethodPrefixAgent.java generic-all - # 8061177 java/lang/instrument/RedefineBigClass.sh generic-all java/lang/instrument/RetransformBigClass.sh generic-all diff -r bb9afe681988 -r 5e7636bd2f65 jdk/test/java/lang/ProcessBuilder/Basic.java --- a/jdk/test/java/lang/ProcessBuilder/Basic.java Tue Jan 27 18:16:27 2015 +0800 +++ b/jdk/test/java/lang/ProcessBuilder/Basic.java Tue Jan 27 10:11:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -26,7 +26,7 @@ * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689 * 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313 * 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958 - * 4947220 7018606 7034570 4244896 5049299 8003488 + * 4947220 7018606 7034570 4244896 5049299 8003488 8054494 * @summary Basic tests for Process and Environment Variable code * @run main/othervm/timeout=300 Basic * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic @@ -2059,13 +2059,11 @@ Thread.yield(); } } else if (s instanceof BufferedInputStream) { - Field f = Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - Unsafe unsafe = (Unsafe)f.get(null); - - while (unsafe.tryMonitorEnter(s)) { - unsafe.monitorExit(s); - Thread.sleep(1); + // Wait until after the s.read occurs in "thread" by + // checking when the input stream monitor is acquired + // (BufferedInputStream.read is synchronized) + while (!isLocked(s, 10)) { + Thread.sleep(100); } } p.destroy(); @@ -2565,4 +2563,21 @@ catch (Throwable t) { if (k.isAssignableFrom(t.getClass())) pass(); else unexpected(t);}} + + static boolean isLocked(final Object monitor, final long millis) throws InterruptedException { + return new Thread() { + volatile boolean unlocked; + + @Override + public void run() { + synchronized (monitor) { unlocked = true; } + } + + boolean isLocked() throws InterruptedException { + start(); + join(millis); + return !unlocked; + } + }.isLocked(); + } } diff -r bb9afe681988 -r 5e7636bd2f65 jdk/test/java/lang/ref/OOMEInReferenceHandler.java --- a/jdk/test/java/lang/ref/OOMEInReferenceHandler.java Tue Jan 27 18:16:27 2015 +0800 +++ b/jdk/test/java/lang/ref/OOMEInReferenceHandler.java Tue Jan 27 10:11:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,7 +25,7 @@ * @test * @bug 7038914 8016341 * @summary Verify that the reference handler does not die after an OOME allocating the InterruptedException object - * @run main/othervm -Xmx24M -XX:-UseTLAB OOMEInReferenceHandler + * @run main/othervm -XX:-UseGCOverheadLimit -Xmx24M -XX:-UseTLAB OOMEInReferenceHandler * @author peter.levart@gmail.com */