From 04edcf722cd71a6c807c57449fb81ec337097e1a Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Fri, 14 Nov 2014 12:32:43 +0300 Subject: [PATCH 001/159] 8004148: NPE in sun.awt.SunToolkit.getWindowDeactivationTime Reviewed-by: serb --- jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java index 29f8c297717..6d179aa4f9f 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java @@ -1882,6 +1882,9 @@ public abstract class SunToolkit extends Toolkit public synchronized void setWindowDeactivationTime(Window w, long time) { AppContext ctx = getAppContext(w); + if (ctx == null) { + return; + } @SuppressWarnings("unchecked") WeakHashMap map = (WeakHashMap)ctx.get(DEACTIVATION_TIMES_MAP_KEY); if (map == null) { @@ -1893,6 +1896,9 @@ public abstract class SunToolkit extends Toolkit public synchronized long getWindowDeactivationTime(Window w) { AppContext ctx = getAppContext(w); + if (ctx == null) { + return -1; + } @SuppressWarnings("unchecked") WeakHashMap map = (WeakHashMap)ctx.get(DEACTIVATION_TIMES_MAP_KEY); if (map == null) { From ea786e7bc7a2f01a712038083cbfbcfda8a47268 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Fri, 14 Nov 2014 11:41:42 +0000 Subject: [PATCH 002/159] 8034031: [parfait] JNI exception pending in jdk/src/macosx/native/apple/security/KeystoreImpl.m Reviewed-by: alanb --- .../macosx/native/libosx/KeystoreImpl.m | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m b/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m index 2fe5c4bb79e..179151440da 100644 --- a/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m +++ b/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m @@ -300,11 +300,21 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore) // Make a java array of certificate data from the chain. jclass byteArrayClass = (*env)->FindClass(env, "[B"); + if (byteArrayClass == NULL) { + goto errOut; + } jobjectArray javaCertArray = (*env)->NewObjectArray(env, certCount, byteArrayClass, NULL); + // Cleanup first then check for a NULL return code (*env)->DeleteLocalRef(env, byteArrayClass); + if (javaCertArray == NULL) { + goto errOut; + } // And, make an array of the certificate refs. jlongArray certRefArray = (*env)->NewLongArray(env, certCount); + if (certRefArray == NULL) { + goto errOut; + } SecCertificateRef currCertRef = NULL; @@ -319,6 +329,9 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore) bzero(&currCertData, sizeof(CSSM_DATA)); err = SecCertificateGetData(currCertRef, &currCertData); jbyteArray encodedCertData = (*env)->NewByteArray(env, currCertData.Length); + if (encodedCertData == NULL) { + goto errOut; + } (*env)->SetByteArrayRegion(env, encodedCertData, 0, currCertData.Length, (jbyte *)currCertData.Data); (*env)->SetObjectArrayElement(env, javaCertArray, i, encodedCertData); jlong certRefElement = ptr_to_jlong(currCertRef); @@ -331,6 +344,9 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore) // Find the label. It's a 'blob', but we interpret as characters. jstring alias = getLabelFromItem(env, (SecKeychainItemRef)certificate); + if (alias == NULL) { + goto errOut; + } // Find the creation date. jlong creationDate = getModDateFromItem(env, (SecKeychainItemRef)certificate); @@ -341,6 +357,7 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore) } } while (searchResult == noErr); +errOut: if (identitySearch != NULL) { CFRelease(identitySearch); } @@ -363,10 +380,16 @@ static void addCertificatesToKeystore(JNIEnv *env, jobject keyStore) CSSM_DATA currCertificate; err = SecCertificateGetData(certRef, &currCertificate); jbyteArray certData = (*env)->NewByteArray(env, currCertificate.Length); + if (certData == NULL) { + goto errOut; + } (*env)->SetByteArrayRegion(env, certData, 0, currCertificate.Length, (jbyte *)currCertificate.Data); // Find the label. It's a 'blob', but we interpret as characters. jstring alias = getLabelFromItem(env, theItem); + if (alias == NULL) { + goto errOut; + } // Find the creation date. jlong creationDate = getModDateFromItem(env, theItem); @@ -377,6 +400,7 @@ static void addCertificatesToKeystore(JNIEnv *env, jobject keyStore) } } while (searchResult == noErr); +errOut: if (keychainItemSearch != NULL) { CFRelease(keychainItemSearch); } @@ -405,6 +429,9 @@ JNIEXPORT jbyteArray JNICALL Java_apple_security_KeychainStore__1getEncodedKeyDa if (passwordLen > 0) { passwordChars = (*env)->GetCharArrayElements(env, passwordObj, NULL); + if (passwordChars == NULL) { + goto errOut; + } passwordStrRef = CFStringCreateWithCharacters(kCFAllocatorDefault, passwordChars, passwordLen); } } @@ -424,9 +451,13 @@ JNIEXPORT jbyteArray JNICALL Java_apple_security_KeychainStore__1getEncodedKeyDa if (err == noErr) { CFIndex size = CFDataGetLength(exportedData); returnValue = (*env)->NewByteArray(env, size); + if (returnValue == NULL) { + goto errOut; + } (*env)->SetByteArrayRegion(env, returnValue, 0, size, (jbyte *)CFDataGetBytePtr(exportedData)); } +errOut: if (exportedData) CFRelease(exportedData); if (passwordStrRef) CFRelease(passwordStrRef); @@ -467,6 +498,9 @@ JNF_COCOA_ENTER(env); jsize dataSize = (*env)->GetArrayLength(env, rawDataObj); jbyte *rawData = (*env)->GetByteArrayElements(env, rawDataObj, NULL); + if (rawData == NULL) { + goto errOut; + } CFDataRef cfDataToImport = CFDataCreate(kCFAllocatorDefault, (UInt8 *)rawData, dataSize); CFArrayRef createdItems = NULL; @@ -523,6 +557,8 @@ JNF_COCOA_ENTER(env); CFRelease(createdItems); } +errOut: ; + JNF_COCOA_EXIT(env); return returnValue; From 187bacb237a08e66bd2046ae141263b899ac3615 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Fri, 14 Nov 2014 18:15:52 +0000 Subject: [PATCH 003/159] 8050983: Misplaced parentheses in sun.net.www.http.HttpClient break HTTP PUT streaming Reviewed-by: michaelm --- .../classes/sun/net/www/http/HttpClient.java | 14 ++++++++------ .../www/http/HttpClient/StreamingRetry.java | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java index 0e07d3ab65c..fcdd50943ab 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java +++ b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java @@ -657,9 +657,10 @@ public class HttpClient extends NetworkClient { cachedHttpClient = false; if (!failedOnce && requests != null) { failedOnce = true; - if (getRequestMethod().equals("CONNECT") || - (httpuc.getRequestMethod().equals("POST") && - (!retryPostProp || streaming))) { + if (getRequestMethod().equals("CONNECT") + || streaming + || (httpuc.getRequestMethod().equals("POST") + && !retryPostProp)) { // do not retry the request } else { // try once more @@ -769,9 +770,10 @@ public class HttpClient extends NetworkClient { } else if (nread != 8) { if (!failedOnce && requests != null) { failedOnce = true; - if (getRequestMethod().equals("CONNECT") || - (httpuc.getRequestMethod().equals("POST") && - (!retryPostProp || streaming))) { + if (getRequestMethod().equals("CONNECT") + || streaming + || (httpuc.getRequestMethod().equals("POST") + && !retryPostProp)) { // do not retry the request } else { closeServer(); diff --git a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java index 03c5b503e8a..35dbc51d2de 100644 --- a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java +++ b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java @@ -23,8 +23,8 @@ /* * @test - * @bug 6672144 - * @summary HttpURLConnection.getInputStream sends POST request after failed chunked send + * @bug 6672144 8050983 + * @summary Do not retry failed request with a streaming body. */ import java.net.HttpURLConnection; @@ -33,6 +33,7 @@ import java.net.URL; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import static java.lang.System.out; public class StreamingRetry implements Runnable { static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds @@ -43,11 +44,17 @@ public class StreamingRetry implements Runnable { } void instanceMain() throws IOException { - test(); + out.println("Test with default method"); + test(null); + out.println("Test with POST method"); + test("POST"); + out.println("Test with PUT method"); + test("PUT"); + if (failed > 0) throw new RuntimeException("Some tests failed"); } - void test() throws IOException { + void test(String method) throws IOException { ss = new ServerSocket(0); ss.setSoTimeout(ACCEPT_TIMEOUT); int port = ss.getLocalPort(); @@ -58,6 +65,8 @@ public class StreamingRetry implements Runnable { URL url = new URL("http://localhost:" + port + "/"); HttpURLConnection uc = (HttpURLConnection) url.openConnection(); uc.setDoOutput(true); + if (method != null) + uc.setRequestMethod(method); uc.setChunkedStreamingMode(4096); OutputStream os = uc.getOutputStream(); os.write("Hello there".getBytes()); @@ -79,7 +88,7 @@ public class StreamingRetry implements Runnable { ss.close(); fail("The server shouldn't accept a second connection"); } catch (IOException e) { - //OK, the clien will close the server socket if successfull + //OK, the client will close the server socket if successful } } From 72f7a2a671cd8ef044cf8e7dd10fb547927260ad Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Mon, 27 Oct 2014 16:24:43 -0700 Subject: [PATCH 004/159] 8062194: java.util.jar.Attributes should use insertion-ordered iteration S/HashMap/LinkedHashMap/g Reviewed-by: alanb, sherman --- .../classes/java/util/jar/Attributes.java | 9 ++- .../util/jar/Attributes/IterationOrder.java | 74 +++++++++++++++++++ 2 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 jdk/test/java/util/jar/Attributes/IterationOrder.java diff --git a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java index 37efbd47481..1bf9ac170fb 100644 --- a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java +++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java @@ -28,7 +28,7 @@ package java.util.jar; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import java.util.Collection; @@ -47,6 +47,9 @@ import sun.misc.ASCIICaseInsensitiveComparator; * JAR File Specification * for more information about valid attribute names and values. * + *

This map and its views have a predictable iteration order, namely the + * order that keys were inserted into the map, as with {@link LinkedHashMap}. + * * @author David Connelly * @see Manifest * @since 1.2 @@ -71,7 +74,7 @@ public class Attributes implements Map, Cloneable { * @param size the initial number of attributes */ public Attributes(int size) { - map = new HashMap<>(size); + map = new LinkedHashMap<>(size); } /** @@ -81,7 +84,7 @@ public class Attributes implements Map, Cloneable { * @param attr the specified Attributes */ public Attributes(Attributes attr) { - map = new HashMap<>(attr); + map = new LinkedHashMap<>(attr); } diff --git a/jdk/test/java/util/jar/Attributes/IterationOrder.java b/jdk/test/java/util/jar/Attributes/IterationOrder.java new file mode 100644 index 00000000000..4028d71e7c4 --- /dev/null +++ b/jdk/test/java/util/jar/Attributes/IterationOrder.java @@ -0,0 +1,74 @@ +/* + * Copyright 2014 Google, Inc. 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 8062194 + * @summary Ensure Attribute iteration order is the insertion order. + */ + +import java.util.Arrays; +import java.util.Map; +import java.util.jar.Attributes; +import java.util.jar.Attributes.Name; + +public class IterationOrder { + static void checkOrder(Attributes.Name k0, String v0, + Attributes.Name k1, String v1, + Attributes.Name k2, String v2) { + Attributes x = new Attributes(); + x.put(k0, v0); + x.put(k1, v1); + x.put(k2, v2); + Map.Entry[] entries + = x.entrySet().toArray(new Map.Entry[3]); + if (!(entries.length == 3 + && entries[0].getKey() == k0 + && entries[0].getValue() == v0 + && entries[1].getKey() == k1 + && entries[1].getValue() == v1 + && entries[2].getKey() == k2 + && entries[2].getValue() == v2)) { + throw new AssertionError(Arrays.toString(entries)); + } + + Object[] keys = x.keySet().toArray(); + if (!(keys.length == 3 + && keys[0] == k0 + && keys[1] == k1 + && keys[2] == k2)) { + throw new AssertionError(Arrays.toString(keys)); + } + } + + public static void main(String[] args) throws Exception { + Attributes.Name k0 = Name.MANIFEST_VERSION; + Attributes.Name k1 = Name.MAIN_CLASS; + Attributes.Name k2 = Name.SEALED; + String v0 = "42.0"; + String v1 = "com.google.Hello"; + String v2 = "yes"; + checkOrder(k0, v0, k1, v1, k2, v2); + checkOrder(k1, v1, k0, v0, k2, v2); + checkOrder(k2, v2, k1, v1, k0, v0); + } +} From 5e65c0f984aa3ce3478e05427cab863d01a1d152 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Thu, 6 Nov 2014 13:29:36 -0800 Subject: [PATCH 005/159] 8063147: Class.getFields spec should state that fields are inherited from superinterfaces Reviewed-by: psandoz, chegar --- .../share/classes/java/lang/Class.java | 3 +- .../java/lang/Class/getFields/Sanity.java | 168 ++++++++++++++++++ 2 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/lang/Class/getFields/Sanity.java diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java index 5c03b975326..9063450866f 100644 --- a/jdk/src/java.base/share/classes/java/lang/Class.java +++ b/jdk/src/java.base/share/classes/java/lang/Class.java @@ -1533,7 +1533,8 @@ public final class Class implements java.io.Serializable, * 0. * *

If this {@code Class} object represents a class, then this method - * returns the public fields of the class and of all its superclasses. + * returns the public fields of the class and of all its superclasses and + * superinterfaces. * *

If this {@code Class} object represents an interface, then this * method returns the fields of the interface and of all its diff --git a/jdk/test/java/lang/Class/getFields/Sanity.java b/jdk/test/java/lang/Class/getFields/Sanity.java new file mode 100644 index 00000000000..e82ac10521d --- /dev/null +++ b/jdk/test/java/lang/Class/getFields/Sanity.java @@ -0,0 +1,168 @@ +/* + * Copyright 2014 Google, Inc. 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 8063147 + * @summary Tests for Class.getFields(). + * @run testng Sanity + */ + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +public class Sanity { + public interface EmptyInterface {} + class EmptyClass {} + interface BI1 { + public int i = 1; + int j = 2; + } + interface BI2 { + int k = 1; + } + public interface DI extends BI1, BI2, EmptyInterface { + int m = 5; + } + interface DDI extends DI { + int n = 6; + } + + public class D extends EmptyClass { + public int publicDField; + protected int protectedDField; + private int privateDField; + } + + class DD extends D { + public int publicDDField; + protected int protectedDDField; + private int privateDDField; + } + + public class Universe extends DD implements DDI { + public int publicUniverseField; + protected int protectedUniverseField; + private int privateUniverseField; + } + + void assertContainsNoFields(Class clazz) { + assertEquals(clazz.getFields().length, 0); + } + + @Test + public void primitiveTypesHaveNoFields() throws Exception { + assertContainsNoFields(byte.class); + assertContainsNoFields(char.class); + assertContainsNoFields(short.class); + assertContainsNoFields(int.class); + assertContainsNoFields(long.class); + assertContainsNoFields(boolean.class); + assertContainsNoFields(void.class); + assertContainsNoFields(double.class); + assertContainsNoFields(float.class); + } + + @Test + public void arrayTypesHaveNoFields() throws Exception { + assertContainsNoFields(byte[].class); + assertContainsNoFields(Object[].class); + assertContainsNoFields(java.util.Map[].class); + assertContainsNoFields(java.util.HashMap[].class); + } + + @Test + public void emptyInterfacesHaveNoFields() throws Exception { + assertContainsNoFields(EmptyInterface.class); + } + + @Test + public void emptyClassesHaveNoFields() throws Exception { + assertContainsNoFields(EmptyClass.class); + class EmptyLocalClass {} + assertContainsNoFields(EmptyLocalClass.class); + } + + void assertContainsFields(Class clazz, int count) { + assertEquals(clazz.getFields().length, count); + } + + @Test + public void checkFieldCounts() throws Exception { + assertContainsFields(BI1.class, 2); + assertContainsFields(BI2.class, 1); + assertContainsFields(DI.class, 4); + assertContainsFields(DDI.class, 5); + assertContainsFields(D.class, 1); + assertContainsFields(DD.class, 2); + assertContainsFields(Universe.class, 8); + } + + void assertContainsFields(Class derived, Class base) { + List derivedFields = Arrays.asList(derived.getFields()); + List baseFields = Arrays.asList(base.getFields()); + assertTrue(derivedFields.containsAll(baseFields)); + } + + List> directSupers(Class clazz) { + List> directSupers = new ArrayList<>(); + directSupers.addAll(Arrays.asList(clazz.getInterfaces())); + if (clazz.getSuperclass() != null) { + directSupers.add(clazz.getSuperclass()); + } + return directSupers; + } + + void assertContainsSuperFields(Class clazz) { + for (Class directSuper : directSupers(clazz)) { + assertContainsFields(clazz, directSuper); + } + } + + List> testClasses() { + List> testClasses = new ArrayList<>(); + testClasses.add(Sanity.class); + testClasses.addAll(Arrays.asList(Sanity.class.getDeclaredClasses())); + assertEquals(testClasses.size(), 10); + return testClasses; + } + + @Test + public void fieldsAreInheritedFromSupers() throws Exception { + for (Class clazz : testClasses()) { + assertContainsSuperFields(clazz); + } + } + + @Test + public void getFieldIsConsistentWithGetFields() throws Exception { + for (Class clazz : testClasses()) { + for (Field field : clazz.getFields()) { + assertEquals(field, clazz.getField(field.getName())); + } + } + } +} From 05ed094d99a4cc89ab61d4d8ce09b7f77eaeffb3 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Sat, 15 Nov 2014 18:26:29 +0000 Subject: [PATCH 006/159] 8015692: java.net.BindException is thrown on Windows XP when HTTP server is started and stopped in the loop Join the dispatcher thread in the ServerImpl.stop method to ensure Dispatcher is finished prior to exiting stop(). Reviewed-by: chegar --- .../sun/net/httpserver/ServerImpl.java | 13 +++- .../net/httpserver/SimpleHttpServerTest.java | 64 +++++++++++++++++++ 2 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java diff --git a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java index 5b424fb948d..5952c79ee87 100644 --- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java +++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java @@ -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 @@ -82,6 +82,7 @@ class ServerImpl implements TimeSource { private Timer timer, timer1; private Logger logger; + private Thread dispatcherThread; ServerImpl ( HttpServer wrapper, String protocol, InetSocketAddress addr, int backlog @@ -141,9 +142,9 @@ class ServerImpl implements TimeSource { if (executor == null) { executor = new DefaultExecutor(); } - Thread t = new Thread (dispatcher); + dispatcherThread = new Thread (dispatcher); started = true; - t.start(); + dispatcherThread.start(); } public void setExecutor (Executor executor) { @@ -205,6 +206,12 @@ class ServerImpl implements TimeSource { if (timer1Enabled) { timer1.cancel(); } + try { + dispatcherThread.join(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + logger.log(Level.FINER, "ServerImpl.stop: ", e); + } } Dispatcher dispatcher; diff --git a/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java b/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java new file mode 100644 index 00000000000..c33ded954b4 --- /dev/null +++ b/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java @@ -0,0 +1,64 @@ +/* + * 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 + * @bug 8015692 + * @summary Test HttpServer instantiation, start, and stop repeated in a loop + * Testing for Bind exception on Windows + */ + +import java.net.InetSocketAddress; +import java.net.ServerSocket; + +import com.sun.net.httpserver.HttpServer; + + +public class SimpleHttpServerTest { + + public static void main(String[] args) throws Exception { + + System.out.println(System.getProperty("java.version")); + InetSocketAddress serverAddr = new InetSocketAddress(0); + HttpServer server = HttpServer.create(serverAddr, 0); + final int serverPort = server.getAddress().getPort(); + server.start(); + server.stop(0); + serverAddr = new InetSocketAddress(serverPort); + int exceptionCount = 0; + System.out.println("Using serverPort == " + serverPort); + for (int i = 0; i < 100; i++) { + try { + server = HttpServer.create(serverAddr, 0); + server.start(); + server.stop(0); + } catch (Exception ex) { + ex.printStackTrace(); + exceptionCount++; + } + } + if (exceptionCount > 0) { + throw new RuntimeException("Test Failed"); + } + } +} From 0d4528c45f76fe5ad05f77e625c78306b49a073f Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Sun, 18 May 2014 23:06:51 +0000 Subject: [PATCH 007/159] 8042480: CipherInputStream.close() throws AEADBadTagException in some cases Reviewed-by: xuelei --- .../share/classes/javax/crypto/CipherInputStream.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java index 0930f9d6426..37520a1b5ec 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java +++ b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java @@ -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 @@ -88,6 +88,8 @@ public class CipherInputStream extends FilterInputStream { private int ofinish = 0; // stream status private boolean closed = false; + // The stream has been read from. False if the stream has never been read. + private boolean read = false; /** * private convenience function. @@ -103,6 +105,7 @@ public class CipherInputStream extends FilterInputStream { private int getMoreData() throws IOException { if (done) return -1; int readin = input.read(ibuffer); + read = true; if (readin == -1) { done = true; try { @@ -306,7 +309,11 @@ public class CipherInputStream extends FilterInputStream { } } catch (BadPaddingException | IllegalBlockSizeException ex) { - throw new IOException(ex); + /* If no data has been read from the stream to be en/decrypted, + we supress any exceptions, and close quietly. */ + if (read) { + throw new IOException(ex); + } } ostart = 0; ofinish = 0; From 9c20c6fd5f29e14ed08fdeece7aa5e3df9a73c46 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 29 May 2014 04:24:10 +0000 Subject: [PATCH 008/159] 8043200: Decrease the preference mode of RC4 in the enabled cipher suite list Reviewed-by: wetmore, ahgross, asmotrak --- .../classes/sun/security/ssl/CipherSuite.java | 103 +++++++++--------- .../ciphersuites/CipherSuitesInOrder.java | 49 +++++---- 2 files changed, 78 insertions(+), 74 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java index c29cb69b6f9..6d52cc68435 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -968,7 +968,7 @@ final class CipherSuite implements Comparable { * 1. Prefer Suite B compliant cipher suites, see RFC6460 (To be * changed later, see below). * 2. Prefer the stronger bulk cipher, in the order of AES_256(GCM), - * AES_128(GCM), AES_256, AES_128, RC-4, 3DES-EDE. + * AES_128(GCM), AES_256, AES_128, 3DES-EDE, RC-4. * 3. Prefer the stronger MAC algorithm, in the order of SHA384, * SHA256, SHA, MD5. * 4. Prefer the better performance of key exchange and digital @@ -1087,18 +1087,6 @@ final class CipherSuite implements Comparable { add("TLS_DHE_DSS_WITH_AES_128_CBC_SHA", 0x0032, --p, K_DHE_DSS, B_AES_128, T); - // RC-4 - add("TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", - 0xC007, --p, K_ECDHE_ECDSA, B_RC4_128, N); - add("TLS_ECDHE_RSA_WITH_RC4_128_SHA", - 0xC011, --p, K_ECDHE_RSA, B_RC4_128, N); - add("SSL_RSA_WITH_RC4_128_SHA", - 0x0005, --p, K_RSA, B_RC4_128, N); - add("TLS_ECDH_ECDSA_WITH_RC4_128_SHA", - 0xC002, --p, K_ECDH_ECDSA, B_RC4_128, N); - add("TLS_ECDH_RSA_WITH_RC4_128_SHA", - 0xC00C, --p, K_ECDH_RSA, B_RC4_128, N); - // 3DES_EDE add("TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", 0xC008, --p, K_ECDHE_ECDSA, B_3DES, T); @@ -1115,6 +1103,17 @@ final class CipherSuite implements Comparable { add("SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", 0x0013, --p, K_DHE_DSS, B_3DES, N); + // RC-4 + add("TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", + 0xC007, --p, K_ECDHE_ECDSA, B_RC4_128, N); + add("TLS_ECDHE_RSA_WITH_RC4_128_SHA", + 0xC011, --p, K_ECDHE_RSA, B_RC4_128, N); + add("SSL_RSA_WITH_RC4_128_SHA", + 0x0005, --p, K_RSA, B_RC4_128, N); + add("TLS_ECDH_ECDSA_WITH_RC4_128_SHA", + 0xC002, --p, K_ECDH_ECDSA, B_RC4_128, N); + add("TLS_ECDH_RSA_WITH_RC4_128_SHA", + 0xC00C, --p, K_ECDH_RSA, B_RC4_128, N); add("SSL_RSA_WITH_RC4_128_MD5", 0x0004, --p, K_RSA, B_RC4_128, N); @@ -1134,7 +1133,7 @@ final class CipherSuite implements Comparable { * 2. If a cipher suite has been obsoleted, we put it at the end of * the list. * 3. Prefer the stronger bulk cipher, in the order of AES_256, - * AES_128, RC-4, 3DES-EDE, DES, RC4_40, DES40, NULL. + * AES_128, 3DES-EDE, RC-4, DES, DES40, RC4_40, NULL. * 4. Prefer the stronger MAC algorithm, in the order of SHA384, * SHA256, SHA, MD5. * 5. Prefer the better performance of key exchange and digital @@ -1162,15 +1161,40 @@ final class CipherSuite implements Comparable { add("TLS_DH_anon_WITH_AES_128_CBC_SHA", 0x0034, --p, K_DH_ANON, B_AES_128, N); + add("TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", + 0xC017, --p, K_ECDH_ANON, B_3DES, N); + add("SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", + 0x001b, --p, K_DH_ANON, B_3DES, N); + add("TLS_ECDH_anon_WITH_RC4_128_SHA", 0xC016, --p, K_ECDH_ANON, B_RC4_128, N); add("SSL_DH_anon_WITH_RC4_128_MD5", 0x0018, --p, K_DH_ANON, B_RC4_128, N); - add("TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", - 0xC017, --p, K_ECDH_ANON, B_3DES, N); - add("SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", - 0x001b, --p, K_DH_ANON, B_3DES, N); + // weak cipher suites obsoleted in TLS 1.2 + add("SSL_RSA_WITH_DES_CBC_SHA", + 0x0009, --p, K_RSA, B_DES, N, tls12); + add("SSL_DHE_RSA_WITH_DES_CBC_SHA", + 0x0015, --p, K_DHE_RSA, B_DES, N, tls12); + add("SSL_DHE_DSS_WITH_DES_CBC_SHA", + 0x0012, --p, K_DHE_DSS, B_DES, N, tls12); + add("SSL_DH_anon_WITH_DES_CBC_SHA", + 0x001a, --p, K_DH_ANON, B_DES, N, tls12); + + // weak cipher suites obsoleted in TLS 1.1 + add("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", + 0x0008, --p, K_RSA_EXPORT, B_DES_40, N, tls11); + add("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", + 0x0014, --p, K_DHE_RSA, B_DES_40, N, tls11); + add("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", + 0x0011, --p, K_DHE_DSS, B_DES_40, N, tls11); + add("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", + 0x0019, --p, K_DH_ANON, B_DES_40, N, tls11); + + add("SSL_RSA_EXPORT_WITH_RC4_40_MD5", + 0x0003, --p, K_RSA_EXPORT, B_RC4_40, N, tls11); + add("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", + 0x0017, --p, K_DH_ANON, B_RC4_40, N, tls11); add("TLS_RSA_WITH_NULL_SHA256", 0x003b, --p, K_RSA, B_NULL, N, max, tls12, P_SHA256); @@ -1189,52 +1213,27 @@ final class CipherSuite implements Comparable { add("SSL_RSA_WITH_NULL_MD5", 0x0001, --p, K_RSA, B_NULL, N); - // weak cipher suites obsoleted in TLS 1.2 - add("SSL_RSA_WITH_DES_CBC_SHA", - 0x0009, --p, K_RSA, B_DES, N, tls12); - add("SSL_DHE_RSA_WITH_DES_CBC_SHA", - 0x0015, --p, K_DHE_RSA, B_DES, N, tls12); - add("SSL_DHE_DSS_WITH_DES_CBC_SHA", - 0x0012, --p, K_DHE_DSS, B_DES, N, tls12); - add("SSL_DH_anon_WITH_DES_CBC_SHA", - 0x001a, --p, K_DH_ANON, B_DES, N, tls12); - - // weak cipher suites obsoleted in TLS 1.1 - add("SSL_RSA_EXPORT_WITH_RC4_40_MD5", - 0x0003, --p, K_RSA_EXPORT, B_RC4_40, N, tls11); - add("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", - 0x0017, --p, K_DH_ANON, B_RC4_40, N, tls11); - - add("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", - 0x0008, --p, K_RSA_EXPORT, B_DES_40, N, tls11); - add("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", - 0x0014, --p, K_DHE_RSA, B_DES_40, N, tls11); - add("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", - 0x0011, --p, K_DHE_DSS, B_DES_40, N, tls11); - add("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", - 0x0019, --p, K_DH_ANON, B_DES_40, N, tls11); - // Supported Kerberos ciphersuites from RFC2712 - add("TLS_KRB5_WITH_RC4_128_SHA", - 0x0020, --p, K_KRB5, B_RC4_128, N); - add("TLS_KRB5_WITH_RC4_128_MD5", - 0x0024, --p, K_KRB5, B_RC4_128, N); add("TLS_KRB5_WITH_3DES_EDE_CBC_SHA", 0x001f, --p, K_KRB5, B_3DES, N); add("TLS_KRB5_WITH_3DES_EDE_CBC_MD5", 0x0023, --p, K_KRB5, B_3DES, N); + add("TLS_KRB5_WITH_RC4_128_SHA", + 0x0020, --p, K_KRB5, B_RC4_128, N); + add("TLS_KRB5_WITH_RC4_128_MD5", + 0x0024, --p, K_KRB5, B_RC4_128, N); add("TLS_KRB5_WITH_DES_CBC_SHA", 0x001e, --p, K_KRB5, B_DES, N, tls12); add("TLS_KRB5_WITH_DES_CBC_MD5", 0x0022, --p, K_KRB5, B_DES, N, tls12); - add("TLS_KRB5_EXPORT_WITH_RC4_40_SHA", - 0x0028, --p, K_KRB5_EXPORT, B_RC4_40, N, tls11); - add("TLS_KRB5_EXPORT_WITH_RC4_40_MD5", - 0x002b, --p, K_KRB5_EXPORT, B_RC4_40, N, tls11); add("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA", 0x0026, --p, K_KRB5_EXPORT, B_DES_40, N, tls11); add("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5", 0x0029, --p, K_KRB5_EXPORT, B_DES_40, N, tls11); + add("TLS_KRB5_EXPORT_WITH_RC4_40_SHA", + 0x0028, --p, K_KRB5_EXPORT, B_RC4_40, N, tls11); + add("TLS_KRB5_EXPORT_WITH_RC4_40_MD5", + 0x002b, --p, K_KRB5_EXPORT, B_RC4_40, N, tls11); /* * Other values from the TLS Cipher Suite Registry, as of August 2010. diff --git a/jdk/test/javax/net/ssl/sanity/ciphersuites/CipherSuitesInOrder.java b/jdk/test/javax/net/ssl/sanity/ciphersuites/CipherSuitesInOrder.java index 012fe96720e..5e337f117d6 100644 --- a/jdk/test/javax/net/ssl/sanity/ciphersuites/CipherSuitesInOrder.java +++ b/jdk/test/javax/net/ssl/sanity/ciphersuites/CipherSuitesInOrder.java @@ -85,11 +85,6 @@ public class CipherSuitesInOrder { "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", - "TLS_ECDHE_RSA_WITH_RC4_128_SHA", - "SSL_RSA_WITH_RC4_128_SHA", - "TLS_ECDH_ECDSA_WITH_RC4_128_SHA", - "TLS_ECDH_RSA_WITH_RC4_128_SHA", "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", @@ -98,6 +93,12 @@ public class CipherSuitesInOrder { "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", + + "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", + "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + "SSL_RSA_WITH_RC4_128_SHA", + "TLS_ECDH_ECDSA_WITH_RC4_128_SHA", + "TLS_ECDH_RSA_WITH_RC4_128_SHA", "SSL_RSA_WITH_RC4_128_MD5", "TLS_EMPTY_RENEGOTIATION_INFO_SCSV", @@ -111,10 +112,23 @@ public class CipherSuitesInOrder { "TLS_DH_anon_WITH_AES_128_CBC_SHA256", "TLS_ECDH_anon_WITH_AES_128_CBC_SHA", "TLS_DH_anon_WITH_AES_128_CBC_SHA", - "TLS_ECDH_anon_WITH_RC4_128_SHA", - "SSL_DH_anon_WITH_RC4_128_MD5", "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_anon_WITH_RC4_128_SHA", + "SSL_DH_anon_WITH_RC4_128_MD5", + + "SSL_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_DSS_WITH_DES_CBC_SHA", + "SSL_DH_anon_WITH_DES_CBC_SHA", + "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", + + "SSL_RSA_EXPORT_WITH_RC4_40_MD5", + "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", + "TLS_RSA_WITH_NULL_SHA256", "TLS_ECDHE_ECDSA_WITH_NULL_SHA", "TLS_ECDHE_RSA_WITH_NULL_SHA", @@ -123,26 +137,17 @@ public class CipherSuitesInOrder { "TLS_ECDH_RSA_WITH_NULL_SHA", "TLS_ECDH_anon_WITH_NULL_SHA", "SSL_RSA_WITH_NULL_MD5", - "SSL_RSA_WITH_DES_CBC_SHA", - "SSL_DHE_RSA_WITH_DES_CBC_SHA", - "SSL_DHE_DSS_WITH_DES_CBC_SHA", - "SSL_DH_anon_WITH_DES_CBC_SHA", - "SSL_RSA_EXPORT_WITH_RC4_40_MD5", - "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", - "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", - "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", - "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", - "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", - "TLS_KRB5_WITH_RC4_128_SHA", - "TLS_KRB5_WITH_RC4_128_MD5", + "TLS_KRB5_WITH_3DES_EDE_CBC_SHA", "TLS_KRB5_WITH_3DES_EDE_CBC_MD5", + "TLS_KRB5_WITH_RC4_128_SHA", + "TLS_KRB5_WITH_RC4_128_MD5", "TLS_KRB5_WITH_DES_CBC_SHA", "TLS_KRB5_WITH_DES_CBC_MD5", - "TLS_KRB5_EXPORT_WITH_RC4_40_SHA", - "TLS_KRB5_EXPORT_WITH_RC4_40_MD5", "TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA", - "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5" + "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5", + "TLS_KRB5_EXPORT_WITH_RC4_40_SHA", + "TLS_KRB5_EXPORT_WITH_RC4_40_MD5" ); private final static String[] protocols = { From 3cc3d82ad9f2cfbc74a5351f777410e121b2dae8 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Wed, 30 Jul 2014 11:08:41 -0700 Subject: [PATCH 009/159] 8052162: REGRESSION: sun/java2d/cmm/ColorConvertOp tests fail since 7u71 b01 Reviewed-by: bae, serb --- jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java b/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java index 12139f6bbda..a867e453389 100644 --- a/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java +++ b/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java @@ -23,7 +23,7 @@ /** * @test - * @bug 6476665 7033534 6830714 + * @bug 6476665 7033534 6830714 8052162 * @summary Verifies color conversion of Component Color Model based images * @run main ColConvCCMTest */ From 01ea2212b1e88a5f0a37a7c4ca4bb0b5c3fa9b93 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 21 Aug 2014 17:51:29 +0100 Subject: [PATCH 010/159] 8053963: (dc) Use DatagramChannel.receive() instead of read() in connect Reviewed-by: alanb, chegar --- .../classes/java/net/DatagramSocket.java | 27 +++++---- .../sun/nio/ch/DatagramChannelImpl.java | 2 +- .../libnet/AbstractPlainDatagramSocketImpl.c | 55 +++++++++++++++---- 3 files changed, 61 insertions(+), 23 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/net/DatagramSocket.java b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java index c047b3cf6a4..5d978e596e2 100644 --- a/jdk/src/java.base/share/classes/java/net/DatagramSocket.java +++ b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java @@ -771,6 +771,7 @@ class DatagramSocket implements java.io.Closeable { } // end of while } } + DatagramPacket tmp = null; if ((connectState == ST_CONNECTED_NO_IMPL) || explicitFilter) { // We have to do the filtering the old fashioned way since // the native impl doesn't support connect or the connect @@ -795,11 +796,13 @@ class DatagramSocket implements java.io.Closeable { if ((!connectedAddress.equals(peekAddress)) || (connectedPort != peekPort)) { // throw the packet away and silently continue - DatagramPacket tmp = new DatagramPacket( + tmp = new DatagramPacket( new byte[1024], 1024); getImpl().receive(tmp); if (explicitFilter) { - bytesLeftToFilter -= tmp.getLength(); + if (checkFiltering(tmp)) { + stop = true; + } } } else { stop = true; @@ -809,18 +812,22 @@ class DatagramSocket implements java.io.Closeable { // If the security check succeeds, or the datagram is // connected then receive the packet getImpl().receive(p); - if (explicitFilter) { - bytesLeftToFilter -= p.getLength(); - if (bytesLeftToFilter <= 0) { - explicitFilter = false; - } else { - // break out of filter, if there is no more data queued - explicitFilter = getImpl().dataAvailable() > 0; - } + if (explicitFilter && tmp == null) { + // packet was not filtered, account for it here + checkFiltering(p); } } } + private boolean checkFiltering(DatagramPacket p) throws SocketException { + bytesLeftToFilter -= p.getLength(); + if (bytesLeftToFilter <= 0 || getImpl().dataAvailable() <= 0) { + explicitFilter = false; + return true; + } + return false; + } + /** * Gets the local address to which the socket is bound. * diff --git a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java index b9fd16eae29..e316facf491 100644 --- a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java +++ b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java @@ -752,7 +752,7 @@ class DatagramChannelImpl } do { tmpBuf.clear(); - } while (read(tmpBuf) > 0); + } while (receive(tmpBuf) != null); } finally { if (blocking) { configureBlocking(true); diff --git a/jdk/src/java.base/windows/native/libnet/AbstractPlainDatagramSocketImpl.c b/jdk/src/java.base/windows/native/libnet/AbstractPlainDatagramSocketImpl.c index 7244e664c9e..dd2c7e8a92f 100644 --- a/jdk/src/java.base/windows/native/libnet/AbstractPlainDatagramSocketImpl.c +++ b/jdk/src/java.base/windows/native/libnet/AbstractPlainDatagramSocketImpl.c @@ -32,9 +32,11 @@ #include "java_net_AbstractPlainDatagramSocketImpl.h" -static jfieldID IO_fd_fdID; +static jfieldID IO_fd_fdID = NULL; +static jfieldID apdsi_fdID = NULL; -static jfieldID apdsi_fdID; +static jfieldID apdsi_fd1ID = NULL; +static jclass two_stacks_clazz = NULL; /* @@ -48,10 +50,21 @@ Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) { apdsi_fdID = (*env)->GetFieldID(env, cls, "fd", "Ljava/io/FileDescriptor;"); CHECK_NULL(apdsi_fdID); - IO_fd_fdID = NET_GetFileDescriptorID(env); CHECK_NULL(IO_fd_fdID); + two_stacks_clazz = (*env)->FindClass(env, "java/net/TwoStacksPlainDatagramSocketImpl"); + CHECK_NULL(two_stacks_clazz); + + /* Handle both TwoStacks and DualStack here */ + + if (JNU_Equals(env, cls, two_stacks_clazz)) { + /* fd1 present only in TwoStack.. */ + apdsi_fd1ID = (*env)->GetFieldID(env, cls, "fd1", + "Ljava/io/FileDescriptor;"); + CHECK_NULL(apdsi_fd1ID); + } + JNU_CHECK_EXCEPTION(env); } @@ -63,20 +76,38 @@ Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) { JNIEXPORT jint JNICALL Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable (JNIEnv *env, jobject this) { SOCKET fd; - int retval; - + SOCKET fd1; + int rv = -1, rv1 = -1; jobject fdObj = (*env)->GetObjectField(env, this, apdsi_fdID); - if (IS_NULL(fdObj)) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", - "Socket closed"); - return -1; + if (!IS_NULL(fdObj)) { + int retval = 0; + fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID); + rv = ioctlsocket(fd, FIONREAD, &retval); + if (retval > 0) { + return retval; + } } - fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID); - if (ioctlsocket(fd, FIONREAD, &retval) < 0) { + if (!IS_NULL(apdsi_fd1ID)) { + /* TwoStacks */ + jobject fd1Obj = (*env)->GetObjectField(env, this, apdsi_fd1ID); + if (!IS_NULL(fd1Obj)) { + int retval = 0; + fd1 = (SOCKET)(*env)->GetIntField(env, fd1Obj, IO_fd_fdID); + rv1 = ioctlsocket(fd1, FIONREAD, &retval); + if (retval > 0) { + return retval; + } + } + } + + if (rv < 0 && rv1 < 0) { + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", + "Socket closed"); return -1; } - return retval; + + return 0; } From 692dbfd02d90e7334d1586f11a41038bd0abf09b Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 12 Nov 2014 13:55:59 +0100 Subject: [PATCH 011/159] 8062808: Turn on the -Wreturn-type warning Reviewed-by: mgerdin, tschatzl, coleenp, jrose, kbarrett --- hotspot/make/linux/makefiles/gcc.make | 2 +- hotspot/src/cpu/x86/vm/x86_32.ad | 1 + hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 1 + hotspot/src/share/vm/classfile/defaultMethods.cpp | 4 ++-- hotspot/src/share/vm/classfile/symbolTable.cpp | 4 ++-- hotspot/src/share/vm/classfile/systemDictionary.cpp | 6 +++--- hotspot/src/share/vm/memory/heapInspection.hpp | 2 +- hotspot/src/share/vm/memory/metaspaceShared.hpp | 2 +- hotspot/src/share/vm/oops/constantPool.hpp | 4 ++-- hotspot/src/share/vm/prims/jvm.cpp | 2 +- hotspot/src/share/vm/runtime/reflection.cpp | 2 +- hotspot/src/share/vm/runtime/sharedRuntime.cpp | 2 +- hotspot/src/share/vm/services/memTracker.hpp | 2 +- 13 files changed, 18 insertions(+), 16 deletions(-) diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make index 2447c8d3dd6..2c874320eb3 100644 --- a/hotspot/make/linux/makefiles/gcc.make +++ b/hotspot/make/linux/makefiles/gcc.make @@ -214,7 +214,7 @@ ifeq ($(USE_CLANG), true) WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body endif -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 +WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type ifeq ($(USE_CLANG),) # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index c246f2d2deb..940541b6c30 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -1210,6 +1210,7 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo Unimplemented(); + return 0; // Mute compiler } #ifndef PRODUCT diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index 136d8066dd4..4089d86cf51 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -542,6 +542,7 @@ JVM_handle_linux_signal(int sig, err.report_and_die(); ShouldNotReachHere(); + return true; // Mute compiler } void os::Linux::init_thread_fpu_state(void) { diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp index 1b56ff2fba4..2694a02826a 100644 --- a/hotspot/src/share/vm/classfile/defaultMethods.cpp +++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp @@ -506,7 +506,7 @@ Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method ss.write((const char*)name->bytes(), name->utf8_length()); ss.write((const char*)signature->bytes(), signature->utf8_length()); ss.print(" is abstract"); - return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL); + return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD); } Symbol* MethodFamily::generate_conflicts_message(GrowableArray* methods, TRAPS) const { @@ -521,7 +521,7 @@ Symbol* MethodFamily::generate_conflicts_message(GrowableArray* methods ss.print("."); ss.write((const char*)name->bytes(), name->utf8_length()); } - return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL); + return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD); } diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index 6111af6cb20..8ffb17f8f71 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -235,7 +235,7 @@ Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) { MutexLocker ml(SymbolTable_lock, THREAD); // Otherwise, add to symbol to table - return the_table()->basic_add(index, (u1*)name, len, hashValue, true, CHECK_NULL); + return the_table()->basic_add(index, (u1*)name, len, hashValue, true, THREAD); } Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) { @@ -274,7 +274,7 @@ Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) { // Grab SymbolTable_lock first. MutexLocker ml(SymbolTable_lock, THREAD); - return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, CHECK_NULL); + return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, THREAD); } Symbol* SymbolTable::lookup_only(const char* name, int len, diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 85f90d436c2..fa18ba477c6 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -233,15 +233,15 @@ Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader class_name->as_C_string(), class_loader.is_null() ? "null" : class_loader->klass()->name()->as_C_string())); if (FieldType::is_array(class_name)) { - return resolve_array_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL); + return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD); } else if (FieldType::is_obj(class_name)) { ResourceMark rm(THREAD); // Ignore wrapping L and ;. TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1, class_name->utf8_length() - 2, CHECK_NULL); - return resolve_instance_class_or_null(name, class_loader, protection_domain, CHECK_NULL); + return resolve_instance_class_or_null(name, class_loader, protection_domain, THREAD); } else { - return resolve_instance_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL); + return resolve_instance_class_or_null(class_name, class_loader, protection_domain, THREAD); } } diff --git a/hotspot/src/share/vm/memory/heapInspection.hpp b/hotspot/src/share/vm/memory/heapInspection.hpp index b305f08fdb3..db782c42505 100644 --- a/hotspot/src/share/vm/memory/heapInspection.hpp +++ b/hotspot/src/share/vm/memory/heapInspection.hpp @@ -367,7 +367,7 @@ class HeapInspection : public StackObj { _csv_format(csv_format), _print_help(print_help), _print_class_stats(print_class_stats), _columns(columns) {} void heap_inspection(outputStream* st) NOT_SERVICES_RETURN; - size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN; + size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN_(0); static void find_instances_at_safepoint(Klass* k, GrowableArray* result) NOT_SERVICES_RETURN; private: void iterate_over_heap(KlassInfoTable* cit, BoolObjectClosure* filter = NULL); diff --git a/hotspot/src/share/vm/memory/metaspaceShared.hpp b/hotspot/src/share/vm/memory/metaspaceShared.hpp index db344359082..cb34465ec69 100644 --- a/hotspot/src/share/vm/memory/metaspaceShared.hpp +++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp @@ -92,7 +92,7 @@ class MetaspaceShared : AllStatic { static void preload_and_dump(TRAPS) NOT_CDS_RETURN; static int preload_and_dump(const char * class_list_path, GrowableArray* class_promote_order, - TRAPS) NOT_CDS_RETURN; + TRAPS) NOT_CDS_RETURN_(0); static ReservedSpace* shared_rs() { CDS_ONLY(return _shared_rs); diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp index 18b86aa7ac6..359fa22d522 100644 --- a/hotspot/src/share/vm/oops/constantPool.hpp +++ b/hotspot/src/share/vm/oops/constantPool.hpp @@ -336,13 +336,13 @@ class ConstantPool : public Metadata { Klass* klass_at(int which, TRAPS) { constantPoolHandle h_this(THREAD, this); - return klass_at_impl(h_this, which, true, CHECK_NULL); + return klass_at_impl(h_this, which, true, THREAD); } // Version of klass_at that doesn't save the resolution error, called during deopt Klass* klass_at_ignore_error(int which, TRAPS) { constantPoolHandle h_this(THREAD, this); - return klass_at_impl(h_this, which, false, CHECK_NULL); + return klass_at_impl(h_this, which, false, THREAD); } Symbol* klass_name_at(int which); // Returns the name, w/o resolving. diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index ad58d7bf966..5ea893b24db 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -3537,7 +3537,7 @@ JVM_ENTRY(jlong,JVM_DTraceActivate( JVM_DTraceProvider* providers)) JVMWrapper("JVM_DTraceActivate"); return DTraceJSDT::activate( - version, module_name, providers_count, providers, CHECK_0); + version, module_name, providers_count, providers, THREAD); JVM_END JVM_ENTRY(jboolean,JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method)) diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp index c6cb79ce7a4..36f5990a69a 100644 --- a/hotspot/src/share/vm/runtime/reflection.cpp +++ b/hotspot/src/share/vm/runtime/reflection.cpp @@ -1004,7 +1004,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method, } else { if (rtype == T_BOOLEAN || rtype == T_BYTE || rtype == T_CHAR || rtype == T_SHORT) narrow((jvalue*) result.get_value_addr(), rtype, CHECK_NULL); - return box((jvalue*) result.get_value_addr(), rtype, CHECK_NULL); + return box((jvalue*) result.get_value_addr(), rtype, THREAD); } } diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index 344c2a61f3e..058ecda90f1 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -986,7 +986,7 @@ Handle SharedRuntime::find_callee_info(JavaThread* thread, Bytecodes::Code& bc, // last java frame on stack (which includes native call frames) vframeStream vfst(thread, true); // Do not skip and javaCalls - return find_callee_info_helper(thread, vfst, bc, callinfo, CHECK_(Handle())); + return find_callee_info_helper(thread, vfst, bc, callinfo, THREAD); } diff --git a/hotspot/src/share/vm/services/memTracker.hpp b/hotspot/src/share/vm/services/memTracker.hpp index 47d0a54ed36..f05d39f3b4c 100644 --- a/hotspot/src/share/vm/services/memTracker.hpp +++ b/hotspot/src/share/vm/services/memTracker.hpp @@ -64,7 +64,7 @@ class MemTracker : AllStatic { const NativeCallStack& stack, MEMFLAGS flag = mtNone) { } static inline void record_virtual_memory_commit(void* addr, size_t size, const NativeCallStack& stack) { } static inline Tracker get_virtual_memory_uncommit_tracker() { return Tracker(); } - static inline Tracker get_virtual_memory_release_tracker() { } + static inline Tracker get_virtual_memory_release_tracker() { return Tracker(); } static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { } static inline void record_thread_stack(void* addr, size_t size) { } static inline void release_thread_stack(void* addr, size_t size) { } From 294a63af5f6aa8068fe19de7b41511a66accfbe0 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Tue, 11 Nov 2014 13:39:00 -0500 Subject: [PATCH 012/159] 8062036: ConcurrentMarkThread::slt may be invoked before ConcurrentMarkThread::makeSurrogateLockerThread causing intermittent crashes Suppress gc_alot during VM init, improve error for SLT uninitialized. Reviewed-by: jmasa, brutisso, tschatzl --- .../concurrentMarkSweep/vmCMSOperations.cpp | 8 ++++++-- .../share/vm/gc_implementation/g1/vm_operations_g1.cpp | 8 ++++++-- .../vm/gc_implementation/shared/concurrentGCThread.cpp | 7 +++++++ .../vm/gc_implementation/shared/concurrentGCThread.hpp | 3 +++ hotspot/src/share/vm/runtime/interfaceSupport.cpp | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp index 7dfbad541bb..9587736f297 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp @@ -42,8 +42,12 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC void VM_CMS_Operation::acquire_pending_list_lock() { // The caller may block while communicating // with the SLT thread in order to acquire/release the PLL. - ConcurrentMarkSweepThread::slt()-> - manipulatePLL(SurrogateLockerThread::acquirePLL); + SurrogateLockerThread* slt = ConcurrentMarkSweepThread::slt(); + if (slt != NULL) { + slt->manipulatePLL(SurrogateLockerThread::acquirePLL); + } else { + SurrogateLockerThread::report_missing_slt(); + } } void VM_CMS_Operation::release_and_notify_pending_list_lock() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp index 9b50ae6af53..80a0f72810e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp @@ -213,8 +213,12 @@ void VM_CGC_Operation::acquire_pending_list_lock() { assert(_needs_pll, "don't call this otherwise"); // The caller may block while communicating // with the SLT thread in order to acquire/release the PLL. - ConcurrentMarkThread::slt()-> - manipulatePLL(SurrogateLockerThread::acquirePLL); + SurrogateLockerThread* slt = ConcurrentMarkThread::slt(); + if (slt != NULL) { + slt->manipulatePLL(SurrogateLockerThread::acquirePLL); + } else { + SurrogateLockerThread::report_missing_slt(); + } } void VM_CGC_Operation::release_and_notify_pending_list_lock() { diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp index b85be793146..2a27f65c8d1 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp @@ -138,6 +138,13 @@ SurrogateLockerThread* SurrogateLockerThread::make(TRAPS) { return res; } +void SurrogateLockerThread::report_missing_slt() { + vm_exit_during_initialization( + "GC before GC support fully initialized: " + "SLT is needed but has not yet been created."); + ShouldNotReachHere(); +} + void SurrogateLockerThread::manipulatePLL(SLT_msg_type msg) { MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag); assert(_buffer == empty, "Should be empty"); diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp index 4b82ed629f0..e87228b238c 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp @@ -93,6 +93,9 @@ class SurrogateLockerThread: public JavaThread { public: static SurrogateLockerThread* make(TRAPS); + // Terminate VM with error message that SLT needed but not yet created. + static void report_missing_slt(); + SurrogateLockerThread(); bool is_hidden_from_external_view() const { return true; } diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.cpp b/hotspot/src/share/vm/runtime/interfaceSupport.cpp index 78a58200f5a..3a6b4817189 100644 --- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp +++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp @@ -87,7 +87,7 @@ void InterfaceSupport::gc_alot() { // Short-circuit any possible re-entrant gc-a-lot attempt if (thread->skip_gcalot()) return; - if (is_init_completed()) { + if (Threads::is_vm_complete()) { if (++_fullgc_alot_invocation < FullGCALotStart) { return; From 3b31df26c8f0138dc229d7bcc9d2ebade8d0227f Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 13 Nov 2014 11:14:01 +0100 Subject: [PATCH 013/159] 8064786: Fix debug build after 8062808: Turn on the -Wreturn-type warning Reviewed-by: stefank, tschatzl --- hotspot/src/share/vm/prims/jni.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index 7b6974e639a..e0116854741 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -603,6 +603,7 @@ JNI_ENTRY(jint, jni_Throw(JNIEnv *env, jthrowable obj)) THROW_OOP_(JNIHandles::resolve(obj), JNI_OK); ShouldNotReachHere(); + return 0; // Mute compiler. JNI_END @@ -623,6 +624,7 @@ JNI_ENTRY(jint, jni_ThrowNew(JNIEnv *env, jclass clazz, const char *message)) Handle protection_domain (THREAD, k->protection_domain()); THROW_MSG_LOADER_(name, (char *)message, class_loader, protection_domain, JNI_OK); ShouldNotReachHere(); + return 0; // Mute compiler. JNI_END From 95704b233c89cc43ff872d1a9777509097d30803 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Fri, 14 Nov 2014 09:47:09 +0100 Subject: [PATCH 014/159] 8064811: Use THREAD instead of CHECK_NULL in return statements Reviewed-by: coleenp, simonis, dholmes --- hotspot/src/os/aix/vm/perfMemory_aix.cpp | 2 +- hotspot/src/os/bsd/vm/perfMemory_bsd.cpp | 2 +- hotspot/src/os/linux/vm/perfMemory_linux.cpp | 2 +- .../src/os/solaris/vm/perfMemory_solaris.cpp | 2 +- hotspot/src/share/vm/ci/ciReplay.cpp | 2 +- .../share/vm/classfile/classLoaderData.cpp | 2 +- .../src/share/vm/classfile/defaultMethods.cpp | 2 +- .../src/share/vm/classfile/javaClasses.cpp | 10 ++++---- .../share/vm/classfile/systemDictionary.cpp | 2 +- .../share/vm/classfile/verificationType.hpp | 2 +- hotspot/src/share/vm/classfile/verifier.cpp | 2 +- hotspot/src/share/vm/memory/allocation.cpp | 3 +-- hotspot/src/share/vm/memory/oopFactory.hpp | 18 +++++++------- hotspot/src/share/vm/oops/constantPool.cpp | 2 +- hotspot/src/share/vm/oops/instanceKlass.cpp | 4 ++-- hotspot/src/share/vm/oops/klass.cpp | 2 +- hotspot/src/share/vm/oops/methodData.cpp | 2 +- hotspot/src/share/vm/oops/objArrayKlass.cpp | 6 ++--- hotspot/src/share/vm/oops/typeArrayKlass.cpp | 2 +- hotspot/src/share/vm/prims/methodHandles.cpp | 6 ++--- .../src/share/vm/runtime/fieldDescriptor.cpp | 2 +- hotspot/src/share/vm/runtime/perfData.hpp | 24 +++++++++---------- hotspot/src/share/vm/runtime/reflection.cpp | 2 +- hotspot/src/share/vm/runtime/synchronizer.hpp | 2 +- hotspot/src/share/vm/utilities/array.hpp | 2 +- 25 files changed, 53 insertions(+), 54 deletions(-) diff --git a/hotspot/src/os/aix/vm/perfMemory_aix.cpp b/hotspot/src/os/aix/vm/perfMemory_aix.cpp index 36644f0f679..7e5b250588c 100644 --- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp +++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp @@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) { // return the name of the user that owns the JVM indicated by the given vmid. // static char* get_user_name(int vmid, TRAPS) { - return get_user_name_slow(vmid, CHECK_NULL); + return get_user_name_slow(vmid, THREAD); } // return the file name of the backing store file for the named diff --git a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp index 631366e2944..7fe1258dbd3 100644 --- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp +++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp @@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) { // return the name of the user that owns the JVM indicated by the given vmid. // static char* get_user_name(int vmid, TRAPS) { - return get_user_name_slow(vmid, CHECK_NULL); + return get_user_name_slow(vmid, THREAD); } // return the file name of the backing store file for the named diff --git a/hotspot/src/os/linux/vm/perfMemory_linux.cpp b/hotspot/src/os/linux/vm/perfMemory_linux.cpp index 6d92575563e..5325b5ff2f7 100644 --- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp +++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp @@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) { // return the name of the user that owns the JVM indicated by the given vmid. // static char* get_user_name(int vmid, TRAPS) { - return get_user_name_slow(vmid, CHECK_NULL); + return get_user_name_slow(vmid, THREAD); } // return the file name of the backing store file for the named diff --git a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp index 7f956338e6b..4dc633fa1e9 100644 --- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp +++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp @@ -461,7 +461,7 @@ static char* get_user_name(int vmid, TRAPS) { // since the structured procfs and old procfs interfaces can't be // mixed, we attempt to find the file through a directory search. - return get_user_name_slow(vmid, CHECK_NULL); + return get_user_name_slow(vmid, THREAD); } // return the file name of the backing store file for the named diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp index 99b742d61dd..1830322361f 100644 --- a/hotspot/src/share/vm/ci/ciReplay.cpp +++ b/hotspot/src/share/vm/ci/ciReplay.cpp @@ -332,7 +332,7 @@ class CompileReplay : public StackObj { // Lookup a klass Klass* resolve_klass(const char* klass, TRAPS) { Symbol* klass_name = SymbolTable::lookup(klass, (int)strlen(klass), CHECK_NULL); - return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, CHECK_NULL); + return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, THREAD); } // Parse the standard tuple of diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp index 380c3dea10c..920b06e9b50 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp @@ -472,7 +472,7 @@ void ClassLoaderData::free_deallocate_list() { // These anonymous class loaders are to contain classes used for JSR292 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) { // Add a new class loader data to the graph. - return ClassLoaderDataGraph::add(loader, true, CHECK_NULL); + return ClassLoaderDataGraph::add(loader, true, THREAD); } const char* ClassLoaderData::loader_name() { diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp index 2694a02826a..65a38fe037c 100644 --- a/hotspot/src/share/vm/classfile/defaultMethods.cpp +++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp @@ -493,7 +493,7 @@ class MethodFamily : public ResourceObj { }; Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const { - return SymbolTable::new_symbol("No qualifying defaults found", CHECK_NULL); + return SymbolTable::new_symbol("No qualifying defaults found", THREAD); } Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method, TRAPS) const { diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 075dea57d81..b05920b9a36 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -1952,7 +1952,7 @@ Handle java_lang_reflect_Method::create(TRAPS) { // This class is eagerly initialized during VM initialization, since we keep a refence // to one of the methods assert(InstanceKlass::cast(klass)->is_initialized(), "must be initialized"); - return InstanceKlass::cast(klass)->allocate_instance_handle(CHECK_NH); + return InstanceKlass::cast(klass)->allocate_instance_handle(THREAD); } oop java_lang_reflect_Method::clazz(oop reflect) { @@ -2130,7 +2130,7 @@ Handle java_lang_reflect_Constructor::create(TRAPS) { instanceKlassHandle klass (THREAD, k); // Ensure it is initialized klass->initialize(CHECK_NH); - return klass->allocate_instance_handle(CHECK_NH); + return klass->allocate_instance_handle(THREAD); } oop java_lang_reflect_Constructor::clazz(oop reflect) { @@ -2270,7 +2270,7 @@ Handle java_lang_reflect_Field::create(TRAPS) { instanceKlassHandle klass (THREAD, k); // Ensure it is initialized klass->initialize(CHECK_NH); - return klass->allocate_instance_handle(CHECK_NH); + return klass->allocate_instance_handle(THREAD); } oop java_lang_reflect_Field::clazz(oop reflect) { @@ -2397,7 +2397,7 @@ Handle java_lang_reflect_Parameter::create(TRAPS) { instanceKlassHandle klass (THREAD, k); // Ensure it is initialized klass->initialize(CHECK_NH); - return klass->allocate_instance_handle(CHECK_NH); + return klass->allocate_instance_handle(THREAD); } oop java_lang_reflect_Parameter::name(oop param) { @@ -2447,7 +2447,7 @@ Handle sun_reflect_ConstantPool::create(TRAPS) { instanceKlassHandle klass (THREAD, k); // Ensure it is initialized klass->initialize(CHECK_NH); - return klass->allocate_instance_handle(CHECK_NH); + return klass->allocate_instance_handle(THREAD); } diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index fa18ba477c6..9c300a9221b 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -123,7 +123,7 @@ void SystemDictionary::compute_java_system_loader(TRAPS) { ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, TRAPS) { if (class_loader() == NULL) return ClassLoaderData::the_null_class_loader_data(); - return ClassLoaderDataGraph::find_or_create(class_loader, CHECK_NULL); + return ClassLoaderDataGraph::find_or_create(class_loader, THREAD); } // ---------------------------------------------------------------------------- diff --git a/hotspot/src/share/vm/classfile/verificationType.hpp b/hotspot/src/share/vm/classfile/verificationType.hpp index 43bd79e21b1..9a7836045f6 100644 --- a/hotspot/src/share/vm/classfile/verificationType.hpp +++ b/hotspot/src/share/vm/classfile/verificationType.hpp @@ -289,7 +289,7 @@ class VerificationType VALUE_OBJ_CLASS_SPEC { if (is_reference() && from.is_reference()) { return is_reference_assignable_from(from, context, from_field_is_protected, - CHECK_false); + THREAD); } else { return false; } diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp index 04cbda3c03d..d5094ae55be 100644 --- a/hotspot/src/share/vm/classfile/verifier.cpp +++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -1927,7 +1927,7 @@ Klass* ClassVerifier::load_class(Symbol* name, TRAPS) { return SystemDictionary::resolve_or_fail( name, Handle(THREAD, loader), Handle(THREAD, protection_domain), - true, CHECK_NULL); + true, THREAD); } bool ClassVerifier::is_protected_access(instanceKlassHandle this_class, diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp index 0a05e6a7960..2bc6c507175 100644 --- a/hotspot/src/share/vm/memory/allocation.cpp +++ b/hotspot/src/share/vm/memory/allocation.cpp @@ -50,8 +50,7 @@ void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, bool read_only, MetaspaceObj::Type type, TRAPS) throw() { // Klass has it's own operator new - return Metaspace::allocate(loader_data, word_size, read_only, - type, CHECK_NULL); + return Metaspace::allocate(loader_data, word_size, read_only, type, THREAD); } bool MetaspaceObj::is_shared() const { diff --git a/hotspot/src/share/vm/memory/oopFactory.hpp b/hotspot/src/share/vm/memory/oopFactory.hpp index 1d14010e278..c8dd27f2df8 100644 --- a/hotspot/src/share/vm/memory/oopFactory.hpp +++ b/hotspot/src/share/vm/memory/oopFactory.hpp @@ -41,20 +41,20 @@ class vframeArray; class oopFactory: AllStatic { public: // Basic type leaf array allocation - static typeArrayOop new_boolArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::boolArrayKlassObj ())->allocate(length, CHECK_NULL); } - static typeArrayOop new_charArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::charArrayKlassObj ())->allocate(length, CHECK_NULL); } - static typeArrayOop new_singleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, CHECK_NULL); } - static typeArrayOop new_doubleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, CHECK_NULL); } - static typeArrayOop new_byteArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::byteArrayKlassObj ())->allocate(length, CHECK_NULL); } - static typeArrayOop new_shortArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, CHECK_NULL); } - static typeArrayOop new_intArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::intArrayKlassObj ())->allocate(length, CHECK_NULL); } - static typeArrayOop new_longArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::longArrayKlassObj ())->allocate(length, CHECK_NULL); } + static typeArrayOop new_boolArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::boolArrayKlassObj ())->allocate(length, THREAD); } + static typeArrayOop new_charArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::charArrayKlassObj ())->allocate(length, THREAD); } + static typeArrayOop new_singleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, THREAD); } + static typeArrayOop new_doubleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, THREAD); } + static typeArrayOop new_byteArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::byteArrayKlassObj ())->allocate(length, THREAD); } + static typeArrayOop new_shortArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, THREAD); } + static typeArrayOop new_intArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::intArrayKlassObj ())->allocate(length, THREAD); } + static typeArrayOop new_longArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::longArrayKlassObj ())->allocate(length, THREAD); } // create java.lang.Object[] static objArrayOop new_objectArray(int length, TRAPS) { assert(Universe::objectArrayKlassObj() != NULL, "Too early?"); return ObjArrayKlass:: - cast(Universe::objectArrayKlassObj())->allocate(length, CHECK_NULL); + cast(Universe::objectArrayKlassObj())->allocate(length, THREAD); } static typeArrayOop new_charArray (const char* utf8_str, TRAPS); diff --git a/hotspot/src/share/vm/oops/constantPool.cpp b/hotspot/src/share/vm/oops/constantPool.cpp index d547398dfae..98c72156bc3 100644 --- a/hotspot/src/share/vm/oops/constantPool.cpp +++ b/hotspot/src/share/vm/oops/constantPool.cpp @@ -461,7 +461,7 @@ int ConstantPool::signature_ref_index_at(int which_nt) { Klass* ConstantPool::klass_ref_at(int which, TRAPS) { - return klass_at(klass_ref_index_at(which), CHECK_NULL); + return klass_at(klass_ref_index_at(which), THREAD); } diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 800971b4df5..968f233adcc 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -532,7 +532,7 @@ bool InstanceKlass::verify_code( // 1) Verify the bytecodes Verifier::Mode mode = throw_verifyerror ? Verifier::ThrowException : Verifier::NoException; - return Verifier::verify(this_k, mode, this_k->should_verify_class(), CHECK_false); + return Verifier::verify(this_k, mode, this_k->should_verify_class(), THREAD); } @@ -1130,7 +1130,7 @@ Klass* InstanceKlass::array_klass_impl(instanceKlassHandle this_k, bool or_null, if (or_null) { return oak->array_klass_or_null(n); } - return oak->array_klass(n, CHECK_NULL); + return oak->array_klass(n, THREAD); } Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) { diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index bdd4839be46..56de60fa37b 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -152,7 +152,7 @@ Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLoo void* Klass::operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw() { return Metaspace::allocate(loader_data, word_size, /*read_only*/false, - MetaspaceObj::ClassType, CHECK_NULL); + MetaspaceObj::ClassType, THREAD); } Klass::Klass() { diff --git a/hotspot/src/share/vm/oops/methodData.cpp b/hotspot/src/share/vm/oops/methodData.cpp index 95fdb621301..35e615a3416 100644 --- a/hotspot/src/share/vm/oops/methodData.cpp +++ b/hotspot/src/share/vm/oops/methodData.cpp @@ -658,7 +658,7 @@ MethodData* MethodData::allocate(ClassLoaderData* loader_data, methodHandle meth int size = MethodData::compute_allocation_size_in_words(method); return new (loader_data, size, false, MetaspaceObj::MethodDataType, THREAD) - MethodData(method(), size, CHECK_NULL); + MethodData(method(), size, THREAD); } int MethodData::bytecode_cell_count(Bytecodes::Code code) { diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp index a4c51d09b1f..ffbdf026f24 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp @@ -189,7 +189,7 @@ objArrayOop ObjArrayKlass::allocate(int length, TRAPS) { if (length <= arrayOopDesc::max_array_length(T_OBJECT)) { int size = objArrayOopDesc::object_size(length); KlassHandle h_k(THREAD, this); - return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, CHECK_NULL); + return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, THREAD); } else { report_java_out_of_memory("Requested array size exceeds VM limit"); JvmtiExport::post_array_size_exhausted(); @@ -362,11 +362,11 @@ Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) { if (or_null) { return ak->array_klass_or_null(n); } - return ak->array_klass(n, CHECK_NULL); + return ak->array_klass(n, THREAD); } Klass* ObjArrayKlass::array_klass_impl(bool or_null, TRAPS) { - return array_klass_impl(or_null, dimension() + 1, CHECK_NULL); + return array_klass_impl(or_null, dimension() + 1, THREAD); } bool ObjArrayKlass::can_be_primary_super_slow() const { diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.cpp b/hotspot/src/share/vm/oops/typeArrayKlass.cpp index 7cc94753a6b..26c9ca55f4c 100644 --- a/hotspot/src/share/vm/oops/typeArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/typeArrayKlass.cpp @@ -191,7 +191,7 @@ Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) { if (or_null) { return h_ak->array_klass_or_null(n); } - return h_ak->array_klass(n, CHECK_NULL); + return h_ak->array_klass(n, THREAD); } Klass* TypeArrayKlass::array_klass_impl(bool or_null, TRAPS) { diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp index 8013a1329a8..168028d8c09 100644 --- a/hotspot/src/share/vm/prims/methodHandles.cpp +++ b/hotspot/src/share/vm/prims/methodHandles.cpp @@ -399,12 +399,12 @@ vmIntrinsics::ID MethodHandles::signature_polymorphic_name_id(Klass* klass, Symb // convert the external string or reflective type to an internal signature Symbol* MethodHandles::lookup_signature(oop type_str, bool intern_if_not_found, TRAPS) { if (java_lang_invoke_MethodType::is_instance(type_str)) { - return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found, CHECK_NULL); + return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found, THREAD); } else if (java_lang_Class::is_instance(type_str)) { - return java_lang_Class::as_signature(type_str, false, CHECK_NULL); + return java_lang_Class::as_signature(type_str, false, THREAD); } else if (java_lang_String::is_instance(type_str)) { if (intern_if_not_found) { - return java_lang_String::as_symbol(type_str, CHECK_NULL); + return java_lang_String::as_symbol(type_str, THREAD); } else { return java_lang_String::as_symbol_or_null(type_str); } diff --git a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp index 79e3ddcd85d..08758a9a99d 100644 --- a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp +++ b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp @@ -94,7 +94,7 @@ jdouble fieldDescriptor::double_initial_value() const { } oop fieldDescriptor::string_initial_value(TRAPS) const { - return constants()->uncached_string_at(initial_value_index(), CHECK_0); + return constants()->uncached_string_at(initial_value_index(), THREAD); } void fieldDescriptor::reinitialize(InstanceKlass* ik, int index) { diff --git a/hotspot/src/share/vm/runtime/perfData.hpp b/hotspot/src/share/vm/runtime/perfData.hpp index f9836ac08ff..d0553431148 100644 --- a/hotspot/src/share/vm/runtime/perfData.hpp +++ b/hotspot/src/share/vm/runtime/perfData.hpp @@ -773,7 +773,7 @@ class PerfDataManager : AllStatic { static PerfStringVariable* create_string_variable(CounterNS ns, const char* name, const char *s, TRAPS) { - return create_string_variable(ns, name, 0, s, CHECK_NULL); + return create_string_variable(ns, name, 0, s, THREAD); }; static PerfLongVariable* create_long_variable(CounterNS ns, @@ -784,7 +784,7 @@ class PerfDataManager : AllStatic { static PerfLongVariable* create_long_variable(CounterNS ns, const char* name, PerfData::Units u, TRAPS) { - return create_long_variable(ns, name, u, (jlong)0, CHECK_NULL); + return create_long_variable(ns, name, u, (jlong)0, THREAD); }; static PerfLongVariable* create_long_variable(CounterNS, const char* name, @@ -805,7 +805,7 @@ class PerfDataManager : AllStatic { static PerfLongCounter* create_long_counter(CounterNS ns, const char* name, PerfData::Units u, TRAPS) { - return create_long_counter(ns, name, u, (jlong)0, CHECK_NULL); + return create_long_counter(ns, name, u, (jlong)0, THREAD); }; static PerfLongCounter* create_long_counter(CounterNS ns, const char* name, @@ -823,49 +823,49 @@ class PerfDataManager : AllStatic { static PerfConstant* create_constant(CounterNS ns, const char* name, PerfData::Units u, jlong val, TRAPS) { - return create_long_constant(ns, name, u, val, CHECK_NULL); + return create_long_constant(ns, name, u, val, THREAD); } static PerfVariable* create_variable(CounterNS ns, const char* name, PerfData::Units u, jlong ival, TRAPS) { - return create_long_variable(ns, name, u, ival, CHECK_NULL); + return create_long_variable(ns, name, u, ival, THREAD); } static PerfVariable* create_variable(CounterNS ns, const char* name, PerfData::Units u, TRAPS) { - return create_long_variable(ns, name, u, (jlong)0, CHECK_NULL); + return create_long_variable(ns, name, u, (jlong)0, THREAD); } static PerfVariable* create_variable(CounterNS ns, const char* name, PerfData::Units u, jlong* sp, TRAPS) { - return create_long_variable(ns, name, u, sp, CHECK_NULL); + return create_long_variable(ns, name, u, sp, THREAD); } static PerfVariable* create_variable(CounterNS ns, const char* name, PerfData::Units u, PerfSampleHelper* sh, TRAPS) { - return create_long_variable(ns, name, u, sh, CHECK_NULL); + return create_long_variable(ns, name, u, sh, THREAD); } static PerfCounter* create_counter(CounterNS ns, const char* name, PerfData::Units u, jlong ival, TRAPS) { - return create_long_counter(ns, name, u, ival, CHECK_NULL); + return create_long_counter(ns, name, u, ival, THREAD); } static PerfCounter* create_counter(CounterNS ns, const char* name, PerfData::Units u, TRAPS) { - return create_long_counter(ns, name, u, (jlong)0, CHECK_NULL); + return create_long_counter(ns, name, u, (jlong)0, THREAD); } static PerfCounter* create_counter(CounterNS ns, const char* name, PerfData::Units u, jlong* sp, TRAPS) { - return create_long_counter(ns, name, u, sp, CHECK_NULL); + return create_long_counter(ns, name, u, sp, THREAD); } static PerfCounter* create_counter(CounterNS ns, const char* name, PerfData::Units u, PerfSampleHelper* sh, TRAPS) { - return create_long_counter(ns, name, u, sh, CHECK_NULL); + return create_long_counter(ns, name, u, sh, THREAD); } static void destroy(); diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp index 36f5990a69a..843aabc0a89 100644 --- a/hotspot/src/share/vm/runtime/reflection.cpp +++ b/hotspot/src/share/vm/runtime/reflection.cpp @@ -635,7 +635,7 @@ objArrayHandle Reflection::get_parameter_types(methodHandle method, int paramete } objArrayHandle Reflection::get_exception_types(methodHandle method, TRAPS) { - return method->resolved_checked_exceptions(CHECK_(objArrayHandle())); + return method->resolved_checked_exceptions(THREAD); } diff --git a/hotspot/src/share/vm/runtime/synchronizer.hpp b/hotspot/src/share/vm/runtime/synchronizer.hpp index c0d9f115eab..a823b540ec4 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.hpp +++ b/hotspot/src/share/vm/runtime/synchronizer.hpp @@ -169,7 +169,7 @@ class ObjectLocker : public StackObj { void waitUninterruptibly(TRAPS) { ObjectSynchronizer::waitUninterruptibly(_obj, 0, CHECK); } // complete_exit gives up lock completely, returning recursion count // reenter reclaims lock with original recursion count - intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, CHECK_0); } + intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, THREAD); } void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); } }; diff --git a/hotspot/src/share/vm/utilities/array.hpp b/hotspot/src/share/vm/utilities/array.hpp index b7ce8e71588..3d575498f05 100644 --- a/hotspot/src/share/vm/utilities/array.hpp +++ b/hotspot/src/share/vm/utilities/array.hpp @@ -322,7 +322,7 @@ protected: void* operator new(size_t size, ClassLoaderData* loader_data, int length, bool read_only, TRAPS) throw() { size_t word_size = Array::size(length); return (void*) Metaspace::allocate(loader_data, word_size, read_only, - MetaspaceObj::array_type(sizeof(T)), CHECK_NULL); + MetaspaceObj::array_type(sizeof(T)), THREAD); } static size_t byte_sizeof(int length) { return sizeof(Array) + MAX2(length - 1, 0) * sizeof(T); } From 4feb7b4dab063fd7ca4b6fb9cadb7d38ee4bac82 Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Fri, 14 Nov 2014 14:23:25 +0100 Subject: [PATCH 015/159] 8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs Read _top before _gc_time_stamp in saved_mark_word() with LoadLoad order to ensure we get a consistent view Reviewed-by: brutisso, dcubed, dholmes, stefank --- hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 3b49ff164fb..299eec5a3e6 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -1004,10 +1004,13 @@ HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start, HeapWord* G1OffsetTableContigSpace::saved_mark_word() const { G1CollectedHeap* g1h = G1CollectedHeap::heap(); assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" ); - if (_gc_time_stamp < g1h->get_gc_time_stamp()) - return top(); - else + HeapWord* local_top = top(); + OrderAccess::loadload(); + if (_gc_time_stamp < g1h->get_gc_time_stamp()) { + return local_top; + } else { return Space::saved_mark_word(); + } } void G1OffsetTableContigSpace::record_top_and_timestamp() { From 04bdb774e1e1749516250853ef8f1282b470a0cd Mon Sep 17 00:00:00 2001 From: Staffan Friberg Date: Fri, 14 Nov 2014 15:03:39 +0100 Subject: [PATCH 016/159] 8064473: Improved handling of age during object copy in G1 Reviewed-by: brutisso, tschatzl --- .../gc_implementation/g1/g1CollectedHeap.cpp | 7 ++-- .../g1/g1ParScanThreadState.cpp | 38 ++++++++----------- .../g1/g1ParScanThreadState.hpp | 2 +- .../g1/g1ParScanThreadState.inline.hpp | 7 ++-- .../vm/gc_implementation/shared/ageTable.hpp | 5 ++- 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index ebd77eb0b1e..e2ae3205d51 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -4270,10 +4270,11 @@ void G1ParCopyClosure::do_oop_work(T* p) { if (state == G1CollectedHeap::InCSet) { oop forwardee; - if (obj->is_forwarded()) { - forwardee = obj->forwardee(); + markOop m = obj->mark(); + if (m->is_marked()) { + forwardee = (oop) m->decode_pointer(); } else { - forwardee = _par_scan_state->copy_to_survivor_space(obj); + forwardee = _par_scan_state->copy_to_survivor_space(obj, m); } assert(forwardee != NULL, "forwardee should not be NULL"); oopDesc::encode_store_heap_oop(p, forwardee); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp index 311b9d00832..9cbc10e78bb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp @@ -150,7 +150,8 @@ void G1ParScanThreadState::trim_queue() { } while (!_refs->is_empty()); } -oop G1ParScanThreadState::copy_to_survivor_space(oop const old) { +oop G1ParScanThreadState::copy_to_survivor_space(oop const old, + markOop const old_mark) { size_t word_sz = old->size(); HeapRegion* from_region = _g1h->heap_region_containing_raw(old); // +1 to make the -1 indexes valid... @@ -158,9 +159,8 @@ oop G1ParScanThreadState::copy_to_survivor_space(oop const old) { assert( (from_region->is_young() && young_index > 0) || (!from_region->is_young() && young_index == 0), "invariant" ); G1CollectorPolicy* g1p = _g1h->g1_policy(); - markOop m = old->mark(); - int age = m->has_displaced_mark_helper() ? m->displaced_mark_helper()->age() - : m->age(); + uint age = old_mark->has_displaced_mark_helper() ? old_mark->displaced_mark_helper()->age() + : old_mark->age(); GCAllocPurpose alloc_purpose = g1p->evacuation_destination(from_region, age, word_sz); AllocationContext_t context = from_region->allocation_context(); @@ -196,30 +196,22 @@ oop G1ParScanThreadState::copy_to_survivor_space(oop const old) { alloc_purpose = to_region->is_young() ? GCAllocForSurvived : GCAllocForTenured; if (g1p->track_object_age(alloc_purpose)) { - // We could simply do obj->incr_age(). However, this causes a - // performance issue. obj->incr_age() will first check whether - // the object has a displaced mark by checking its mark word; - // getting the mark word from the new location of the object - // stalls. So, given that we already have the mark word and we - // are about to install it anyway, it's better to increase the - // age on the mark word, when the object does not have a - // displaced mark word. We're not expecting many objects to have - // a displaced marked word, so that case is not optimized - // further (it could be...) and we simply call obj->incr_age(). - - if (m->has_displaced_mark_helper()) { - // in this case, we have to install the mark word first, + if (age < markOopDesc::max_age) { + age++; + } + if (old_mark->has_displaced_mark_helper()) { + // In this case, we have to install the mark word first, // otherwise obj looks to be forwarded (the old mark word, // which contains the forward pointer, was copied) - obj->set_mark(m); - obj->incr_age(); + obj->set_mark(old_mark); + markOop new_mark = old_mark->displaced_mark_helper()->set_age(age); + old_mark->set_displaced_mark_helper(new_mark); } else { - m = m->incr_age(); - obj->set_mark(m); + obj->set_mark(old_mark->set_age(age)); } - age_table()->add(obj, word_sz); + age_table()->add(age, word_sz); } else { - obj->set_mark(m); + obj->set_mark(old_mark); } if (G1StringDedup::is_enabled()) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp index a9b9283d32e..a7c2f8ea119 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp @@ -195,7 +195,7 @@ class G1ParScanThreadState : public StackObj { inline void dispatch_reference(StarTask ref); public: - oop copy_to_survivor_space(oop const obj); + oop copy_to_survivor_space(oop const obj, markOop const old_mark); void trim_queue(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp index 3fb1829f20d..8e20df6fe66 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp @@ -41,10 +41,11 @@ template void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from G1CollectedHeap::in_cset_state_t in_cset_state = _g1h->in_cset_state(obj); if (in_cset_state == G1CollectedHeap::InCSet) { oop forwardee; - if (obj->is_forwarded()) { - forwardee = obj->forwardee(); + markOop m = obj->mark(); + if (m->is_marked()) { + forwardee = (oop) m->decode_pointer(); } else { - forwardee = copy_to_survivor_space(obj); + forwardee = copy_to_survivor_space(obj, m); } oopDesc::encode_store_heap_oop(p, forwardee); } else if (in_cset_state == G1CollectedHeap::IsHumongous) { diff --git a/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp b/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp index 9e2ee99997f..44d8e0ace7f 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp @@ -55,7 +55,10 @@ class ageTable VALUE_OBJ_CLASS_SPEC { // add entry void add(oop p, size_t oop_size) { - uint age = p->age(); + add(p->age(), oop_size); + } + + void add(uint age, size_t oop_size) { assert(age > 0 && age < table_size, "invalid age of object"); sizes[age] += oop_size; } From d326162380ef72f8f6afef5978cafc9006a716f8 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 11 Nov 2014 17:05:33 +0100 Subject: [PATCH 017/159] 8064580: Move INCLUDE_CDS include section to the end of the include list Reviewed-by: jwilhelm, brutisso, coleenp, dholmes --- hotspot/src/os/linux/vm/os_linux.cpp | 1 + hotspot/src/share/vm/classfile/classFileParser.cpp | 7 ++++--- hotspot/src/share/vm/classfile/classLoader.cpp | 11 ++++++----- hotspot/src/share/vm/classfile/classLoader.hpp | 1 + hotspot/src/share/vm/classfile/systemDictionary.cpp | 9 ++++----- hotspot/src/share/vm/memory/metaspace.cpp | 1 + hotspot/src/share/vm/memory/universe.cpp | 6 +++--- hotspot/src/share/vm/prims/jvm.cpp | 9 +++++---- hotspot/src/share/vm/utilities/ostream.cpp | 1 + 9 files changed, 26 insertions(+), 20 deletions(-) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 3e5dc4066d5..fcae0343300 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -68,6 +68,7 @@ #include "utilities/events.hpp" #include "utilities/elfFile.hpp" #include "utilities/growableArray.hpp" +#include "utilities/macros.hpp" #include "utilities/vmError.hpp" // put OS-includes here diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index fe9f2443a80..e643ad9b61b 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -31,9 +31,6 @@ #include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" -#if INCLUDE_CDS -#include "classfile/systemDictionaryShared.hpp" -#endif #include "classfile/verificationType.hpp" #include "classfile/verifier.hpp" #include "classfile/vmSymbols.hpp" @@ -63,7 +60,11 @@ #include "services/threadService.hpp" #include "utilities/array.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" #include "utilities/ostream.hpp" +#if INCLUDE_CDS +#include "classfile/systemDictionaryShared.hpp" +#endif // We generally try to create the oops directly when parsing, rather than // allocating temporary data structures and copying the bytes twice. A diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index 780fea1c2a3..aa4685c3032 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -29,10 +29,6 @@ #include "classfile/classLoaderExt.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/javaClasses.hpp" -#if INCLUDE_CDS -#include "classfile/sharedPathsMiscInfo.hpp" -#include "classfile/sharedClassUtil.hpp" -#endif #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compileBroker.hpp" @@ -64,8 +60,13 @@ #include "services/management.hpp" #include "services/threadService.hpp" #include "utilities/events.hpp" -#include "utilities/hashtable.hpp" #include "utilities/hashtable.inline.hpp" +#include "utilities/macros.hpp" +#if INCLUDE_CDS +#include "classfile/sharedPathsMiscInfo.hpp" +#include "classfile/sharedClassUtil.hpp" +#endif + // Entry points in zip.dll for loading zip/jar file entries diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp index f69de2ec2cd..ba9c02acfdc 100644 --- a/hotspot/src/share/vm/classfile/classLoader.hpp +++ b/hotspot/src/share/vm/classfile/classLoader.hpp @@ -27,6 +27,7 @@ #include "classfile/classFileParser.hpp" #include "runtime/perfData.hpp" +#include "utilities/macros.hpp" // The VM class loader. #include diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 9c300a9221b..861f82306da 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -31,10 +31,6 @@ #include "classfile/resolutionErrors.hpp" #include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" -#if INCLUDE_CDS -#include "classfile/sharedClassUtil.hpp" -#include "classfile/systemDictionaryShared.hpp" -#endif #include "classfile/vmSymbols.hpp" #include "compiler/compileBroker.hpp" #include "interpreter/bytecodeStream.hpp" @@ -65,7 +61,10 @@ #include "services/threadService.hpp" #include "utilities/macros.hpp" #include "utilities/ticks.hpp" - +#if INCLUDE_CDS +#include "classfile/sharedClassUtil.hpp" +#include "classfile/systemDictionaryShared.hpp" +#endif #if INCLUDE_TRACE #include "trace/tracing.hpp" #endif diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 2f5d5843ee2..037267e288b 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -47,6 +47,7 @@ #include "services/memoryService.hpp" #include "utilities/copy.hpp" #include "utilities/debug.hpp" +#include "utilities/macros.hpp" PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index 54a6c759f0d..d2d1837b74f 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -26,9 +26,6 @@ #include "classfile/classLoader.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/javaClasses.hpp" -#if INCLUDE_CDS -#include "classfile/sharedClassUtil.hpp" -#endif #include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" @@ -82,6 +79,9 @@ #include "gc_implementation/g1/g1CollectorPolicy.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #endif // INCLUDE_ALL_GCS +#if INCLUDE_CDS +#include "classfile/sharedClassUtil.hpp" +#endif PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 5ea893b24db..0c333741364 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -28,10 +28,6 @@ #include "classfile/javaClasses.hpp" #include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" -#if INCLUDE_CDS -#include "classfile/sharedClassUtil.hpp" -#include "classfile/systemDictionaryShared.hpp" -#endif #include "classfile/vmSymbols.hpp" #include "gc_interface/collectedHeap.inline.hpp" #include "interpreter/bytecode.hpp" @@ -73,8 +69,13 @@ #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/histogram.hpp" +#include "utilities/macros.hpp" #include "utilities/top.hpp" #include "utilities/utf8.hpp" +#if INCLUDE_CDS +#include "classfile/sharedClassUtil.hpp" +#include "classfile/systemDictionaryShared.hpp" +#endif #ifdef TARGET_OS_FAMILY_linux # include "jvm_linux.h" #endif diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp index ceb5774fe81..0546f99ad34 100644 --- a/hotspot/src/share/vm/utilities/ostream.cpp +++ b/hotspot/src/share/vm/utilities/ostream.cpp @@ -30,6 +30,7 @@ #include "runtime/os.hpp" #include "runtime/vm_version.hpp" #include "utilities/defaultStream.hpp" +#include "utilities/macros.hpp" #include "utilities/ostream.hpp" #include "utilities/top.hpp" #include "utilities/xmlstream.hpp" From eebf2b91266ba7c6f02c6c9433918612ba216ea3 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 12 Nov 2014 12:41:59 +0100 Subject: [PATCH 018/159] 8064581: Move INCLUDE_ALL_GCS include section to the end of the include list Reviewed-by: jwilhelm, brutisso, coleenp, dholmes --- hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp | 1 + hotspot/src/share/vm/ci/ciObjectFactory.cpp | 1 + .../src/share/vm/classfile/stringTable.cpp | 1 + .../vm/gc_implementation/shared/gcTrace.cpp | 2 +- .../vm/gc_implementation/shared/gcTrace.hpp | 5 ++--- .../gc_implementation/shared/gcTraceSend.cpp | 1 + .../share/vm/memory/binaryTreeDictionary.cpp | 3 +-- .../share/vm/memory/freeBlockDictionary.cpp | 7 +++---- hotspot/src/share/vm/memory/freeList.cpp | 1 - hotspot/src/share/vm/oops/oop.pcgc.inline.hpp | 2 +- hotspot/src/share/vm/prims/jni.cpp | 8 +++---- hotspot/src/share/vm/prims/unsafe.cpp | 8 +++---- hotspot/src/share/vm/prims/whitebox.cpp | 21 +++++++------------ hotspot/src/share/vm/runtime/globals.cpp | 2 +- 14 files changed, 28 insertions(+), 35 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp index 5bbea5ada2a..66e33888223 100644 --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp @@ -27,6 +27,7 @@ #define CPU_PPC_VM_MACROASSEMBLER_PPC_HPP #include "asm/assembler.hpp" +#include "utilities/macros.hpp" // MacroAssembler extends Assembler by a few frequently used macros. diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.cpp b/hotspot/src/share/vm/ci/ciObjectFactory.cpp index aaa607ff135..bf7b3f6013a 100644 --- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp +++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp @@ -46,6 +46,7 @@ #include "oops/oop.inline.hpp" #include "oops/oop.inline2.hpp" #include "runtime/fieldType.hpp" +#include "utilities/macros.hpp" #if INCLUDE_ALL_GCS # include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" #endif diff --git a/hotspot/src/share/vm/classfile/stringTable.cpp b/hotspot/src/share/vm/classfile/stringTable.cpp index b12134a1252..334fe7cbd39 100644 --- a/hotspot/src/share/vm/classfile/stringTable.cpp +++ b/hotspot/src/share/vm/classfile/stringTable.cpp @@ -36,6 +36,7 @@ #include "runtime/atomic.inline.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/hashtable.inline.hpp" +#include "utilities/macros.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" #include "gc_implementation/g1/g1StringDedup.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp index ddac9531667..dba0c5f709b 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp @@ -33,8 +33,8 @@ #include "memory/referenceProcessorStats.hpp" #include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" #include "utilities/ticks.inline.hpp" - #if INCLUDE_ALL_GCS #include "gc_implementation/g1/evacuationInfo.hpp" #endif diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp index dd13344155f..20342ebc244 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp @@ -33,12 +33,11 @@ #include "memory/allocation.hpp" #include "memory/metaspace.hpp" #include "memory/referenceType.hpp" +#include "utilities/macros.hpp" +#include "utilities/ticks.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1YCTypes.hpp" #endif -#include "utilities/macros.hpp" -#include "utilities/ticks.hpp" - class EvacuationInfo; class GCHeapSummary; diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp index 5462135a014..97055694fae 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp @@ -31,6 +31,7 @@ #include "runtime/os.hpp" #include "trace/tracing.hpp" #include "trace/traceBackend.hpp" +#include "utilities/macros.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/g1/evacuationInfo.hpp" #include "gc_implementation/g1/g1YCTypes.hpp" diff --git a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp index 60435e63c1d..5988eeef516 100644 --- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp +++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" -#include "utilities/macros.hpp" #include "gc_implementation/shared/allocationStats.hpp" +#include "gc_implementation/shared/spaceDecorator.hpp" #include "memory/binaryTreeDictionary.hpp" #include "memory/freeList.hpp" #include "memory/freeBlockDictionary.hpp" @@ -32,7 +32,6 @@ #include "runtime/globals.hpp" #include "utilities/ostream.hpp" #include "utilities/macros.hpp" -#include "gc_implementation/shared/spaceDecorator.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp" #include "gc_implementation/concurrentMarkSweep/freeChunk.hpp" diff --git a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp index 1db7dcf75e5..3ac6f88d4ad 100644 --- a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp +++ b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp @@ -23,14 +23,13 @@ */ #include "precompiled.hpp" -#include "utilities/macros.hpp" -#if INCLUDE_ALL_GCS -#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp" -#endif // INCLUDE_ALL_GCS #include "memory/freeBlockDictionary.hpp" #include "memory/metachunk.hpp" #include "runtime/thread.inline.hpp" #include "utilities/macros.hpp" +#if INCLUDE_ALL_GCS +#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp" +#endif // INCLUDE_ALL_GCS #ifndef PRODUCT template Mutex* FreeBlockDictionary::par_lock() const { diff --git a/hotspot/src/share/vm/memory/freeList.cpp b/hotspot/src/share/vm/memory/freeList.cpp index b1d901b9fc2..2eb74992b89 100644 --- a/hotspot/src/share/vm/memory/freeList.cpp +++ b/hotspot/src/share/vm/memory/freeList.cpp @@ -31,7 +31,6 @@ #include "runtime/mutex.hpp" #include "runtime/vmThread.hpp" #include "utilities/macros.hpp" - #if INCLUDE_ALL_GCS #include "gc_implementation/concurrentMarkSweep/freeChunk.hpp" #endif // INCLUDE_ALL_GCS diff --git a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp index b613e4ee73f..ddc3f667227 100644 --- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp @@ -25,8 +25,8 @@ #ifndef SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP #define SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP -#include "utilities/macros.hpp" #include "runtime/atomic.inline.hpp" +#include "utilities/macros.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/parNew/parNewGeneration.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index e0116854741..cd99e787a72 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -32,10 +32,6 @@ #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "interpreter/linkResolver.hpp" -#include "utilities/macros.hpp" -#if INCLUDE_ALL_GCS -#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" -#endif // INCLUDE_ALL_GCS #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" #include "memory/gcLocker.inline.hpp" @@ -81,6 +77,10 @@ #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/histogram.hpp" +#include "utilities/macros.hpp" +#if INCLUDE_ALL_GCS +#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" +#endif // INCLUDE_ALL_GCS static jint CurrentVersion = JNI_VERSION_1_8; diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index c0e4f30d2a2..321d3c3c8fc 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -24,10 +24,6 @@ #include "precompiled.hpp" #include "classfile/vmSymbols.hpp" -#include "utilities/macros.hpp" -#if INCLUDE_ALL_GCS -#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" -#endif // INCLUDE_ALL_GCS #include "memory/allocation.inline.hpp" #include "prims/jni.h" #include "prims/jvm.h" @@ -43,6 +39,10 @@ #include "trace/tracing.hpp" #include "utilities/copy.hpp" #include "utilities/dtrace.hpp" +#include "utilities/macros.hpp" +#if INCLUDE_ALL_GCS +#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" +#endif // INCLUDE_ALL_GCS PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index c4cf7088e69..eea24851f5d 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -23,44 +23,37 @@ */ #include "precompiled.hpp" - +#include "classfile/classLoaderData.hpp" +#include "classfile/stringTable.hpp" #include "code/codeCache.hpp" +#include "compiler/compileBroker.hpp" #include "memory/metadataFactory.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" - -#include "classfile/stringTable.hpp" -#include "classfile/classLoaderData.hpp" - -#include "prims/whitebox.hpp" #include "prims/wbtestmethods/parserTests.hpp" - -#include "runtime/thread.hpp" +#include "prims/whitebox.hpp" #include "runtime/arguments.hpp" +#include "runtime/compilationPolicy.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/os.hpp" +#include "runtime/thread.hpp" #include "runtime/vm_version.hpp" - #include "utilities/array.hpp" #include "utilities/debug.hpp" -#include "utilities/macros.hpp" #include "utilities/exceptions.hpp" - +#include "utilities/macros.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp" #include "gc_implementation/g1/concurrentMark.hpp" #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/heapRegionRemSet.hpp" #endif // INCLUDE_ALL_GCS - #if INCLUDE_NMT #include "services/mallocSiteTable.hpp" #include "services/memTracker.hpp" #include "utilities/nativeCallStack.hpp" #endif // INCLUDE_NMT -#include "compiler/compileBroker.hpp" -#include "runtime/compilationPolicy.hpp" PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index 81bf15d0f0c..ab301c57ce6 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -28,10 +28,10 @@ #include "runtime/arguments.hpp" #include "runtime/globals.hpp" #include "runtime/globals_extension.hpp" +#include "trace/tracing.hpp" #include "utilities/ostream.hpp" #include "utilities/macros.hpp" #include "utilities/top.hpp" -#include "trace/tracing.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1_globals.hpp" #endif // INCLUDE_ALL_GCS From 4b60638d85aa9a20dec9efffcb84dc64a46c4ae3 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 18 Nov 2014 10:23:26 +0100 Subject: [PATCH 019/159] 8064702: Remove the CMS foreground collector Reviewed-by: kbarrett, ysr --- .../concurrentMarkSweepGeneration.cpp | 598 ++++-------------- .../concurrentMarkSweepGeneration.hpp | 65 +- .../concurrentMarkSweepGeneration.inline.hpp | 3 +- .../concurrentMarkSweepThread.cpp | 2 +- hotspot/src/share/vm/runtime/arguments.cpp | 9 - hotspot/src/share/vm/runtime/globals.hpp | 13 - .../CheckAllocateAndSystemGC.java | 66 -- .../SystemGCOnForegroundCollector.java | 67 -- .../TestCMSForegroundFlags.java | 52 -- 9 files changed, 160 insertions(+), 715 deletions(-) delete mode 100644 hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java delete mode 100644 hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java delete mode 100644 hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index aec716c782a..b94bd52a3a9 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -192,7 +192,7 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration( FreeBlockDictionary::DictionaryChoice dictionaryChoice) : CardGeneration(rs, initial_byte_size, level, ct), _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))), - _debug_collection_type(Concurrent_collection_type), + _debug_concurrent_cycle(true), _did_compact(false) { HeapWord* bottom = (HeapWord*) _virtual_space.low(); @@ -612,8 +612,6 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, // Clip CMSBootstrapOccupancy between 0 and 100. _bootstrap_occupancy = ((double)CMSBootstrapOccupancy)/(double)100; - _full_gcs_since_conc_gc = 0; - // Now tell CMS generations the identity of their collector ConcurrentMarkSweepGeneration::set_collector(this); @@ -1248,16 +1246,10 @@ bool CMSCollector::shouldConcurrentCollect() { } // For debugging purposes, change the type of collection. - // If the rotation is not on the concurrent collection - // type, don't start a concurrent collection. + // Rotate between concurrent and stop-the-world full GCs. NOT_PRODUCT( - if (RotateCMSCollectionTypes && - (_cmsGen->debug_collection_type() != - ConcurrentMarkSweepGeneration::Concurrent_collection_type)) { - assert(_cmsGen->debug_collection_type() != - ConcurrentMarkSweepGeneration::Unknown_collection_type, - "Bad cms collection type"); - return false; + if (RotateCMSCollectionTypes) { + return _cmsGen->debug_concurrent_cycle(); } ) @@ -1441,16 +1433,6 @@ void CMSCollector::collect(bool full, size_t size, bool tlab) { - if (!UseCMSCollectionPassing && _collectorState > Idling) { - // For debugging purposes skip the collection if the state - // is not currently idle - if (TraceCMSState) { - gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " skipped full:%d CMS state %d", - Thread::current(), full, _collectorState); - } - return; - } - // The following "if" branch is present for defensive reasons. // In the current uses of this interface, it can be replaced with: // assert(!GC_locker.is_active(), "Can't be called otherwise"); @@ -1466,7 +1448,6 @@ void CMSCollector::collect(bool full, return; } acquire_control_and_collect(full, clear_all_soft_refs); - _full_gcs_since_conc_gc++; } void CMSCollector::request_full_gc(unsigned int full_gc_count, GCCause::Cause cause) { @@ -1636,66 +1617,52 @@ void CMSCollector::acquire_control_and_collect(bool full, gclog_or_tty->print_cr(" gets control with state %d", _collectorState); } - // Check if we need to do a compaction, or if not, whether - // we need to start the mark-sweep from scratch. - bool should_compact = false; - bool should_start_over = false; - decide_foreground_collection_type(clear_all_soft_refs, - &should_compact, &should_start_over); - -NOT_PRODUCT( - if (RotateCMSCollectionTypes) { - if (_cmsGen->debug_collection_type() == - ConcurrentMarkSweepGeneration::MSC_foreground_collection_type) { - should_compact = true; - } else if (_cmsGen->debug_collection_type() == - ConcurrentMarkSweepGeneration::MS_foreground_collection_type) { - should_compact = false; - } + // Inform cms gen if this was due to partial collection failing. + // The CMS gen may use this fact to determine its expansion policy. + GenCollectedHeap* gch = GenCollectedHeap::heap(); + if (gch->incremental_collection_will_fail(false /* don't consult_young */)) { + assert(!_cmsGen->incremental_collection_failed(), + "Should have been noticed, reacted to and cleared"); + _cmsGen->set_incremental_collection_failed(); } -) if (first_state > Idling) { report_concurrent_mode_interruption(); } - set_did_compact(should_compact); - if (should_compact) { - // If the collection is being acquired from the background - // collector, there may be references on the discovered - // references lists that have NULL referents (being those - // that were concurrently cleared by a mutator) or - // that are no longer active (having been enqueued concurrently - // by the mutator). - // Scrub the list of those references because Mark-Sweep-Compact - // code assumes referents are not NULL and that all discovered - // Reference objects are active. - ref_processor()->clean_up_discovered_references(); + set_did_compact(true); - if (first_state > Idling) { - save_heap_summary(); - } + // If the collection is being acquired from the background + // collector, there may be references on the discovered + // references lists that have NULL referents (being those + // that were concurrently cleared by a mutator) or + // that are no longer active (having been enqueued concurrently + // by the mutator). + // Scrub the list of those references because Mark-Sweep-Compact + // code assumes referents are not NULL and that all discovered + // Reference objects are active. + ref_processor()->clean_up_discovered_references(); - do_compaction_work(clear_all_soft_refs); - - // Has the GC time limit been exceeded? - DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration(); - size_t max_eden_size = young_gen->max_capacity() - - young_gen->to()->capacity() - - young_gen->from()->capacity(); - GenCollectedHeap* gch = GenCollectedHeap::heap(); - GCCause::Cause gc_cause = gch->gc_cause(); - size_policy()->check_gc_overhead_limit(_young_gen->used(), - young_gen->eden()->used(), - _cmsGen->max_capacity(), - max_eden_size, - full, - gc_cause, - gch->collector_policy()); - } else { - do_mark_sweep_work(clear_all_soft_refs, first_state, - should_start_over); + if (first_state > Idling) { + save_heap_summary(); } + + do_compaction_work(clear_all_soft_refs); + + // Has the GC time limit been exceeded? + DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration(); + size_t max_eden_size = young_gen->max_capacity() - + young_gen->to()->capacity() - + young_gen->from()->capacity(); + GCCause::Cause gc_cause = gch->gc_cause(); + size_policy()->check_gc_overhead_limit(_young_gen->used(), + young_gen->eden()->used(), + _cmsGen->max_capacity(), + max_eden_size, + full, + gc_cause, + gch->collector_policy()); + // Reset the expansion cause, now that we just completed // a collection cycle. clear_expansion_cause(); @@ -1713,68 +1680,6 @@ void CMSCollector::compute_new_size() { _cmsGen->compute_new_size_free_list(); } -// A work method used by foreground collection to determine -// what type of collection (compacting or not, continuing or fresh) -// it should do. -// NOTE: the intent is to make UseCMSCompactAtFullCollection -// and CMSCompactWhenClearAllSoftRefs the default in the future -// and do away with the flags after a suitable period. -void CMSCollector::decide_foreground_collection_type( - bool clear_all_soft_refs, bool* should_compact, - bool* should_start_over) { - // Normally, we'll compact only if the UseCMSCompactAtFullCollection - // flag is set, and we have either requested a System.gc() or - // the number of full gc's since the last concurrent cycle - // has exceeded the threshold set by CMSFullGCsBeforeCompaction, - // or if an incremental collection has failed - GenCollectedHeap* gch = GenCollectedHeap::heap(); - assert(gch->collector_policy()->is_generation_policy(), - "You may want to check the correctness of the following"); - // Inform cms gen if this was due to partial collection failing. - // The CMS gen may use this fact to determine its expansion policy. - if (gch->incremental_collection_will_fail(false /* don't consult_young */)) { - assert(!_cmsGen->incremental_collection_failed(), - "Should have been noticed, reacted to and cleared"); - _cmsGen->set_incremental_collection_failed(); - } - *should_compact = - UseCMSCompactAtFullCollection && - ((_full_gcs_since_conc_gc >= CMSFullGCsBeforeCompaction) || - GCCause::is_user_requested_gc(gch->gc_cause()) || - gch->incremental_collection_will_fail(true /* consult_young */)); - *should_start_over = false; - if (clear_all_soft_refs && !*should_compact) { - // We are about to do a last ditch collection attempt - // so it would normally make sense to do a compaction - // to reclaim as much space as possible. - if (CMSCompactWhenClearAllSoftRefs) { - // Default: The rationale is that in this case either - // we are past the final marking phase, in which case - // we'd have to start over, or so little has been done - // that there's little point in saving that work. Compaction - // appears to be the sensible choice in either case. - *should_compact = true; - } else { - // We have been asked to clear all soft refs, but not to - // compact. Make sure that we aren't past the final checkpoint - // phase, for that is where we process soft refs. If we are already - // past that phase, we'll need to redo the refs discovery phase and - // if necessary clear soft refs that weren't previously - // cleared. We do so by remembering the phase in which - // we came in, and if we are past the refs processing - // phase, we'll choose to just redo the mark-sweep - // collection from scratch. - if (_collectorState > FinalMarking) { - // We are past the refs processing phase; - // start over and do a fresh synchronous CMS cycle - _collectorState = Resetting; // skip to reset to start new cycle - reset(false /* == !asynch */); - *should_start_over = true; - } // else we can continue a possibly ongoing current cycle - } - } -} - // A work method used by the foreground collector to do // a mark-sweep-compact. void CMSCollector::do_compaction_work(bool clear_all_soft_refs) { @@ -1787,10 +1692,6 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) { gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start()); GCTraceTime t("CMS:MSC ", PrintGCDetails && Verbose, true, NULL, gc_tracer->gc_id()); - if (PrintGC && Verbose && !(GCCause::is_user_requested_gc(gch->gc_cause()))) { - gclog_or_tty->print_cr("Compact ConcurrentMarkSweepGeneration after %d " - "collections passed to foreground collector", _full_gcs_since_conc_gc); - } // Temporarily widen the span of the weak reference processing to // the entire heap. @@ -1852,7 +1753,7 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) { _collectorState = Resetting; assert(_restart_addr == NULL, "Should have been NULL'd before baton was passed"); - reset(false /* == !asynch */); + reset(false /* == !concurrent */); _cmsGen->reset_after_compaction(); _concurrent_cycles_since_last_unload = 0; @@ -1875,40 +1776,6 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) { // in the heap's do_collection() method. } -// A work method used by the foreground collector to do -// a mark-sweep, after taking over from a possibly on-going -// concurrent mark-sweep collection. -void CMSCollector::do_mark_sweep_work(bool clear_all_soft_refs, - CollectorState first_state, bool should_start_over) { - if (PrintGC && Verbose) { - gclog_or_tty->print_cr("Pass concurrent collection to foreground " - "collector with count %d", - _full_gcs_since_conc_gc); - } - switch (_collectorState) { - case Idling: - if (first_state == Idling || should_start_over) { - // The background GC was not active, or should - // restarted from scratch; start the cycle. - _collectorState = InitialMarking; - } - // If first_state was not Idling, then a background GC - // was in progress and has now finished. No need to do it - // again. Leave the state as Idling. - break; - case Precleaning: - // In the foreground case don't do the precleaning since - // it is not done concurrently and there is extra work - // required. - _collectorState = FinalMarking; - } - collect_in_foreground(clear_all_soft_refs, GenCollectedHeap::heap()->gc_cause()); - - // For a mark-sweep, compute_new_size() will be called - // in the heap's do_collection() method. -} - - void CMSCollector::print_eden_and_survivor_chunk_arrays() { DefNewGeneration* dng = _young_gen->as_DefNewGeneration(); ContiguousSpace* eden_space = dng->eden(); @@ -1989,13 +1856,7 @@ class ReleaseForegroundGC: public StackObj { } }; -// There are separate collect_in_background and collect_in_foreground because of -// the different locking requirements of the background collector and the -// foreground collector. There was originally an attempt to share -// one "collect" method between the background collector and the foreground -// collector but the if-then-else required made it cleaner to have -// separate methods. -void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Cause cause) { +void CMSCollector::collect_in_background(GCCause::Cause cause) { assert(Thread::current()->is_ConcurrentGC_thread(), "A CMS asynchronous collection is only allowed on a CMS thread."); @@ -2036,7 +1897,7 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus // Used for PrintGC size_t prev_used; if (PrintGC && Verbose) { - prev_used = _cmsGen->used(); // XXXPERM + prev_used = _cmsGen->used(); } // The change of the collection state is normally done at this level; @@ -2116,7 +1977,7 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus break; case Marking: // initial marking in checkpointRootsInitialWork has been completed - if (markFromRoots(true)) { // we were successful + if (markFromRoots()) { // we were successful assert(_collectorState == Precleaning, "Collector state should " "have changed"); } else { @@ -2146,10 +2007,9 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus break; case Sweeping: // final marking in checkpointRootsFinal has been completed - sweep(true); + sweep(); assert(_collectorState == Resizing, "Collector state change " "to Resizing must be done under the free_list_lock"); - _full_gcs_since_conc_gc = 0; case Resizing: { // Sweeping has been completed... @@ -2222,12 +2082,6 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus } } -void CMSCollector::register_foreground_gc_start(GCCause::Cause cause) { - if (!_cms_start_registered) { - register_gc_start(cause); - } -} - void CMSCollector::register_gc_start(GCCause::Cause cause) { _cms_start_registered = true; _gc_timer_cm->register_gc_start(); @@ -2255,120 +2109,6 @@ void CMSCollector::report_heap_summary(GCWhen::Type when) { _gc_tracer_cm->report_metaspace_summary(when, _last_metaspace_summary); } -void CMSCollector::collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause) { - assert(_foregroundGCIsActive && !_foregroundGCShouldWait, - "Foreground collector should be waiting, not executing"); - assert(Thread::current()->is_VM_thread(), "A foreground collection" - "may only be done by the VM Thread with the world stopped"); - assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(), - "VM thread should have CMS token"); - - // The gc id is created in register_foreground_gc_start if this collection is synchronous - const GCId gc_id = _collectorState == InitialMarking ? GCId::peek() : _gc_tracer_cm->gc_id(); - NOT_PRODUCT(GCTraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose, - true, NULL, gc_id);) - COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); - - HandleMark hm; // Discard invalid handles created during verification - - if (VerifyBeforeGC && - GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { - Universe::verify(); - } - - // Snapshot the soft reference policy to be used in this collection cycle. - ref_processor()->setup_policy(clear_all_soft_refs); - - // Decide if class unloading should be done - update_should_unload_classes(); - - bool init_mark_was_synchronous = false; // until proven otherwise - while (_collectorState != Idling) { - if (TraceCMSState) { - gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d", - Thread::current(), _collectorState); - } - switch (_collectorState) { - case InitialMarking: - register_foreground_gc_start(cause); - init_mark_was_synchronous = true; // fact to be exploited in re-mark - checkpointRootsInitial(false); - assert(_collectorState == Marking, "Collector state should have changed" - " within checkpointRootsInitial()"); - break; - case Marking: - // initial marking in checkpointRootsInitialWork has been completed - if (VerifyDuringGC && - GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { - Universe::verify("Verify before initial mark: "); - } - { - bool res = markFromRoots(false); - assert(res && _collectorState == FinalMarking, "Collector state should " - "have changed"); - break; - } - case FinalMarking: - if (VerifyDuringGC && - GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { - Universe::verify("Verify before re-mark: "); - } - checkpointRootsFinal(false, clear_all_soft_refs, - init_mark_was_synchronous); - assert(_collectorState == Sweeping, "Collector state should not " - "have changed within checkpointRootsFinal()"); - break; - case Sweeping: - // final marking in checkpointRootsFinal has been completed - if (VerifyDuringGC && - GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { - Universe::verify("Verify before sweep: "); - } - sweep(false); - assert(_collectorState == Resizing, "Incorrect state"); - break; - case Resizing: { - // Sweeping has been completed; the actual resize in this case - // is done separately; nothing to be done in this state. - _collectorState = Resetting; - break; - } - case Resetting: - // The heap has been resized. - if (VerifyDuringGC && - GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { - Universe::verify("Verify before reset: "); - } - save_heap_summary(); - reset(false); - assert(_collectorState == Idling, "Collector state should " - "have changed"); - break; - case Precleaning: - case AbortablePreclean: - // Elide the preclean phase - _collectorState = FinalMarking; - break; - default: - ShouldNotReachHere(); - } - if (TraceCMSState) { - gclog_or_tty->print_cr(" Thread " INTPTR_FORMAT " done - next CMS state %d", - Thread::current(), _collectorState); - } - } - - if (VerifyAfterGC && - GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { - Universe::verify(); - } - if (TraceCMSState) { - gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT - " exiting collection CMS state %d", - Thread::current(), _collectorState); - } -} - bool CMSCollector::waitForForegroundGC() { bool res = false; assert(ConcurrentMarkSweepThread::cms_thread_has_cms_token(), @@ -3345,7 +3085,7 @@ class CMSParInitialMarkTask: public CMSParMarkTask { // Checkpoint the roots into this generation from outside // this generation. [Note this initial checkpoint need only // be approximate -- we'll do a catch up phase subsequently.] -void CMSCollector::checkpointRootsInitial(bool asynch) { +void CMSCollector::checkpointRootsInitial() { assert(_collectorState == InitialMarking, "Wrong collector state"); check_correct_thread_executing(); TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause()); @@ -3356,32 +3096,19 @@ void CMSCollector::checkpointRootsInitial(bool asynch) { ReferenceProcessor* rp = ref_processor(); SpecializationStats::clear(); assert(_restart_addr == NULL, "Control point invariant"); - if (asynch) { + { // acquire locks for subsequent manipulations MutexLockerEx x(bitMapLock(), Mutex::_no_safepoint_check_flag); - checkpointRootsInitialWork(asynch); + checkpointRootsInitialWork(); // enable ("weak") refs discovery rp->enable_discovery(true /*verify_disabled*/, true /*check_no_refs*/); _collectorState = Marking; - } else { - // (Weak) Refs discovery: this is controlled from genCollectedHeap::do_collection - // which recognizes if we are a CMS generation, and doesn't try to turn on - // discovery; verify that they aren't meddling. - assert(!rp->discovery_is_atomic(), - "incorrect setting of discovery predicate"); - assert(!rp->discovery_enabled(), "genCollectedHeap shouldn't control " - "ref discovery for this generation kind"); - // already have locks - checkpointRootsInitialWork(asynch); - // now enable ("weak") refs discovery - rp->enable_discovery(true /*verify_disabled*/, false /*verify_no_refs*/); - _collectorState = Marking; } SpecializationStats::print(); } -void CMSCollector::checkpointRootsInitialWork(bool asynch) { +void CMSCollector::checkpointRootsInitialWork() { assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped"); assert(_collectorState == InitialMarking, "just checking"); @@ -3483,9 +3210,9 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) { verify_overflow_empty(); } -bool CMSCollector::markFromRoots(bool asynch) { +bool CMSCollector::markFromRoots() { // we might be tempted to assert that: - // assert(asynch == !SafepointSynchronize::is_at_safepoint(), + // assert(!SafepointSynchronize::is_at_safepoint(), // "inconsistent argument?"); // However that wouldn't be right, because it's possible that // a safepoint is indeed in progress as a younger generation @@ -3494,37 +3221,28 @@ bool CMSCollector::markFromRoots(bool asynch) { check_correct_thread_executing(); verify_overflow_empty(); - bool res; - if (asynch) { - // Weak ref discovery note: We may be discovering weak - // refs in this generation concurrent (but interleaved) with - // weak ref discovery by a younger generation collector. + // Weak ref discovery note: We may be discovering weak + // refs in this generation concurrent (but interleaved) with + // weak ref discovery by a younger generation collector. - CMSTokenSyncWithLocks ts(true, bitMapLock()); - TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - CMSPhaseAccounting pa(this, "mark", _gc_tracer_cm->gc_id(), !PrintGCDetails); - res = markFromRootsWork(asynch); - if (res) { - _collectorState = Precleaning; - } else { // We failed and a foreground collection wants to take over - assert(_foregroundGCIsActive, "internal state inconsistency"); - assert(_restart_addr == NULL, "foreground will restart from scratch"); - if (PrintGCDetails) { - gclog_or_tty->print_cr("bailing out to foreground collection"); - } + CMSTokenSyncWithLocks ts(true, bitMapLock()); + TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); + CMSPhaseAccounting pa(this, "mark", _gc_tracer_cm->gc_id(), !PrintGCDetails); + bool res = markFromRootsWork(); + if (res) { + _collectorState = Precleaning; + } else { // We failed and a foreground collection wants to take over + assert(_foregroundGCIsActive, "internal state inconsistency"); + assert(_restart_addr == NULL, "foreground will restart from scratch"); + if (PrintGCDetails) { + gclog_or_tty->print_cr("bailing out to foreground collection"); } - } else { - assert(SafepointSynchronize::is_at_safepoint(), - "inconsistent with asynch == false"); - // already have locks - res = markFromRootsWork(asynch); - _collectorState = FinalMarking; } verify_overflow_empty(); return res; } -bool CMSCollector::markFromRootsWork(bool asynch) { +bool CMSCollector::markFromRootsWork() { // iterate over marked bits in bit map, doing a full scan and mark // from these roots using the following algorithm: // . if oop is to the right of the current scan pointer, @@ -3549,9 +3267,9 @@ bool CMSCollector::markFromRootsWork(bool asynch) { verify_overflow_empty(); bool result = false; if (CMSConcurrentMTEnabled && ConcGCThreads > 0) { - result = do_marking_mt(asynch); + result = do_marking_mt(); } else { - result = do_marking_st(asynch); + result = do_marking_st(); } return result; } @@ -3591,7 +3309,6 @@ class CMSConcMarkingTerminatorTerminator: public TerminatorTerminator { class CMSConcMarkingTask: public YieldingFlexibleGangTask { CMSCollector* _collector; int _n_workers; // requested/desired # workers - bool _asynch; bool _result; CompactibleFreeListSpace* _cms_space; char _pad_front[64]; // padding to ... @@ -3612,13 +3329,12 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask { public: CMSConcMarkingTask(CMSCollector* collector, CompactibleFreeListSpace* cms_space, - bool asynch, YieldingFlexibleWorkGang* workers, OopTaskQueueSet* task_queues): YieldingFlexibleGangTask("Concurrent marking done multi-threaded"), _collector(collector), _cms_space(cms_space), - _asynch(asynch), _n_workers(0), _result(true), + _n_workers(0), _result(true), _task_queues(task_queues), _term(_n_workers, task_queues, _collector), _bit_map_lock(collector->bitMapLock()) @@ -3645,8 +3361,7 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask { void work(uint worker_id); bool should_yield() { return ConcurrentMarkSweepThread::should_yield() - && !_collector->foregroundGCIsActive() - && _asynch; + && !_collector->foregroundGCIsActive(); } virtual void coordinator_yield(); // stuff done by coordinator @@ -3878,8 +3593,7 @@ void CMSConcMarkingTask::do_scan_and_mark(int i, CompactibleFreeListSpace* sp) { Par_MarkFromRootsClosure cl(this, _collector, my_span, &_collector->_markBitMap, work_queue(i), - &_collector->_markStack, - _asynch); + &_collector->_markStack); _collector->_markBitMap.iterate(&cl, my_span.start(), my_span.end()); } // else nothing to do for this task } // else nothing to do for this task @@ -4084,7 +3798,7 @@ void CMSConcMarkingTask::coordinator_yield() { _collector->startTimer(); } -bool CMSCollector::do_marking_mt(bool asynch) { +bool CMSCollector::do_marking_mt() { assert(ConcGCThreads > 0 && conc_workers() != NULL, "precondition"); int num_workers = AdaptiveSizePolicy::calc_active_conc_workers( conc_workers()->total_workers(), @@ -4096,7 +3810,6 @@ bool CMSCollector::do_marking_mt(bool asynch) { CMSConcMarkingTask tsk(this, cms_space, - asynch, conc_workers(), task_queues()); @@ -4125,7 +3838,7 @@ bool CMSCollector::do_marking_mt(bool asynch) { // If _restart_addr is non-NULL, a marking stack overflow // occurred; we need to do a fresh marking iteration from the // indicated restart address. - if (_foregroundGCIsActive && asynch) { + if (_foregroundGCIsActive) { // We may be running into repeated stack overflows, having // reached the limit of the stack size, while making very // slow forward progress. It may be best to bail out and @@ -4154,14 +3867,14 @@ bool CMSCollector::do_marking_mt(bool asynch) { return true; } -bool CMSCollector::do_marking_st(bool asynch) { +bool CMSCollector::do_marking_st() { ResourceMark rm; HandleMark hm; // Temporarily make refs discovery single threaded (non-MT) ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(ref_processor(), false); MarkFromRootsClosure markFromRootsClosure(this, _span, &_markBitMap, - &_markStack, CMSYield && asynch); + &_markStack, CMSYield); // the last argument to iterate indicates whether the iteration // should be incremental with periodic yields. _markBitMap.iterate(&markFromRootsClosure); @@ -4169,7 +3882,7 @@ bool CMSCollector::do_marking_st(bool asynch) { // occurred; we need to do a fresh iteration from the // indicated restart address. while (_restart_addr != NULL) { - if (_foregroundGCIsActive && asynch) { + if (_foregroundGCIsActive) { // We may be running into repeated stack overflows, having // reached the limit of the stack size, while making very // slow forward progress. It may be best to bail out and @@ -4703,8 +4416,7 @@ void CMSCollector::preclean_klasses(MarkRefsIntoAndScanClosure* cl, Mutex* freel verify_overflow_empty(); } -void CMSCollector::checkpointRootsFinal(bool asynch, - bool clear_all_soft_refs, bool init_mark_was_synchronous) { +void CMSCollector::checkpointRootsFinal() { assert(_collectorState == FinalMarking, "incorrect state transition?"); check_correct_thread_executing(); // world is stopped at this checkpoint @@ -4721,7 +4433,7 @@ void CMSCollector::checkpointRootsFinal(bool asynch, _young_gen->used() / K, _young_gen->capacity() / K); } - if (asynch) { + { if (CMSScavengeBeforeRemark) { GenCollectedHeap* gch = GenCollectedHeap::heap(); // Temporarily set flag to false, GCH->do_collection will @@ -4742,21 +4454,14 @@ void CMSCollector::checkpointRootsFinal(bool asynch, FreelistLocker x(this); MutexLockerEx y(bitMapLock(), Mutex::_no_safepoint_check_flag); - assert(!init_mark_was_synchronous, "but that's impossible!"); - checkpointRootsFinalWork(asynch, clear_all_soft_refs, false); - } else { - // already have all the locks - checkpointRootsFinalWork(asynch, clear_all_soft_refs, - init_mark_was_synchronous); + checkpointRootsFinalWork(); } verify_work_stacks_empty(); verify_overflow_empty(); SpecializationStats::print(); } -void CMSCollector::checkpointRootsFinalWork(bool asynch, - bool clear_all_soft_refs, bool init_mark_was_synchronous) { - +void CMSCollector::checkpointRootsFinalWork() { NOT_PRODUCT(GCTraceTime tr("checkpointRootsFinalWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());) assert(haveFreelistLocks(), "must have free list locks"); @@ -4773,60 +4478,54 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch, assert(haveFreelistLocks(), "must have free list locks"); assert_lock_strong(bitMapLock()); - if (!init_mark_was_synchronous) { - // We might assume that we need not fill TLAB's when - // CMSScavengeBeforeRemark is set, because we may have just done - // a scavenge which would have filled all TLAB's -- and besides - // Eden would be empty. This however may not always be the case -- - // for instance although we asked for a scavenge, it may not have - // happened because of a JNI critical section. We probably need - // a policy for deciding whether we can in that case wait until - // the critical section releases and then do the remark following - // the scavenge, and skip it here. In the absence of that policy, - // or of an indication of whether the scavenge did indeed occur, - // we cannot rely on TLAB's having been filled and must do - // so here just in case a scavenge did not happen. - gch->ensure_parsability(false); // fill TLAB's, but no need to retire them - // Update the saved marks which may affect the root scans. - gch->save_marks(); + // We might assume that we need not fill TLAB's when + // CMSScavengeBeforeRemark is set, because we may have just done + // a scavenge which would have filled all TLAB's -- and besides + // Eden would be empty. This however may not always be the case -- + // for instance although we asked for a scavenge, it may not have + // happened because of a JNI critical section. We probably need + // a policy for deciding whether we can in that case wait until + // the critical section releases and then do the remark following + // the scavenge, and skip it here. In the absence of that policy, + // or of an indication of whether the scavenge did indeed occur, + // we cannot rely on TLAB's having been filled and must do + // so here just in case a scavenge did not happen. + gch->ensure_parsability(false); // fill TLAB's, but no need to retire them + // Update the saved marks which may affect the root scans. + gch->save_marks(); - if (CMSPrintEdenSurvivorChunks) { - print_eden_and_survivor_chunk_arrays(); + if (CMSPrintEdenSurvivorChunks) { + print_eden_and_survivor_chunk_arrays(); + } + + { + COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;) + + // Note on the role of the mod union table: + // Since the marker in "markFromRoots" marks concurrently with + // mutators, it is possible for some reachable objects not to have been + // scanned. For instance, an only reference to an object A was + // placed in object B after the marker scanned B. Unless B is rescanned, + // A would be collected. Such updates to references in marked objects + // are detected via the mod union table which is the set of all cards + // dirtied since the first checkpoint in this GC cycle and prior to + // the most recent young generation GC, minus those cleaned up by the + // concurrent precleaning. + if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) { + GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id()); + do_remark_parallel(); + } else { + GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false, + _gc_timer_cm, _gc_tracer_cm->gc_id()); + do_remark_non_parallel(); } - - { - COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;) - - // Note on the role of the mod union table: - // Since the marker in "markFromRoots" marks concurrently with - // mutators, it is possible for some reachable objects not to have been - // scanned. For instance, an only reference to an object A was - // placed in object B after the marker scanned B. Unless B is rescanned, - // A would be collected. Such updates to references in marked objects - // are detected via the mod union table which is the set of all cards - // dirtied since the first checkpoint in this GC cycle and prior to - // the most recent young generation GC, minus those cleaned up by the - // concurrent precleaning. - if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) { - GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id()); - do_remark_parallel(); - } else { - GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false, - _gc_timer_cm, _gc_tracer_cm->gc_id()); - do_remark_non_parallel(); - } - } - } else { - assert(!asynch, "Can't have init_mark_was_synchronous in asynch mode"); - // The initial mark was stop-world, so there's no rescanning to - // do; go straight on to the next step below. } verify_work_stacks_empty(); verify_overflow_empty(); { NOT_PRODUCT(GCTraceTime ts("refProcessingWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());) - refProcessingWork(asynch, clear_all_soft_refs); + refProcessingWork(); } verify_work_stacks_empty(); verify_overflow_empty(); @@ -5872,8 +5571,7 @@ void CMSRefProcTaskExecutor::execute(EnqueueTask& task) workers->run_task(&enq_task); } -void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) { - +void CMSCollector::refProcessingWork() { ResourceMark rm; HandleMark hm; @@ -5881,7 +5579,7 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) { assert(rp->span().equals(_span), "Spans should be equal"); assert(!rp->enqueuing_is_done(), "Enqueuing should not be complete"); // Process weak references. - rp->setup_policy(clear_all_soft_refs); + rp->setup_policy(false); verify_work_stacks_empty(); CMSKeepAliveClosure cmsKeepAliveClosure(this, _span, &_markBitMap, @@ -6005,7 +5703,7 @@ void CMSCollector::check_correct_thread_executing() { } #endif -void CMSCollector::sweep(bool asynch) { +void CMSCollector::sweep() { assert(_collectorState == Sweeping, "just checking"); check_correct_thread_executing(); verify_work_stacks_empty(); @@ -6019,14 +5717,14 @@ void CMSCollector::sweep(bool asynch) { assert(!_intra_sweep_timer.is_active(), "Should not be active"); _intra_sweep_timer.reset(); _intra_sweep_timer.start(); - if (asynch) { + { TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); CMSPhaseAccounting pa(this, "sweep", _gc_tracer_cm->gc_id(), !PrintGCDetails); // First sweep the old gen { CMSTokenSyncWithLocks ts(true, _cmsGen->freelistLock(), bitMapLock()); - sweepWork(_cmsGen, asynch); + sweepWork(_cmsGen); } // Update Universe::_heap_*_at_gc figures. @@ -6040,13 +5738,6 @@ void CMSCollector::sweep(bool asynch) { Universe::update_heap_info_at_gc(); _collectorState = Resizing; } - } else { - // already have needed locks - sweepWork(_cmsGen, asynch); - // Update heap occupancy information which is used as - // input to soft ref clearing policy at the next gc. - Universe::update_heap_info_at_gc(); - _collectorState = Resizing; } verify_work_stacks_empty(); verify_overflow_empty(); @@ -6141,18 +5832,16 @@ void ConcurrentMarkSweepGeneration::update_gc_stats(int current_level, void ConcurrentMarkSweepGeneration::rotate_debug_collection_type() { if (PrintGCDetails && Verbose) { - gclog_or_tty->print("Rotate from %d ", _debug_collection_type); - } - _debug_collection_type = (CollectionTypes) (_debug_collection_type + 1); - _debug_collection_type = - (CollectionTypes) (_debug_collection_type % Unknown_collection_type); - if (PrintGCDetails && Verbose) { - gclog_or_tty->print_cr("to %d ", _debug_collection_type); + if (_debug_concurrent_cycle) { + gclog_or_tty->print_cr("Rotate from concurrent to STW collections"); + } else { + gclog_or_tty->print_cr("Rotate from STW to concurrent collections"); + } } + _debug_concurrent_cycle = !_debug_concurrent_cycle; } -void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen, - bool asynch) { +void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen) { // We iterate over the space(s) underlying this generation, // checking the mark bit map to see if the bits corresponding // to specific blocks are marked or not. Blocks that are @@ -6180,9 +5869,7 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen, // check that we hold the requisite locks assert(have_cms_token(), "Should hold cms token"); - assert( (asynch && ConcurrentMarkSweepThread::cms_thread_has_cms_token()) - || (!asynch && ConcurrentMarkSweepThread::vm_thread_has_cms_token()), - "Should possess CMS token to sweep"); + assert(ConcurrentMarkSweepThread::cms_thread_has_cms_token(), "Should possess CMS token to sweep"); assert_lock_strong(gen->freelistLock()); assert_lock_strong(bitMapLock()); @@ -6194,8 +5881,7 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen, gen->setNearLargestChunk(); { - SweepClosure sweepClosure(this, gen, &_markBitMap, - CMSYield && asynch); + SweepClosure sweepClosure(this, gen, &_markBitMap, CMSYield); gen->cmsSpace()->blk_iterate_careful(&sweepClosure); // We need to free-up/coalesce garbage/blocks from a // co-terminal free run. This is done in the SweepClosure @@ -6213,8 +5899,8 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen, // Reset CMS data structures (for now just the marking bit map) // preparatory for the next cycle. -void CMSCollector::reset(bool asynch) { - if (asynch) { +void CMSCollector::reset(bool concurrent) { + if (concurrent) { CMSTokenSyncWithLocks ts(true, bitMapLock()); // If the state is not "Resetting", the foreground thread @@ -6293,7 +5979,7 @@ void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) { switch (op) { case CMS_op_checkpointRootsInitial: { SvcGCMarker sgcm(SvcGCMarker::OTHER); - checkpointRootsInitial(true); // asynch + checkpointRootsInitial(); if (PrintGC) { _cmsGen->printOccupancy("initial-mark"); } @@ -6301,9 +5987,7 @@ void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) { } case CMS_op_checkpointRootsFinal: { SvcGCMarker sgcm(SvcGCMarker::OTHER); - checkpointRootsFinal(true, // asynch - false, // !clear_all_soft_refs - false); // !init_mark_was_synchronous + checkpointRootsFinal(); if (PrintGC) { _cmsGen->printOccupancy("remark"); } @@ -7193,8 +6877,7 @@ Par_MarkFromRootsClosure::Par_MarkFromRootsClosure(CMSConcMarkingTask* task, CMSCollector* collector, MemRegion span, CMSBitMap* bit_map, OopTaskQueue* work_queue, - CMSMarkStack* overflow_stack, - bool should_yield): + CMSMarkStack* overflow_stack): _collector(collector), _whole_span(collector->_span), _span(span), @@ -7202,7 +6885,6 @@ Par_MarkFromRootsClosure::Par_MarkFromRootsClosure(CMSConcMarkingTask* task, _mut(&collector->_modUnionTable), _work_queue(work_queue), _overflow_stack(overflow_stack), - _yield(should_yield), _skip_bits(0), _task(task) { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index e46c01e400c..aa117dec415 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -608,7 +608,6 @@ class CMSCollector: public CHeapObj { GCHeapSummary _last_heap_summary; MetaspaceSummary _last_metaspace_summary; - void register_foreground_gc_start(GCCause::Cause cause); void register_gc_start(GCCause::Cause cause); void register_gc_end(); void save_heap_summary(); @@ -695,8 +694,6 @@ class CMSCollector: public CHeapObj { int _numYields; size_t _numDirtyCards; size_t _sweep_count; - // Number of full gc's since the last concurrent gc. - uint _full_gcs_since_conc_gc; // Occupancy used for bootstrapping stats double _bootstrap_occupancy; @@ -760,14 +757,14 @@ class CMSCollector: public CHeapObj { NOT_PRODUCT(bool par_simulate_overflow();) // MT version // CMS work methods - void checkpointRootsInitialWork(bool asynch); // Initial checkpoint work + void checkpointRootsInitialWork(); // Initial checkpoint work // A return value of false indicates failure due to stack overflow - bool markFromRootsWork(bool asynch); // Concurrent marking work + bool markFromRootsWork(); // Concurrent marking work public: // FIX ME!!! only for testing - bool do_marking_st(bool asynch); // Single-threaded marking - bool do_marking_mt(bool asynch); // Multi-threaded marking + bool do_marking_st(); // Single-threaded marking + bool do_marking_mt(); // Multi-threaded marking private: @@ -788,20 +785,19 @@ class CMSCollector: public CHeapObj { void reset_survivor_plab_arrays(); // Final (second) checkpoint work - void checkpointRootsFinalWork(bool asynch, bool clear_all_soft_refs, - bool init_mark_was_synchronous); + void checkpointRootsFinalWork(); // Work routine for parallel version of remark void do_remark_parallel(); // Work routine for non-parallel version of remark void do_remark_non_parallel(); // Reference processing work routine (during second checkpoint) - void refProcessingWork(bool asynch, bool clear_all_soft_refs); + void refProcessingWork(); // Concurrent sweeping work - void sweepWork(ConcurrentMarkSweepGeneration* gen, bool asynch); + void sweepWork(ConcurrentMarkSweepGeneration* gen); // (Concurrent) resetting of support data structures - void reset(bool asynch); + void reset(bool concurrent); // Clear _expansion_cause fields of constituent generations void clear_expansion_cause(); @@ -810,22 +806,10 @@ class CMSCollector: public CHeapObj { // used regions of each generation to limit the extent of sweep void save_sweep_limits(); - // A work method used by foreground collection to determine - // what type of collection (compacting or not, continuing or fresh) - // it should do. - void decide_foreground_collection_type(bool clear_all_soft_refs, - bool* should_compact, bool* should_start_over); - // A work method used by the foreground collector to do // a mark-sweep-compact. void do_compaction_work(bool clear_all_soft_refs); - // A work method used by the foreground collector to do - // a mark-sweep, after taking over from a possibly on-going - // concurrent mark-sweep collection. - void do_mark_sweep_work(bool clear_all_soft_refs, - CollectorState first_state, bool should_start_over); - // Work methods for reporting concurrent mode interruption or failure bool is_external_interruption(); void report_concurrent_mode_interruption(); @@ -868,15 +852,13 @@ class CMSCollector: public CHeapObj { // Locking checks NOT_PRODUCT(static bool have_cms_token();) - // XXXPERM bool should_collect(bool full, size_t size, bool tlab); bool shouldConcurrentCollect(); void collect(bool full, bool clear_all_soft_refs, size_t size, bool tlab); - void collect_in_background(bool clear_all_soft_refs, GCCause::Cause cause); - void collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause); + void collect_in_background(GCCause::Cause cause); // In support of ExplicitGCInvokesConcurrent static void request_full_gc(unsigned int full_gc_count, GCCause::Cause cause); @@ -928,18 +910,16 @@ class CMSCollector: public CHeapObj { void directAllocated(HeapWord* start, size_t size); // Main CMS steps and related support - void checkpointRootsInitial(bool asynch); - bool markFromRoots(bool asynch); // a return value of false indicates failure - // due to stack overflow + void checkpointRootsInitial(); + bool markFromRoots(); // a return value of false indicates failure + // due to stack overflow void preclean(); - void checkpointRootsFinal(bool asynch, bool clear_all_soft_refs, - bool init_mark_was_synchronous); - void sweep(bool asynch); + void checkpointRootsFinal(); + void sweep(); // Check that the currently executing thread is the expected // one (foreground collector or background collector). static void check_correct_thread_executing() PRODUCT_RETURN; - // XXXPERM void print_statistics() PRODUCT_RETURN; bool is_cms_reachable(HeapWord* addr); @@ -1060,14 +1040,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { // In support of MinChunkSize being larger than min object size const double _dilatation_factor; - enum CollectionTypes { - Concurrent_collection_type = 0, - MS_foreground_collection_type = 1, - MSC_foreground_collection_type = 2, - Unknown_collection_type = 3 - }; - - CollectionTypes _debug_collection_type; + bool _debug_concurrent_cycle; // True if a compacting collection was done. bool _did_compact; @@ -1152,7 +1125,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { // hack to allow the collection of the younger gen first if the flag is // set. virtual bool full_collects_younger_generations() const { - return UseCMSCompactAtFullCollection && !ScavengeBeforeFullGC; + return !ScavengeBeforeFullGC; } void space_iterate(SpaceClosure* blk, bool usedOnly = false); @@ -1296,7 +1269,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { // collection. void compute_new_size_free_list(); - CollectionTypes debug_collection_type() { return _debug_collection_type; } + bool debug_concurrent_cycle() { return _debug_concurrent_cycle; } void rotate_debug_collection_type(); }; @@ -1344,7 +1317,6 @@ class Par_MarkFromRootsClosure: public BitMapClosure { CMSBitMap* _mut; OopTaskQueue* _work_queue; CMSMarkStack* _overflow_stack; - bool _yield; int _skip_bits; HeapWord* _finger; HeapWord* _threshold; @@ -1354,8 +1326,7 @@ class Par_MarkFromRootsClosure: public BitMapClosure { MemRegion span, CMSBitMap* bit_map, OopTaskQueue* work_queue, - CMSMarkStack* overflow_stack, - bool should_yield); + CMSMarkStack* overflow_stack); bool do_bit(size_t offset); inline void do_yield_check(); diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp index 53eb0a80976..b80830bf234 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp @@ -398,8 +398,7 @@ inline void MarkFromRootsClosure::do_yield_check() { inline void Par_MarkFromRootsClosure::do_yield_check() { if (ConcurrentMarkSweepThread::should_yield() && - !_collector->foregroundGCIsActive() && - _yield) { + !_collector->foregroundGCIsActive()) { do_yield_work(); } } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp index 8e31f5610d2..b588cce717e 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp @@ -134,7 +134,7 @@ void ConcurrentMarkSweepThread::run() { if (_should_terminate) break; GCCause::Cause cause = _collector->_full_gc_requested ? _collector->_full_gc_cause : GCCause::_cms_concurrent_mark; - _collector->collect_in_background(false, cause); + _collector->collect_in_background(cause); } assert(_should_terminate, "just checking"); // Check that the state of any protocol for synchronization diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index d06ccf47e2d..f9adba7985a 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2202,15 +2202,6 @@ void Arguments::check_deprecated_gc_flags() { warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. " "Use MaxRAMFraction instead."); } - if (FLAG_IS_CMDLINE(UseCMSCompactAtFullCollection)) { - warning("UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release."); - } - if (FLAG_IS_CMDLINE(CMSFullGCsBeforeCompaction)) { - warning("CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release."); - } - if (FLAG_IS_CMDLINE(UseCMSCollectionPassing)) { - warning("UseCMSCollectionPassing is deprecated and will likely be removed in a future release."); - } } // Check stack pages settings diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 580d3867f59..3d296d09162 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1529,9 +1529,6 @@ class CommandLineFlags { product(bool, UseCMSBestFit, true, \ "Use CMS best fit allocation strategy") \ \ - product(bool, UseCMSCollectionPassing, true, \ - "Use passing of collection from background to foreground") \ - \ product(bool, UseParNewGC, false, \ "Use parallel threads in the new generation") \ \ @@ -1707,16 +1704,6 @@ class CommandLineFlags { "When CMS class unloading is enabled, the maximum CMS cycle " \ "count for which classes may not be unloaded") \ \ - product(bool, CMSCompactWhenClearAllSoftRefs, true, \ - "Compact when asked to collect CMS gen with " \ - "clear_all_soft_refs()") \ - \ - product(bool, UseCMSCompactAtFullCollection, true, \ - "Use Mark-Sweep-Compact algorithm at full collections") \ - \ - product(uintx, CMSFullGCsBeforeCompaction, 0, \ - "Number of CMS full collection done before compaction if > 0") \ - \ develop(intx, CMSDictionaryChoice, 0, \ "Use BinaryTreeDictionary as default in the CMS generation") \ \ diff --git a/hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java b/hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java deleted file mode 100644 index e548539c0e0..00000000000 --- a/hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 CheckAllocateAndSystemGC - * @summary CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456 - * @bug 8013032 - * @key gc - * @key regression - * @library /testlibrary - * @run main/othervm CheckAllocateAndSystemGC - * @author jon.masamitsu@oracle.com - */ - -import com.oracle.java.testlibrary.*; - -public class CheckAllocateAndSystemGC { - public static void main(String args[]) throws Exception { - - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-showversion", - "-XX:+UseConcMarkSweepGC", - "-Xmn4m", - "-XX:MaxTenuringThreshold=1", - "-XX:-UseCMSCompactAtFullCollection", - "CheckAllocateAndSystemGC$AllocateAndSystemGC" - ); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - - output.shouldNotContain("error"); - - output.shouldHaveExitValue(0); - } - static class AllocateAndSystemGC { - public static void main(String [] args) { - Integer x[] = new Integer [1000]; - // Allocate enough objects to cause a minor collection. - // These allocations suffice for a 4m young geneneration. - for (int i = 0; i < 100; i++) { - Integer y[] = new Integer[10000]; - } - System.gc(); - } - } -} diff --git a/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java b/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java deleted file mode 100644 index c590f3dcb30..00000000000 --- a/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 SystemGCOnForegroundCollector - * @summary CMS: Call reset_after_compaction() only if a compaction has been done - * @bug 8013184 - * @key gc - * @key regression - * @library /testlibrary - * @run main/othervm SystemGCOnForegroundCollector - * @author jon.masamitsu@oracle.com - */ - -import com.oracle.java.testlibrary.*; - -public class SystemGCOnForegroundCollector { - public static void main(String args[]) throws Exception { - - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-showversion", - "-XX:+UseConcMarkSweepGC", - "-XX:MaxTenuringThreshold=1", - "-XX:-UseCMSCompactAtFullCollection", - ThreePlusMSSystemGC.class.getName() - ); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - - output.shouldNotContain("error"); - - output.shouldHaveExitValue(0); - } - - static class ThreePlusMSSystemGC { - public static void main(String [] args) { - // From running this test 3 System.gc() were always - // enough to see the failure but the cause of the failure - // depends on how objects are allocated in the CMS generation - // which is non-deterministic. Use 30 iterations for a more - // reliable test. - for (int i = 0; i < 30; i++) { - System.gc(); - } - } - } -} diff --git a/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java b/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java deleted file mode 100644 index ead8788524a..00000000000 --- a/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java +++ /dev/null @@ -1,52 +0,0 @@ -/* -* 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 TestCMSForegroundFlags -* @key gc -* @bug 8027132 -* @summary Test that the deprecated CMS foreground collector flags print warning messages -* @library /testlibrary -* @run main TestCMSForegroundFlags -XX:-UseCMSCompactAtFullCollection UseCMSCompactAtFullCollection -* @run main TestCMSForegroundFlags -XX:CMSFullGCsBeforeCompaction=4 CMSFullGCsBeforeCompaction -* @run main TestCMSForegroundFlags -XX:-UseCMSCollectionPassing UseCMSCollectionPassing -*/ - -import com.oracle.java.testlibrary.OutputAnalyzer; -import com.oracle.java.testlibrary.ProcessTools; - -public class TestCMSForegroundFlags { - public static void main(String[] args) throws Exception { - if (args.length != 2) { - throw new Exception("Expected two arguments,flagValue and flagName"); - } - String flagValue = args[0]; - String flagName = args[1]; - - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagValue, "-version"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("warning: " + flagName + " is deprecated and will likely be removed in a future release."); - output.shouldNotContain("error"); - output.shouldHaveExitValue(0); - } -} From f3997d8eedaec622eb19a892fa08ea004dfbfcdb Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Tue, 18 Nov 2014 10:36:42 +0100 Subject: [PATCH 020/159] 8064721: The card tables only ever need two covering regions Reviewed-by: jmasa, tschatzl, kbarrett --- .../gc_implementation/g1/g1CollectedHeap.cpp | 2 +- .../g1/g1SATBCardTableModRefBS.cpp | 10 ++++------ .../g1/g1SATBCardTableModRefBS.hpp | 6 ++---- .../parallelScavenge/cardTableExtension.hpp | 4 ++-- .../parallelScavenge/parallelScavengeHeap.cpp | 2 +- hotspot/src/share/vm/memory/barrierSet.hpp | 19 ++++++------------- .../src/share/vm/memory/cardTableModRefBS.cpp | 5 ++--- .../src/share/vm/memory/cardTableModRefBS.hpp | 7 +++---- hotspot/src/share/vm/memory/cardTableRS.cpp | 13 +++++-------- hotspot/src/share/vm/memory/cardTableRS.hpp | 5 +++-- .../src/share/vm/memory/collectorPolicy.cpp | 5 ++--- .../src/share/vm/memory/collectorPolicy.hpp | 5 +---- .../src/share/vm/memory/genCollectedHeap.cpp | 14 ++------------ .../src/share/vm/memory/genCollectedHeap.hpp | 4 +--- .../src/share/vm/memory/generationSpec.hpp | 4 ---- .../src/share/vm/memory/modRefBarrierSet.hpp | 4 ---- hotspot/src/share/vm/runtime/vmStructs.cpp | 1 - 17 files changed, 35 insertions(+), 75 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index e2ae3205d51..8d51bbfcdfd 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1888,7 +1888,7 @@ jint G1CollectedHeap::initialize() { initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size())); // Create the gen rem set (and barrier set) for the entire reserved region. - _rem_set = collector_policy()->create_rem_set(reserved_region(), 2); + _rem_set = collector_policy()->create_rem_set(reserved_region()); set_barrier_set(rem_set()->bs()); if (!barrier_set()->is_a(BarrierSet::G1SATBCTLogging)) { vm_exit_during_initialization("G1 requires a G1SATBLoggingCardTableModRefBS"); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp index 7e1c8c08105..1e3788858b0 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp @@ -32,9 +32,8 @@ #include "runtime/orderAccess.inline.hpp" #include "runtime/thread.inline.hpp" -G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap, - int max_covered_regions) : - CardTableModRefBSForCTRS(whole_heap, max_covered_regions) +G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap) : + CardTableModRefBSForCTRS(whole_heap) { _kind = G1SATBCT; } @@ -132,9 +131,8 @@ void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, si } G1SATBCardTableLoggingModRefBS:: -G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, - int max_covered_regions) : - G1SATBCardTableModRefBS(whole_heap, max_covered_regions), +G1SATBCardTableLoggingModRefBS(MemRegion whole_heap) : + G1SATBCardTableModRefBS(whole_heap), _dcqs(JavaThread::dirty_card_queue_set()), _listener() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp index 1fbe45faaea..6a06523d0cb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp @@ -50,8 +50,7 @@ public: // pre-marking object graph. static void enqueue(oop pre_val); - G1SATBCardTableModRefBS(MemRegion whole_heap, - int max_covered_regions); + G1SATBCardTableModRefBS(MemRegion whole_heap); bool is_a(BarrierSet::Name bsn) { return bsn == BarrierSet::G1SATBCT || CardTableModRefBS::is_a(bsn); @@ -152,8 +151,7 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS { return ReservedSpace::allocation_align_size_up(number_of_slots); } - G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, - int max_covered_regions); + G1SATBCardTableLoggingModRefBS(MemRegion whole_heap); virtual void initialize() { } virtual void initialize(G1RegionToSpaceMapper* mapper); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp index 733b5c91ad9..1fc55ad081b 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp @@ -53,8 +53,8 @@ class CardTableExtension : public CardTableModRefBS { verify_card = CardTableModRefBS::CT_MR_BS_last_reserved + 5 }; - CardTableExtension(MemRegion whole_heap, int max_covered_regions) : - CardTableModRefBS(whole_heap, max_covered_regions) { } + CardTableExtension(MemRegion whole_heap) : + CardTableModRefBS(whole_heap) { } // Too risky for the 4/10/02 putback // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp index 4e1a1b06323..0a410ccb0f6 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp @@ -76,7 +76,7 @@ jint ParallelScavengeHeap::initialize() { initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size())); - CardTableExtension* const barrier_set = new CardTableExtension(reserved_region(), 3); + CardTableExtension* const barrier_set = new CardTableExtension(reserved_region()); barrier_set->initialize(); _barrier_set = barrier_set; oopDesc::set_bs(_barrier_set); diff --git a/hotspot/src/share/vm/memory/barrierSet.hpp b/hotspot/src/share/vm/memory/barrierSet.hpp index 3a5342bc9fc..08d354c36df 100644 --- a/hotspot/src/share/vm/memory/barrierSet.hpp +++ b/hotspot/src/share/vm/memory/barrierSet.hpp @@ -49,7 +49,12 @@ public: TargetUninitialized = 1 }; protected: - int _max_covered_regions; + // Some barrier sets create tables whose elements correspond to parts of + // the heap; the CardTableModRefBS is an example. Such barrier sets will + // normally reserve space for such tables, and commit parts of the table + // "covering" parts of the heap that are committed. At most one covered + // region per generation is needed. + static const int _max_covered_regions = 2; Name _kind; public: @@ -159,18 +164,6 @@ public: protected: virtual void write_region_work(MemRegion mr) = 0; public: - - // Some barrier sets create tables whose elements correspond to parts of - // the heap; the CardTableModRefBS is an example. Such barrier sets will - // normally reserve space for such tables, and commit parts of the table - // "covering" parts of the heap that are committed. The constructor is - // passed the maximum number of independently committable subregions to - // be covered, and the "resize_covered_region" function allows the - // sub-parts of the heap to inform the barrier set of changes of their - // sizes. - BarrierSet(int max_covered_regions) : - _max_covered_regions(max_covered_regions) {} - // Inform the BarrierSet that the the covered heap region that starts // with "base" has been changed to have the given size (possibly from 0, // for initialization.) diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp index 30e8618d597..8446d290266 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp @@ -53,9 +53,8 @@ size_t CardTableModRefBS::compute_byte_map_size() return align_size_up(_guard_index + 1, MAX2(_page_size, granularity)); } -CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap, - int max_covered_regions): - ModRefBarrierSet(max_covered_regions), +CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap) : + ModRefBarrierSet(), _whole_heap(whole_heap), _guard_index(0), _guard_region(), diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp index c824e6185a0..04a1cb1b937 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp @@ -284,7 +284,7 @@ public: return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn); } - CardTableModRefBS(MemRegion whole_heap, int max_covered_regions); + CardTableModRefBS(MemRegion whole_heap); ~CardTableModRefBS(); virtual void initialize(); @@ -482,9 +482,8 @@ protected: bool card_will_be_scanned(jbyte cv); bool card_may_have_been_dirty(jbyte cv); public: - CardTableModRefBSForCTRS(MemRegion whole_heap, - int max_covered_regions) : - CardTableModRefBS(whole_heap, max_covered_regions) {} + CardTableModRefBSForCTRS(MemRegion whole_heap) : + CardTableModRefBS(whole_heap) {} void set_CTRS(CardTableRS* rs) { _rs = rs; } }; diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp index 90f72d19efd..c3b8968cb07 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.cpp +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp @@ -38,21 +38,18 @@ #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" #endif // INCLUDE_ALL_GCS -CardTableRS::CardTableRS(MemRegion whole_heap, - int max_covered_regions) : +CardTableRS::CardTableRS(MemRegion whole_heap) : GenRemSet(), - _cur_youngergen_card_val(youngergenP1_card), - _regions_to_iterate(max_covered_regions - 1) + _cur_youngergen_card_val(youngergenP1_card) { #if INCLUDE_ALL_GCS if (UseG1GC) { - _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap, - max_covered_regions); + _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap); } else { - _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions); + _ct_bs = new CardTableModRefBSForCTRS(whole_heap); } #else - _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions); + _ct_bs = new CardTableModRefBSForCTRS(whole_heap); #endif _ct_bs->initialize(); set_bs(_ct_bs); diff --git a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp index 873b3f62f94..a9bfef87b76 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.hpp +++ b/hotspot/src/share/vm/memory/cardTableRS.hpp @@ -83,7 +83,8 @@ class CardTableRS: public GenRemSet { jbyte _cur_youngergen_card_val; - int _regions_to_iterate; + // Number of generations, plus one for lingering PermGen issues in CardTableRS. + static const int _regions_to_iterate = 3; jbyte cur_youngergen_card_val() { return _cur_youngergen_card_val; @@ -101,7 +102,7 @@ class CardTableRS: public GenRemSet { jbyte find_unused_youngergenP_card_value(); public: - CardTableRS(MemRegion whole_heap, int max_covered_regions); + CardTableRS(MemRegion whole_heap); ~CardTableRS(); // *** GenRemSet functions. diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp index fa07a5794de..86c7a979d93 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp @@ -152,9 +152,8 @@ bool CollectorPolicy::use_should_clear_all_soft_refs(bool v) { return result; } -GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap, - int max_covered_regions) { - return new CardTableRS(whole_heap, max_covered_regions); +GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap) { + return new CardTableRS(whole_heap); } void CollectorPolicy::cleared_all_soft_refs() { diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp index d923cf36a27..6f20be7f6dc 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.hpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp @@ -152,10 +152,7 @@ class CollectorPolicy : public CHeapObj { virtual BarrierSet::Name barrier_set_name() = 0; - // Create the remembered set (to cover the given reserved region, - // allowing breaking up into at most "max_covered_regions"). - virtual GenRemSet* create_rem_set(MemRegion reserved, - int max_covered_regions); + virtual GenRemSet* create_rem_set(MemRegion reserved); // This method controls how a collector satisfies a request // for a block of memory. "gc_time_limit_was_exceeded" will diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 28a062825c3..bf7a3f7f0a5 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -109,13 +109,11 @@ jint GenCollectedHeap::initialize() { char* heap_address; size_t total_reserved = 0; - int n_covered_regions = 0; ReservedSpace heap_rs; size_t heap_alignment = collector_policy()->heap_alignment(); - heap_address = allocate(heap_alignment, &total_reserved, - &n_covered_regions, &heap_rs); + heap_address = allocate(heap_alignment, &total_reserved, &heap_rs); if (!heap_rs.is_reserved()) { vm_shutdown_during_initialization( @@ -125,7 +123,7 @@ jint GenCollectedHeap::initialize() { initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size())); - _rem_set = collector_policy()->create_rem_set(reserved_region(), n_covered_regions); + _rem_set = collector_policy()->create_rem_set(reserved_region()); set_barrier_set(rem_set()->bs()); _gch = this; @@ -152,14 +150,12 @@ jint GenCollectedHeap::initialize() { char* GenCollectedHeap::allocate(size_t alignment, size_t* _total_reserved, - int* _n_covered_regions, ReservedSpace* heap_rs){ const char overflow_msg[] = "The size of the object heap + VM data exceeds " "the maximum representable size"; // Now figure out the total size. size_t total_reserved = 0; - int n_covered_regions = 0; const size_t pageSize = UseLargePages ? os::large_page_size() : os::vm_page_size(); @@ -170,18 +166,12 @@ char* GenCollectedHeap::allocate(size_t alignment, if (total_reserved < _gen_specs[i]->max_size()) { vm_exit_during_initialization(overflow_msg); } - n_covered_regions += _gen_specs[i]->n_covered_regions(); } assert(total_reserved % alignment == 0, err_msg("Gen size; total_reserved=" SIZE_FORMAT ", alignment=" SIZE_FORMAT, total_reserved, alignment)); - // Needed until the cardtable is fixed to have the right number - // of covered regions. - n_covered_regions += 2; - *_total_reserved = total_reserved; - *_n_covered_regions = n_covered_regions; *heap_rs = Universe::reserve_heap(total_reserved, alignment); return heap_rs->base(); diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index dab317d71ff..e4615b3b76b 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -121,9 +121,7 @@ public: // Returns JNI_OK on success virtual jint initialize(); - char* allocate(size_t alignment, - size_t* _total_reserved, int* _n_covered_regions, - ReservedSpace* heap_rs); + char* allocate(size_t alignment, size_t* _total_reserved, ReservedSpace* heap_rs); // Does operations required after initialization has been done. void post_initialize(); diff --git a/hotspot/src/share/vm/memory/generationSpec.hpp b/hotspot/src/share/vm/memory/generationSpec.hpp index 64ebd270b43..58448a496af 100644 --- a/hotspot/src/share/vm/memory/generationSpec.hpp +++ b/hotspot/src/share/vm/memory/generationSpec.hpp @@ -59,10 +59,6 @@ public: set_init_size(align_size_up(init_size(), alignment)); set_max_size(align_size_up(max_size(), alignment)); } - - // Return the number of regions contained in the generation which - // might need to be independently covered by a remembered set. - virtual int n_covered_regions() const { return 1; } }; typedef GenerationSpec* GenerationSpecPtr; diff --git a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp index ec89a235d70..a320e61c854 100644 --- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp +++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp @@ -95,10 +95,6 @@ public: // The caller guarantees that "mr" contains no references. (Perhaps it's // objects have been moved elsewhere.) virtual void clear(MemRegion mr) = 0; - - // Pass along the argument to the superclass. - ModRefBarrierSet(int max_covered_regions) : - BarrierSet(max_covered_regions) {} }; #endif // SHARE_VM_MEMORY_MODREFBARRIERSET_HPP diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 9c1cec41a39..cbd7aa43a37 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -473,7 +473,6 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; \ unchecked_nonstatic_field(ageTable, sizes, sizeof(ageTable::sizes)) \ \ - nonstatic_field(BarrierSet, _max_covered_regions, int) \ nonstatic_field(BarrierSet, _kind, BarrierSet::Name) \ nonstatic_field(BlockOffsetTable, _bottom, HeapWord*) \ nonstatic_field(BlockOffsetTable, _end, HeapWord*) \ From 2da855a25934dd648e039f437cf741ef1d4c8b49 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 18 Nov 2014 10:39:16 +0100 Subject: [PATCH 021/159] 8064865: Remove the debug funciontality RotateCMSCollectionTypes for CMS Reviewed-by: jmasa, kbarrett, ysr --- .../concurrentMarkSweepGeneration.cpp | 26 ------------------- .../concurrentMarkSweepGeneration.hpp | 5 ---- hotspot/src/share/vm/runtime/globals.hpp | 3 --- 3 files changed, 34 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index b94bd52a3a9..c088c7d130c 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -192,7 +192,6 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration( FreeBlockDictionary::DictionaryChoice dictionaryChoice) : CardGeneration(rs, initial_byte_size, level, ct), _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))), - _debug_concurrent_cycle(true), _did_compact(false) { HeapWord* bottom = (HeapWord*) _virtual_space.low(); @@ -1245,14 +1244,6 @@ bool CMSCollector::shouldConcurrentCollect() { return true; } - // For debugging purposes, change the type of collection. - // Rotate between concurrent and stop-the-world full GCs. - NOT_PRODUCT( - if (RotateCMSCollectionTypes) { - return _cmsGen->debug_concurrent_cycle(); - } - ) - FreelistLocker x(this); // ------------------------------------------------------------------ // Print out lots of information which affects the initiation of @@ -5830,17 +5821,6 @@ void ConcurrentMarkSweepGeneration::update_gc_stats(int current_level, } } -void ConcurrentMarkSweepGeneration::rotate_debug_collection_type() { - if (PrintGCDetails && Verbose) { - if (_debug_concurrent_cycle) { - gclog_or_tty->print_cr("Rotate from concurrent to STW collections"); - } else { - gclog_or_tty->print_cr("Rotate from STW to concurrent collections"); - } - } - _debug_concurrent_cycle = !_debug_concurrent_cycle; -} - void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen) { // We iterate over the space(s) underlying this generation, // checking the mark bit map to see if the bits corresponding @@ -5961,12 +5941,6 @@ void CMSCollector::reset(bool concurrent) { _collectorState = Idling; } - NOT_PRODUCT( - if (RotateCMSCollectionTypes) { - _cmsGen->rotate_debug_collection_type(); - } - ) - register_gc_end(); } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index aa117dec415..58ee68d7b27 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -1040,8 +1040,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { // In support of MinChunkSize being larger than min object size const double _dilatation_factor; - bool _debug_concurrent_cycle; - // True if a compacting collection was done. bool _did_compact; bool did_compact() { return _did_compact; } @@ -1268,9 +1266,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { // Resize the generation after a non-compacting // collection. void compute_new_size_free_list(); - - bool debug_concurrent_cycle() { return _debug_concurrent_cycle; } - void rotate_debug_collection_type(); }; // diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 3d296d09162..8420890b566 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1523,9 +1523,6 @@ class CommandLineFlags { develop(bool, UseAsyncConcMarkSweepGC, true, \ "Use Asynchronous Concurrent Mark-Sweep GC in the old generation")\ \ - develop(bool, RotateCMSCollectionTypes, false, \ - "Rotate the CMS collections among concurrent and STW") \ - \ product(bool, UseCMSBestFit, true, \ "Use CMS best fit allocation strategy") \ \ From a324ff0f31379653fa0c1fbdf6d74cfc22a21c4e Mon Sep 17 00:00:00 2001 From: Erik Osterlund Date: Tue, 21 Oct 2014 15:07:25 +0200 Subject: [PATCH 022/159] 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms Use the native cmpxchgb instruction on x86. Reviewed-by: dholmes, kbarrett, phh --- .../src/cpu/sparc/vm/stubGenerator_sparc.cpp | 1 + hotspot/src/cpu/x86/vm/assembler_x86.cpp | 11 +++++++ hotspot/src/cpu/x86/vm/assembler_x86.hpp | 1 + .../src/cpu/x86/vm/stubGenerator_x86_64.cpp | 33 +++++++++++++++++-- .../src/cpu/zero/vm/stubGenerator_zero.cpp | 1 + .../bsd_x86/vm/atomic_bsd_x86.inline.hpp | 9 +++++ .../linux_x86/vm/atomic_linux_x86.inline.hpp | 9 +++++ .../vm/atomic_solaris_x86.inline.hpp | 16 +++++++++ .../os_cpu/solaris_x86/vm/solaris_x86_32.il | 17 ++++++++++ .../os_cpu/solaris_x86/vm/solaris_x86_64.il | 9 +++++ .../vm/atomic_windows_x86.inline.hpp | 18 ++++++++++ .../os_cpu/windows_x86/vm/os_windows_x86.cpp | 19 +++++++++++ .../os_cpu/windows_x86/vm/os_windows_x86.hpp | 2 ++ hotspot/src/share/vm/runtime/atomic.cpp | 8 ++++- hotspot/src/share/vm/runtime/atomic.hpp | 5 ++- .../src/share/vm/runtime/atomic.inline.hpp | 8 +++++ hotspot/src/share/vm/runtime/stubRoutines.cpp | 1 + hotspot/src/share/vm/runtime/stubRoutines.hpp | 2 ++ 18 files changed, 165 insertions(+), 5 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp index e4cc113c2e2..780120bd60d 100644 --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp @@ -4813,6 +4813,7 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_atomic_add_entry = generate_atomic_add(); StubRoutines::_atomic_xchg_ptr_entry = StubRoutines::_atomic_xchg_entry; StubRoutines::_atomic_cmpxchg_ptr_entry = StubRoutines::_atomic_cmpxchg_entry; + StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long(); StubRoutines::_atomic_add_ptr_entry = StubRoutines::_atomic_add_entry; #endif // COMPILER2 !=> _LP64 diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index 8098e889ba9..f61e0a0917c 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -1297,6 +1297,17 @@ void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg emit_operand(reg, adr); } +// The 8-bit cmpxchg compares the value at adr with the contents of rax, +// and stores reg into adr if so; otherwise, the value at adr is loaded into rax,. +// The ZF is set if the compared values were equal, and cleared otherwise. +void Assembler::cmpxchgb(Register reg, Address adr) { // cmpxchg + InstructionMark im(this); + prefix(adr, reg, true); + emit_int8(0x0F); + emit_int8((unsigned char)0xB0); + emit_operand(reg, adr); +} + void Assembler::comisd(XMMRegister dst, Address src) { // NOTE: dbx seems to decode this as comiss even though the // 0x66 is there. Strangly ucomisd comes out correct diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp index ef16f27538f..3f3fff83d66 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp @@ -1006,6 +1006,7 @@ private: void cmpxchg8 (Address adr); + void cmpxchgb(Register reg, Address adr); void cmpxchgl(Register reg, Address adr); void cmpxchgq(Register reg, Address adr); diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 0000146f535..c3c2500126d 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -594,9 +594,35 @@ class StubGenerator: public StubCodeGenerator { return start; } - // Support for jint atomic::atomic_cmpxchg_long(jlong exchange_value, - // volatile jlong* dest, - // jlong compare_value) + // Support for jbyte atomic::atomic_cmpxchg(jbyte exchange_value, volatile jbyte* dest, + // jbyte compare_value) + // + // Arguments : + // c_rarg0: exchange_value + // c_rarg1: dest + // c_rarg2: compare_value + // + // Result: + // if ( compare_value == *dest ) { + // *dest = exchange_value + // return compare_value; + // else + // return *dest; + address generate_atomic_cmpxchg_byte() { + StubCodeMark mark(this, "StubRoutines", "atomic_cmpxchg_byte"); + address start = __ pc(); + + __ movsbq(rax, c_rarg2); + if ( os::is_MP() ) __ lock(); + __ cmpxchgb(c_rarg0, Address(c_rarg1, 0)); + __ ret(0); + + return start; + } + + // Support for jlong atomic::atomic_cmpxchg(jlong exchange_value, + // volatile jlong* dest, + // jlong compare_value) // Arguments : // c_rarg0: exchange_value // c_rarg1: dest @@ -3894,6 +3920,7 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); StubRoutines::_atomic_xchg_ptr_entry = generate_atomic_xchg_ptr(); StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg(); + StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte(); StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long(); StubRoutines::_atomic_add_entry = generate_atomic_add(); StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr(); diff --git a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp index b88df23737b..be7f72b2341 100644 --- a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp +++ b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp @@ -207,6 +207,7 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_atomic_xchg_ptr_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_cmpxchg_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_cmpxchg_ptr_entry = ShouldNotCallThisStub(); + StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_add_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_add_ptr_entry = ShouldNotCallThisStub(); diff --git a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp index 0a9feddfec4..9108476c2d5 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp @@ -88,6 +88,15 @@ inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* des return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest); } +#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE +inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { + int mp = os::is_MP(); + __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)" + : "=a" (exchange_value) + : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp) + : "cc", "memory"); + return exchange_value; +} inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) { int mp = os::is_MP(); diff --git a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp index 679dd614523..03fa9bcf840 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp @@ -88,6 +88,15 @@ inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* des return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest); } +#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE +inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { + int mp = os::is_MP(); + __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)" + : "=a" (exchange_value) + : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp) + : "cc", "memory"); + return exchange_value; +} inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) { int mp = os::is_MP(); diff --git a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp index e00d5be1ff0..f8b47f56495 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp @@ -68,6 +68,8 @@ inline void Atomic::dec_ptr(volatile void* dest) { (void)add_ptr(-1, dest); extern "C" { jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL()); jint _Atomic_xchg(jint exchange_value, volatile jint* dest); + jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, + jbyte compare_value IS_MP_DECL()); jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value IS_MP_DECL()); jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest, @@ -82,6 +84,11 @@ inline jint Atomic::xchg (jint exchange_value, volatile jint* return _Atomic_xchg(exchange_value, dest); } +#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE +inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { + return _Atomic_cmpxchg_byte(exchange_value, dest, compare_value IS_MP_ARG()); +} + inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) { return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG()); } @@ -217,6 +224,15 @@ extern "C" { return exchange_value; } + + inline jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, int mp) { + __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)" + : "=a" (exchange_value) + : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp) + : "cc", "memory"); + return exchange_value; + } + // This is the interface to the atomic instruction in solaris_i486.s. jlong _Atomic_cmpxchg_long_gcc(jlong exchange_value, volatile jlong* dest, jlong compare_value, int mp); diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il index 281711d4b3a..f6d289e725c 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il +++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il @@ -76,6 +76,23 @@ xchgl (%ecx), %eax .end + // Support for jbyte Atomic::cmpxchg(jbyte exchange_value, + // volatile jbyte *dest, + // jbyte compare_value) + // An additional bool (os::is_MP()) is passed as the last argument. + .inline _Atomic_cmpxchg_byte,4 + movb 8(%esp), %al // compare_value + movb 0(%esp), %cl // exchange_value + movl 4(%esp), %edx // dest + cmp $0, 12(%esp) // MP test + jne 1f + cmpxchgb %cl, (%edx) + jmp 2f +1: lock + cmpxchgb %cl, (%edx) +2: + .end + // Support for jint Atomic::cmpxchg(jint exchange_value, // volatile jint *dest, // jint compare_value) diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il index 16bd3541079..bf0335f7f17 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il +++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il @@ -77,6 +77,15 @@ movq %rdi, %rax .end + // Support for jbyte Atomic::cmpxchg(jbyte exchange_value, + // volatile jbyte *dest, + // jbyte compare_value) + .inline _Atomic_cmpxchg_byte,3 + movb %dl, %al // compare_value + lock + cmpxchgb %dil, (%rsi) + .end + // Support for jint Atomic::cmpxchg(jint exchange_value, // volatile jint *dest, // jint compare_value) diff --git a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp index 072b61f07d3..d8c5f70870c 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp @@ -123,6 +123,11 @@ inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value); } +#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE +inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { + return (*os::atomic_cmpxchg_byte_func)(exchange_value, dest, compare_value); +} + inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) { return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value); } @@ -212,6 +217,19 @@ inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* des return (void*)xchg((jint)exchange_value, (volatile jint*)dest); } +#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE +inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { + // alternative for InterlockedCompareExchange + int mp = os::is_MP(); + __asm { + mov edx, dest + mov cl, exchange_value + mov al, compare_value + LOCK_IF_MP(mp) + cmpxchg byte ptr [edx], cl + } +} + inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) { // alternative for InterlockedCompareExchange int mp = os::is_MP(); diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp index 5325e0ee807..29c9851bb2f 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp @@ -220,6 +220,7 @@ void os::initialize_thread(Thread* thr) { typedef jint xchg_func_t (jint, volatile jint*); typedef intptr_t xchg_ptr_func_t (intptr_t, volatile intptr_t*); typedef jint cmpxchg_func_t (jint, volatile jint*, jint); +typedef jbyte cmpxchg_byte_func_t (jbyte, volatile jbyte*, jbyte); typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong); typedef jint add_func_t (jint, volatile jint*); typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*); @@ -272,6 +273,23 @@ jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint *dest = exchange_value; return old_value; } + +jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { + // try to use the stub: + cmpxchg_byte_func_t* func = CAST_TO_FN_PTR(cmpxchg_byte_func_t*, StubRoutines::atomic_cmpxchg_byte_entry()); + + if (func != NULL) { + os::atomic_cmpxchg_byte_func = func; + return (*func)(exchange_value, dest, compare_value); + } + assert(Threads::number_of_threads() == 0, "for bootstrap only"); + + jbyte old_value = *dest; + if (old_value == compare_value) + *dest = exchange_value; + return old_value; +} + #endif // AMD64 jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) { @@ -321,6 +339,7 @@ intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* des xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap; xchg_ptr_func_t* os::atomic_xchg_ptr_func = os::atomic_xchg_ptr_bootstrap; cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; +cmpxchg_byte_func_t* os::atomic_cmpxchg_byte_func = os::atomic_cmpxchg_byte_bootstrap; add_func_t* os::atomic_add_func = os::atomic_add_bootstrap; add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap; diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp index 1ac00b10455..9433ef72f8d 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp @@ -33,6 +33,7 @@ static intptr_t (*atomic_xchg_ptr_func) (intptr_t, volatile intptr_t*); static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint); + static jbyte (*atomic_cmpxchg_byte_func) (jbyte, volatile jbyte*, jbyte); static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong); static jint (*atomic_add_func) (jint, volatile jint*); @@ -42,6 +43,7 @@ static intptr_t atomic_xchg_ptr_bootstrap (intptr_t, volatile intptr_t*); static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint); + static jbyte atomic_cmpxchg_byte_bootstrap(jbyte, volatile jbyte*, jbyte); #else static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong); diff --git a/hotspot/src/share/vm/runtime/atomic.cpp b/hotspot/src/share/vm/runtime/atomic.cpp index 2a3dbc5a6ac..9aaa416e24c 100644 --- a/hotspot/src/share/vm/runtime/atomic.cpp +++ b/hotspot/src/share/vm/runtime/atomic.cpp @@ -25,7 +25,13 @@ #include "precompiled.hpp" #include "runtime/atomic.inline.hpp" -jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { +/* + * This is the default implementation of byte-sized cmpxchg. It emulates jbyte-sized cmpxchg + * in terms of jint-sized cmpxchg. Platforms may override this by defining their own inline definition + * as well as defining VM_HAS_SPECIALIZED_CMPXCHG_BYTE. This will cause the platform specific + * implementation to be used instead. + */ +jbyte Atomic::cmpxchg_general(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { assert(sizeof(jbyte) == 1, "assumption."); uintptr_t dest_addr = (uintptr_t)dest; uintptr_t offset = dest_addr % sizeof(jint); diff --git a/hotspot/src/share/vm/runtime/atomic.hpp b/hotspot/src/share/vm/runtime/atomic.hpp index 4729adefc5f..0662c8e3b2a 100644 --- a/hotspot/src/share/vm/runtime/atomic.hpp +++ b/hotspot/src/share/vm/runtime/atomic.hpp @@ -28,6 +28,9 @@ #include "memory/allocation.hpp" class Atomic : AllStatic { + private: + static jbyte cmpxchg_general(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); + public: // Atomic operations on jlong types are not available on all 32-bit // platforms. If atomic ops on jlongs are defined here they must only @@ -104,7 +107,7 @@ class Atomic : AllStatic { // *dest with exchange_value if the comparison succeeded. Returns prior // value of *dest. cmpxchg*() provide: // compare-and-exchange - static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); + inline static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value); // See comment above about using jlong atomics on 32-bit platforms inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value); diff --git a/hotspot/src/share/vm/runtime/atomic.inline.hpp b/hotspot/src/share/vm/runtime/atomic.inline.hpp index e3983ef6b55..afe405826a8 100644 --- a/hotspot/src/share/vm/runtime/atomic.inline.hpp +++ b/hotspot/src/share/vm/runtime/atomic.inline.hpp @@ -87,4 +87,12 @@ inline void Atomic::dec(volatile size_t* dest) { dec_ptr((volatile intptr_t*) dest); } +#ifndef VM_HAS_SPECIALIZED_CMPXCHG_BYTE +// See comment in atomic.cpp how to override. +inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte *dest, jbyte comparand) +{ + return cmpxchg_general(exchange_value, dest, comparand); +} +#endif // VM_HAS_SPECIALIZED_CMPXCHG_BYTE + #endif // SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp index f35cce9f5e9..61838c12a1d 100644 --- a/hotspot/src/share/vm/runtime/stubRoutines.cpp +++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp @@ -62,6 +62,7 @@ address StubRoutines::_atomic_store_entry = NULL; address StubRoutines::_atomic_store_ptr_entry = NULL; address StubRoutines::_atomic_cmpxchg_entry = NULL; address StubRoutines::_atomic_cmpxchg_ptr_entry = NULL; +address StubRoutines::_atomic_cmpxchg_byte_entry = NULL; address StubRoutines::_atomic_cmpxchg_long_entry = NULL; address StubRoutines::_atomic_add_entry = NULL; address StubRoutines::_atomic_add_ptr_entry = NULL; diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp index 60f24843abf..de2e090f3b2 100644 --- a/hotspot/src/share/vm/runtime/stubRoutines.hpp +++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp @@ -126,6 +126,7 @@ class StubRoutines: AllStatic { static address _atomic_store_ptr_entry; static address _atomic_cmpxchg_entry; static address _atomic_cmpxchg_ptr_entry; + static address _atomic_cmpxchg_byte_entry; static address _atomic_cmpxchg_long_entry; static address _atomic_add_entry; static address _atomic_add_ptr_entry; @@ -282,6 +283,7 @@ class StubRoutines: AllStatic { static address atomic_store_ptr_entry() { return _atomic_store_ptr_entry; } static address atomic_cmpxchg_entry() { return _atomic_cmpxchg_entry; } static address atomic_cmpxchg_ptr_entry() { return _atomic_cmpxchg_ptr_entry; } + static address atomic_cmpxchg_byte_entry() { return _atomic_cmpxchg_byte_entry; } static address atomic_cmpxchg_long_entry() { return _atomic_cmpxchg_long_entry; } static address atomic_add_entry() { return _atomic_add_entry; } static address atomic_add_ptr_entry() { return _atomic_add_ptr_entry; } From 6306dce8314bc82d7bf3cb7a3b3a53ff7440ed2f Mon Sep 17 00:00:00 2001 From: Stefan Johansson Date: Thu, 30 Oct 2014 10:51:06 +0100 Subject: [PATCH 023/159] 8061234: ResourceContext.requestAccurateUpdate() is unreliable Changing copy_allocation_context_stats to return if there are more stats available after the copy. Reviewed-by: rriggs, jcoomes --- .../src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp | 2 +- .../share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp | 3 ++- hotspot/src/share/vm/gc_interface/collectedHeap.hpp | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index f1aaceaacb4..e7ff5d4b016 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1248,7 +1248,7 @@ public: // The same as above but assume that the caller holds the Heap_lock. void collect_locked(GCCause::Cause cause); - virtual void copy_allocation_context_stats(const jint* contexts, + virtual bool copy_allocation_context_stats(const jint* contexts, jlong* totals, jbyte* accuracy, jint len); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp index 401b28b6fee..7f71451b6ca 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp @@ -25,8 +25,9 @@ #include "precompiled.hpp" #include "gc_implementation/g1/g1CollectedHeap.hpp" -void G1CollectedHeap::copy_allocation_context_stats(const jint* contexts, +bool G1CollectedHeap::copy_allocation_context_stats(const jint* contexts, jlong* totals, jbyte* accuracy, jint len) { + return false; } diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp index ea2dcc9a54b..bbd778c3463 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp @@ -644,10 +644,13 @@ class CollectedHeap : public CHeapObj { // For each context in contexts, set the corresponding entries in the totals // and accuracy arrays to the current values held by the statistics. Each // array should be of length len. - virtual void copy_allocation_context_stats(const jint* contexts, + // Returns true if there are more stats available. + virtual bool copy_allocation_context_stats(const jint* contexts, jlong* totals, jbyte* accuracy, - jint len) { } + jint len) { + return false; + } /////////////// Unit tests /////////////// From 5fd7516136651023ac48fec20d360fe261f7c2a7 Mon Sep 17 00:00:00 2001 From: Marcus Larsson Date: Thu, 30 Oct 2014 12:45:22 +0100 Subject: [PATCH 024/159] 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods Reviewed-by: mgerdin, kbarrett --- .../compactibleFreeListSpace.cpp | 10 +- .../compactibleFreeListSpace.hpp | 29 + .../vm/gc_implementation/g1/heapRegion.cpp | 10 +- .../vm/gc_implementation/g1/heapRegion.hpp | 22 +- .../shared/markSweep.inline.hpp | 1 + hotspot/src/share/vm/memory/space.cpp | 50 +- hotspot/src/share/vm/memory/space.hpp | 84 ++- hotspot/src/share/vm/memory/space.inline.hpp | 528 +++++++++--------- 8 files changed, 402 insertions(+), 332 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index 1406d5dfd8b..ee2dc9b3622 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -2083,17 +2083,13 @@ bool CompactibleFreeListSpace::should_concurrent_collect() const { } // Support for compaction - void CompactibleFreeListSpace::prepare_for_compaction(CompactPoint* cp) { - SCAN_AND_FORWARD(cp,end,block_is_obj,block_size); + scan_and_forward(this, cp); // Prepare_for_compaction() uses the space between live objects // so that later phase can skip dead space quickly. So verification // of the free lists doesn't work after. } -#define obj_size(q) adjustObjectSize(oop(q)->size()) -#define adjust_obj_size(s) adjustObjectSize(s) - void CompactibleFreeListSpace::adjust_pointers() { // In other versions of adjust_pointers(), a bail out // based on the amount of live data in the generation @@ -2101,12 +2097,12 @@ void CompactibleFreeListSpace::adjust_pointers() { // Cannot test used() == 0 here because the free lists have already // been mangled by the compaction. - SCAN_AND_ADJUST_POINTERS(adjust_obj_size); + scan_and_adjust_pointers(this); // See note about verification in prepare_for_compaction(). } void CompactibleFreeListSpace::compact() { - SCAN_AND_COMPACT(obj_size); + scan_and_compact(this); } // Fragmentation metric = 1 - [sum of (fbs**2) / (sum of fbs)**2] diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp index 4b10e6fb2bc..5c05828103c 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp @@ -73,6 +73,13 @@ class CompactibleFreeListSpace: public CompactibleSpace { friend class CMSCollector; // Local alloc buffer for promotion into this space. friend class CFLS_LAB; + // Allow scan_and_* functions to call (private) overrides of the auxiliary functions on this class + template + friend void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space); + template + friend void CompactibleSpace::scan_and_compact(SpaceType* space); + template + friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp); // "Size" of chunks of work (executed during parallel remark phases // of CMS collection); this probably belongs in CMSCollector, although @@ -288,6 +295,28 @@ class CompactibleFreeListSpace: public CompactibleSpace { _bt.freed(start, size); } + // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support. + // See comments for CompactibleSpace for more information. + inline HeapWord* scan_limit() const { + return end(); + } + + inline bool scanned_block_is_obj(const HeapWord* addr) const { + return CompactibleFreeListSpace::block_is_obj(addr); // Avoid virtual call + } + + inline size_t scanned_block_size(const HeapWord* addr) const { + return CompactibleFreeListSpace::block_size(addr); // Avoid virtual call + } + + inline size_t adjust_obj_size(size_t size) const { + return adjustObjectSize(size); + } + + inline size_t obj_size(const HeapWord* addr) const { + return adjustObjectSize(oop(addr)->size()); + } + protected: // Reset the indexed free list to its initial empty condition. void resetIndexedFreeListArray(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 55e74c6669c..3b49ff164fb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -960,6 +960,10 @@ void HeapRegion::verify() const { verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy); } +void HeapRegion::prepare_for_compaction(CompactPoint* cp) { + scan_and_forward(this, cp); +} + // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go // away eventually. @@ -1043,12 +1047,6 @@ void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) { } } -#define block_is_always_obj(q) true -void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) { - SCAN_AND_FORWARD(cp, top, block_is_always_obj, block_size); -} -#undef block_is_always_obj - G1OffsetTableContigSpace:: G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) : diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index 916726e48a0..997524b5bed 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -187,8 +187,6 @@ class G1OffsetTableContigSpace: public CompactibleSpace { HeapWord* block_start(const void* p); HeapWord* block_start_const(const void* p) const; - void prepare_for_compaction(CompactPoint* cp); - // Add offset table update. virtual HeapWord* allocate(size_t word_size); HeapWord* par_allocate(size_t word_size); @@ -210,6 +208,9 @@ class G1OffsetTableContigSpace: public CompactibleSpace { class HeapRegion: public G1OffsetTableContigSpace { friend class VMStructs; + // Allow scan_and_forward to call (private) overrides for auxiliary functions on this class + template + friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp); private: // The remembered set for this region. @@ -219,6 +220,20 @@ class HeapRegion: public G1OffsetTableContigSpace { G1BlockOffsetArrayContigSpace* offsets() { return &_offsets; } + // Auxiliary functions for scan_and_forward support. + // See comments for CompactibleSpace for more information. + inline HeapWord* scan_limit() const { + return top(); + } + + inline bool scanned_block_is_obj(const HeapWord* addr) const { + return true; // Always true, since scan_limit is top + } + + inline size_t scanned_block_size(const HeapWord* addr) const { + return HeapRegion::block_size(addr); // Avoid virtual call + } + protected: // The index of this region in the heap region sequence. uint _hrm_index; @@ -340,6 +355,9 @@ class HeapRegion: public G1OffsetTableContigSpace { // and the amount of unallocated words if called on top() size_t block_size(const HeapWord* p) const; + // Override for scan_and_forward support. + void prepare_for_compaction(CompactPoint* cp); + inline HeapWord* par_allocate_no_bot_updates(size_t word_size); inline HeapWord* allocate_no_bot_updates(size_t word_size); diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp index c08e7a6379b..ebc89061a32 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp @@ -27,6 +27,7 @@ #include "gc_implementation/shared/markSweep.hpp" #include "gc_interface/collectedHeap.hpp" +#include "oops/markOop.inline.hpp" #include "utilities/stack.inline.hpp" #include "utilities/macros.hpp" #if INCLUDE_ALL_GCS diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 41f1a72150a..092a68bee70 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -438,52 +438,8 @@ bool CompactibleSpace::insert_deadspace(size_t& allowed_deadspace_words, } } -#define block_is_always_obj(q) true -#define obj_size(q) oop(q)->size() -#define adjust_obj_size(s) s - -void CompactibleSpace::prepare_for_compaction(CompactPoint* cp) { - SCAN_AND_FORWARD(cp, end, block_is_obj, block_size); -} - -// Faster object search. void ContiguousSpace::prepare_for_compaction(CompactPoint* cp) { - SCAN_AND_FORWARD(cp, top, block_is_always_obj, obj_size); -} - -void Space::adjust_pointers() { - // adjust all the interior pointers to point at the new locations of objects - // Used by MarkSweep::mark_sweep_phase3() - - // First check to see if there is any work to be done. - if (used() == 0) { - return; // Nothing to do. - } - - // Otherwise... - HeapWord* q = bottom(); - HeapWord* t = end(); - - debug_only(HeapWord* prev_q = NULL); - while (q < t) { - if (oop(q)->is_gc_marked()) { - // q is alive - - // point all the oops to the new location - size_t size = oop(q)->adjust_pointers(); - - debug_only(prev_q = q); - - q += size; - } else { - // q is not a live object. But we're not in a compactible space, - // So we don't have live ranges. - debug_only(prev_q = q); - q += block_size(q); - assert(q > prev_q, "we should be moving forward through memory"); - } - } - assert(q == t, "just checking"); + scan_and_forward(this, cp); } void CompactibleSpace::adjust_pointers() { @@ -492,11 +448,11 @@ void CompactibleSpace::adjust_pointers() { return; // Nothing to do. } - SCAN_AND_ADJUST_POINTERS(adjust_obj_size); + scan_and_adjust_pointers(this); } void CompactibleSpace::compact() { - SCAN_AND_COMPACT(obj_size); + scan_and_compact(this); } void Space::print_short() const { print_short_on(tty); } diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index f7c313cca0d..dddbcf26109 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -46,6 +46,7 @@ // - Space -- an abstract base class describing a heap area // - CompactibleSpace -- a space supporting compaction // - CompactibleFreeListSpace -- (used for CMS generation) +// - G1OffsetTableContigSpace -- G1 version of OffsetTableContigSpace // - ContiguousSpace -- a compactible space in which all free space // is contiguous // - EdenSpace -- contiguous space used as nursery @@ -238,7 +239,7 @@ class Space: public CHeapObj { // Mark-sweep-compact support: all spaces can update pointers to objects // moving as a part of compaction. - virtual void adjust_pointers(); + virtual void adjust_pointers() = 0; // PrintHeapAtGC support virtual void print() const; @@ -339,7 +340,36 @@ public: // necessarily, a space that is normally contiguous. But, for example, a // free-list-based space whose normal collection is a mark-sweep without // compaction could still support compaction in full GC's. - +// +// The compaction operations are implemented by the +// scan_and_{adjust_pointers,compact,forward} function templates. +// The following are, non-virtual, auxiliary functions used by these function templates: +// - scan_limit() +// - scanned_block_is_obj() +// - scanned_block_size() +// - adjust_obj_size() +// - obj_size() +// These functions are to be used exclusively by the scan_and_* function templates, +// and must be defined for all (non-abstract) subclasses of CompactibleSpace. +// +// NOTE: Any subclasses to CompactibleSpace wanting to change/define the behavior +// in any of the auxiliary functions must also override the corresponding +// prepare_for_compaction/adjust_pointers/compact functions using them. +// If not, such changes will not be used or have no effect on the compaction operations. +// +// This translates to the following dependencies: +// Overrides/definitions of +// - scan_limit +// - scanned_block_is_obj +// - scanned_block_size +// require override/definition of prepare_for_compaction(). +// Similar dependencies exist between +// - adjust_obj_size and adjust_pointers() +// - obj_size and compact(). +// +// Additionally, this also means that changes to block_size() or block_is_obj() that +// should be effective during the compaction operations must provide a corresponding +// definition of scanned_block_size/scanned_block_is_obj respectively. class CompactibleSpace: public Space { friend class VMStructs; friend class CompactibleFreeListSpace; @@ -347,6 +377,15 @@ private: HeapWord* _compaction_top; CompactibleSpace* _next_compaction_space; + // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support. + inline size_t adjust_obj_size(size_t size) const { + return size; + } + + inline size_t obj_size(const HeapWord* addr) const { + return oop(addr)->size(); + } + public: CompactibleSpace() : _compaction_top(NULL), _next_compaction_space(NULL) {} @@ -390,7 +429,7 @@ public: // "cp->compaction_space" up-to-date. Offset tables may be updated in // this phase as if the final copy had occurred; if so, "cp->threshold" // indicates when the next such action should be taken. - virtual void prepare_for_compaction(CompactPoint* cp); + virtual void prepare_for_compaction(CompactPoint* cp) = 0; // MarkSweep support phase3 virtual void adjust_pointers(); // MarkSweep support phase4 @@ -449,6 +488,25 @@ protected: // words remaining after this operation. bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q, size_t word_len); + + // Below are template functions for scan_and_* algorithms (avoiding virtual calls). + // The space argument should be a subclass of CompactibleSpace, implementing + // scan_limit(), scanned_block_is_obj(), and scanned_block_size(), + // and possibly also overriding obj_size(), and adjust_obj_size(). + // These functions should avoid virtual calls whenever possible. + + // Frequently calls adjust_obj_size(). + template + static inline void scan_and_adjust_pointers(SpaceType* space); + + // Frequently calls obj_size(). + template + static inline void scan_and_compact(SpaceType* space); + + // Frequently calls scanned_block_is_obj() and scanned_block_size(). + // Requires the scan_limit() function. + template + static inline void scan_and_forward(SpaceType* space, CompactPoint* cp); }; class GenSpaceMangler; @@ -458,6 +516,25 @@ class GenSpaceMangler; class ContiguousSpace: public CompactibleSpace { friend class OneContigSpaceCardGeneration; friend class VMStructs; + // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class + template + friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp); + + private: + // Auxiliary functions for scan_and_forward support. + // See comments for CompactibleSpace for more information. + inline HeapWord* scan_limit() const { + return top(); + } + + inline bool scanned_block_is_obj(const HeapWord* addr) const { + return true; // Always true, since scan_limit is top + } + + inline size_t scanned_block_size(const HeapWord* addr) const { + return oop(addr)->size(); + } + protected: HeapWord* _top; HeapWord* _concurrent_iteration_safe_limit; @@ -622,7 +699,6 @@ class ContiguousSpace: public CompactibleSpace { // Used to increase collection frequency. "factor" of 0 means entire // space. void allocate_temporary_filler(int factor); - }; diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp index 007cebd16e6..d85ba249e28 100644 --- a/hotspot/src/share/vm/memory/space.inline.hpp +++ b/hotspot/src/share/vm/memory/space.inline.hpp @@ -25,6 +25,9 @@ #ifndef SHARE_VM_MEMORY_SPACE_INLINE_HPP #define SHARE_VM_MEMORY_SPACE_INLINE_HPP +#include "gc_implementation/shared/liveRange.hpp" +#include "gc_implementation/shared/markSweep.inline.hpp" +#include "gc_implementation/shared/spaceDecorator.hpp" #include "gc_interface/collectedHeap.hpp" #include "memory/space.hpp" #include "memory/universe.hpp" @@ -35,272 +38,6 @@ inline HeapWord* Space::block_start(const void* p) { return block_start_const(p); } -#define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) { \ - /* Compute the new addresses for the live objects and store it in the mark \ - * Used by universe::mark_sweep_phase2() \ - */ \ - HeapWord* compact_top; /* This is where we are currently compacting to. */ \ - \ - /* We're sure to be here before any objects are compacted into this \ - * space, so this is a good time to initialize this: \ - */ \ - set_compaction_top(bottom()); \ - \ - if (cp->space == NULL) { \ - assert(cp->gen != NULL, "need a generation"); \ - assert(cp->threshold == NULL, "just checking"); \ - assert(cp->gen->first_compaction_space() == this, "just checking"); \ - cp->space = cp->gen->first_compaction_space(); \ - compact_top = cp->space->bottom(); \ - cp->space->set_compaction_top(compact_top); \ - cp->threshold = cp->space->initialize_threshold(); \ - } else { \ - compact_top = cp->space->compaction_top(); \ - } \ - \ - /* We allow some amount of garbage towards the bottom of the space, so \ - * we don't start compacting before there is a significant gain to be made.\ - * Occasionally, we want to ensure a full compaction, which is determined \ - * by the MarkSweepAlwaysCompactCount parameter. \ - */ \ - uint invocations = MarkSweep::total_invocations(); \ - bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); \ - \ - size_t allowed_deadspace = 0; \ - if (skip_dead) { \ - const size_t ratio = allowed_dead_ratio(); \ - allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \ - } \ - \ - HeapWord* q = bottom(); \ - HeapWord* t = scan_limit(); \ - \ - HeapWord* end_of_live= q; /* One byte beyond the last byte of the last \ - live object. */ \ - HeapWord* first_dead = end();/* The first dead object. */ \ - LiveRange* liveRange = NULL; /* The current live range, recorded in the \ - first header of preceding free area. */ \ - _first_dead = first_dead; \ - \ - const intx interval = PrefetchScanIntervalInBytes; \ - \ - while (q < t) { \ - assert(!block_is_obj(q) || \ - oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() || \ - oop(q)->mark()->has_bias_pattern(), \ - "these are the only valid states during a mark sweep"); \ - if (block_is_obj(q) && oop(q)->is_gc_marked()) { \ - /* prefetch beyond q */ \ - Prefetch::write(q, interval); \ - size_t size = block_size(q); \ - compact_top = cp->space->forward(oop(q), size, cp, compact_top); \ - q += size; \ - end_of_live = q; \ - } else { \ - /* run over all the contiguous dead objects */ \ - HeapWord* end = q; \ - do { \ - /* prefetch beyond end */ \ - Prefetch::write(end, interval); \ - end += block_size(end); \ - } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\ - \ - /* see if we might want to pretend this object is alive so that \ - * we don't have to compact quite as often. \ - */ \ - if (allowed_deadspace > 0 && q == compact_top) { \ - size_t sz = pointer_delta(end, q); \ - if (insert_deadspace(allowed_deadspace, q, sz)) { \ - compact_top = cp->space->forward(oop(q), sz, cp, compact_top); \ - q = end; \ - end_of_live = end; \ - continue; \ - } \ - } \ - \ - /* otherwise, it really is a free region. */ \ - \ - /* for the previous LiveRange, record the end of the live objects. */ \ - if (liveRange) { \ - liveRange->set_end(q); \ - } \ - \ - /* record the current LiveRange object. \ - * liveRange->start() is overlaid on the mark word. \ - */ \ - liveRange = (LiveRange*)q; \ - liveRange->set_start(end); \ - liveRange->set_end(end); \ - \ - /* see if this is the first dead region. */ \ - if (q < first_dead) { \ - first_dead = q; \ - } \ - \ - /* move on to the next object */ \ - q = end; \ - } \ - } \ - \ - assert(q == t, "just checking"); \ - if (liveRange != NULL) { \ - liveRange->set_end(q); \ - } \ - _end_of_live = end_of_live; \ - if (end_of_live < first_dead) { \ - first_dead = end_of_live; \ - } \ - _first_dead = first_dead; \ - \ - /* save the compaction_top of the compaction space. */ \ - cp->space->set_compaction_top(compact_top); \ -} - -#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) { \ - /* adjust all the interior pointers to point at the new locations of objects \ - * Used by MarkSweep::mark_sweep_phase3() */ \ - \ - HeapWord* q = bottom(); \ - HeapWord* t = _end_of_live; /* Established by "prepare_for_compaction". */ \ - \ - assert(_first_dead <= _end_of_live, "Stands to reason, no?"); \ - \ - if (q < t && _first_dead > q && \ - !oop(q)->is_gc_marked()) { \ - /* we have a chunk of the space which hasn't moved and we've \ - * reinitialized the mark word during the previous pass, so we can't \ - * use is_gc_marked for the traversal. */ \ - HeapWord* end = _first_dead; \ - \ - while (q < end) { \ - /* I originally tried to conjoin "block_start(q) == q" to the \ - * assertion below, but that doesn't work, because you can't \ - * accurately traverse previous objects to get to the current one \ - * after their pointers have been \ - * updated, until the actual compaction is done. dld, 4/00 */ \ - assert(block_is_obj(q), \ - "should be at block boundaries, and should be looking at objs"); \ - \ - /* point all the oops to the new location */ \ - size_t size = oop(q)->adjust_pointers(); \ - size = adjust_obj_size(size); \ - \ - q += size; \ - } \ - \ - if (_first_dead == t) { \ - q = t; \ - } else { \ - /* $$$ This is funky. Using this to read the previously written \ - * LiveRange. See also use below. */ \ - q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer(); \ - } \ - } \ - \ - const intx interval = PrefetchScanIntervalInBytes; \ - \ - debug_only(HeapWord* prev_q = NULL); \ - while (q < t) { \ - /* prefetch beyond q */ \ - Prefetch::write(q, interval); \ - if (oop(q)->is_gc_marked()) { \ - /* q is alive */ \ - /* point all the oops to the new location */ \ - size_t size = oop(q)->adjust_pointers(); \ - size = adjust_obj_size(size); \ - debug_only(prev_q = q); \ - q += size; \ - } else { \ - /* q is not a live object, so its mark should point at the next \ - * live object */ \ - debug_only(prev_q = q); \ - q = (HeapWord*) oop(q)->mark()->decode_pointer(); \ - assert(q > prev_q, "we should be moving forward through memory"); \ - } \ - } \ - \ - assert(q == t, "just checking"); \ -} - -#define SCAN_AND_COMPACT(obj_size) { \ - /* Copy all live objects to their new location \ - * Used by MarkSweep::mark_sweep_phase4() */ \ - \ - HeapWord* q = bottom(); \ - HeapWord* const t = _end_of_live; \ - debug_only(HeapWord* prev_q = NULL); \ - \ - if (q < t && _first_dead > q && \ - !oop(q)->is_gc_marked()) { \ - debug_only( \ - /* we have a chunk of the space which hasn't moved and we've reinitialized \ - * the mark word during the previous pass, so we can't use is_gc_marked for \ - * the traversal. */ \ - HeapWord* const end = _first_dead; \ - \ - while (q < end) { \ - size_t size = obj_size(q); \ - assert(!oop(q)->is_gc_marked(), \ - "should be unmarked (special dense prefix handling)"); \ - debug_only(prev_q = q); \ - q += size; \ - } \ - ) /* debug_only */ \ - \ - if (_first_dead == t) { \ - q = t; \ - } else { \ - /* $$$ Funky */ \ - q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer(); \ - } \ - } \ - \ - const intx scan_interval = PrefetchScanIntervalInBytes; \ - const intx copy_interval = PrefetchCopyIntervalInBytes; \ - while (q < t) { \ - if (!oop(q)->is_gc_marked()) { \ - /* mark is pointer to next marked oop */ \ - debug_only(prev_q = q); \ - q = (HeapWord*) oop(q)->mark()->decode_pointer(); \ - assert(q > prev_q, "we should be moving forward through memory"); \ - } else { \ - /* prefetch beyond q */ \ - Prefetch::read(q, scan_interval); \ - \ - /* size and destination */ \ - size_t size = obj_size(q); \ - HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee(); \ - \ - /* prefetch beyond compaction_top */ \ - Prefetch::write(compaction_top, copy_interval); \ - \ - /* copy object and reinit its mark */ \ - assert(q != compaction_top, "everything in this pass should be moving"); \ - Copy::aligned_conjoint_words(q, compaction_top, size); \ - oop(compaction_top)->init_mark(); \ - assert(oop(compaction_top)->klass() != NULL, "should have a class"); \ - \ - debug_only(prev_q = q); \ - q += size; \ - } \ - } \ - \ - /* Let's remember if we were empty before we did the compaction. */ \ - bool was_empty = used_region().is_empty(); \ - /* Reset space after compaction is complete */ \ - reset_after_compaction(); \ - /* We do this clear, below, since it has overloaded meanings for some */ \ - /* space subtypes. For example, OffsetTableContigSpace's that were */ \ - /* compacted into will have had their offset table thresholds updated */ \ - /* continuously, but those that weren't need to have their thresholds */ \ - /* re-initialized. Also mangles unused area for debugging. */ \ - if (used_region().is_empty()) { \ - if (!was_empty) clear(SpaceDecorator::Mangle); \ - } else { \ - if (ZapUnusedHeapArea) mangle_unused_area(); \ - } \ -} - inline HeapWord* OffsetTableContigSpace::allocate(size_t size) { HeapWord* res = ContiguousSpace::allocate(size); if (res != NULL) { @@ -334,4 +71,263 @@ OffsetTableContigSpace::block_start_const(const void* p) const { return _offsets.block_start(p); } +template +inline void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp) { + // Compute the new addresses for the live objects and store it in the mark + // Used by universe::mark_sweep_phase2() + HeapWord* compact_top; // This is where we are currently compacting to. + + // We're sure to be here before any objects are compacted into this + // space, so this is a good time to initialize this: + space->set_compaction_top(space->bottom()); + + if (cp->space == NULL) { + assert(cp->gen != NULL, "need a generation"); + assert(cp->threshold == NULL, "just checking"); + assert(cp->gen->first_compaction_space() == space, "just checking"); + cp->space = cp->gen->first_compaction_space(); + compact_top = cp->space->bottom(); + cp->space->set_compaction_top(compact_top); + cp->threshold = cp->space->initialize_threshold(); + } else { + compact_top = cp->space->compaction_top(); + } + + // We allow some amount of garbage towards the bottom of the space, so + // we don't start compacting before there is a significant gain to be made. + // Occasionally, we want to ensure a full compaction, which is determined + // by the MarkSweepAlwaysCompactCount parameter. + uint invocations = MarkSweep::total_invocations(); + bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); + + size_t allowed_deadspace = 0; + if (skip_dead) { + const size_t ratio = space->allowed_dead_ratio(); + allowed_deadspace = (space->capacity() * ratio / 100) / HeapWordSize; + } + + HeapWord* q = space->bottom(); + HeapWord* t = space->scan_limit(); + + HeapWord* end_of_live= q; // One byte beyond the last byte of the last + // live object. + HeapWord* first_dead = space->end(); // The first dead object. + LiveRange* liveRange = NULL; // The current live range, recorded in the + // first header of preceding free area. + space->_first_dead = first_dead; + + const intx interval = PrefetchScanIntervalInBytes; + + while (q < t) { + assert(!space->scanned_block_is_obj(q) || + oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() || + oop(q)->mark()->has_bias_pattern(), + "these are the only valid states during a mark sweep"); + if (space->scanned_block_is_obj(q) && oop(q)->is_gc_marked()) { + // prefetch beyond q + Prefetch::write(q, interval); + size_t size = space->scanned_block_size(q); + compact_top = cp->space->forward(oop(q), size, cp, compact_top); + q += size; + end_of_live = q; + } else { + // run over all the contiguous dead objects + HeapWord* end = q; + do { + // prefetch beyond end + Prefetch::write(end, interval); + end += space->scanned_block_size(end); + } while (end < t && (!space->scanned_block_is_obj(end) || !oop(end)->is_gc_marked())); + + // see if we might want to pretend this object is alive so that + // we don't have to compact quite as often. + if (allowed_deadspace > 0 && q == compact_top) { + size_t sz = pointer_delta(end, q); + if (space->insert_deadspace(allowed_deadspace, q, sz)) { + compact_top = cp->space->forward(oop(q), sz, cp, compact_top); + q = end; + end_of_live = end; + continue; + } + } + + // otherwise, it really is a free region. + + // for the previous LiveRange, record the end of the live objects. + if (liveRange) { + liveRange->set_end(q); + } + + // record the current LiveRange object. + // liveRange->start() is overlaid on the mark word. + liveRange = (LiveRange*)q; + liveRange->set_start(end); + liveRange->set_end(end); + + // see if this is the first dead region. + if (q < first_dead) { + first_dead = q; + } + + // move on to the next object + q = end; + } + } + + assert(q == t, "just checking"); + if (liveRange != NULL) { + liveRange->set_end(q); + } + space->_end_of_live = end_of_live; + if (end_of_live < first_dead) { + first_dead = end_of_live; + } + space->_first_dead = first_dead; + + // save the compaction_top of the compaction space. + cp->space->set_compaction_top(compact_top); +} + +template +inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) { + // adjust all the interior pointers to point at the new locations of objects + // Used by MarkSweep::mark_sweep_phase3() + + HeapWord* q = space->bottom(); + HeapWord* t = space->_end_of_live; // Established by "prepare_for_compaction". + + assert(space->_first_dead <= space->_end_of_live, "Stands to reason, no?"); + + if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) { + // we have a chunk of the space which hasn't moved and we've + // reinitialized the mark word during the previous pass, so we can't + // use is_gc_marked for the traversal. + HeapWord* end = space->_first_dead; + + while (q < end) { + // I originally tried to conjoin "block_start(q) == q" to the + // assertion below, but that doesn't work, because you can't + // accurately traverse previous objects to get to the current one + // after their pointers have been + // updated, until the actual compaction is done. dld, 4/00 + assert(space->block_is_obj(q), "should be at block boundaries, and should be looking at objs"); + + // point all the oops to the new location + size_t size = oop(q)->adjust_pointers(); + size = space->adjust_obj_size(size); + + q += size; + } + + if (space->_first_dead == t) { + q = t; + } else { + // $$$ This is funky. Using this to read the previously written + // LiveRange. See also use below. + q = (HeapWord*)oop(space->_first_dead)->mark()->decode_pointer(); + } + } + + const intx interval = PrefetchScanIntervalInBytes; + + debug_only(HeapWord* prev_q = NULL); + while (q < t) { + // prefetch beyond q + Prefetch::write(q, interval); + if (oop(q)->is_gc_marked()) { + // q is alive + // point all the oops to the new location + size_t size = oop(q)->adjust_pointers(); + size = space->adjust_obj_size(size); + debug_only(prev_q = q); + q += size; + } else { + // q is not a live object, so its mark should point at the next + // live object + debug_only(prev_q = q); + q = (HeapWord*) oop(q)->mark()->decode_pointer(); + assert(q > prev_q, "we should be moving forward through memory"); + } + } + + assert(q == t, "just checking"); +} + +template +inline void CompactibleSpace::scan_and_compact(SpaceType* space) { + // Copy all live objects to their new location + // Used by MarkSweep::mark_sweep_phase4() + + HeapWord* q = space->bottom(); + HeapWord* const t = space->_end_of_live; + debug_only(HeapWord* prev_q = NULL); + + if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) { + #ifdef ASSERT // Debug only + // we have a chunk of the space which hasn't moved and we've reinitialized + // the mark word during the previous pass, so we can't use is_gc_marked for + // the traversal. + HeapWord* const end = space->_first_dead; + + while (q < end) { + size_t size = space->obj_size(q); + assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)"); + prev_q = q; + q += size; + } + #endif + + if (space->_first_dead == t) { + q = t; + } else { + // $$$ Funky + q = (HeapWord*) oop(space->_first_dead)->mark()->decode_pointer(); + } + } + + const intx scan_interval = PrefetchScanIntervalInBytes; + const intx copy_interval = PrefetchCopyIntervalInBytes; + while (q < t) { + if (!oop(q)->is_gc_marked()) { + // mark is pointer to next marked oop + debug_only(prev_q = q); + q = (HeapWord*) oop(q)->mark()->decode_pointer(); + assert(q > prev_q, "we should be moving forward through memory"); + } else { + // prefetch beyond q + Prefetch::read(q, scan_interval); + + // size and destination + size_t size = space->obj_size(q); + HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee(); + + // prefetch beyond compaction_top + Prefetch::write(compaction_top, copy_interval); + + // copy object and reinit its mark + assert(q != compaction_top, "everything in this pass should be moving"); + Copy::aligned_conjoint_words(q, compaction_top, size); + oop(compaction_top)->init_mark(); + assert(oop(compaction_top)->klass() != NULL, "should have a class"); + + debug_only(prev_q = q); + q += size; + } + } + + // Let's remember if we were empty before we did the compaction. + bool was_empty = space->used_region().is_empty(); + // Reset space after compaction is complete + space->reset_after_compaction(); + // We do this clear, below, since it has overloaded meanings for some + // space subtypes. For example, OffsetTableContigSpace's that were + // compacted into will have had their offset table thresholds updated + // continuously, but those that weren't need to have their thresholds + // re-initialized. Also mangles unused area for debugging. + if (space->used_region().is_empty()) { + if (!was_empty) space->clear(SpaceDecorator::Mangle); + } else { + if (ZapUnusedHeapArea) space->mangle_unused_area(); + } +} #endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP From 4601eb634ac385f04815597a53d48a414bf7ffa7 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Fri, 31 Oct 2014 09:10:51 +0100 Subject: [PATCH 025/159] 8061308: Remove iCMS Reviewed-by: mgerdin, jmasa --- .../jvm/hotspot/memory/DefNewGeneration.java | 4 +- .../sun/jvm/hotspot/memory/EdenSpace.java | 40 --- .../src/cpu/ppc/vm/templateTable_ppc_64.cpp | 2 +- .../src/cpu/sparc/vm/macroAssembler_sparc.cpp | 4 +- .../src/cpu/sparc/vm/templateTable_sparc.cpp | 2 +- hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp | 4 +- .../src/cpu/x86/vm/templateTable_x86_32.cpp | 2 +- .../src/cpu/x86/vm/templateTable_x86_64.cpp | 2 +- hotspot/src/share/vm/Xusage.txt | 1 - .../cmsCollectorPolicy.cpp | 6 - .../cmsCollectorPolicy.hpp | 3 - .../concurrentMarkSweepGeneration.cpp | 273 +----------------- .../concurrentMarkSweepGeneration.hpp | 43 --- .../concurrentMarkSweepGeneration.inline.hpp | 45 --- .../concurrentMarkSweepThread.cpp | 71 +---- .../concurrentMarkSweepThread.hpp | 114 +------- .../concurrentMarkSweep/vmCMSOperations.cpp | 10 - .../concurrentMarkSweep/vmCMSOperations.hpp | 4 +- .../src/share/vm/memory/collectorPolicy.hpp | 5 - .../src/share/vm/memory/defNewGeneration.cpp | 47 +-- .../src/share/vm/memory/defNewGeneration.hpp | 11 +- hotspot/src/share/vm/memory/generation.hpp | 8 - hotspot/src/share/vm/memory/space.cpp | 57 +--- hotspot/src/share/vm/memory/space.hpp | 68 +---- hotspot/src/share/vm/opto/macro.cpp | 3 +- hotspot/src/share/vm/runtime/arguments.cpp | 42 +-- hotspot/src/share/vm/runtime/globals.hpp | 29 -- hotspot/src/share/vm/runtime/mutexLocker.cpp | 4 - hotspot/src/share/vm/runtime/mutexLocker.hpp | 1 - hotspot/src/share/vm/runtime/vmStructs.cpp | 6 +- hotspot/test/TEST.groups | 5 - .../test/gc/g1/TestShrinkAuxiliaryData.java | 3 +- .../TestCMSIncrementalMode.java | 46 --- .../TestCMSNoIncrementalMode.java | 45 --- .../test/gc/startup_warnings/TestIncGC.java | 46 --- 35 files changed, 57 insertions(+), 999 deletions(-) delete mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java delete mode 100644 hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java delete mode 100644 hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java delete mode 100644 hotspot/test/gc/startup_warnings/TestIncGC.java diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java index 89c8dbe4803..bbc44198406 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java @@ -64,8 +64,8 @@ public class DefNewGeneration extends Generation { } // Accessing spaces - public EdenSpace eden() { - return (EdenSpace) VMObjectFactory.newObject(EdenSpace.class, edenSpaceField.getValue(addr)); + public ContiguousSpace eden() { + return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, edenSpaceField.getValue(addr)); } public ContiguousSpace from() { diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java deleted file mode 100644 index 67584c3146e..00000000000 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2000, 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. - * - */ - -package sun.jvm.hotspot.memory; - -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.types.*; - -/**

Class EdenSpace describes eden-space in new - generation. (Currently it does not add any significant - functionality beyond ContiguousSpace.) */ - -public class EdenSpace extends ContiguousSpace { - public EdenSpace(Address addr) { - super(addr); - } -} diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp index f0c7097abbd..bf8f5ead1c9 100644 --- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -3513,7 +3513,7 @@ void TemplateTable::_new() { Rtags = R3_ARG1, Rindex = R5_ARG3; - const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode; + const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc(); // -------------------------------------------------------------------------- // Check if fast case is possible. diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp index 79ca56aecd3..4b6aa5d4f54 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -3196,7 +3196,7 @@ void MacroAssembler::eden_allocate( assert(0 <= con_size_in_bytes && Assembler::is_simm13(con_size_in_bytes), "illegal object size"); assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0, "object size is not multiple of alignment"); - if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { + if (!Universe::heap()->supports_inline_contig_alloc()) { // No allocation in the shared eden. ba(slow_case); delayed()->nop(); @@ -3331,7 +3331,7 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case assert_different_registers(top, t1, t2, t3, G4, G5 /* preserve G4 and G5 */); Label do_refill, discard_tlab; - if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { + if (!Universe::heap()->supports_inline_contig_alloc()) { // No allocation in the shared eden. ba(slow_case); delayed()->nop(); diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index cd40653a2fb..9424b1be1f6 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -3309,7 +3309,7 @@ void TemplateTable::_new() { // (creates a new TLAB, etc.) const bool allow_shared_alloc = - Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode; + Universe::heap()->supports_inline_contig_alloc(); if(UseTLAB) { Register RoldTopValue = RallocatedObject; diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp index 592b45c9fd0..74e52a436ee 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -2964,7 +2964,7 @@ void MacroAssembler::eden_allocate(Register obj, Label& slow_case) { assert(obj == rax, "obj must be in rax, for cmpxchg"); assert_different_registers(obj, var_size_in_bytes, t1); - if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { + if (!Universe::heap()->supports_inline_contig_alloc()) { jmp(slow_case); } else { Register end = t1; @@ -4437,7 +4437,7 @@ Register MacroAssembler::tlab_refill(Label& retry, assert_different_registers(top, thread_reg, t1, t2, /* preserve: */ rbx, rdx); Label do_refill, discard_tlab; - if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { + if (!Universe::heap()->supports_inline_contig_alloc()) { // No allocation in the shared eden. jmp(slow_case); } diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index 958613081f3..2187056a384 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -3214,7 +3214,7 @@ void TemplateTable::_new() { // (creates a new TLAB, etc.) const bool allow_shared_alloc = - Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode; + Universe::heap()->supports_inline_contig_alloc(); const Register thread = rcx; if (UseTLAB || allow_shared_alloc) { diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp index cd7ee3b65b0..b1b1b00a615 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -3269,7 +3269,7 @@ void TemplateTable::_new() { // (creates a new TLAB, etc.) const bool allow_shared_alloc = - Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode; + Universe::heap()->supports_inline_contig_alloc(); if (UseTLAB) { __ movptr(rax, Address(r15_thread, in_bytes(JavaThread::tlab_top_offset()))); diff --git a/hotspot/src/share/vm/Xusage.txt b/hotspot/src/share/vm/Xusage.txt index 11302aaa6d9..acd829b449f 100644 --- a/hotspot/src/share/vm/Xusage.txt +++ b/hotspot/src/share/vm/Xusage.txt @@ -7,7 +7,6 @@ -Xbootclasspath/p: prepend in front of bootstrap class path -Xnoclassgc disable class garbage collection - -Xincgc enable incremental garbage collection -Xloggc: log GC status to a file with time stamps -Xbatch disable background compilation -Xms set initial Java heap size diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp index aed729017c0..9bd48077b87 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp @@ -89,9 +89,3 @@ void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() { _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3); } } - -// Returns true if the incremental mode is enabled. -bool ConcurrentMarkSweepPolicy::has_soft_ended_eden() -{ - return CMSIncrementalMode; -} diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp index 24c59ac83ab..0f09d0cf6ac 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp @@ -42,9 +42,6 @@ class ConcurrentMarkSweepPolicy : public GenCollectorPolicy { virtual void initialize_size_policy(size_t init_eden_size, size_t init_promo_size, size_t init_survivor_size); - - // Returns true if the incremental mode is enabled. - virtual bool has_soft_ended_eden(); }; #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSCOLLECTORPOLICY_HPP diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index bc9547d4ee4..aec716c782a 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -167,16 +167,6 @@ class CMSTokenSyncWithLocks: public CMSTokenSync { }; -// Wrapper class to temporarily disable icms during a foreground cms collection. -class ICMSDisabler: public StackObj { - public: - // The ctor disables icms and wakes up the thread so it notices the change; - // the dtor re-enables icms. Note that the CMSCollector methods will check - // CMSIncrementalMode. - ICMSDisabler() { CMSCollector::disable_icms(); CMSCollector::start_icms(); } - ~ICMSDisabler() { CMSCollector::enable_icms(); } -}; - ////////////////////////////////////////////////////////////////// // Concurrent Mark-Sweep Generation ///////////////////////////// ////////////////////////////////////////////////////////////////// @@ -363,7 +353,6 @@ CMSStats::CMSStats(ConcurrentMarkSweepGeneration* cms_gen, unsigned int alpha): _cms_used_at_gc0_end = 0; _allow_duty_cycle_reduction = false; _valid_bits = 0; - _icms_duty_cycle = CMSIncrementalDutyCycle; } double CMSStats::cms_free_adjustment_factor(size_t free) const { @@ -442,86 +431,17 @@ double CMSStats::time_until_cms_start() const { return work - deadline; } -// Return a duty cycle based on old_duty_cycle and new_duty_cycle, limiting the -// amount of change to prevent wild oscillation. -unsigned int CMSStats::icms_damped_duty_cycle(unsigned int old_duty_cycle, - unsigned int new_duty_cycle) { - assert(old_duty_cycle <= 100, "bad input value"); - assert(new_duty_cycle <= 100, "bad input value"); - - // Note: use subtraction with caution since it may underflow (values are - // unsigned). Addition is safe since we're in the range 0-100. - unsigned int damped_duty_cycle = new_duty_cycle; - if (new_duty_cycle < old_duty_cycle) { - const unsigned int largest_delta = MAX2(old_duty_cycle / 4, 5U); - if (new_duty_cycle + largest_delta < old_duty_cycle) { - damped_duty_cycle = old_duty_cycle - largest_delta; - } - } else if (new_duty_cycle > old_duty_cycle) { - const unsigned int largest_delta = MAX2(old_duty_cycle / 4, 15U); - if (new_duty_cycle > old_duty_cycle + largest_delta) { - damped_duty_cycle = MIN2(old_duty_cycle + largest_delta, 100U); - } - } - assert(damped_duty_cycle <= 100, "invalid duty cycle computed"); - - if (CMSTraceIncrementalPacing) { - gclog_or_tty->print(" [icms_damped_duty_cycle(%d,%d) = %d] ", - old_duty_cycle, new_duty_cycle, damped_duty_cycle); - } - return damped_duty_cycle; -} - -unsigned int CMSStats::icms_update_duty_cycle_impl() { - assert(CMSIncrementalPacing && valid(), - "should be handled in icms_update_duty_cycle()"); - - double cms_time_so_far = cms_timer().seconds(); - double scaled_duration = cms_duration_per_mb() * _cms_used_at_gc0_end / M; - double scaled_duration_remaining = fabsd(scaled_duration - cms_time_so_far); - - // Avoid division by 0. - double time_until_full = MAX2(time_until_cms_gen_full(), 0.01); - double duty_cycle_dbl = 100.0 * scaled_duration_remaining / time_until_full; - - unsigned int new_duty_cycle = MIN2((unsigned int)duty_cycle_dbl, 100U); - if (new_duty_cycle > _icms_duty_cycle) { - // Avoid very small duty cycles (1 or 2); 0 is allowed. - if (new_duty_cycle > 2) { - _icms_duty_cycle = icms_damped_duty_cycle(_icms_duty_cycle, - new_duty_cycle); - } - } else if (_allow_duty_cycle_reduction) { - // The duty cycle is reduced only once per cms cycle (see record_cms_end()). - new_duty_cycle = icms_damped_duty_cycle(_icms_duty_cycle, new_duty_cycle); - // Respect the minimum duty cycle. - unsigned int min_duty_cycle = (unsigned int)CMSIncrementalDutyCycleMin; - _icms_duty_cycle = MAX2(new_duty_cycle, min_duty_cycle); - } - - if (PrintGCDetails || CMSTraceIncrementalPacing) { - gclog_or_tty->print(" icms_dc=%d ", _icms_duty_cycle); - } - - _allow_duty_cycle_reduction = false; - return _icms_duty_cycle; -} - #ifndef PRODUCT void CMSStats::print_on(outputStream *st) const { st->print(" gc0_alpha=%d,cms_alpha=%d", _gc0_alpha, _cms_alpha); st->print(",gc0_dur=%g,gc0_per=%g,gc0_promo=" SIZE_FORMAT, gc0_duration(), gc0_period(), gc0_promoted()); - st->print(",cms_dur=%g,cms_dur_per_mb=%g,cms_per=%g,cms_alloc=" SIZE_FORMAT, - cms_duration(), cms_duration_per_mb(), - cms_period(), cms_allocated()); + st->print(",cms_dur=%g,cms_per=%g,cms_alloc=" SIZE_FORMAT, + cms_duration(), cms_period(), cms_allocated()); st->print(",cms_since_beg=%g,cms_since_end=%g", cms_time_since_begin(), cms_time_since_end()); st->print(",cms_used_beg=" SIZE_FORMAT ",cms_used_end=" SIZE_FORMAT, _cms_used_at_gc0_begin, _cms_used_at_gc0_end); - if (CMSIncrementalMode) { - st->print(",dc=%d", icms_duty_cycle()); - } if (valid()) { st->print(",promo_rate=%g,cms_alloc_rate=%g", @@ -579,8 +499,6 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, #endif _collection_count_start(0), _verifying(false), - _icms_start_limit(NULL), - _icms_stop_limit(NULL), _verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"), _completed_initialization(false), _collector_policy(cp), @@ -1116,137 +1034,6 @@ void CMSCollector::promoted(bool par, HeapWord* start, } } -static inline size_t percent_of_space(Space* space, HeapWord* addr) -{ - size_t delta = pointer_delta(addr, space->bottom()); - return (size_t)(delta * 100.0 / (space->capacity() / HeapWordSize)); -} - -void CMSCollector::icms_update_allocation_limits() -{ - Generation* young = GenCollectedHeap::heap()->get_gen(0); - EdenSpace* eden = young->as_DefNewGeneration()->eden(); - - const unsigned int duty_cycle = stats().icms_update_duty_cycle(); - if (CMSTraceIncrementalPacing) { - stats().print(); - } - - assert(duty_cycle <= 100, "invalid duty cycle"); - if (duty_cycle != 0) { - // The duty_cycle is a percentage between 0 and 100; convert to words and - // then compute the offset from the endpoints of the space. - size_t free_words = eden->free() / HeapWordSize; - double free_words_dbl = (double)free_words; - size_t duty_cycle_words = (size_t)(free_words_dbl * duty_cycle / 100.0); - size_t offset_words = (free_words - duty_cycle_words) / 2; - - _icms_start_limit = eden->top() + offset_words; - _icms_stop_limit = eden->end() - offset_words; - - // The limits may be adjusted (shifted to the right) by - // CMSIncrementalOffset, to allow the application more mutator time after a - // young gen gc (when all mutators were stopped) and before CMS starts and - // takes away one or more cpus. - if (CMSIncrementalOffset != 0) { - double adjustment_dbl = free_words_dbl * CMSIncrementalOffset / 100.0; - size_t adjustment = (size_t)adjustment_dbl; - HeapWord* tmp_stop = _icms_stop_limit + adjustment; - if (tmp_stop > _icms_stop_limit && tmp_stop < eden->end()) { - _icms_start_limit += adjustment; - _icms_stop_limit = tmp_stop; - } - } - } - if (duty_cycle == 0 || (_icms_start_limit == _icms_stop_limit)) { - _icms_start_limit = _icms_stop_limit = eden->end(); - } - - // Install the new start limit. - eden->set_soft_end(_icms_start_limit); - - if (CMSTraceIncrementalMode) { - gclog_or_tty->print(" icms alloc limits: " - PTR_FORMAT "," PTR_FORMAT - " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ", - p2i(_icms_start_limit), p2i(_icms_stop_limit), - percent_of_space(eden, _icms_start_limit), - percent_of_space(eden, _icms_stop_limit)); - if (Verbose) { - gclog_or_tty->print("eden: "); - eden->print_on(gclog_or_tty); - } - } -} - -// Any changes here should try to maintain the invariant -// that if this method is called with _icms_start_limit -// and _icms_stop_limit both NULL, then it should return NULL -// and not notify the icms thread. -HeapWord* -CMSCollector::allocation_limit_reached(Space* space, HeapWord* top, - size_t word_size) -{ - // A start_limit equal to end() means the duty cycle is 0, so treat that as a - // nop. - if (CMSIncrementalMode && _icms_start_limit != space->end()) { - if (top <= _icms_start_limit) { - if (CMSTraceIncrementalMode) { - space->print_on(gclog_or_tty); - gclog_or_tty->stamp(); - gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT - ", new limit=" PTR_FORMAT - " (" SIZE_FORMAT "%%)", - p2i(top), p2i(_icms_stop_limit), - percent_of_space(space, _icms_stop_limit)); - } - ConcurrentMarkSweepThread::start_icms(); - assert(top < _icms_stop_limit, "Tautology"); - if (word_size < pointer_delta(_icms_stop_limit, top)) { - return _icms_stop_limit; - } - - // The allocation will cross both the _start and _stop limits, so do the - // stop notification also and return end(). - if (CMSTraceIncrementalMode) { - space->print_on(gclog_or_tty); - gclog_or_tty->stamp(); - gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT - ", new limit=" PTR_FORMAT - " (" SIZE_FORMAT "%%)", - p2i(top), p2i(space->end()), - percent_of_space(space, space->end())); - } - ConcurrentMarkSweepThread::stop_icms(); - return space->end(); - } - - if (top <= _icms_stop_limit) { - if (CMSTraceIncrementalMode) { - space->print_on(gclog_or_tty); - gclog_or_tty->stamp(); - gclog_or_tty->print_cr(" stop limit top=" PTR_FORMAT - ", new limit=" PTR_FORMAT - " (" SIZE_FORMAT "%%)", - top, space->end(), - percent_of_space(space, space->end())); - } - ConcurrentMarkSweepThread::stop_icms(); - return space->end(); - } - - if (CMSTraceIncrementalMode) { - space->print_on(gclog_or_tty); - gclog_or_tty->stamp(); - gclog_or_tty->print_cr(" end limit top=" PTR_FORMAT - ", new limit=" PTR_FORMAT, - top, NULL); - } - } - - return NULL; -} - oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) { assert(obj_size == (size_t)obj->size(), "bad obj_size passed in"); // allocate, copy and if necessary update promoinfo -- @@ -1289,14 +1076,6 @@ oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) { } -HeapWord* -ConcurrentMarkSweepGeneration::allocation_limit_reached(Space* space, - HeapWord* top, - size_t word_sz) -{ - return collector()->allocation_limit_reached(space, top, word_sz); -} - // IMPORTANT: Notes on object size recognition in CMS. // --------------------------------------------------- // A block of storage in the CMS generation is always in @@ -1809,9 +1588,6 @@ void CMSCollector::acquire_control_and_collect(bool full, // we want to do a foreground collection. _foregroundGCIsActive = true; - // Disable incremental mode during a foreground collection. - ICMSDisabler icms_disabler; - // release locks and wait for a notify from the background collector // releasing the locks in only necessary for phases which // do yields to improve the granularity of the collection. @@ -2135,7 +1911,7 @@ void CMSCollector::do_mark_sweep_work(bool clear_all_soft_refs, void CMSCollector::print_eden_and_survivor_chunk_arrays() { DefNewGeneration* dng = _young_gen->as_DefNewGeneration(); - EdenSpace* eden_space = dng->eden(); + ContiguousSpace* eden_space = dng->eden(); ContiguousSpace* from_space = dng->from(); ContiguousSpace* to_space = dng->to(); // Eden @@ -2783,10 +2559,6 @@ void CMSCollector::gc_epilogue(bool full) { // _cmsGen->update_counters(cms_used); - if (CMSIncrementalMode) { - icms_update_allocation_limits(); - } - bitMapLock()->unlock(); releaseFreelistLocks(); @@ -4272,12 +4044,10 @@ void CMSConcMarkingTask::coordinator_yield() { assert_lock_strong(_bit_map_lock); _bit_map_lock->unlock(); ConcurrentMarkSweepThread::desynchronize(true); - ConcurrentMarkSweepThread::acknowledge_yield_request(); _collector->stopTimer(); if (PrintCMSStatistics != 0) { _collector->incrementYields(); } - _collector->icms_wait(); // It is possible for whichever thread initiated the yield request // not to get a chance to wake up and take the bitmap lock between @@ -4307,7 +4077,6 @@ void CMSConcMarkingTask::coordinator_yield() { ConcurrentMarkSweepThread::should_yield() && !CMSCollector::foregroundGCIsActive(); ++i) { os::sleep(Thread::current(), 1, false); - ConcurrentMarkSweepThread::acknowledge_yield_request(); } ConcurrentMarkSweepThread::synchronize(true); @@ -5238,7 +5007,7 @@ class RemarkKlassClosure : public KlassClosure { void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) { DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration(); - EdenSpace* eden_space = dng->eden(); + ContiguousSpace* eden_space = dng->eden(); ContiguousSpace* from_space = dng->from(); ContiguousSpace* to_space = dng->to(); @@ -5410,7 +5179,7 @@ CMSParMarkTask::do_young_space_rescan(uint worker_id, while (!pst->is_task_claimed(/* reference */ nth_task)) { // We claimed task # nth_task; compute its boundaries. if (chunk_top == 0) { // no samples were taken - assert(nth_task == 0 && n_tasks == 1, "Can have only 1 EdenSpace task"); + assert(nth_task == 0 && n_tasks == 1, "Can have only 1 eden task"); start = space->bottom(); end = space->top(); } else if (nth_task == 0) { @@ -5788,7 +5557,7 @@ void CMSCollector::do_remark_parallel() { // process_roots (which currently doesn't know how to // parallelize such a scan), but rather will be broken up into // a set of parallel tasks (via the sampling that the [abortable] - // preclean phase did of EdenSpace, plus the [two] tasks of + // preclean phase did of eden, plus the [two] tasks of // scanning the [two] survivor spaces. Further fine-grain // parallelization of the scanning of the survivor spaces // themselves, and of precleaning of the younger gen itself @@ -6474,19 +6243,16 @@ void CMSCollector::reset(bool asynch) { assert_lock_strong(bitMapLock()); bitMapLock()->unlock(); ConcurrentMarkSweepThread::desynchronize(true); - ConcurrentMarkSweepThread::acknowledge_yield_request(); stopTimer(); if (PrintCMSStatistics != 0) { incrementYields(); } - icms_wait(); // See the comment in coordinator_yield() for (unsigned i = 0; i < CMSYieldSleepCount && ConcurrentMarkSweepThread::should_yield() && !CMSCollector::foregroundGCIsActive(); ++i) { os::sleep(Thread::current(), 1, false); - ConcurrentMarkSweepThread::acknowledge_yield_request(); } ConcurrentMarkSweepThread::synchronize(true); @@ -6509,10 +6275,6 @@ void CMSCollector::reset(bool asynch) { _collectorState = Idling; } - // Stop incremental mode after a cycle completes, so that any future cycles - // are triggered by allocation. - stop_icms(); - NOT_PRODUCT( if (RotateCMSCollectionTypes) { _cmsGen->rotate_debug_collection_type(); @@ -6964,12 +6726,10 @@ void MarkRefsIntoAndScanClosure::do_yield_work() { _bit_map->lock()->unlock(); _freelistLock->unlock(); ConcurrentMarkSweepThread::desynchronize(true); - ConcurrentMarkSweepThread::acknowledge_yield_request(); _collector->stopTimer(); if (PrintCMSStatistics != 0) { _collector->incrementYields(); } - _collector->icms_wait(); // See the comment in coordinator_yield() for (unsigned i = 0; @@ -6978,7 +6738,6 @@ void MarkRefsIntoAndScanClosure::do_yield_work() { !CMSCollector::foregroundGCIsActive(); ++i) { os::sleep(Thread::current(), 1, false); - ConcurrentMarkSweepThread::acknowledge_yield_request(); } ConcurrentMarkSweepThread::synchronize(true); @@ -7124,19 +6883,16 @@ void ScanMarkedObjectsAgainCarefullyClosure::do_yield_work() { _bitMap->lock()->unlock(); _freelistLock->unlock(); ConcurrentMarkSweepThread::desynchronize(true); - ConcurrentMarkSweepThread::acknowledge_yield_request(); _collector->stopTimer(); if (PrintCMSStatistics != 0) { _collector->incrementYields(); } - _collector->icms_wait(); // See the comment in coordinator_yield() for (unsigned i = 0; i < CMSYieldSleepCount && ConcurrentMarkSweepThread::should_yield() && !CMSCollector::foregroundGCIsActive(); ++i) { os::sleep(Thread::current(), 1, false); - ConcurrentMarkSweepThread::acknowledge_yield_request(); } ConcurrentMarkSweepThread::synchronize(true); @@ -7196,19 +6952,16 @@ void SurvivorSpacePrecleanClosure::do_yield_work() { // Relinquish the bit map lock _bit_map->lock()->unlock(); ConcurrentMarkSweepThread::desynchronize(true); - ConcurrentMarkSweepThread::acknowledge_yield_request(); _collector->stopTimer(); if (PrintCMSStatistics != 0) { _collector->incrementYields(); } - _collector->icms_wait(); // See the comment in coordinator_yield() for (unsigned i = 0; i < CMSYieldSleepCount && ConcurrentMarkSweepThread::should_yield() && !CMSCollector::foregroundGCIsActive(); ++i) { os::sleep(Thread::current(), 1, false); - ConcurrentMarkSweepThread::acknowledge_yield_request(); } ConcurrentMarkSweepThread::synchronize(true); @@ -7354,19 +7107,16 @@ void MarkFromRootsClosure::do_yield_work() { assert_lock_strong(_bitMap->lock()); _bitMap->lock()->unlock(); ConcurrentMarkSweepThread::desynchronize(true); - ConcurrentMarkSweepThread::acknowledge_yield_request(); _collector->stopTimer(); if (PrintCMSStatistics != 0) { _collector->incrementYields(); } - _collector->icms_wait(); // See the comment in coordinator_yield() for (unsigned i = 0; i < CMSYieldSleepCount && ConcurrentMarkSweepThread::should_yield() && !CMSCollector::foregroundGCIsActive(); ++i) { os::sleep(Thread::current(), 1, false); - ConcurrentMarkSweepThread::acknowledge_yield_request(); } ConcurrentMarkSweepThread::synchronize(true); @@ -7388,7 +7138,7 @@ void MarkFromRootsClosure::scanOopsInOop(HeapWord* ptr) { _finger = ptr + obj->size(); assert(_finger > ptr, "we just incremented it above"); // On large heaps, it may take us some time to get through - // the marking phase (especially if running iCMS). During + // the marking phase. During // this time it's possible that a lot of mutations have // accumulated in the card table and the mod union table -- // these mutation records are redundant until we have @@ -7505,7 +7255,7 @@ void Par_MarkFromRootsClosure::scan_oops_in_oop(HeapWord* ptr) { _finger = ptr + obj->size(); assert(_finger > ptr, "we just incremented it above"); // On large heaps, it may take us some time to get through - // the marking phase (especially if running iCMS). During + // the marking phase. During // this time it's possible that a lot of mutations have // accumulated in the card table and the mod union table -- // these mutation records are redundant until we have @@ -7994,20 +7744,16 @@ void CMSPrecleanRefsYieldClosure::do_yield_work() { bml->unlock(); ConcurrentMarkSweepThread::desynchronize(true); - ConcurrentMarkSweepThread::acknowledge_yield_request(); - _collector->stopTimer(); if (PrintCMSStatistics != 0) { _collector->incrementYields(); } - _collector->icms_wait(); // See the comment in coordinator_yield() for (unsigned i = 0; i < CMSYieldSleepCount && ConcurrentMarkSweepThread::should_yield() && !CMSCollector::foregroundGCIsActive(); ++i) { os::sleep(Thread::current(), 1, false); - ConcurrentMarkSweepThread::acknowledge_yield_request(); } ConcurrentMarkSweepThread::synchronize(true); @@ -8675,19 +8421,16 @@ void SweepClosure::do_yield_work(HeapWord* addr) { _bitMap->lock()->unlock(); _freelistLock->unlock(); ConcurrentMarkSweepThread::desynchronize(true); - ConcurrentMarkSweepThread::acknowledge_yield_request(); _collector->stopTimer(); if (PrintCMSStatistics != 0) { _collector->incrementYields(); } - _collector->icms_wait(); // See the comment in coordinator_yield() for (unsigned i = 0; i < CMSYieldSleepCount && ConcurrentMarkSweepThread::should_yield() && !CMSCollector::foregroundGCIsActive(); ++i) { os::sleep(Thread::current(), 1, false); - ConcurrentMarkSweepThread::acknowledge_yield_request(); } ConcurrentMarkSweepThread::synchronize(true); diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index 8d3d6ef128e..e46c01e400c 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -356,7 +356,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC { size_t _gc0_promoted; // bytes promoted per gc0 double _cms_duration; double _cms_duration_pre_sweep; // time from initiation to start of sweep - double _cms_duration_per_mb; double _cms_period; size_t _cms_allocated; // bytes of direct allocation per gc0 period @@ -383,17 +382,7 @@ class CMSStats VALUE_OBJ_CLASS_SPEC { unsigned int _valid_bits; - unsigned int _icms_duty_cycle; // icms duty cycle (0-100). - protected: - - // Return a duty cycle that avoids wild oscillations, by limiting the amount - // of change between old_duty_cycle and new_duty_cycle (the latter is treated - // as a recommended value). - static unsigned int icms_damped_duty_cycle(unsigned int old_duty_cycle, - unsigned int new_duty_cycle); - unsigned int icms_update_duty_cycle_impl(); - // In support of adjusting of cms trigger ratios based on history // of concurrent mode failure. double cms_free_adjustment_factor(size_t free) const; @@ -426,7 +415,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC { size_t gc0_promoted() const { return _gc0_promoted; } double cms_period() const { return _cms_period; } double cms_duration() const { return _cms_duration; } - double cms_duration_per_mb() const { return _cms_duration_per_mb; } size_t cms_allocated() const { return _cms_allocated; } size_t cms_used_at_gc0_end() const { return _cms_used_at_gc0_end;} @@ -458,12 +446,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC { // End of higher level statistics. - // Returns the cms incremental mode duty cycle, as a percentage (0-100). - unsigned int icms_duty_cycle() const { return _icms_duty_cycle; } - - // Update the duty cycle and return the new value. - unsigned int icms_update_duty_cycle(); - // Debugging. void print_on(outputStream* st) const PRODUCT_RETURN; void print() const { print_on(gclog_or_tty); } @@ -725,13 +707,6 @@ class CMSCollector: public CHeapObj { // Timing, allocation and promotion statistics, used for scheduling. CMSStats _stats; - // Allocation limits installed in the young gen, used only in - // CMSIncrementalMode. When an allocation in the young gen would cross one of - // these limits, the cms generation is notified and the cms thread is started - // or stopped, respectively. - HeapWord* _icms_start_limit; - HeapWord* _icms_stop_limit; - enum CMS_op_type { CMS_op_checkpointRootsInitial, CMS_op_checkpointRootsFinal @@ -867,10 +842,6 @@ class CMSCollector: public CHeapObj { // collector. bool waitForForegroundGC(); - // Incremental mode triggering: recompute the icms duty cycle and set the - // allocation limits in the young gen. - void icms_update_allocation_limits(); - size_t block_size_using_printezis_bits(HeapWord* addr) const; size_t block_size_if_printezis_bits(HeapWord* addr) const; HeapWord* next_card_start_after_block(HeapWord* addr) const; @@ -928,9 +899,6 @@ class CMSCollector: public CHeapObj { void promoted(bool par, HeapWord* start, bool is_obj_array, size_t obj_size); - HeapWord* allocation_limit_reached(Space* space, HeapWord* top, - size_t word_size); - void getFreelistLocks() const; void releaseFreelistLocks() const; bool haveFreelistLocks() const; @@ -1001,14 +969,6 @@ class CMSCollector: public CHeapObj { // Timers/stats for gc scheduling and incremental mode pacing. CMSStats& stats() { return _stats; } - // Convenience methods that check whether CMSIncrementalMode is enabled and - // forward to the corresponding methods in ConcurrentMarkSweepThread. - static void start_icms(); - static void stop_icms(); // Called at the end of the cms cycle. - static void disable_icms(); // Called before a foreground collection. - static void enable_icms(); // Called after a foreground collection. - void icms_wait(); // Called at yield points. - // Adaptive size policy AdaptiveSizePolicy* size_policy(); @@ -1211,9 +1171,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { return allocate(size, tlab); } - // Incremental mode triggering. - HeapWord* allocation_limit_reached(Space* space, HeapWord* top, - size_t word_size); // Used by CMSStats to track direct allocation. The value is sampled and // reset after each young gen collection. diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp index 46c518e4b64..53eb0a80976 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp @@ -234,36 +234,6 @@ inline void CMSBitMap::iterate(BitMapClosure* cl, HeapWord* left, } } -inline void CMSCollector::start_icms() { - if (CMSIncrementalMode) { - ConcurrentMarkSweepThread::start_icms(); - } -} - -inline void CMSCollector::stop_icms() { - if (CMSIncrementalMode) { - ConcurrentMarkSweepThread::stop_icms(); - } -} - -inline void CMSCollector::disable_icms() { - if (CMSIncrementalMode) { - ConcurrentMarkSweepThread::disable_icms(); - } -} - -inline void CMSCollector::enable_icms() { - if (CMSIncrementalMode) { - ConcurrentMarkSweepThread::enable_icms(); - } -} - -inline void CMSCollector::icms_wait() { - if (CMSIncrementalMode) { - cmsThread()->icms_wait(); - } -} - inline void CMSCollector::save_sweep_limits() { _cmsGen->save_sweep_limit(); } @@ -363,12 +333,6 @@ inline void CMSStats::record_cms_end() { _cms_duration = AdaptiveWeightedAverage::exp_avg(_cms_duration, cur_duration, _cms_alpha); - // Avoid division by 0. - const size_t cms_used_mb = MAX2(_cms_used_at_cms_begin / M, (size_t)1); - _cms_duration_per_mb = AdaptiveWeightedAverage::exp_avg(_cms_duration_per_mb, - cur_duration / cms_used_mb, - _cms_alpha); - _cms_end_time.update(); _cms_alpha = _saved_alpha; _allow_duty_cycle_reduction = true; @@ -400,15 +364,6 @@ inline double CMSStats::cms_consumption_rate() const { return (gc0_promoted() + cms_allocated()) / gc0_period(); } -inline unsigned int CMSStats::icms_update_duty_cycle() { - // Update the duty cycle only if pacing is enabled and the stats are valid - // (after at least one young gen gc and one cms cycle have completed). - if (CMSIncrementalPacing && valid()) { - return icms_update_duty_cycle_impl(); - } - return _icms_duty_cycle; -} - inline void ConcurrentMarkSweepGeneration::save_sweep_limit() { cmsSpace()->save_sweep_limit(); } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp index 0479143d4f9..8e31f5610d2 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp @@ -49,13 +49,6 @@ bool ConcurrentMarkSweepThread::_should_terminate = false; int ConcurrentMarkSweepThread::_CMS_flag = CMS_nil; volatile jint ConcurrentMarkSweepThread::_pending_yields = 0; -volatile jint ConcurrentMarkSweepThread::_pending_decrements = 0; - -volatile jint ConcurrentMarkSweepThread::_icms_disabled = 0; -volatile bool ConcurrentMarkSweepThread::_should_run = false; -// When icms is enabled, the icms thread is stopped until explicitly -// started. -volatile bool ConcurrentMarkSweepThread::_should_stop = true; SurrogateLockerThread* ConcurrentMarkSweepThread::_slt = NULL; @@ -99,7 +92,6 @@ ConcurrentMarkSweepThread::ConcurrentMarkSweepThread(CMSCollector* collector) } } _sltMonitor = SLT_lock; - assert(!CMSIncrementalMode || icms_is_enabled(), "Error"); } void ConcurrentMarkSweepThread::run() { @@ -184,11 +176,6 @@ ConcurrentMarkSweepThread* ConcurrentMarkSweepThread::start(CMSCollector* collec } void ConcurrentMarkSweepThread::stop() { - if (CMSIncrementalMode) { - // Disable incremental mode and wake up the thread so it notices the change. - disable_icms(); - start_icms(); - } // it is ok to take late safepoints here, if needed { MutexLockerEx x(Terminator_lock); @@ -387,23 +374,13 @@ void ConcurrentMarkSweepThread::wait_on_cms_lock_for_scavenge(long t_millis) { void ConcurrentMarkSweepThread::sleepBeforeNextCycle() { while (!_should_terminate) { - if (CMSIncrementalMode) { - icms_wait(); - if(CMSWaitDuration >= 0) { - // Wait until the next synchronous GC, a concurrent full gc - // request or a timeout, whichever is earlier. - wait_on_cms_lock_for_scavenge(CMSWaitDuration); - } - return; + if(CMSWaitDuration >= 0) { + // Wait until the next synchronous GC, a concurrent full gc + // request or a timeout, whichever is earlier. + wait_on_cms_lock_for_scavenge(CMSWaitDuration); } else { - if(CMSWaitDuration >= 0) { - // Wait until the next synchronous GC, a concurrent full gc - // request or a timeout, whichever is earlier. - wait_on_cms_lock_for_scavenge(CMSWaitDuration); - } else { - // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently - wait_on_cms_lock(CMSCheckInterval); - } + // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently + wait_on_cms_lock(CMSCheckInterval); } // Check if we should start a CMS collection cycle if (_collector->shouldConcurrentCollect()) { @@ -414,42 +391,6 @@ void ConcurrentMarkSweepThread::sleepBeforeNextCycle() { } } -// Incremental CMS -void ConcurrentMarkSweepThread::start_icms() { - assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking"); - MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag); - trace_state("start_icms"); - _should_run = true; - iCMS_lock->notify_all(); -} - -void ConcurrentMarkSweepThread::stop_icms() { - assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking"); - MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag); - if (!_should_stop) { - trace_state("stop_icms"); - _should_stop = true; - _should_run = false; - asynchronous_yield_request(); - iCMS_lock->notify_all(); - } -} - -void ConcurrentMarkSweepThread::icms_wait() { - assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking"); - if (_should_stop && icms_is_enabled()) { - MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag); - trace_state("pause_icms"); - _collector->stats().stop_cms_timer(); - while(!_should_run && icms_is_enabled()) { - iCMS_lock->wait(Mutex::_no_safepoint_check_flag); - } - _collector->stats().start_cms_timer(); - _should_stop = false; - trace_state("pause_icms end"); - } -} - // Note: this method, although exported by the ConcurrentMarkSweepThread, // which is a non-JavaThread, can only be called by a JavaThread. // Currently this is done at vm creation time (post-vm-init) by the diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp index 5f508cc09a4..f3e40f61d48 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp @@ -64,20 +64,11 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread { static bool clear_CMS_flag(int b) { return (_CMS_flag &= ~b) != 0; } void sleepBeforeNextCycle(); - // CMS thread should yield for a young gen collection, direct allocation, - // and iCMS activity. + // CMS thread should yield for a young gen collection and direct allocations static char _pad_1[64 - sizeof(jint)]; // prevent cache-line sharing static volatile jint _pending_yields; - static volatile jint _pending_decrements; // decrements to _pending_yields static char _pad_2[64 - sizeof(jint)]; // prevent cache-line sharing - // Tracing messages, enabled by CMSTraceThreadState. - static inline void trace_state(const char* desc); - - static volatile int _icms_disabled; // a counter to track #iCMS disable & enable - static volatile bool _should_run; // iCMS may run - static volatile bool _should_stop; // iCMS should stop - // debugging void verify_ok_to_terminate() const PRODUCT_RETURN; @@ -135,44 +126,13 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread { void wait_on_cms_lock_for_scavenge(long t_millis); // The CMS thread will yield during the work portion of its cycle - // only when requested to. Both synchronous and asychronous requests - // are provided: - // (1) A synchronous request is used for young gen collections and - // for direct allocations. The requesting thread increments - // _pending_yields at the beginning of an operation, and decrements - // _pending_yields when that operation is completed. - // In turn, the CMS thread yields when _pending_yields is positive, - // and continues to yield until the value reverts to 0. - // (2) An asynchronous request, on the other hand, is used by iCMS - // for the stop_icms() operation. A single yield satisfies all of - // the outstanding asynch yield requests, of which there may - // occasionally be several in close succession. To accomplish - // this, an asynch-requesting thread atomically increments both - // _pending_yields and _pending_decrements. An asynchr requesting - // thread does not wait and "acknowledge" completion of an operation - // and deregister the request, like the synchronous version described - // above does. In turn, after yielding, the CMS thread decrements both - // _pending_yields and _pending_decrements by the value seen in - // _pending_decrements before the decrement. - // NOTE: The above scheme is isomorphic to having two request counters, - // one for async requests and one for sync requests, and for the CMS thread - // to check the sum of the two counters to decide whether it should yield - // and to clear only the async counter when it yields. However, it turns out - // to be more efficient for CMS code to just check a single counter - // _pending_yields that holds the sum (of both sync and async requests), and - // a second counter _pending_decrements that only holds the async requests, - // for greater efficiency, since in a typical CMS run, there are many more - // potential (i.e. static) yield points than there are actual - // (i.e. dynamic) yields because of requests, which are few and far between. - // - // Note that, while "_pending_yields >= _pending_decrements" is an invariant, - // we cannot easily test that invariant, since the counters are manipulated via - // atomic instructions without explicit locking and we cannot read - // the two counters atomically together: one suggestion is to - // use (for example) 16-bit counters so as to be able to read the - // two counters atomically even on 32-bit platforms. Notice that - // the second assert in acknowledge_yield_request() below does indeed - // check a form of the above invariant, albeit indirectly. + // only when requested to. + // A synchronous request is used for young gen collections and + // for direct allocations. The requesting thread increments + // _pending_yields at the beginning of an operation, and decrements + // _pending_yields when that operation is completed. + // In turn, the CMS thread yields when _pending_yields is positive, + // and continues to yield until the value reverts to 0. static void increment_pending_yields() { Atomic::inc(&_pending_yields); @@ -182,67 +142,9 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread { Atomic::dec(&_pending_yields); assert(_pending_yields >= 0, "can't be negative"); } - static void asynchronous_yield_request() { - assert(CMSIncrementalMode, "Currently only used w/iCMS"); - increment_pending_yields(); - Atomic::inc(&_pending_decrements); - assert(_pending_decrements >= 0, "can't be negative"); - } - static void acknowledge_yield_request() { - jint decrement = _pending_decrements; - if (decrement > 0) { - assert(CMSIncrementalMode, "Currently only used w/iCMS"); - // Order important to preserve: _pending_yields >= _pending_decrements - Atomic::add(-decrement, &_pending_decrements); - Atomic::add(-decrement, &_pending_yields); - assert(_pending_decrements >= 0, "can't be negative"); - assert(_pending_yields >= 0, "can't be negative"); - } - } static bool should_yield() { return _pending_yields > 0; } - - // CMS incremental mode. - static void start_icms(); // notify thread to start a quantum of work - static void stop_icms(); // request thread to stop working - void icms_wait(); // if asked to stop, wait until notified to start - - // Incremental mode is enabled globally by the flag CMSIncrementalMode. It - // must also be enabled/disabled dynamically to allow foreground collections. -#define ICMS_ENABLING_ASSERT \ - assert((CMSIncrementalMode && _icms_disabled >= 0) || \ - (!CMSIncrementalMode && _icms_disabled <= 0), "Error") - - static inline void enable_icms() { - ICMS_ENABLING_ASSERT; - Atomic::dec(&_icms_disabled); - } - static inline void disable_icms() { - ICMS_ENABLING_ASSERT; - Atomic::inc(&_icms_disabled); - } - static inline bool icms_is_disabled() { - ICMS_ENABLING_ASSERT; - return _icms_disabled > 0; - } - static inline bool icms_is_enabled() { - return !icms_is_disabled(); - } }; -inline void ConcurrentMarkSweepThread::trace_state(const char* desc) { - if (CMSTraceThreadState) { - char buf[128]; - TimeStamp& ts = gclog_or_tty->time_stamp(); - if (!ts.is_updated()) { - ts.update(); - } - jio_snprintf(buf, sizeof(buf), " [%.3f: CMSThread %s] ", - ts.seconds(), desc); - buf[sizeof(buf) - 1] = '\0'; - gclog_or_tty->print("%s", buf); - } -} - // For scoped increment/decrement of (synchronous) yield requests class CMSSynchronousYieldRequest: public StackObj { public: diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp index 1b23ecbb554..7dfbad541bb 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp @@ -207,12 +207,6 @@ void VM_GenCollectFullConcurrent::doit() { MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag); assert(_full_gc_count_before <= gch->total_full_collections(), "Error"); if (gch->total_full_collections() == _full_gc_count_before) { - // Disable iCMS until the full collection is done, and - // remember that we did so. - CMSCollector::disable_icms(); - _disabled_icms = true; - // In case CMS thread was in icms_wait(), wake it up. - CMSCollector::start_icms(); // Nudge the CMS thread to start a concurrent collection. CMSCollector::request_full_gc(_full_gc_count_before, _gc_cause); } else { @@ -276,8 +270,4 @@ void VM_GenCollectFullConcurrent::doit_epilogue() { FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag); } } - // Enable iCMS back if we disabled it earlier. - if (_disabled_icms) { - CMSCollector::enable_icms(); - } } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp index 982f7c1036d..35c846a1921 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp @@ -128,13 +128,11 @@ class VM_CMS_Final_Remark: public VM_CMS_Operation { // VM operation to invoke a concurrent collection of the heap as a // GenCollectedHeap heap. class VM_GenCollectFullConcurrent: public VM_GC_Operation { - bool _disabled_icms; public: VM_GenCollectFullConcurrent(unsigned int gc_count_before, unsigned int full_gc_count_before, GCCause::Cause gc_cause) - : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */), - _disabled_icms(false) + : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */) { assert(FullGCCount_lock != NULL, "Error"); assert(UseAsyncConcMarkSweepGC, "Else will hang caller"); diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp index faffc6fec34..d923cf36a27 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.hpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp @@ -189,11 +189,6 @@ class CollectorPolicy : public CHeapObj { return CollectorPolicy::CollectorPolicyKind; } - // Returns true if a collector has eden space with soft end. - virtual bool has_soft_ended_eden() { - return false; - } - // Do any updates required to global flags that are due to heap initialization // changes virtual void post_heap_initialize() = 0; diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index ae3726281ec..57cdf5c3c27 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -194,11 +194,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs, (HeapWord*)_virtual_space.high()); Universe::heap()->barrier_set()->resize_covered_region(cmr); - if (GenCollectedHeap::heap()->collector_policy()->has_soft_ended_eden()) { - _eden_space = new ConcEdenSpace(this); - } else { - _eden_space = new EdenSpace(this); - } + _eden_space = new ContiguousSpace(); _from_space = new ContiguousSpace(); _to_space = new ContiguousSpace(); @@ -1038,38 +1034,12 @@ HeapWord* DefNewGeneration::allocate(size_t word_size, if (CMSEdenChunksRecordAlways && _next_gen != NULL) { _next_gen->sample_eden_chunk(); } - return result; - } - do { - HeapWord* old_limit = eden()->soft_end(); - if (old_limit < eden()->end()) { - // Tell the next generation we reached a limit. - HeapWord* new_limit = - next_gen()->allocation_limit_reached(eden(), eden()->top(), word_size); - if (new_limit != NULL) { - Atomic::cmpxchg_ptr(new_limit, eden()->soft_end_addr(), old_limit); - } else { - assert(eden()->soft_end() == eden()->end(), - "invalid state after allocation_limit_reached returned null"); - } - } else { - // The allocation failed and the soft limit is equal to the hard limit, - // there are no reasons to do an attempt to allocate - assert(old_limit == eden()->end(), "sanity check"); - break; - } - // Try to allocate until succeeded or the soft limit can't be adjusted - result = eden()->par_allocate(word_size); - } while (result == NULL); - - // If the eden is full and the last collection bailed out, we are running - // out of heap space, and we try to allocate the from-space, too. - // allocate_from_space can't be inlined because that would introduce a - // circular dependency at compile time. - if (result == NULL) { + } else { + // If the eden is full and the last collection bailed out, we are running + // out of heap space, and we try to allocate the from-space, too. + // allocate_from_space can't be inlined because that would introduce a + // circular dependency at compile time. result = allocate_from_space(word_size); - } else if (CMSEdenChunksRecordAlways && _next_gen != NULL) { - _next_gen->sample_eden_chunk(); } return result; } @@ -1083,11 +1053,6 @@ HeapWord* DefNewGeneration::par_allocate(size_t word_size, return res; } -void DefNewGeneration::gc_prologue(bool full) { - // Ensure that _end and _soft_end are the same in eden space. - eden()->set_soft_end(eden()->end()); -} - size_t DefNewGeneration::tlab_capacity() const { return eden()->capacity(); } diff --git a/hotspot/src/share/vm/memory/defNewGeneration.hpp b/hotspot/src/share/vm/memory/defNewGeneration.hpp index a5c0eb30951..c6e8c56f4b1 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.hpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp @@ -32,7 +32,6 @@ #include "memory/generation.inline.hpp" #include "utilities/stack.hpp" -class EdenSpace; class ContiguousSpace; class ScanClosure; class STWGCTimer; @@ -132,7 +131,7 @@ protected: void adjust_desired_tenuring_threshold(); // Spaces - EdenSpace* _eden_space; + ContiguousSpace* _eden_space; ContiguousSpace* _from_space; ContiguousSpace* _to_space; @@ -214,9 +213,9 @@ protected: virtual Generation::Name kind() { return Generation::DefNew; } // Accessing spaces - EdenSpace* eden() const { return _eden_space; } - ContiguousSpace* from() const { return _from_space; } - ContiguousSpace* to() const { return _to_space; } + ContiguousSpace* eden() const { return _eden_space; } + ContiguousSpace* from() const { return _from_space; } + ContiguousSpace* to() const { return _to_space; } virtual CompactibleSpace* first_compaction_space() const; @@ -282,8 +281,6 @@ protected: HeapWord* par_allocate(size_t word_size, bool is_tlab); - // Prologue & Epilogue - virtual void gc_prologue(bool full); virtual void gc_epilogue(bool full); // Save the tops for eden, from, and to diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp index feb2fb7946d..e472d9b8a46 100644 --- a/hotspot/src/share/vm/memory/generation.hpp +++ b/hotspot/src/share/vm/memory/generation.hpp @@ -265,14 +265,6 @@ class Generation: public CHeapObj { // Like "allocate", but performs any necessary locking internally. virtual HeapWord* par_allocate(size_t word_size, bool is_tlab) = 0; - // A 'younger' gen has reached an allocation limit, and uses this to notify - // the next older gen. The return value is a new limit, or NULL if none. The - // caller must do the necessary locking. - virtual HeapWord* allocation_limit_reached(Space* space, HeapWord* top, - size_t word_size) { - return NULL; - } - // Some generation may offer a region for shared, contiguous allocation, // via inlined code (by exporting the address of the top and end fields // defining the extent of the contiguous allocation region.) diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 092a68bee70..9ced66021d1 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -640,13 +640,12 @@ size_t ContiguousSpace::block_size(const HeapWord* p) const { } // This version requires locking. -inline HeapWord* ContiguousSpace::allocate_impl(size_t size, - HeapWord* const end_value) { +inline HeapWord* ContiguousSpace::allocate_impl(size_t size) { assert(Heap_lock->owned_by_self() || (SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread()), "not locked"); HeapWord* obj = top(); - if (pointer_delta(end_value, obj) >= size) { + if (pointer_delta(end(), obj) >= size) { HeapWord* new_top = obj + size; set_top(new_top); assert(is_aligned(obj) && is_aligned(new_top), "checking alignment"); @@ -657,11 +656,10 @@ inline HeapWord* ContiguousSpace::allocate_impl(size_t size, } // This version is lock-free. -inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size, - HeapWord* const end_value) { +inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size) { do { HeapWord* obj = top(); - if (pointer_delta(end_value, obj) >= size) { + if (pointer_delta(end(), obj) >= size) { HeapWord* new_top = obj + size; HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj); // result can be one of two: @@ -700,12 +698,12 @@ HeapWord* ContiguousSpace::allocate_aligned(size_t size) { // Requires locking. HeapWord* ContiguousSpace::allocate(size_t size) { - return allocate_impl(size, end()); + return allocate_impl(size); } // Lock-free. HeapWord* ContiguousSpace::par_allocate(size_t size) { - return par_allocate_impl(size, end()); + return par_allocate_impl(size); } void ContiguousSpace::allocate_temporary_filler(int factor) { @@ -740,49 +738,6 @@ void ContiguousSpace::allocate_temporary_filler(int factor) { } } -void EdenSpace::clear(bool mangle_space) { - ContiguousSpace::clear(mangle_space); - set_soft_end(end()); -} - -// Requires locking. -HeapWord* EdenSpace::allocate(size_t size) { - return allocate_impl(size, soft_end()); -} - -// Lock-free. -HeapWord* EdenSpace::par_allocate(size_t size) { - return par_allocate_impl(size, soft_end()); -} - -HeapWord* ConcEdenSpace::par_allocate(size_t size) -{ - do { - // The invariant is top() should be read before end() because - // top() can't be greater than end(), so if an update of _soft_end - // occurs between 'end_val = end();' and 'top_val = top();' top() - // also can grow up to the new end() and the condition - // 'top_val > end_val' is true. To ensure the loading order - // OrderAccess::loadload() is required after top() read. - HeapWord* obj = top(); - OrderAccess::loadload(); - if (pointer_delta(*soft_end_addr(), obj) >= size) { - HeapWord* new_top = obj + size; - HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj); - // result can be one of two: - // the old top value: the exchange succeeded - // otherwise: the new value of the top is returned. - if (result == obj) { - assert(is_aligned(obj) && is_aligned(new_top), "checking alignment"); - return obj; - } - } else { - return NULL; - } - } while (true); -} - - HeapWord* OffsetTableContigSpace::initialize_threshold() { return _offsets.initialize_threshold(); } diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index dddbcf26109..d0c7a111784 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -41,20 +41,6 @@ // implementations for keeping track of free and used space, // for iterating over objects and free blocks, etc. -// Here's the Space hierarchy: -// -// - Space -- an abstract base class describing a heap area -// - CompactibleSpace -- a space supporting compaction -// - CompactibleFreeListSpace -- (used for CMS generation) -// - G1OffsetTableContigSpace -- G1 version of OffsetTableContigSpace -// - ContiguousSpace -- a compactible space in which all free space -// is contiguous -// - EdenSpace -- contiguous space used as nursery -// - ConcEdenSpace -- contiguous space with a 'soft end safe' allocation -// - OffsetTableContigSpace -- contiguous space with a block offset array -// that allows "fast" block_start calls -// - TenuredSpace -- (used for TenuredGeneration) - // Forward decls. class Space; class BlockOffsetArray; @@ -544,8 +530,8 @@ class ContiguousSpace: public CompactibleSpace { GenSpaceMangler* mangler() { return _mangler; } // Allocation helpers (return NULL if full). - inline HeapWord* allocate_impl(size_t word_size, HeapWord* end_value); - inline HeapWord* par_allocate_impl(size_t word_size, HeapWord* end_value); + inline HeapWord* allocate_impl(size_t word_size); + inline HeapWord* par_allocate_impl(size_t word_size); public: ContiguousSpace(); @@ -761,56 +747,6 @@ public: {} }; - -// Class EdenSpace describes eden-space in new generation. - -class DefNewGeneration; - -class EdenSpace : public ContiguousSpace { - friend class VMStructs; - private: - DefNewGeneration* _gen; - - // _soft_end is used as a soft limit on allocation. As soft limits are - // reached, the slow-path allocation code can invoke other actions and then - // adjust _soft_end up to a new soft limit or to end(). - HeapWord* _soft_end; - - public: - EdenSpace(DefNewGeneration* gen) : - _gen(gen), _soft_end(NULL) {} - - // Get/set just the 'soft' limit. - HeapWord* soft_end() { return _soft_end; } - HeapWord** soft_end_addr() { return &_soft_end; } - void set_soft_end(HeapWord* value) { _soft_end = value; } - - // Override. - void clear(bool mangle_space); - - // Set both the 'hard' and 'soft' limits (_end and _soft_end). - void set_end(HeapWord* value) { - set_soft_end(value); - ContiguousSpace::set_end(value); - } - - // Allocation (return NULL if full) - HeapWord* allocate(size_t word_size); - HeapWord* par_allocate(size_t word_size); -}; - -// Class ConcEdenSpace extends EdenSpace for the sake of safe -// allocation while soft-end is being modified concurrently - -class ConcEdenSpace : public EdenSpace { - public: - ConcEdenSpace(DefNewGeneration* gen) : EdenSpace(gen) { } - - // Allocation (return NULL if full) - HeapWord* par_allocate(size_t word_size); -}; - - // A ContigSpace that Supports an efficient "block_start" operation via // a BlockOffsetArray (whose BlockOffsetSharedArray may be shared with // other spaces.) This is the abstract base class for old generation diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 40cc26aa0d1..ded7ed21554 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -1197,8 +1197,7 @@ void PhaseMacroExpand::expand_allocate_common( } if (C->env()->dtrace_alloc_probes() || - !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc() || - (UseConcMarkSweepGC && CMSIncrementalMode))) { + !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc())) { // Force slow-path allocation always_slow = true; initial_slow_test = NULL; diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 346208fa427..b002b524af2 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1774,7 +1774,7 @@ void Arguments::set_g1_gc_flags() { #ifdef ASSERT static bool verify_serial_gc_flags() { return (UseSerialGC && - !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || + !(UseParNewGC || (UseConcMarkSweepGC) || UseG1GC || UseParallelGC || UseParallelOldGC)); } #endif // ASSERT @@ -2188,10 +2188,6 @@ void Arguments::check_deprecated_gcs() { warning("Using the ParNew young collector with the Serial old collector is deprecated " "and will likely be removed in a future release"); } - - if (CMSIncrementalMode) { - warning("Using incremental CMS is deprecated and will likely be removed in a future release"); - } } void Arguments::check_deprecated_gc_flags() { @@ -2313,31 +2309,8 @@ bool Arguments::check_vm_args_consistency() { status = status && ArgumentsExt::check_gc_consistency_user(); status = status && check_stack_pages(); - if (CMSIncrementalMode) { - if (!UseConcMarkSweepGC) { - jio_fprintf(defaultStream::error_stream(), - "error: invalid argument combination.\n" - "The CMS collector (-XX:+UseConcMarkSweepGC) must be " - "selected in order\nto use CMSIncrementalMode.\n"); - status = false; - } else { - status = status && verify_percentage(CMSIncrementalDutyCycle, - "CMSIncrementalDutyCycle"); - status = status && verify_percentage(CMSIncrementalDutyCycleMin, - "CMSIncrementalDutyCycleMin"); - status = status && verify_percentage(CMSIncrementalSafetyFactor, - "CMSIncrementalSafetyFactor"); - status = status && verify_percentage(CMSIncrementalOffset, - "CMSIncrementalOffset"); - status = status && verify_percentage(CMSExpAvgFactor, - "CMSExpAvgFactor"); - // If it was not set on the command line, set - // CMSInitiatingOccupancyFraction to 1 so icms can initiate cycles early. - if (CMSInitiatingOccupancyFraction < 0) { - FLAG_SET_DEFAULT(CMSInitiatingOccupancyFraction, 1); - } - } - } + status = status && verify_percentage(CMSIncrementalSafetyFactor, + "CMSIncrementalSafetyFactor"); // CMS space iteration, which FLSVerifyAllHeapreferences entails, // insists that we hold the requisite locks so that the iteration is @@ -2870,14 +2843,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, // -Xnoclassgc } else if (match_option(option, "-Xnoclassgc", &tail)) { FLAG_SET_CMDLINE(bool, ClassUnloading, false); - // -Xincgc: i-CMS - } else if (match_option(option, "-Xincgc", &tail)) { - FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true); - FLAG_SET_CMDLINE(bool, CMSIncrementalMode, true); - // -Xnoincgc: no i-CMS - } else if (match_option(option, "-Xnoincgc", &tail)) { - FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false); - FLAG_SET_CMDLINE(bool, CMSIncrementalMode, false); // -Xconcgc } else if (match_option(option, "-Xconcgc", &tail)) { FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true); @@ -3707,7 +3672,6 @@ void Arguments::set_shared_spaces_flags() { #if !INCLUDE_ALL_GCS static void force_serial_gc() { FLAG_SET_DEFAULT(UseSerialGC, true); - FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption UNSUPPORTED_GC_OPTION(UseG1GC); UNSUPPORTED_GC_OPTION(UseParallelGC); UNSUPPORTED_GC_OPTION(UseParallelOldGC); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index bbab0184627..cb6b2306745 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1638,30 +1638,10 @@ class CommandLineFlags { "The maximum size of young gen chosen by default per GC worker " \ "thread available") \ \ - product(bool, CMSIncrementalMode, false, \ - "Whether CMS GC should operate in \"incremental\" mode") \ - \ - product(uintx, CMSIncrementalDutyCycle, 10, \ - "Percentage (0-100) of CMS incremental mode duty cycle. If " \ - "CMSIncrementalPacing is enabled, then this is just the initial " \ - "value.") \ - \ - product(bool, CMSIncrementalPacing, true, \ - "Whether the CMS incremental mode duty cycle should be " \ - "automatically adjusted") \ - \ - product(uintx, CMSIncrementalDutyCycleMin, 0, \ - "Minimum percentage (0-100) of the CMS incremental duty cycle " \ - "used when CMSIncrementalPacing is enabled") \ - \ product(uintx, CMSIncrementalSafetyFactor, 10, \ "Percentage (0-100) used to add conservatism when computing the " \ "duty cycle") \ \ - product(uintx, CMSIncrementalOffset, 0, \ - "Percentage (0-100) by which the CMS incremental mode duty cycle "\ - "is shifted to the right within the period between young GCs") \ - \ product(uintx, CMSExpAvgFactor, 50, \ "Percentage (0-100) used to weight the current sample when " \ "computing exponential averages for CMS statistics") \ @@ -1720,15 +1700,6 @@ class CommandLineFlags { "Skip block flux-rate sampling for an epoch unless inter-sweep " \ "duration exceeds this threshold in milliseconds") \ \ - develop(bool, CMSTraceIncrementalMode, false, \ - "Trace CMS incremental mode") \ - \ - develop(bool, CMSTraceIncrementalPacing, false, \ - "Trace CMS incremental mode pacing computation") \ - \ - develop(bool, CMSTraceThreadState, false, \ - "Trace the CMS thread state (enable the trace_state() method)") \ - \ product(bool, CMSClassUnloadingEnabled, true, \ "Whether class unloading enabled when using CMS GC") \ \ diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp index 5cbbbeb3828..6acb0828407 100644 --- a/hotspot/src/share/vm/runtime/mutexLocker.cpp +++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp @@ -72,7 +72,6 @@ Monitor* Threads_lock = NULL; Monitor* CGC_lock = NULL; Monitor* STS_lock = NULL; Monitor* SLT_lock = NULL; -Monitor* iCMS_lock = NULL; Monitor* FullGCCount_lock = NULL; Monitor* CMark_lock = NULL; Mutex* CMRegionStack_lock = NULL; @@ -175,9 +174,6 @@ void mutex_init() { def(CGC_lock , Monitor, special, true ); // coordinate between fore- and background GC def(STS_lock , Monitor, leaf, true ); - if (UseConcMarkSweepGC) { - def(iCMS_lock , Monitor, special, true ); // CMS incremental mode start/stop notification - } if (UseConcMarkSweepGC || UseG1GC) { def(FullGCCount_lock , Monitor, leaf, true ); // in support of ExplicitGCInvokesConcurrent } diff --git a/hotspot/src/share/vm/runtime/mutexLocker.hpp b/hotspot/src/share/vm/runtime/mutexLocker.hpp index ab027291d30..0a28a6821f6 100644 --- a/hotspot/src/share/vm/runtime/mutexLocker.hpp +++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp @@ -66,7 +66,6 @@ extern Monitor* CGC_lock; // used for coordination betwee // fore- & background GC threads. extern Monitor* STS_lock; // used for joining/leaving SuspendibleThreadSet. extern Monitor* SLT_lock; // used in CMS GC for acquiring PLL -extern Monitor* iCMS_lock; // CMS incremental mode start/stop notification extern Monitor* FullGCCount_lock; // in support of "concurrent" full gc extern Monitor* CMark_lock; // used for concurrent mark thread coordination extern Mutex* CMRegionStack_lock; // used for protecting accesses to the CM region stack diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index c81cd8a2c9a..14fa1fc7ff5 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -527,12 +527,10 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; nonstatic_field(DefNewGeneration, _next_gen, Generation*) \ nonstatic_field(DefNewGeneration, _tenuring_threshold, uint) \ nonstatic_field(DefNewGeneration, _age_table, ageTable) \ - nonstatic_field(DefNewGeneration, _eden_space, EdenSpace*) \ + nonstatic_field(DefNewGeneration, _eden_space, ContiguousSpace*) \ nonstatic_field(DefNewGeneration, _from_space, ContiguousSpace*) \ nonstatic_field(DefNewGeneration, _to_space, ContiguousSpace*) \ \ - nonstatic_field(EdenSpace, _gen, DefNewGeneration*) \ - \ nonstatic_field(Generation, _reserved, MemRegion) \ nonstatic_field(Generation, _virtual_space, VirtualSpace) \ nonstatic_field(Generation, _level, int) \ @@ -1490,7 +1488,6 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; declare_toplevel_type(BitMap) \ declare_type(CompactibleSpace, Space) \ declare_type(ContiguousSpace, CompactibleSpace) \ - declare_type(EdenSpace, ContiguousSpace) \ declare_type(OffsetTableContigSpace, ContiguousSpace) \ declare_type(TenuredSpace, OffsetTableContigSpace) \ declare_toplevel_type(BarrierSet) \ @@ -1532,7 +1529,6 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; declare_toplevel_type(CollectedHeap*) \ declare_toplevel_type(ContiguousSpace*) \ declare_toplevel_type(DefNewGeneration*) \ - declare_toplevel_type(EdenSpace*) \ declare_toplevel_type(GenCollectedHeap*) \ declare_toplevel_type(Generation*) \ declare_toplevel_type(GenerationSpec**) \ diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index 0b65e906df7..9c12a059526 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -175,11 +175,8 @@ needs_full_vm_compact1 = \ gc/g1/TestShrinkToOneRegion.java \ gc/metaspace/G1AddMetaspaceDependency.java \ gc/startup_warnings/TestCMS.java \ - gc/startup_warnings/TestCMSIncrementalMode.java \ - gc/startup_warnings/TestCMSNoIncrementalMode.java \ gc/startup_warnings/TestDefaultMaxRAMFraction.java \ gc/startup_warnings/TestDefNewCMS.java \ - gc/startup_warnings/TestIncGC.java \ gc/startup_warnings/TestParallelGC.java \ gc/startup_warnings/TestParallelScavengeSerialOld.java \ gc/startup_warnings/TestParNewCMS.java \ @@ -273,8 +270,6 @@ needs_cmsgc = \ gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java \ gc/concurrentMarkSweep/ \ gc/startup_warnings/TestCMS.java \ - gc/startup_warnings/TestCMSIncrementalMode.java \ - gc/startup_warnings/TestCMSNoIncrementalMode.java \ gc/startup_warnings/TestDefNewCMS.java \ gc/startup_warnings/TestParNewCMS.java diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java index a185fe5d4e8..6a268ae8c46 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java @@ -279,8 +279,7 @@ public class TestShrinkAuxiliaryData { "-XX:\\+UseConcMarkSweepGC", "-XX:\\+UseParallelOldGC", "-XX:\\+UseParNewGC", - "-Xconcgc", - "-Xincgc" + "-Xconcgc" }; } } diff --git a/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java b/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java deleted file mode 100644 index 2103093ce58..00000000000 --- a/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java +++ /dev/null @@ -1,46 +0,0 @@ - -/* -* 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 TestCMSIncrementalMode -* @key gc -* @bug 8006398 -* @summary Test that the deprecated CMSIncrementalMode print a warning message -* @library /testlibrary -*/ - -import com.oracle.java.testlibrary.OutputAnalyzer; -import com.oracle.java.testlibrary.ProcessTools; - -public class TestCMSIncrementalMode { - - public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:+CMSIncrementalMode", "-version"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("warning: Using incremental CMS is deprecated and will likely be removed in a future release"); - output.shouldNotContain("error"); - output.shouldHaveExitValue(0); - } - -} diff --git a/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java b/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java deleted file mode 100644 index 0d329fbe57e..00000000000 --- a/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java +++ /dev/null @@ -1,45 +0,0 @@ -/* -* 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 TestCMSNoIncrementalMode -* @key gc -* @bug 8006398 -* @summary Test that CMS with incremental mode turned off does not print a warning message -* @library /testlibrary -*/ - -import com.oracle.java.testlibrary.OutputAnalyzer; -import com.oracle.java.testlibrary.ProcessTools; - -public class TestCMSNoIncrementalMode { - - public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:-CMSIncrementalMode", "-version"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldNotContain("deprecated"); - output.shouldNotContain("error"); - output.shouldHaveExitValue(0); - } - -} diff --git a/hotspot/test/gc/startup_warnings/TestIncGC.java b/hotspot/test/gc/startup_warnings/TestIncGC.java deleted file mode 100644 index 03c7f9b9fad..00000000000 --- a/hotspot/test/gc/startup_warnings/TestIncGC.java +++ /dev/null @@ -1,46 +0,0 @@ -/* -* 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 TestIncGC -* @key gc -* @bug 8006398 -* @summary Test that the deprecated -Xincgc print a warning message -* @library /testlibrary -*/ - -import com.oracle.java.testlibrary.OutputAnalyzer; -import com.oracle.java.testlibrary.ProcessTools; - - -public class TestIncGC { - - public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xincgc", "-version"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("warning: Using incremental CMS is deprecated and will likely be removed in a future release"); - output.shouldNotContain("error"); - output.shouldHaveExitValue(0); - } - -} From fe45f7091b90e3345e9d66faedb98c59d2e12e48 Mon Sep 17 00:00:00 2001 From: Marcus Larsson Date: Mon, 3 Nov 2014 11:29:00 +0100 Subject: [PATCH 026/159] 8054491: Remove wrong assert and refactor code in G1CollectorPolicy::record_concurrent_mark_end Reviewed-by: tschatzl, brutisso --- .../g1/g1CollectorPolicy.cpp | 38 +++++++------------ .../g1/g1CollectorPolicy.hpp | 6 ++- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 4b193af1fae..ec9dc9a506a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1585,34 +1585,22 @@ public: } }; +uint G1CollectorPolicy::calculate_parallel_work_chunk_size(uint n_workers, uint n_regions) { + assert(n_workers > 0, "Active gc workers should be greater than 0"); + const uint overpartition_factor = 4; + const uint min_chunk_size = MAX2(n_regions / n_workers, 1U); + return MAX2(n_regions / (n_workers * overpartition_factor), min_chunk_size); +} + void -G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) { +G1CollectorPolicy::record_concurrent_mark_cleanup_end(uint n_workers) { _collectionSetChooser->clear(); - uint region_num = _g1->num_regions(); - const uint OverpartitionFactor = 4; - uint WorkUnit; - // The use of MinChunkSize = 8 in the original code - // causes some assertion failures when the total number of - // region is less than 8. The code here tries to fix that. - // Should the original code also be fixed? - if (no_of_gc_threads > 0) { - const uint MinWorkUnit = MAX2(region_num / no_of_gc_threads, 1U); - WorkUnit = MAX2(region_num / (no_of_gc_threads * OverpartitionFactor), - MinWorkUnit); - } else { - assert(no_of_gc_threads > 0, - "The active gc workers should be greater than 0"); - // In a product build do something reasonable to avoid a crash. - const uint MinWorkUnit = MAX2(region_num / (uint) ParallelGCThreads, 1U); - WorkUnit = - MAX2(region_num / (uint) (ParallelGCThreads * OverpartitionFactor), - MinWorkUnit); - } - _collectionSetChooser->prepare_for_par_region_addition(_g1->num_regions(), - WorkUnit); - ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser, WorkUnit, (uint) no_of_gc_threads); - _g1->workers()->run_task(&parKnownGarbageTask); + uint n_regions = _g1->num_regions(); + uint chunk_size = calculate_parallel_work_chunk_size(n_workers, n_regions); + _collectionSetChooser->prepare_for_par_region_addition(n_regions, chunk_size); + ParKnownGarbageTask par_known_garbage_task(_collectionSetChooser, chunk_size, n_workers); + _g1->workers()->run_task(&par_known_garbage_task); _collectionSetChooser->sort_regions(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index 4746e0aac8a..b9c73f4120b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -612,6 +612,10 @@ private: uint desired_min_length, uint desired_max_length); + // Calculate and return chunk size (in number of regions) for parallel + // concurrent mark cleanup. + uint calculate_parallel_work_chunk_size(uint n_workers, uint n_regions); + // Check whether a given young length (young_length) fits into the // given target pause time and whether the prediction for the amount // of objects to be copied for the given length will fit into the @@ -687,7 +691,7 @@ public: // Record start, end, and completion of cleanup. void record_concurrent_mark_cleanup_start(); - void record_concurrent_mark_cleanup_end(int no_of_gc_threads); + void record_concurrent_mark_cleanup_end(uint n_workers); void record_concurrent_mark_cleanup_completed(); // Records the information about the heap size for reporting in From 4a9f06758726838799673a0e19af9588f4447500 Mon Sep 17 00:00:00 2001 From: Marcus Larsson Date: Mon, 3 Nov 2014 12:49:21 +0100 Subject: [PATCH 027/159] 8049341: Parallelize clearing the next mark bitmap Reviewed-by: mgerdin, tschatzl --- .../gc_implementation/g1/concurrentMark.cpp | 28 +++++++++++++++++-- .../g1/concurrentMarkThread.cpp | 1 - 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index eeb110cd015..b01b5d16860 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -180,9 +180,32 @@ class ClearBitmapHRClosure : public HeapRegionClosure { } }; +class ParClearNextMarkBitmapTask : public AbstractGangTask { + ClearBitmapHRClosure* _cl; + HeapRegionClaimer _hrclaimer; + bool _suspendible; // If the task is suspendible, workers must join the STS. + +public: + ParClearNextMarkBitmapTask(ClearBitmapHRClosure *cl, uint n_workers, bool suspendible) : + _cl(cl), _suspendible(suspendible), AbstractGangTask("Parallel Clear Bitmap Task"), _hrclaimer(n_workers) {} + + void work(uint worker_id) { + if (_suspendible) { + SuspendibleThreadSet::join(); + } + G1CollectedHeap::heap()->heap_region_par_iterate(_cl, worker_id, &_hrclaimer); + if (_suspendible) { + SuspendibleThreadSet::leave(); + } + } +}; + void CMBitMap::clearAll() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); ClearBitmapHRClosure cl(NULL, this, false /* may_yield */); - G1CollectedHeap::heap()->heap_region_iterate(&cl); + uint n_workers = g1h->workers()->active_workers(); + ParClearNextMarkBitmapTask task(&cl, n_workers, false); + g1h->workers()->run_task(&task); guarantee(cl.complete(), "Must have completed iteration."); return; } @@ -861,7 +884,8 @@ void ConcurrentMark::clearNextBitmap() { guarantee(!g1h->mark_in_progress(), "invariant"); ClearBitmapHRClosure cl(this, _nextMarkBitMap, true /* may_yield */); - g1h->heap_region_iterate(&cl); + ParClearNextMarkBitmapTask task(&cl, parallel_marking_threads(), true); + _parallel_workers->run_task(&task); // Clear the liveness counting data. If the marking has been aborted, the abort() // call already did that. diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp index 1f9f0661779..5b51a6f4675 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp @@ -280,7 +280,6 @@ void ConcurrentMarkThread::run() { // We may have aborted just before the remark. Do not bother clearing the // bitmap then, as it has been done during mark abort. if (!cm()->has_aborted()) { - SuspendibleThreadSetJoiner sts; _cm->clearNextBitmap(); } else { assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear"); From c1bc4be92b0dae26e36cd165a63bd62872cf16c2 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Wed, 5 Nov 2014 10:12:51 +0100 Subject: [PATCH 028/159] 8061449: G1: FreeRegionList_test() fails with G1 after the JDK-8058534 fix to HeapRegion::orig_end() Reviewed-by: mgerdin, tschatzl, stefank --- .../vm/gc_implementation/g1/heapRegionSet.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp index e1674516881..7c954ffd6bc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp @@ -426,11 +426,19 @@ void FreeRegionList_test() { mtGC); G1BlockOffsetSharedArray oa(heap, bot_storage); bot_storage->commit_regions(0, num_regions_in_test); - HeapRegion hr0(0, &oa, heap); - HeapRegion hr1(1, &oa, heap); - HeapRegion hr2(2, &oa, heap); - HeapRegion hr3(3, &oa, heap); - HeapRegion hr4(4, &oa, heap); + + // Set up memory regions for the heap regions. + MemRegion mr0(heap.start(), HeapRegion::GrainWords); + MemRegion mr1(mr0.end(), HeapRegion::GrainWords); + MemRegion mr2(mr1.end(), HeapRegion::GrainWords); + MemRegion mr3(mr2.end(), HeapRegion::GrainWords); + MemRegion mr4(mr3.end(), HeapRegion::GrainWords); + + HeapRegion hr0(0, &oa, mr0); + HeapRegion hr1(1, &oa, mr1); + HeapRegion hr2(2, &oa, mr2); + HeapRegion hr3(3, &oa, mr3); + HeapRegion hr4(4, &oa, mr4); l.add_ordered(&hr1); l.add_ordered(&hr0); l.add_ordered(&hr3); From 0e5492868614324428f9ab876df4214ce5066f39 Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Wed, 5 Nov 2014 16:39:10 +0100 Subject: [PATCH 029/159] 8061467: Bad page size passed to setup_large_pages() on Solaris Reviewed-by: tschatzl, mgerdin --- hotspot/src/os/solaris/vm/os_solaris.cpp | 5 +++- hotspot/test/gc/TestNUMAPageSize.java | 37 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 hotspot/test/gc/TestNUMAPageSize.java diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index dddb4e7e567..fdf2c1ec1d7 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -2607,7 +2607,10 @@ void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) { assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned."); assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned."); if (UseLargePages) { - Solaris::setup_large_pages(addr, bytes, alignment_hint); + size_t page_size = Solaris::page_size_for_alignment(alignment_hint); + if (page_size > (size_t) vm_page_size()) { + Solaris::setup_large_pages(addr, bytes, page_size); + } } } diff --git a/hotspot/test/gc/TestNUMAPageSize.java b/hotspot/test/gc/TestNUMAPageSize.java new file mode 100644 index 00000000000..1a3b5ddbebf --- /dev/null +++ b/hotspot/test/gc/TestNUMAPageSize.java @@ -0,0 +1,37 @@ +/* + * 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 TestNUMAPageSize + * @summary Make sure that start up with NUMA support does not cause problems. + * @bug 8061467 + * @key gc + * @key regression + * @run main/othervm -Xmx8M -XX:+UseNUMA TestNUMAPageSize + */ + +public class TestNUMAPageSize { + public static void main(String args[]) throws Exception { + // nothing to do + } +} From 7339456266104bf8f691e4710cc4cd19b5a221ac Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Wed, 5 Nov 2014 15:50:14 +0100 Subject: [PATCH 030/159] 8062836: BACKOUT - Parallelize clearing the next mark bitmap Backing out due to non-trivial issues found in nightly testing Reviewed-by: mgerdin, mlarsson --- .../gc_implementation/g1/concurrentMark.cpp | 28 ++----------------- .../g1/concurrentMarkThread.cpp | 1 + 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index b01b5d16860..eeb110cd015 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -180,32 +180,9 @@ class ClearBitmapHRClosure : public HeapRegionClosure { } }; -class ParClearNextMarkBitmapTask : public AbstractGangTask { - ClearBitmapHRClosure* _cl; - HeapRegionClaimer _hrclaimer; - bool _suspendible; // If the task is suspendible, workers must join the STS. - -public: - ParClearNextMarkBitmapTask(ClearBitmapHRClosure *cl, uint n_workers, bool suspendible) : - _cl(cl), _suspendible(suspendible), AbstractGangTask("Parallel Clear Bitmap Task"), _hrclaimer(n_workers) {} - - void work(uint worker_id) { - if (_suspendible) { - SuspendibleThreadSet::join(); - } - G1CollectedHeap::heap()->heap_region_par_iterate(_cl, worker_id, &_hrclaimer); - if (_suspendible) { - SuspendibleThreadSet::leave(); - } - } -}; - void CMBitMap::clearAll() { - G1CollectedHeap* g1h = G1CollectedHeap::heap(); ClearBitmapHRClosure cl(NULL, this, false /* may_yield */); - uint n_workers = g1h->workers()->active_workers(); - ParClearNextMarkBitmapTask task(&cl, n_workers, false); - g1h->workers()->run_task(&task); + G1CollectedHeap::heap()->heap_region_iterate(&cl); guarantee(cl.complete(), "Must have completed iteration."); return; } @@ -884,8 +861,7 @@ void ConcurrentMark::clearNextBitmap() { guarantee(!g1h->mark_in_progress(), "invariant"); ClearBitmapHRClosure cl(this, _nextMarkBitMap, true /* may_yield */); - ParClearNextMarkBitmapTask task(&cl, parallel_marking_threads(), true); - _parallel_workers->run_task(&task); + g1h->heap_region_iterate(&cl); // Clear the liveness counting data. If the marking has been aborted, the abort() // call already did that. diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp index 5b51a6f4675..1f9f0661779 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp @@ -280,6 +280,7 @@ void ConcurrentMarkThread::run() { // We may have aborted just before the remark. Do not bother clearing the // bitmap then, as it has been done during mark abort. if (!cm()->has_aborted()) { + SuspendibleThreadSetJoiner sts; _cm->clearNextBitmap(); } else { assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear"); From bb556024a72ae9ce6177f8f73d90e5887246b358 Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Mon, 3 Nov 2014 11:08:03 +0100 Subject: [PATCH 031/159] 8061964: Insufficient compiler barriers for GCC in OrderAccess functions Fix OrderAccess functions to emit memory clobbering inline assembly to attempt to stop copiler reordering. Reviewed-by: dcubed, dholmes, bdelsart --- .../vm/orderAccess_linux_x86.inline.hpp | 57 ++++++++++--------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp index a71a53cfa8c..d391baf8095 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp @@ -31,6 +31,11 @@ // Implementation of class OrderAccess. +// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions +static inline void compiler_barrier() { + __asm__ volatile ("" : : : "memory"); +} + inline void OrderAccess::loadload() { acquire(); } inline void OrderAccess::storestore() { release(); } inline void OrderAccess::loadstore() { acquire(); } @@ -46,9 +51,7 @@ inline void OrderAccess::acquire() { } inline void OrderAccess::release() { - // Avoid hitting the same cache-line from - // different threads. - volatile jint local_dummy = 0; + compiler_barrier(); } inline void OrderAccess::fence() { @@ -62,34 +65,34 @@ inline void OrderAccess::fence() { } } -inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { return *p; } -inline jshort OrderAccess::load_acquire(volatile jshort* p) { return *p; } -inline jint OrderAccess::load_acquire(volatile jint* p) { return *p; } -inline jlong OrderAccess::load_acquire(volatile jlong* p) { return Atomic::load(p); } -inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { return *p; } -inline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; } -inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; } -inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); } -inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; } -inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); } +inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { jbyte v = *p; compiler_barrier(); return v; } +inline jshort OrderAccess::load_acquire(volatile jshort* p) { jshort v = *p; compiler_barrier(); return v; } +inline jint OrderAccess::load_acquire(volatile jint* p) { jint v = *p; compiler_barrier(); return v; } +inline jlong OrderAccess::load_acquire(volatile jlong* p) { jlong v = Atomic::load(p); compiler_barrier(); return v; } +inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { jubyte v = *p; compiler_barrier(); return v; } +inline jushort OrderAccess::load_acquire(volatile jushort* p) { jushort v = *p; compiler_barrier(); return v; } +inline juint OrderAccess::load_acquire(volatile juint* p) { juint v = *p; compiler_barrier(); return v; } +inline julong OrderAccess::load_acquire(volatile julong* p) { julong v = Atomic::load((volatile jlong*)p); compiler_barrier(); return v; } +inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { jfloat v = *p; compiler_barrier(); return v; } +inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { jdouble v = jdouble_cast(Atomic::load((volatile jlong*)p)); compiler_barrier(); return v; } -inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; } -inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; } -inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; } +inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { intptr_t v = *p; compiler_barrier(); return v; } +inline void* OrderAccess::load_ptr_acquire(volatile void* p) { void* v = *(void* volatile *)p; compiler_barrier(); return v; } +inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { void* v = *(void* const volatile *)p; compiler_barrier(); return v; } -inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { *p = v; } -inline void OrderAccess::release_store(volatile jshort* p, jshort v) { *p = v; } -inline void OrderAccess::release_store(volatile jint* p, jint v) { *p = v; } -inline void OrderAccess::release_store(volatile jlong* p, jlong v) { Atomic::store(v, p); } -inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { *p = v; } -inline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; } -inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; } -inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); } -inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; } +inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { compiler_barrier(); *p = v; } +inline void OrderAccess::release_store(volatile jshort* p, jshort v) { compiler_barrier(); *p = v; } +inline void OrderAccess::release_store(volatile jint* p, jint v) { compiler_barrier(); *p = v; } +inline void OrderAccess::release_store(volatile jlong* p, jlong v) { compiler_barrier(); Atomic::store(v, p); } +inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { compiler_barrier(); *p = v; } +inline void OrderAccess::release_store(volatile jushort* p, jushort v) { compiler_barrier(); *p = v; } +inline void OrderAccess::release_store(volatile juint* p, juint v) { compiler_barrier(); *p = v; } +inline void OrderAccess::release_store(volatile julong* p, julong v) { compiler_barrier(); Atomic::store((jlong)v, (volatile jlong*)p); } +inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { compiler_barrier(); *p = v; } inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong *)p, jlong_cast(v)); } -inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; } -inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; } +inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { compiler_barrier(); *p = v; } +inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { compiler_barrier(); *(void* volatile *)p = v; } inline void OrderAccess::store_fence(jbyte* p, jbyte v) { __asm__ volatile ( "xchgb (%2),%0" From 894e9e8f87916207edf5969cfa2365d4c1a7df85 Mon Sep 17 00:00:00 2001 From: John Coomes Date: Fri, 7 Nov 2014 15:34:33 -0800 Subject: [PATCH 032/159] 8060467: CMS: small OldPLABSize and -XX:-ResizePLAB cause assert(ResizePLAB || n_blks == OldPLABSize) failed: Error Reviewed-by: tschatzl, jmasa, kbarrett --- .../compactibleFreeListSpace.cpp | 2 +- .../DisableResizePLAB.java | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index ee2dc9b3622..812b8bcf3cf 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -2625,7 +2625,7 @@ void CFLS_LAB::get_from_global_pool(size_t word_sz, AdaptiveFreeList* // Get the #blocks we want to claim size_t n_blks = (size_t)_blocks_to_claim[word_sz].average(); assert(n_blks > 0, "Error"); - assert(ResizePLAB || n_blks == OldPLABSize, "Error"); + assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error"); // In some cases, when the application has a phase change, // there may be a sudden and sharp shift in the object survival // profile, and updating the counts at the end of a scavenge diff --git a/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java new file mode 100644 index 00000000000..c504d069a72 --- /dev/null +++ b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java @@ -0,0 +1,44 @@ +/* +* 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 DisableResizePLAB + * @key gc + * @bug 8060467 + * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com + * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize + * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -XX:+PrintGCDetails DisableResizePLAB + */ + +public class DisableResizePLAB { + public static void main(String args[]) throws Exception { + Object garbage[] = new Object[1_000]; + for (int i = 0; i < garbage.length; i++) { + garbage[i] = new byte[0]; + } + long startTime = System.currentTimeMillis(); + while (System.currentTimeMillis() - startTime < 10_000) { + Object o = new byte[1024]; + } + } +} From 6e148efe69a6ea2ab2838ae179854e51fb8a8400 Mon Sep 17 00:00:00 2001 From: Marcus Larsson Date: Mon, 10 Nov 2014 12:13:46 +0100 Subject: [PATCH 033/159] 8064348: Add TraceEvent::is_enabled() for embedded/minimal builds Reviewed-by: ehelin, sla --- hotspot/src/share/vm/trace/traceEventClasses.xsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/trace/traceEventClasses.xsl b/hotspot/src/share/vm/trace/traceEventClasses.xsl index b213ea29c18..12496ac65e8 100644 --- a/hotspot/src/share/vm/trace/traceEventClasses.xsl +++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl @@ -1,6 +1,6 @@ is :" + is); - System.out.println(" is.hash :" + is.hashCode()); - System.out.println(); - System.out.println(" e.name :" + e.getName()); - System.out.println(" e.hash :" + e.hashCode()); - System.out.println(" e.method :" + e.getMethod()); - System.out.println(" e.size :" + e.getSize()); - System.out.println(" e.csize :" + e.getCompressedSize()); + try (final InputStream is = zf.getInputStream(e)) { + try { + while (is.read(bytes) >= 0) { + } + } catch (IOException x) { + System.out.println(".................................."); + System.out.println(" --> is :" + is); + System.out.println(" is.hash :" + is.hashCode()); + System.out.println(); + System.out.println(" e.name :" + e.getName()); + System.out.println(" e.hash :" + e.hashCode()); + System.out.println(" e.method :" + e.getMethod()); + System.out.println(" e.size :" + e.getSize()); + System.out.println(" e.csize :" + e.getCompressedSize()); + System.out.println(".................................."); - x.printStackTrace(); - System.out.println(".................................."); - System.exit(97); + throw new AssertionError("IOException was throwing while read the archive. Test failed.", x); + } + } } } - zf.close(); + System.out.println("Test passed."); + } + + private static void createTestJarFile() { + ArrayList jarOptions = new ArrayList<>(); + + // jar cf foo.jar * + System.out.println("Creating jar file.."); + jarOptions.add("cf"); + jarOptions.add(JAR_NAME); + try { + for (int i = 0; i < 100; ++i) { + Path temp = Files.createTempFile(CURRENT_DIR, SELF_NAME, ".java"); + Files.copy(TEST_SOURCE_PATH, temp, StandardCopyOption.REPLACE_EXISTING); + jarOptions.add(temp.toString()); + } + } catch (IOException ex) { + throw new AssertionError("TESTBUG: Creating temp files failed.", ex); + } + runJar(jarOptions); + + // jar -uf0 foo.jar Test7068051.java + System.out.println("Adding unpacked file..."); + jarOptions.clear(); + jarOptions.add("-uf0"); + jarOptions.add(JAR_NAME); + jarOptions.add(TEST_SOURCE_PATH.toString()); + runJar(jarOptions); + } + + private static void runJar(List params) { + JDKToolLauncher jar = JDKToolLauncher.create("jar"); + for (String p : params) { + jar.addToolArg(p); + } + ProcessBuilder pb = new ProcessBuilder(jar.getCommand()); + try { + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } catch (IOException ex) { + throw new AssertionError("TESTBUG: jar failed.", ex); + } } } diff --git a/hotspot/test/compiler/7068051/Test7068051.sh b/hotspot/test/compiler/7068051/Test7068051.sh deleted file mode 100644 index 35bc0f72efd..00000000000 --- a/hotspot/test/compiler/7068051/Test7068051.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2011, 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. -# -# -## some tests require path to find test source dir -if [ "${TESTSRC}" = "" ] -then - TESTSRC=${PWD} - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -set -x - -${COMPILEJAVA}/bin/jar xf ${COMPILEJAVA}/jre/lib/javaws.jar -${COMPILEJAVA}/bin/jar cf foo.jar * -cp ${TESTSRC}/Test7068051.java ./ -${COMPILEJAVA}/bin/jar -uf0 foo.jar Test7068051.java - -${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} -d . Test7068051.java - -${TESTJAVA}/bin/java ${TESTOPTS} -showversion -Xbatch Test7068051 foo.jar - From 80830d4932c73e38f5932d2ea7aeef291ca4e0f8 Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Sat, 8 Nov 2014 16:00:28 +0300 Subject: [PATCH 045/159] 8062742: compiler/EliminateAutoBox/UnsignedLoads.java fails with client vm Reviewed-by: kvn, rbackman, anoll, vlivanov, iignatyev --- hotspot/test/TEST.groups | 3 ++- hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index 8dbacc847f3..dbeb191ee3c 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -431,7 +431,8 @@ hotspot_compiler_2 = \ compiler/8005033/Test8005033.java \ compiler/8005419/Test8005419.java \ compiler/8005956/PolynomialRoot.java \ - compiler/8007294/Test8007294.java + compiler/8007294/Test8007294.java \ + compiler/EliminateAutoBox/UnsignedLoads.java hotspot_compiler_3 = \ compiler/8007722/Test8007722.java \ diff --git a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java b/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java index 982c5f7beb1..6343386b999 100644 --- a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java +++ b/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java @@ -26,7 +26,7 @@ /* * @test * @library /testlibrary - * @run main/othervm -Xbatch -XX:+EliminateAutoBox + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox * -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort * UnsignedLoads */ From 913c598d6c1f196432655d311553a56e8bb6a337 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Sat, 8 Nov 2014 16:01:10 +0300 Subject: [PATCH 046/159] 8063157: add targets for optimized builds Reviewed-by: kvn, dholmes --- make/jprt.properties | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/make/jprt.properties b/make/jprt.properties index 1a268de8353..dbe27081b20 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -50,14 +50,18 @@ jprt.build.flavor.debugOpen.target=jprt_bundle jprt.build.flavor.fastdebug.target=jprt_bundle jprt.build.flavor.product.target=jprt_bundle jprt.build.flavor.productOpen.target=jprt_bundle +jprt.build.flavor.optimized.target=jprt_bundle +jprt.build.flavor.optimizedOpen.target=jprt_bundle # Use these configure args to define debug level jprt.debug.build.configure.args=--with-debug-level=slowdebug jprt.fastdebug.build.configure.args=--with-debug-level=fastdebug jprt.product.build.configure.args=--with-debug-level=release +jprt.optimized.build.configure.args=--with-debug-level=optimized jprt.debugOpen.build.configure.args=${jprt.debug.build.configure.args} --enable-openjdk-only jprt.fastdebugOpen.build.configure.args=${jprt.fastdebug.build.configure.args} --enable-openjdk-only jprt.productOpen.build.configure.args=${jprt.product.build.configure.args} --enable-openjdk-only +jprt.optimizedOpen.build.configure.args=${jprt.product.build.configure.args} --enable-openjdk-only # Select build flavors and build targets jprt.build.flavors=${my.is.hotspot.job ? ${my.build.flavors.hotspot} : ${my.build.flavors.default}} @@ -230,18 +234,18 @@ my.make.rule.test.targets.jck= \ # The hotspot build flavors my.build.flavors.hotspot= \ - debugOpen,fastdebug,product,productOpen, \ + debugOpen,fastdebug,product,productOpen,optimized,optimizedOpen \ ${my.additional.build.flavors.hotspot} # Platforms built for hotspot push jobs my.build.targets.hotspot= \ - solaris_sparcv9_5.11-{product|fastdebug|optimized}, \ + solaris_sparcv9_5.11-{product|fastdebug}, \ solaris_x64_5.11-{product|fastdebug}, \ linux_i586_2.6-{product|fastdebug}, \ - linux_x64_2.6-{product|fastdebug|optimized}, \ + linux_x64_2.6-{product|fastdebug}, \ macosx_x64_10.7-{product|fastdebug}, \ windows_i586_6.1-{product|fastdebug}, \ - windows_x64_6.1-{product|fastdebug|optimized}, \ + windows_x64_6.1-{product|fastdebug}, \ solaris_x64_5.11-{debugOpen}, \ linux_x64_2.6-{productOpen}, \ ${my.additional.build.targets.hotspot} From e8c7cc1187a169adf895f7d0c92150fc9933e01f Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Sun, 9 Nov 2014 22:17:45 +0300 Subject: [PATCH 047/159] 7169583: JInternalFrame title not antialiased in Nimbus LaF Reviewed-by: azvegint, alexsch --- .../plaf/basic/BasicInternalFrameTitlePane.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java index 7ae4bc1b408..17284fd4f86 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java @@ -31,16 +31,14 @@ import java.awt.event.*; import javax.accessibility.AccessibleContext; import javax.swing.*; import javax.swing.plaf.*; -import javax.swing.border.*; import javax.swing.event.InternalFrameEvent; -import java.util.EventListener; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; -import java.beans.VetoableChangeListener; import java.beans.PropertyVetoException; import sun.swing.DefaultLookup; -import sun.swing.UIAction; + +import static sun.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY; /** * The class that manages a basic title bar @@ -215,6 +213,12 @@ public class BasicInternalFrameTitlePane extends JComponent createButtons(); addSubComponents(); + updateProperties(); + } + + private void updateProperties() { + final Object aaTextInfo = frame.getClientProperty(AA_TEXT_PROPERTY_KEY); + putClientProperty(AA_TEXT_PROPERTY_KEY, aaTextInfo); } /** From 043868fac75236bf49dbb9d6776b57f57a3fef41 Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Mon, 10 Nov 2014 16:23:30 +0300 Subject: [PATCH 048/159] 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1 Reviewed-by: pchelko, serb --- .../sun/awt/Translucency/WindowOpacity.java | 15 ++++---- .../NoUpdateUponShow/NoUpdateUponShow.java | 9 +++-- .../java/awt/Component/PaintAll/PaintAll.java | 17 ++++++---- .../ModalBlockedStealsFocusTest.java | 10 ++++-- .../WindowInitialFocusTest.java | 17 ++++++---- .../ExceptionOnSetExtendedStateTest.java | 11 +++--- .../awt/Frame/FrameSize/TestFrameSize.java | 8 ++++- .../MaximizedByPlatform.java | 18 +++++++--- .../MaximizedToMaximized.java | 5 +-- .../SlideNotResizableTest.java | 7 ++-- .../TranslucentWindow/TranslucentWindow.java | 15 +++++--- .../IncorrectDisplayModeExitFullscreen.java | 20 ++++++----- .../GridBagLayoutIpadXYTest.java | 9 ++++- .../List/ListPeer/R2303044ListSelection.java | 10 +++--- .../SingleModeDeselect.java | 9 +++-- jdk/test/java/awt/Paint/ExposeOnEDT.java | 17 ++++++---- .../ScrollPanePreferredSize.java | 13 ++++--- .../awt/TextArea/DisposeTest/TestDispose.java | 17 ++++++---- .../bug7129742.java | 7 ++-- .../TextAreaTwicePack/TextAreaTwicePack.java | 9 ++--- .../TextField/DisposeTest/TestDispose.java | 16 +++++---- .../PopupMenuLeakTest/PopupMenuLeakTest.java | 10 +++--- .../java/awt/Window/8027025/Test8027025.java | 5 ++- .../AlwaysOnTop/AlwaysOnTopFieldTest.java | 21 +++++++----- .../OwnedWindowsSerialization.java | 5 ++- .../TextEventSequenceTest.java | 34 +++++++++++-------- .../WarningWindowDisposeCrashTest.java | 19 +++++------ .../WarningWindowDisposeTest.java | 23 +++++++------ 28 files changed, 233 insertions(+), 143 deletions(-) diff --git a/jdk/test/com/sun/awt/Translucency/WindowOpacity.java b/jdk/test/com/sun/awt/Translucency/WindowOpacity.java index 26c611c35d5..a8391503238 100644 --- a/jdk/test/com/sun/awt/Translucency/WindowOpacity.java +++ b/jdk/test/com/sun/awt/Translucency/WindowOpacity.java @@ -33,15 +33,12 @@ import java.awt.*; import java.awt.event.*; import com.sun.awt.AWTUtilities; -import sun.awt.SunToolkit; public class WindowOpacity { //*** test-writer defined static variables go here *** - private static void realSync() { - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); - } + private static Robot robot; private static void init() @@ -60,6 +57,12 @@ public class WindowOpacity System.out.println("Either the Toolkit or the native system does not support controlling the window opacity level."); pass(); } + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException ("Unexpected failure"); + } boolean passed; @@ -137,7 +140,7 @@ public class WindowOpacity f.setBounds(100, 100, 300, 200); f.setVisible(true); - realSync(); + robot.waitForIdle(); curOpacity = AWTUtilities.getWindowOpacity(f); if (curOpacity < 0.75f || curOpacity > 0.75f) { @@ -147,7 +150,7 @@ public class WindowOpacity AWTUtilities.setWindowOpacity(f, 0.5f); - realSync(); + robot.waitForIdle(); curOpacity = AWTUtilities.getWindowOpacity(f); if (curOpacity < 0.5f || curOpacity > 0.5f) { diff --git a/jdk/test/java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java b/jdk/test/java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java index 80360dfdbe5..d032f0d784b 100644 --- a/jdk/test/java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java +++ b/jdk/test/java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java @@ -36,7 +36,6 @@ */ import java.awt.*; -import sun.awt.SunToolkit; public class NoUpdateUponShow { @@ -70,7 +69,13 @@ public class NoUpdateUponShow }); f.setVisible(true); - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + try { + Robot robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } if (wasUpdate) { fail(" Unexpected update. "); diff --git a/jdk/test/java/awt/Component/PaintAll/PaintAll.java b/jdk/test/java/awt/Component/PaintAll/PaintAll.java index e734cad1fdf..483f1a5bd5a 100644 --- a/jdk/test/java/awt/Component/PaintAll/PaintAll.java +++ b/jdk/test/java/awt/Component/PaintAll/PaintAll.java @@ -21,8 +21,6 @@ * questions. */ -import sun.awt.SunToolkit; - import java.awt.Button; import java.awt.Canvas; import java.awt.Checkbox; @@ -48,6 +46,8 @@ import java.awt.image.BufferedImage; @bug 6596915 @summary Test Component.paintAll() method @author sergey.bylokhov@oracle.com: area=awt.component + @library ../../../../lib/testlibrary/ + @build ExtendedRobot @run main PaintAll */ public class PaintAll { @@ -66,6 +66,7 @@ public class PaintAll { private static volatile boolean scrollPanePainted; private static volatile boolean textAreaPainted; private static volatile boolean textFieldPainted; + private static ExtendedRobot robot = null; private static final Button buttonStub = new Button() { @Override @@ -283,11 +284,15 @@ public class PaintAll { } private static void sleep() { - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); - try { - Thread.sleep(500L); - } catch (InterruptedException ignored) { + if(robot == null) { + try { + robot = new ExtendedRobot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } } + robot.waitForIdle(500); } private static void fail(final String message) { diff --git a/jdk/test/java/awt/Focus/ModalBlockedStealsFocusTest/ModalBlockedStealsFocusTest.java b/jdk/test/java/awt/Focus/ModalBlockedStealsFocusTest/ModalBlockedStealsFocusTest.java index 7c8e6574c92..f718ecbcfc1 100644 --- a/jdk/test/java/awt/Focus/ModalBlockedStealsFocusTest/ModalBlockedStealsFocusTest.java +++ b/jdk/test/java/awt/Focus/ModalBlockedStealsFocusTest/ModalBlockedStealsFocusTest.java @@ -34,11 +34,9 @@ import java.awt.event.*; import java.applet.Applet; import java.util.concurrent.atomic.AtomicBoolean; import java.lang.reflect.InvocationTargetException; -import sun.awt.SunToolkit; import test.java.awt.regtesthelpers.Util; public class ModalBlockedStealsFocusTest extends Applet { - SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); Frame frame = new Frame("Blocked Frame"); Dialog dialog = new Dialog(frame, "Modal Dialog", Dialog.ModalityType.TOOLKIT_MODAL); AtomicBoolean lostFocus = new AtomicBoolean(false); @@ -85,7 +83,13 @@ public class ModalBlockedStealsFocusTest extends Applet { }).start(); Util.waitTillShown(dialog); - toolkit.realSync(); + try { + Robot robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } // Test 1. Show a modal blocked frame, check that it doesn't steal focus. diff --git a/jdk/test/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java b/jdk/test/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java index ee047a3b493..38c924b3a6c 100644 --- a/jdk/test/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java +++ b/jdk/test/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java @@ -33,7 +33,6 @@ import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.util.concurrent.atomic.AtomicBoolean; -import sun.awt.SunToolkit; import test.java.awt.regtesthelpers.Util; public class WindowInitialFocusTest extends Applet { @@ -41,7 +40,7 @@ public class WindowInitialFocusTest extends Applet { Window window = new Window(frame); Button button = new Button("button"); AtomicBoolean focused = new AtomicBoolean(false); - SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); + Robot robot; public static void main(String[] args) { WindowInitialFocusTest app = new WindowInitialFocusTest(); @@ -75,12 +74,18 @@ public class WindowInitialFocusTest extends Applet { }}); frame.setVisible(true); - toolkit.realSync(); + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } + robot.waitForIdle(); // Test 1. Show the window, check that it become focused. window.setVisible(true); - toolkit.realSync(); + robot.waitForIdle(); if (!Util.waitForCondition(focused, 2000L)) { throw new TestFailedException("the window didn't get focused on its showing!"); @@ -89,13 +94,13 @@ public class WindowInitialFocusTest extends Applet { // Test 2. Show unfocusable window, check that it doesn't become focused. window.setVisible(false); - toolkit.realSync(); + robot.waitForIdle(); window.setFocusableWindowState(false); focused.set(false); window.setVisible(true); - toolkit.realSync(); + robot.waitForIdle(); if (Util.waitForCondition(focused, 2000L)) { throw new TestFailedException("the unfocusable window got focused on its showing!"); diff --git a/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java b/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java index b0f3c63b048..845138ab3bb 100644 --- a/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java +++ b/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java @@ -30,11 +30,8 @@ import java.awt.*; -import sun.awt.SunToolkit; - public class ExceptionOnSetExtendedStateTest { private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH }; - private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); private static boolean validatePlatform() { String osName = System.getProperty("os.name"); @@ -53,7 +50,13 @@ public class ExceptionOnSetExtendedStateTest { frame.setSize(200, 200); frame.setUndecorated(!decoratedFrame); frame.setVisible(true); - toolkit.realSync(); + try { + Robot robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } frame.setExtendedState(oldState); sleep(1000); diff --git a/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java b/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java index b2a978300a9..b42a70fbd11 100644 --- a/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java +++ b/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java @@ -77,7 +77,13 @@ public class TestFrameSize { mainWindow.setVisible(true); - ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + try { + Robot robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure."); + } Dimension clientSize2 = getClientSize(mainWindow); System.out.println("Client size after showing: " + clientSize2); diff --git a/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java b/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java index 070aa4deba6..224c10e7996 100644 --- a/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java +++ b/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java @@ -25,11 +25,12 @@ * @bug 8026143 * @summary [macosx] Maximized state could be inconsistent between peer and frame * @author Petr Pchelko + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run main MaximizedByPlatform */ -import sun.awt.OSInfo; -import sun.awt.SunToolkit; +import jdk.testlibrary.OSInfo; import java.awt.*; @@ -43,6 +44,13 @@ public class MaximizedByPlatform { return; } + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } availableScreenBounds = getAvailableScreenBounds(); // Test 1. The maximized state is set in setBounds @@ -51,12 +59,12 @@ public class MaximizedByPlatform { frame.setBounds(100, 100, 100, 100); frame.setVisible(true); - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); frame.setBounds(availableScreenBounds.x, availableScreenBounds.y, availableScreenBounds.width, availableScreenBounds.height); - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) { throw new RuntimeException("Maximized state was not set for frame in setBounds"); @@ -73,7 +81,7 @@ public class MaximizedByPlatform { availableScreenBounds.width + 100, availableScreenBounds.height); frame.setVisible(true); - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) { throw new RuntimeException("Maximized state was not set for frame in setVisible"); diff --git a/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java b/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java index 83fcfa1701d..e0da056b035 100644 --- a/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java +++ b/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java @@ -28,7 +28,7 @@ import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.Rectangle; import java.awt.Toolkit; -import sun.awt.SunToolkit; +import java.awt.Robot; /** * @test @@ -65,7 +65,8 @@ public class MaximizedToMaximized { Rectangle frameBounds = frame.getBounds(); frame.setExtendedState(Frame.MAXIMIZED_BOTH); - ((SunToolkit) toolkit).realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); Rectangle maximizedFrameBounds = frame.getBounds(); if (maximizedFrameBounds.width < frameBounds.width diff --git a/jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java b/jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java index 37df055ca22..b5938187185 100644 --- a/jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java +++ b/jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java @@ -21,8 +21,6 @@ * questions. */ -import sun.awt.SunToolkit; - import java.awt.*; import java.awt.Dimension; import java.awt.Point; @@ -62,8 +60,9 @@ public class SlideNotResizableTest { } } - private static void sync() throws InterruptedException { - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + private static void sync() throws Exception { + Robot robot = new Robot(); + robot.waitForIdle(); Thread.sleep(1000); } } diff --git a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java index 1210b0dc551..35ab7dc906f 100644 --- a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java +++ b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java @@ -34,10 +34,17 @@ import java.awt.geom.*; import static java.awt.GraphicsDevice.WindowTranslucency.*; -import sun.awt.SunToolkit; public class TranslucentWindow { public static void main(String args[]) { + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); @@ -47,10 +54,10 @@ public class TranslucentWindow { // First, check it can be made fullscreen window without any effects applied gd.setFullScreenWindow(f); - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); gd.setFullScreenWindow(null); - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); // Second, check if it applying any effects doesn't prevent the window // from going into the fullscreen mode @@ -64,7 +71,7 @@ public class TranslucentWindow { f.setBackground(new Color(0, 0, 0, 128)); } gd.setFullScreenWindow(f); - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); // Third, make sure all the effects are unset when entering the fullscreen mode if (f.getShape() != null) { diff --git a/jdk/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java b/jdk/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java index 1d42db8f47d..ad808c3ab63 100644 --- a/jdk/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java +++ b/jdk/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java @@ -27,16 +27,17 @@ import java.awt.DisplayMode; import java.awt.Frame; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; -import java.awt.Toolkit; - -import sun.awt.SunToolkit; /** * @test * @bug 8019587 * @author Sergey Bylokhov + * @library ../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main IncorrectDisplayModeExitFullscreen */ public class IncorrectDisplayModeExitFullscreen { + static ExtendedRobot robot; public static void main(final String[] args) { @@ -64,6 +65,13 @@ public class IncorrectDisplayModeExitFullscreen { return; } + try { + robot = new ExtendedRobot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } + final Frame frame = new Frame(); frame.setBackground(Color.GREEN); frame.setUndecorated(true); @@ -85,10 +93,6 @@ public class IncorrectDisplayModeExitFullscreen { } } private static void sleep() { - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); - try { - Thread.sleep(1500); - } catch (InterruptedException ignored) { - } + robot.waitForIdle(1500); } } diff --git a/jdk/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java b/jdk/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java index f547ead583e..637bed4f3d5 100644 --- a/jdk/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java +++ b/jdk/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java @@ -71,7 +71,14 @@ public class GridBagLayoutIpadXYTest extends Applet frame.pack(); frame.setVisible(true); - ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + Robot robot; + try { + robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } Dimension minSize = jtf.getMinimumSize(); if ( minSize.width + customIpadx != jtf.getSize().width || diff --git a/jdk/test/java/awt/List/ListPeer/R2303044ListSelection.java b/jdk/test/java/awt/List/ListPeer/R2303044ListSelection.java index d7ef3902a03..d170fe081b9 100644 --- a/jdk/test/java/awt/List/ListPeer/R2303044ListSelection.java +++ b/jdk/test/java/awt/List/ListPeer/R2303044ListSelection.java @@ -21,12 +21,10 @@ * questions. */ -import sun.awt.SunToolkit; - import java.awt.Frame; import java.awt.HeadlessException; import java.awt.List; -import java.awt.Toolkit; +import java.awt.Robot; /** * @test @@ -57,9 +55,11 @@ public final class R2303044ListSelection { private static void sleep() { try { - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); Thread.sleep(1000); - } catch (final InterruptedException ignored) { + } catch (final Exception ignored) { + ignored.printStackTrace(); } } } diff --git a/jdk/test/java/awt/List/SingleModeDeselect/SingleModeDeselect.java b/jdk/test/java/awt/List/SingleModeDeselect/SingleModeDeselect.java index 726835f5f73..c4452cd1015 100644 --- a/jdk/test/java/awt/List/SingleModeDeselect/SingleModeDeselect.java +++ b/jdk/test/java/awt/List/SingleModeDeselect/SingleModeDeselect.java @@ -30,7 +30,6 @@ */ import java.awt.*; -import sun.awt.SunToolkit; public class SingleModeDeselect { @@ -50,7 +49,13 @@ public class SingleModeDeselect list.select(0); list.deselect(1); - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + try { + Robot robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } if (list.getSelectedIndex() != 0){ throw new RuntimeException("Test failed: List.getSelectedIndex() returns "+list.getSelectedIndex()); diff --git a/jdk/test/java/awt/Paint/ExposeOnEDT.java b/jdk/test/java/awt/Paint/ExposeOnEDT.java index cf8a3a547e0..21f7dc00c29 100644 --- a/jdk/test/java/awt/Paint/ExposeOnEDT.java +++ b/jdk/test/java/awt/Paint/ExposeOnEDT.java @@ -22,18 +22,19 @@ */ -import sun.awt.SunToolkit; - import java.awt.*; /** * @test * @bug 7090424 * @author Sergey Bylokhov + * @library ../../../lib/testlibrary/ + * @build ExtendedRobot * @run main ExposeOnEDT */ public final class ExposeOnEDT { + private static ExtendedRobot robot = null; private static final Button buttonStub = new Button() { @Override public void paint(final Graphics g) { @@ -275,11 +276,15 @@ public final class ExposeOnEDT { } private static void sleep() { - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); - try { - Thread.sleep(1000L); - } catch (InterruptedException ignored) { + if(robot == null) { + try { + robot = new ExtendedRobot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } } + robot.waitForIdle(1000); } private static void fail(final String message) { diff --git a/jdk/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java b/jdk/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java index 0c799f14a1d..02a84e859fa 100644 --- a/jdk/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java +++ b/jdk/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java @@ -26,12 +26,13 @@ import java.awt.Frame; import java.awt.ScrollPane; import java.awt.Toolkit; -import sun.awt.SunToolkit; - /** * @test * @bug 7124213 * @author Sergey Bylokhov + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main ScrollPanePreferredSize */ public final class ScrollPanePreferredSize { @@ -54,10 +55,12 @@ public final class ScrollPanePreferredSize { } private static void sleep() { - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); try { - Thread.sleep(500L); - } catch (InterruptedException ignored) { + ExtendedRobot robot = new ExtendedRobot(); + robot.waitForIdle(500); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); } } } diff --git a/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java b/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java index 91c795fbfee..47c534be94f 100644 --- a/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java +++ b/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java @@ -35,14 +35,12 @@ import java.awt.FlowLayout; import java.awt.Frame; import java.awt.TextArea; -import java.awt.Toolkit; +import java.awt.Robot; import java.lang.reflect.InvocationTargetException; import javax.swing.JFrame; import javax.swing.SwingUtilities; -import sun.awt.SunToolkit; - public class TestDispose { public static Frame frame = null; @@ -51,7 +49,14 @@ public class TestDispose { public void testDispose() throws InvocationTargetException, InterruptedException { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } + SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -69,7 +74,7 @@ public class TestDispose { frame.setVisible(true); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -77,7 +82,7 @@ public class TestDispose { frame.dispose(); } }); - toolkit.realSync(); + robot.waitForIdle(); } public static void main(String[] args) throws Exception{ diff --git a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java index d3de4954591..94f1d911f89 100644 --- a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java +++ b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java @@ -34,7 +34,7 @@ import java.awt.FlowLayout; import java.awt.TextArea; -import java.awt.Toolkit; +import java.awt.Robot; import java.lang.reflect.Field; import javax.swing.JFrame; @@ -42,7 +42,6 @@ import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.text.DefaultCaret; -import sun.awt.SunToolkit; public class bug7129742 { @@ -51,7 +50,7 @@ public class bug7129742 { public static boolean fastreturn = false; public static void main(String[] args) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -88,7 +87,7 @@ public class bug7129742 { } } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override diff --git a/jdk/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java b/jdk/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java index eba92a50063..e134c386c05 100644 --- a/jdk/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java +++ b/jdk/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java @@ -24,9 +24,8 @@ import java.awt.Dimension; import java.awt.Frame; import java.awt.TextArea; -import java.awt.Toolkit; +import java.awt.Robot; -import sun.awt.SunToolkit; /** * @test @@ -55,10 +54,12 @@ public final class TextAreaTwicePack { } private static void sleep() { - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); try { + Robot robot = new Robot(); + robot.waitForIdle(); Thread.sleep(500L); - } catch (InterruptedException ignored) { + } catch (Exception ignored) { + ignored.printStackTrace(); } } } diff --git a/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java b/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java index 6ef00cd215d..a4adbc2b229 100644 --- a/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java +++ b/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java @@ -35,14 +35,12 @@ import java.awt.FlowLayout; import java.awt.Frame; import java.awt.TextField; -import java.awt.Toolkit; +import java.awt.Robot; import java.lang.reflect.InvocationTargetException; import javax.swing.JFrame; import javax.swing.SwingUtilities; -import sun.awt.SunToolkit; - public class TestDispose { public static Frame frame = null; @@ -51,7 +49,13 @@ public class TestDispose { public void testDispose() throws InvocationTargetException, InterruptedException { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -69,7 +73,7 @@ public class TestDispose { frame.setVisible(true); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -77,7 +81,7 @@ public class TestDispose { frame.dispose(); } }); - toolkit.realSync(); + robot.waitForIdle(); } diff --git a/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java b/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java index 4d5dd7295f6..5220546fd63 100644 --- a/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java +++ b/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java @@ -26,12 +26,13 @@ @bug 8007220 @summary Reference to the popup leaks after the TrayIcon is removed @author Petr Pchelko + @library ../../../../lib/testlibrary/ + @build ExtendedRobot @run main/othervm -Xmx50m PopupMenuLeakTest */ import java.awt.*; import javax.swing.SwingUtilities; -import sun.awt.SunToolkit; import java.awt.image.BufferedImage; import java.lang.ref.WeakReference; @@ -42,8 +43,10 @@ public class PopupMenuLeakTest { static final AtomicReference> iconWeakReference = new AtomicReference<>(); static final AtomicReference> popupWeakReference = new AtomicReference<>(); + static ExtendedRobot robot; public static void main(String[] args) throws Exception { + robot = new ExtendedRobot(); SwingUtilities.invokeAndWait(PopupMenuLeakTest::createSystemTrayIcon); sleep(); // To make the test automatic we explicitly call addNotify on a popup to create the peer @@ -141,9 +144,6 @@ public class PopupMenuLeakTest { } private static void sleep() { - ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); - try { - Thread.sleep(100); - } catch (InterruptedException ignored) { } + robot.waitForIdle(100); } } diff --git a/jdk/test/java/awt/Window/8027025/Test8027025.java b/jdk/test/java/awt/Window/8027025/Test8027025.java index 44988904419..e798354264f 100644 --- a/jdk/test/java/awt/Window/8027025/Test8027025.java +++ b/jdk/test/java/awt/Window/8027025/Test8027025.java @@ -28,8 +28,6 @@ * @run main Test8027025 */ -import sun.awt.SunToolkit; - import javax.swing.*; import java.awt.*; import java.util.concurrent.atomic.AtomicReference; @@ -49,7 +47,8 @@ public class Test8027025 { window.setVisible(true); }); - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); AtomicReference point = new AtomicReference<>(); SwingUtilities.invokeAndWait(() -> point.set(window.getLocationOnScreen())); diff --git a/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java b/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java index 965eb7f5b07..5cfaa00419c 100644 --- a/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java +++ b/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java @@ -22,9 +22,8 @@ */ import java.awt.Dialog; import java.awt.Frame; -import java.awt.Toolkit; +import java.awt.Robot; import java.awt.Window; -import sun.awt.SunToolkit; /** * @test * @bug 7081594 @@ -35,19 +34,25 @@ import sun.awt.SunToolkit; public class AlwaysOnTopFieldTest { public static void main(String[] args) { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } Window window = new Frame("Window 1"); window.setSize(200, 200); window.setAlwaysOnTop(true); window.setVisible(true); - toolkit.realSync(); + robot.waitForIdle(); Dialog dialog = new Dialog(window, "Owned dialog 1"); dialog.setSize(200, 200); dialog.setLocation(100, 100); dialog.setVisible(true); - toolkit.realSync(); + robot.waitForIdle(); try { if (!window.isAlwaysOnTop()) { @@ -64,17 +69,17 @@ public class AlwaysOnTopFieldTest { window = new Frame("Window 2"); window.setSize(200, 200); window.setVisible(true); - toolkit.realSync(); + robot.waitForIdle(); dialog = new Dialog(window, "Owned dialog 2"); dialog.setSize(200, 200); dialog.setLocation(100, 100); dialog.setVisible(true); - toolkit.realSync(); + robot.waitForIdle(); window.setAlwaysOnTop(true); - toolkit.realSync(); + robot.waitForIdle(); try { if (!window.isAlwaysOnTop()) { diff --git a/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java b/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java index 864c5add1df..9100c500674 100644 --- a/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java +++ b/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java @@ -21,8 +21,6 @@ * questions. */ -import sun.awt.SunToolkit; - import javax.swing.*; import java.awt.*; import java.io.ByteArrayInputStream; @@ -54,7 +52,8 @@ public class OwnedWindowsSerialization { subDialog = new Dialog(dialog, SUBDIALOG_LABEL); }); - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); if (!topFrame.isAlwaysOnTop() || !dialog.isAlwaysOnTop() || !subDialog.isAlwaysOnTop()) { throw new RuntimeException("TEST FAILED: AlwaysOnTop was not set properly"); diff --git a/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java b/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java index 7836b086f4e..0c06ba162eb 100644 --- a/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java +++ b/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java @@ -30,7 +30,6 @@ */ import java.awt.*; import java.awt.event.*; -import sun.awt.SunToolkit; public class TextEventSequenceTest { @@ -48,43 +47,50 @@ public class TextEventSequenceTest { } private static void test(String test) { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } createAndShowGUI(test); - toolkit.realSync(); + robot.waitForIdle(); initCounts(); t.setText("Hello "); - toolkit.realSync(); + robot.waitForIdle(); t.append("World! !"); - toolkit.realSync(); + robot.waitForIdle(); t.insert("from Roger Pham", 13); - toolkit.realSync(); + robot.waitForIdle(); t.replaceRange("Java Duke", 18, 28); - toolkit.realSync(); + robot.waitForIdle(); checkCounts(0, 4); initCounts(); t.setText(""); - toolkit.realSync(); + robot.waitForIdle(); t.setText(""); - toolkit.realSync(); + robot.waitForIdle(); t.setText(""); - toolkit.realSync(); + robot.waitForIdle(); checkCounts(1, 0); initCounts(); tf.setText("Hello There!"); - toolkit.realSync(); + robot.waitForIdle(); checkCounts(0, 1); initCounts(); tf.setText(""); - toolkit.realSync(); + robot.waitForIdle(); tf.setText(""); - toolkit.realSync(); + robot.waitForIdle(); tf.setText(""); - toolkit.realSync(); + robot.waitForIdle(); checkCounts(1, 0); f.dispose(); diff --git a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java index 298059054d9..25e03d61646 100644 --- a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java +++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java @@ -26,26 +26,25 @@ @bug 8041490 @summary tests that the WarningWindow's surface is invalidated on dispose @author Petr Pchelko - @run main/othervm WarningWindowDisposeCrashTest + @run main/othervm/policy=policy -Djava.security.manager WarningWindowDisposeCrashTest */ -import sun.applet.AppletSecurity; -import sun.awt.SunToolkit; import java.awt.*; public class WarningWindowDisposeCrashTest { public static void main(String[] args) throws Exception { - System.setSecurityManager(new AppletSecurity() { - @Override - public void checkPackageAccess (String s){ - } - }); - Frame f = new Frame(); f.setVisible(true); - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + Robot robot; + try{ + robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Cannot create Robot"); + } Thread.sleep(1000); f.dispose(); // If the bug is present VM could crash after this call diff --git a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java index 6f0149dc4d1..3f525e967d9 100644 --- a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java +++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java @@ -31,12 +31,11 @@ @run main WarningWindowDisposeTest */ -import sun.applet.AppletSecurity; -import sun.awt.SunToolkit; - import java.awt.*; import java.awt.Toolkit; import java.util.concurrent.atomic.AtomicBoolean; +import java.security.Permission; +import java.io.File; import test.java.awt.regtesthelpers.process.ProcessCommunicator; import test.java.awt.regtesthelpers.process.ProcessResults; @@ -57,7 +56,9 @@ public class WarningWindowDisposeTest { }, "TimeoutThread").start(); String classpath = System.getProperty("java.class.path"); - ProcessResults pres = ProcessCommunicator.executeChildProcess(TestApplication.class, classpath, new String[0]); + String policyPath = System.getProperty("test.src")+File.separatorChar+"policy"; + System.out.println("policyPath in main: "+policyPath); + ProcessResults pres = ProcessCommunicator.executeChildProcess(TestApplication.class, classpath+" -Djava.security.manager -Djava.security.policy="+policyPath, new String[0]); passed.set(true); if (pres.getStdErr() != null && pres.getStdErr().length() > 0) { System.err.println("========= Child VM System.err ========"); @@ -74,14 +75,16 @@ public class WarningWindowDisposeTest { public static class TestApplication { public static void main(String[] args) throws Exception { - System.setSecurityManager(new AppletSecurity() { - @Override - public void checkPackageAccess (String s){ - } - }); + Robot robot; + try{ + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Cannot create Robot"); + } Frame f = new Frame("Test frame"); f.setVisible(true); - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); Thread.sleep(500); f.setVisible(false); f.dispose(); From 41d2bc7e75c358daf3c0def4bbbdcc8371ed46f1 Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Mon, 10 Nov 2014 16:37:40 +0300 Subject: [PATCH 049/159] 8063106: Change open swing regression tests to avoid sun.awt.SunToolkit.realSync, part 1 Reviewed-by: pchelko, serb --- .../plaf/windows/8016551/bug8016551.java | 7 +- .../CompEventOnHiddenComponent.java | 441 ++++++++++++++++++ .../Window/GetWindowsTest/GetWindowsTest.java | 271 +++++++++++ .../HandleWindowDestroyTest.html | 23 + .../HandleWindowDestroyTest.java | 96 ++++ .../MovedResizedTwiceTest.java | 276 +++++++++++ .../security/WarningWindowDisposeTest/policy | 3 + .../JButtonPaintNPE/JButtonPaintNPE.java | 15 +- .../swing/JComboBox/6406264/bug6406264.java | 118 +++++ .../swing/JComboBox/8015300/Test8015300.java | 17 +- .../ShowPopupAfterHidePopupTest.java | 9 +- .../swing/JComponent/6989617/bug6989617.java | 12 +- .../swing/JEditorPane/4492274/bug4492274.java | 9 +- .../JInternalFrame/4251301/bug4251301.java | 9 +- .../JInternalFrame/6647340/bug6647340.java | 31 +- .../JInternalFrame/6725409/bug6725409.java | 23 +- .../swing/JLayer/6824395/bug6824395.java | 12 +- .../swing/JPopupMenu/6583251/bug6583251.java | 77 +++ .../swing/JPopupMenu/6691503/bug6691503.java | 10 +- .../swing/JPopupMenu/6694823/bug6694823.java | 19 +- .../swing/JScrollBar/4865918/bug4865918.java | 7 +- .../swing/JScrollPane/6274267/bug6274267.java | 100 ++++ .../swing/JSpinner/8008657/bug8008657.java | 17 +- .../swing/JSplitPane/4816114/bug4816114.java | 7 +- .../JTabbedPane/7024235/Test7024235.java | 14 +- .../swing/JTabbedPane/7170310/bug7170310.java | 17 +- .../swing/JTabbedPane/8017284/bug8017284.java | 7 +- .../swing/JTable/8032874/bug8032874.java | 8 +- .../swing/JTextArea/7049024/bug7049024.java | 14 +- .../swing/JToolBar/4529206/bug4529206.java | 91 ++++ .../swing/JViewport/7107099/bug7107099.java | 9 +- .../javax/swing/Popup/6514582/bug6514582.java | 73 +++ .../IconifyTest/IconifyTest.java | 7 +- .../swing/Security/6657138/ComponentTest.java | 8 +- jdk/test/javax/swing/SwingTest.java | 8 +- .../swing/text/Utilities/bug7045593.java | 5 +- .../swing/text/View/8048110/bug8048110.java | 7 +- .../swing/text/html/7189299/bug7189299.java | 7 +- .../html/HTMLDocument/8058120/bug8058120.java | 14 +- .../HTMLEditorKit/4242228/bug4242228.java | 5 +- .../parser/Parser/7165725/bug7165725.java | 6 +- 41 files changed, 1760 insertions(+), 149 deletions(-) create mode 100644 jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java create mode 100644 jdk/test/java/awt/Window/GetWindowsTest/GetWindowsTest.java create mode 100644 jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.html create mode 100644 jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.java create mode 100644 jdk/test/java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java create mode 100644 jdk/test/java/awt/security/WarningWindowDisposeTest/policy create mode 100644 jdk/test/javax/swing/JComboBox/6406264/bug6406264.java create mode 100644 jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java create mode 100644 jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java create mode 100644 jdk/test/javax/swing/JToolBar/4529206/bug4529206.java create mode 100644 jdk/test/javax/swing/Popup/6514582/bug6514582.java diff --git a/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java b/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java index 35e55f09174..23c46ff533d 100644 --- a/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java +++ b/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java @@ -30,8 +30,7 @@ import javax.swing.*; import java.awt.Graphics; -import java.awt.Toolkit; -import sun.awt.SunToolkit; +import java.awt.Robot; public class bug8016551 { private static volatile RuntimeException exception = null; @@ -64,8 +63,8 @@ public class bug8016551 { } }); - SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit(); - tk.realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); if (exception != null) { throw exception; diff --git a/jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java b/jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java new file mode 100644 index 00000000000..43a6d326702 --- /dev/null +++ b/jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java @@ -0,0 +1,441 @@ +/* + * Copyright (c) 2006, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 6383903 + @summary REGRESSION: componentMoved is now getting called for some hidden components + @author andrei.dmitriev: area=awt.component + @run main CompEventOnHiddenComponent +*/ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class CompEventOnHiddenComponent +{ + transient static boolean moved = false; + transient static boolean resized = false; + + transient static boolean ancestor_moved = false; + transient static boolean ancestor_resized = false; + static String passed = ""; + + private static void init() + { + String[] instructions = + { + "This is an AUTOMATIC test, simply wait until it is done.", + "The result (passed or failed) will be shown in the", + "message window below." + }; + Sysout.createDialog( ); + Sysout.printInstructions( instructions ); + + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } + + EventQueue.invokeLater(new Runnable(){ + public void run(){ + JFrame f = new JFrame("JFrame"); + JButton b = new JButton("JButton"); + f.add(b); + new JOptionPane(). + createInternalFrame(b, "Test"). + addComponentListener(new ComponentAdapter() { + public void componentMoved(ComponentEvent e) { + moved = true; + System.out.println(e); + } + public void componentResized(ComponentEvent e) { + resized = true; + System.out.println(e); + } + }); + } + }); + + robot.waitForIdle(); + + if (moved || resized){ + passed = "Hidden component got COMPONENT_MOVED or COMPONENT_RESIZED event"; + } else { + System.out.println("Stage 1 passed."); + } + + EventQueue.invokeLater(new Runnable() { + public void run() { + JFrame parentWindow = new JFrame("JFrame 1"); + JButton component = new JButton("JButton 1");; + JButton smallButton = new JButton("Small Button"); + + + smallButton.addHierarchyBoundsListener(new HierarchyBoundsAdapter() { + public void ancestorMoved(HierarchyEvent e) { + ancestor_moved = true; + System.out.println("SMALL COMPONENT >>>>>"+e); + } + public void ancestorResized(HierarchyEvent e) { + ancestor_resized = true; + System.out.println("SMALL COMPONENT >>>>>"+e); + } + }); + + + parentWindow.add(component); + component.add(smallButton); + + component.setSize(100, 100); + component.setLocation(100, 100); + + } + }); + + robot.waitForIdle(); + + if (!ancestor_resized || !ancestor_moved){ + passed = "Hidden component didn't get ANCESTOR event"; + } else { + System.out.println("Stage 2 passed."); + } + + robot.waitForIdle(); + + if (passed.equals("")){ + CompEventOnHiddenComponent.pass(); + } else { + CompEventOnHiddenComponent.fail(passed); + } + + }//End init() + + + + /***************************************************** + * Standard Test Machinery Section + * DO NOT modify anything in this section -- it's a + * standard chunk of code which has all of the + * synchronisation necessary for the test harness. + * By keeping it the same in all tests, it is easier + * to read and understand someone else's test, as + * well as insuring that all tests behave correctly + * with the test harness. + * There is a section following this for test- + * classes + ******************************************************/ + private static boolean theTestPassed = false; + private static boolean testGeneratedInterrupt = false; + private static String failureMessage = ""; + + private static Thread mainThread = null; + + private static int sleepTime = 300000; + + // Not sure about what happens if multiple of this test are + // instantiated in the same VM. Being static (and using + // static vars), it aint gonna work. Not worrying about + // it for now. + public static void main( String args[] ) throws InterruptedException + { + mainThread = Thread.currentThread(); + try + { + init(); + } + catch( TestPassedException e ) + { + //The test passed, so just return from main and harness will + // interepret this return as a pass + return; + } + //At this point, neither test pass nor test fail has been + // called -- either would have thrown an exception and ended the + // test, so we know we have multiple threads. + + //Test involves other threads, so sleep and wait for them to + // called pass() or fail() + try + { + Thread.sleep( sleepTime ); + //Timed out, so fail the test + throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" ); + } + catch (InterruptedException e) + { + //The test harness may have interrupted the test. If so, rethrow the exception + // so that the harness gets it and deals with it. + if( ! testGeneratedInterrupt ) throw e; + + //reset flag in case hit this code more than once for some reason (just safety) + testGeneratedInterrupt = false; + + if ( theTestPassed == false ) + { + throw new RuntimeException( failureMessage ); + } + } + + }//main + + public static synchronized void setTimeoutTo( int seconds ) + { + sleepTime = seconds * 1000; + } + + public static synchronized void pass() + { + Sysout.println( "The test passed." ); + Sysout.println( "The test is over, hit Ctl-C to stop Java VM" ); + //first check if this is executing in main thread + if ( mainThread == Thread.currentThread() ) + { + //Still in the main thread, so set the flag just for kicks, + // and throw a test passed exception which will be caught + // and end the test. + theTestPassed = true; + throw new TestPassedException(); + } + theTestPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + }//pass() + + public static synchronized void fail() + { + //test writer didn't specify why test failed, so give generic + fail( "it just plain failed! :-)" ); + } + + public static synchronized void fail( String whyFailed ) + { + Sysout.println( "The test failed: " + whyFailed ); + Sysout.println( "The test is over, hit Ctl-C to stop Java VM" ); + //check if this called from main thread + if ( mainThread == Thread.currentThread() ) + { + //If main thread, fail now 'cause not sleeping + throw new RuntimeException( whyFailed ); + } + theTestPassed = false; + testGeneratedInterrupt = true; + failureMessage = whyFailed; + mainThread.interrupt(); + }//fail() + +}// class CompEventOnHiddenComponent + +//This exception is used to exit from any level of call nesting +// when it's determined that the test has passed, and immediately +// end the test. +class TestPassedException extends RuntimeException +{ +} + +//*********** End Standard Test Machinery Section ********** + + +//************ Begin classes defined for the test **************** + +// if want to make listeners, here is the recommended place for them, then instantiate +// them in init() + +/* Example of a class which may be written as part of a test +class NewClass implements anInterface + { + static int newVar = 0; + + public void eventDispatched(AWTEvent e) + { + //Counting events to see if we get enough + eventCount++; + + if( eventCount == 20 ) + { + //got enough events, so pass + + CompEventOnHiddenComponent.pass(); + } + else if( tries == 20 ) + { + //tried too many times without getting enough events so fail + + CompEventOnHiddenComponent.fail(); + } + + }// eventDispatched() + + }// NewClass class + +*/ + + +//************** End classes defined for the test ******************* + + + + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + This is part of the standard test machinery. + It creates a dialog (with the instructions), and is the interface + for sending text messages to the user. + To print the instructions, send an array of strings to Sysout.createDialog + WithInstructions method. Put one line of instructions per array entry. + To display a message for the tester to see, simply call Sysout.println + with the string to be displayed. + This mimics System.out.println but works within the test harness as well + as standalone. + */ + +class Sysout +{ + private static TestDialog dialog; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + + public static void println( String messageIn ) + { + dialog.displayMessage( messageIn ); + System.out.println(messageIn); + } + +}// Sysout class + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog +{ + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("Center", messageText); + + pack(); + + setVisible(true); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + System.out.println(messageIn); + } + +}// TestDialog class diff --git a/jdk/test/java/awt/Window/GetWindowsTest/GetWindowsTest.java b/jdk/test/java/awt/Window/GetWindowsTest/GetWindowsTest.java new file mode 100644 index 00000000000..e1a9482cd39 --- /dev/null +++ b/jdk/test/java/awt/Window/GetWindowsTest/GetWindowsTest.java @@ -0,0 +1,271 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 6322270 + @summary Test for new API introduced in the fix for 6322270: Window.getWindows(), +Window.getOwnerlessWindows() and Frame.getFrames() + @author artem.ananiev: area=awt.toplevel + @run main GetWindowsTest +*/ + +import java.awt.*; +import java.awt.event.*; + +import java.util.*; + +public class GetWindowsTest +{ + private static Vector frames = new Vector(); + private static Vector windows = new Vector(); + private static Vector ownerless = new Vector(); + + private static void init() + { + Frame f1 = new Frame("F1"); + f1.setBounds(100, 100, 100, 100); + f1.setVisible(true); + addToWindowsList(f1); + + Dialog d1 = new Dialog(f1, "D1", Dialog.ModalityType.MODELESS); + d1.setBounds(120, 120, 100, 100); + d1.setVisible(true); + addToWindowsList(d1); + + Window w1 = new Window(d1); + w1.setBounds(140, 140, 100, 100); + w1.setVisible(true); + addToWindowsList(w1); + + Frame f2 = new Frame("F2"); + f2.setBounds(300, 100, 100, 100); + f2.setVisible(true); + addToWindowsList(f2); + + Window w2 = new Window(f2); + w2.setBounds(320, 120, 100, 100); + w2.setVisible(true); + addToWindowsList(w2); + + Dialog d2 = new Dialog(f2, "D2", Dialog.ModalityType.MODELESS); + d2.setBounds(340, 140, 100, 100); + d2.setVisible(true); + addToWindowsList(d2); + + Dialog d3 = new Dialog((Frame)null, "D3", Dialog.ModalityType.MODELESS); + d3.setBounds(500, 100, 100, 100); + d3.setVisible(true); + addToWindowsList(d3); + + Dialog d4 = new Dialog(d3, "D4", Dialog.ModalityType.MODELESS); + d4.setBounds(520, 120, 100, 100); + d4.setVisible(true); + addToWindowsList(d4); + + Window w3 = new Window((Frame)null); + w3.setBounds(700, 100, 100, 100); + w3.setVisible(true); + addToWindowsList(w3); + + Window w4 = new Window(w3); + w4.setBounds(720, 120, 100, 100); + w4.setVisible(true); + addToWindowsList(w4); + + try { + Robot robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new Error("Unexpected failure"); + } + + Frame[] fl = Frame.getFrames(); + Vector framesToCheck = new Vector(); + for (Frame f : fl) + { + framesToCheck.add(f); + } + checkWindowsList(frames, framesToCheck, "Frame.getFrames()"); + + Window[] wl = Window.getWindows(); + Vector windowsToCheck = new Vector(); + for (Window w : wl) + { + windowsToCheck.add(w); + } + checkWindowsList(windows, windowsToCheck, "Window.getWindows()"); + + Window[] ol = Window.getOwnerlessWindows(); + Vector ownerlessToCheck = new Vector(); + for (Window o : ol) + { + ownerlessToCheck.add(o); + } + checkWindowsList(ownerless, ownerlessToCheck, "Window.getOwnerlessWindows()"); + + GetWindowsTest.pass(); + } + + private static void addToWindowsList(Window w) + { + if (w instanceof Frame) + { + frames.add(w); + } + windows.add(w); + if (w.getOwner() == null) + { + ownerless.add(w); + } + } + + private static void checkWindowsList(Vector wl1, Vector wl2, String methodName) + { + if ((wl1.size() != wl2.size()) || + !wl1.containsAll(wl2) || + !wl2.containsAll(wl1)) + { + fail("Test FAILED: method " + methodName + " returns incorrect list of windows"); + } + } + +/***************************************************** + * Standard Test Machinery Section + * DO NOT modify anything in this section -- it's a + * standard chunk of code which has all of the + * synchronisation necessary for the test harness. + * By keeping it the same in all tests, it is easier + * to read and understand someone else's test, as + * well as insuring that all tests behave correctly + * with the test harness. + * There is a section following this for test- + * classes + ******************************************************/ + + private static boolean theTestPassed = false; + private static boolean testGeneratedInterrupt = false; + private static String failureMessage = ""; + + private static Thread mainThread = null; + + private static int sleepTime = 300000; + + // Not sure about what happens if multiple of this test are + // instantiated in the same VM. Being static (and using + // static vars), it aint gonna work. Not worrying about + // it for now. + public static void main( String args[] ) throws InterruptedException + { + mainThread = Thread.currentThread(); + try + { + init(); + } + catch( TestPassedException e ) + { + //The test passed, so just return from main and harness will + // interepret this return as a pass + return; + } + //At this point, neither test pass nor test fail has been + // called -- either would have thrown an exception and ended the + // test, so we know we have multiple threads. + + //Test involves other threads, so sleep and wait for them to + // called pass() or fail() + try + { + Thread.sleep( sleepTime ); + //Timed out, so fail the test + throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" ); + } + catch (InterruptedException e) + { + //The test harness may have interrupted the test. If so, rethrow the exception + // so that the harness gets it and deals with it. + if( ! testGeneratedInterrupt ) throw e; + + //reset flag in case hit this code more than once for some reason (just safety) + testGeneratedInterrupt = false; + + if ( theTestPassed == false ) + { + throw new RuntimeException( failureMessage ); + } + } + } + + public static synchronized void setTimeoutTo( int seconds ) + { + sleepTime = seconds * 1000; + } + + public static synchronized void pass() + { + //first check if this is executing in main thread + if ( mainThread == Thread.currentThread() ) + { + //Still in the main thread, so set the flag just for kicks, + // and throw a test passed exception which will be caught + // and end the test. + theTestPassed = true; + throw new TestPassedException(); + } + theTestPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + public static synchronized void fail() + { + //test writer didn't specify why test failed, so give generic + fail( "it just plain failed! :-)" ); + } + + public static synchronized void fail( String whyFailed ) + { + //check if this called from main thread + if ( mainThread == Thread.currentThread() ) + { + //If main thread, fail now 'cause not sleeping + throw new RuntimeException( whyFailed ); + } + theTestPassed = false; + testGeneratedInterrupt = true; + failureMessage = whyFailed; + mainThread.interrupt(); + } +} + +//This exception is used to exit from any level of call nesting +// when it's determined that the test has passed, and immediately +// end the test. +class TestPassedException extends RuntimeException +{ +} + +//*********** End Standard Test Machinery Section ********** diff --git a/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.html b/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.html new file mode 100644 index 00000000000..aea7f2317e6 --- /dev/null +++ b/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.html @@ -0,0 +1,23 @@ + + + + + + + +

HandleWindowDestroyTest
Bug ID: 6260648

+ +

This is an AUTOMATIC test, simply wait for completion

+ + + + + diff --git a/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.java b/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.java new file mode 100644 index 00000000000..fffcf18dc3b --- /dev/null +++ b/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.java @@ -0,0 +1,96 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 6260648 + @summary Tests that WINDOW_DESTROY event can be handled by overriding handleEvent(). Also, +tests that handleEvent() is not called by AWT if any listener is added to the component +(i. e. when post-1.1 events schema is used) + @author artem.ananiev: area=awt.event + @run applet HandleWindowDestroyTest.html +*/ + +import java.applet.*; + +import java.awt.*; +import java.awt.event.*; + +public class HandleWindowDestroyTest extends Applet +{ + private volatile boolean handleEventCalled; + + public void start () + { + setSize (200,200); + setVisible(true); + validate(); + + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } + + Frame f = new Frame("Frame") + { + public boolean handleEvent(Event e) + { + if (e.id == Event.WINDOW_DESTROY) + { + handleEventCalled = true; + } + return super.handleEvent(e); + } + }; + f.setBounds(100, 100, 100, 100); + f.setVisible(true); + robot.waitForIdle(); + + handleEventCalled = false; + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(f, Event.WINDOW_DESTROY)); + robot.waitForIdle(); + + if (!handleEventCalled) + { + throw new RuntimeException("Test FAILED: handleEvent() is not called"); + } + + f.addWindowListener(new WindowAdapter() + { + }); + + handleEventCalled = false; + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(f, Event.WINDOW_DESTROY)); + robot.waitForIdle(); + + if (handleEventCalled) + { + throw new RuntimeException("Test FAILED: handleEvent() is called event with a listener added"); + } + } +} diff --git a/jdk/test/java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java new file mode 100644 index 00000000000..d88c54d9fab --- /dev/null +++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java @@ -0,0 +1,276 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 5025858 + @summary Tests that after programmatically moving or resizing a component, +corresponding ComponentEvents are generated only once + @author artem.ananiev: area=awt.event + @run main/manual MovedResizedTwiceTest +*/ + +import java.awt.*; +import java.awt.event.*; + +/* + IMPORTANT: this test is made manual as some window managers may generate + strange events and that would lead to the test to fail. However, on most + popular platforms (windows, linux w/ KDE or GNOME, solaris w/ CDE or + GNOME) it usually passes successfully. +*/ + +public class MovedResizedTwiceTest +{ + private static volatile int componentMovedCount; + private static volatile int componentResizedCount; + + private static volatile int rightX, rightY; + + private static volatile boolean failed = false; + + private static void init() + { + componentMovedCount = componentResizedCount = 0; + + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Cannot create Robot: failure"); + } + + Frame f = new Frame("Frame F"); + f.setLayout(null); + f.setBounds(100, 100, 100, 100); + f.add(new Button("Button")); + + f.setVisible(true); + robot.waitForIdle(); + + ComponentListener cl = new ComponentAdapter() + { + public void componentMoved(ComponentEvent e) + { + componentMovedCount++; + Component c = (Component)e.getSource(); + if (!(c instanceof Window)) + { + return; + } + Point p = c.getLocationOnScreen(); + if ((p.x != rightX) || (p.y != rightY)) + { + System.err.println("Error: wrong location on screen after COMPONENT_MOVED"); + System.err.println("Location on screen is (" + p.x + ", " + p.y + ") against right location (" + rightX + ", " + rightY + ")"); + failed = true; + } + } + public void componentResized(ComponentEvent e) + { + componentResizedCount++; + } + }; + + f.addComponentListener(cl); + + componentResizedCount = componentMovedCount = 0; + rightX = 100; + rightY = 100; + f.setSize(200, 200); + robot.waitForIdle(); + checkResized("setSize", f); + + componentResizedCount = componentMovedCount = 0; + rightX = 200; + rightY = 200; + f.setLocation(200, 200); + robot.waitForIdle(); + checkMoved("setLocation", f); + + componentResizedCount = componentMovedCount = 0; + rightX = 150; + rightY = 150; + f.setBounds(150, 150, 100, 100); + robot.waitForIdle(); + checkResized("setBounds", f); + checkMoved("setBounds", f); + + Button b = new Button("B"); + b.setBounds(10, 10, 40, 40); + f.add(b); + robot.waitForIdle(); + + b.addComponentListener(cl); + + componentResizedCount = componentMovedCount = 0; + b.setBounds(20, 20, 50, 50); + robot.waitForIdle(); + checkMoved("setBounds", b); + checkResized("setBounds", b); + f.remove(b); + + Component c = new Component() {}; + c.setBounds(10, 10, 40, 40); + f.add(c); + robot.waitForIdle(); + + c.addComponentListener(cl); + + componentResizedCount = componentMovedCount = 0; + c.setBounds(20, 20, 50, 50); + robot.waitForIdle(); + checkMoved("setBounds", c); + checkResized("setBounds", c); + f.remove(c); + + if (failed) + { + MovedResizedTwiceTest.fail("Test FAILED"); + } + else + { + MovedResizedTwiceTest.pass(); + } + } + + private static void checkResized(String methodName, Component c) + { + String failMessage = null; + if (componentResizedCount == 1) + { + return; + } + else if (componentResizedCount == 0) + { + failMessage = "Test FAILED: COMPONENT_RESIZED is not sent after call to " + methodName + "()"; + } + else + { + failMessage = "Test FAILED: COMPONENT_RESIZED is sent " + componentResizedCount + " + times after call to " + methodName + "()"; + } + System.err.println("Failed component: " + c); + MovedResizedTwiceTest.fail(failMessage); + } + + private static void checkMoved(String methodName, Component c) + { + String failMessage = null; + if (componentMovedCount == 1) + { + return; + } + if (componentMovedCount == 0) + { + failMessage = "Test FAILED: COMPONENT_MOVED is not sent after call to " + methodName + "()"; + } + else + { + failMessage = "Test FAILED: COMPONENT_MOVED is sent " + componentMovedCount + " times after call to " + methodName + "()"; + } + System.err.println("Failed component: " + c); + MovedResizedTwiceTest.fail(failMessage); + } + + private static boolean theTestPassed = false; + private static boolean testGeneratedInterrupt = false; + private static String failureMessage = ""; + + private static Thread mainThread = null; + + private static int sleepTime = 300000; + + public static void main( String args[] ) throws InterruptedException + { + mainThread = Thread.currentThread(); + try + { + init(); + } + catch (TestPassedException e) + { + return; + } + + try + { + Thread.sleep(sleepTime); + throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" ); + } + catch (InterruptedException e) + { + if (!testGeneratedInterrupt) + { + throw e; + } + + testGeneratedInterrupt = false; + + if (!theTestPassed) + { + throw new RuntimeException( failureMessage ); + } + } + } + + public static synchronized void setTimeoutTo(int seconds) + { + sleepTime = seconds * 1000; + } + + public static synchronized void pass() + { + if (mainThread == Thread.currentThread()) + { + theTestPassed = true; + throw new TestPassedException(); + } + theTestPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + public static synchronized void fail() + { + fail("it just plain failed! :-)"); + } + + public static synchronized void fail(String whyFailed) + { + if (mainThread == Thread.currentThread()) + { + throw new RuntimeException(whyFailed); + } + theTestPassed = false; + testGeneratedInterrupt = true; + failureMessage = whyFailed; + mainThread.interrupt(); + } +} + +class TestPassedException extends RuntimeException +{ +} diff --git a/jdk/test/java/awt/security/WarningWindowDisposeTest/policy b/jdk/test/java/awt/security/WarningWindowDisposeTest/policy new file mode 100644 index 00000000000..22405359e59 --- /dev/null +++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/policy @@ -0,0 +1,3 @@ +grant { + permission java.awt.AWTPermission "createRobot"; +}; diff --git a/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java b/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java index 75e49967aa7..e0182a5fc03 100644 --- a/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java +++ b/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java @@ -31,12 +31,13 @@ import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; -import sun.awt.SunToolkit; - /** * @test * @bug 8009919 * @author Sergey Bylokhov + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main JButtonPaintNPE */ public final class JButtonPaintNPE { @@ -69,9 +70,11 @@ public final class JButtonPaintNPE { private static void sleep() { try { - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); - Thread.sleep(1000); - } catch (final InterruptedException ignored) { - } + ExtendedRobot robot = new ExtendedRobot(); + robot.waitForIdle(1000); + }catch(Exception ex) { + ex.printStackTrace(); + throw new Error("Unexpected Failure"); + } } } diff --git a/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java b/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java new file mode 100644 index 00000000000..91356c3d476 --- /dev/null +++ b/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2006, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 6406264 + @summary Tests that JComboBox's focusable popup can be shown. + @author Mikhail Lapshin + @run main bug6406264 + */ + +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.plaf.basic.BasicComboBoxUI; +import javax.swing.plaf.basic.ComboPopup; +import javax.swing.plaf.basic.BasicComboPopup; +import java.awt.*; + +public class bug6406264 extends JComboBox { + + static JFrame frame; + static bug6406264 comboBox; + + public static void main(String[] args) throws Exception { + + Robot robot = new Robot(); + // Setup and show frame + SwingUtilities.invokeAndWait( + new Runnable() { + public void run() { + frame = new JFrame("JComboBox6406264 test"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + comboBox = new bug6406264("One", "Two", "Three"); + frame.getContentPane().add(comboBox); + + frame.setLocationRelativeTo(null); + frame.pack(); + frame.setVisible(true); + } + } + ); + + robot.waitForIdle(); + + // Show popup + SwingUtilities.invokeAndWait( + new Runnable() { + public void run() { + comboBox.showPopup(); + } + }); + robot.waitForIdle(); + + // Check that popup is visible + SwingUtilities.invokeAndWait( + new Runnable() { + public void run() { + if (comboBox.getUI().isPopupVisible(comboBox) == false) + { + throw new RuntimeException("A focusable popup is not visible " + + "in JComboBox!"); + } + } + } + ); + + frame.dispose(); + } + + public bug6406264(Object ... items) { + super(items); + } + + public void updateUI() { + setUI(new CustomComboBoxUI()); + } + + // Use FocusablePopup for our JComboBox + private class CustomComboBoxUI extends BasicComboBoxUI { + protected ComboPopup createPopup() { + return new FocusablePopup(bug6406264.this); + } + } + + // Popup window which can take a focus + private class FocusablePopup extends BasicComboPopup { + public FocusablePopup(JComboBox combo) { + super(combo); + } + + public boolean isFocusable() { + return true; + } + } +} diff --git a/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java b/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java index 1fadfdbb9d1..37a8c0d6404 100644 --- a/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java +++ b/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java @@ -41,10 +41,13 @@ import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE; * @bug 8015300 * @summary Tests that editable combobox select all text * @author Sergey Malenkov + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main Test8015300 */ public class Test8015300 { - private static final SunToolkit STK = (SunToolkit) Toolkit.getDefaultToolkit(); + private static final ExtendedRobot robot = createRobot(); private static final String[] ITEMS = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; @@ -113,7 +116,15 @@ public class Test8015300 { combo.setSelectedIndex(index); } }); - STK.realSync(); - Thread.sleep(50L); + robot.waitForIdle(50); + } + private static ExtendedRobot createRobot() { + try { + ExtendedRobot robot = new ExtendedRobot(); + return robot; + }catch(Exception ex) { + ex.printStackTrace(); + throw new Error("Unexpected Failure"); + } } } diff --git a/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java b/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java index e015f5ed587..52b9e71ea29 100644 --- a/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java +++ b/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java @@ -25,6 +25,7 @@ @bug 8006417 @summary JComboBox.showPopup(), hidePopup() fails in JRE 1.7 on OS X @author Anton Litvinov + @run main ShowPopupAfterHidePopupTest */ import java.awt.*; @@ -32,8 +33,6 @@ import java.awt.*; import javax.swing.*; import javax.swing.plaf.metal.*; -import sun.awt.SunToolkit; - public class ShowPopupAfterHidePopupTest { private static JFrame frame = null; private static JComboBox comboBox = null; @@ -41,6 +40,7 @@ public class ShowPopupAfterHidePopupTest { public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(new MetalLookAndFeel()); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { @@ -51,8 +51,7 @@ public class ShowPopupAfterHidePopupTest { frame.setVisible(true); } }); - final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -62,7 +61,7 @@ public class ShowPopupAfterHidePopupTest { comboBox.showPopup(); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override diff --git a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java index 23f3754b78a..a13201df761 100644 --- a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java +++ b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java @@ -28,8 +28,6 @@ @run main bug6989617 */ -import sun.awt.SunToolkit; - import javax.swing.*; import java.awt.*; @@ -38,7 +36,7 @@ public class bug6989617 { private static JButton button; public static void main(String... args) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { JFrame frame = new JFrame(); @@ -56,14 +54,14 @@ public class bug6989617 { // Testing the panel as a painting origin, // the panel.paintImmediately() must be triggered // when button.repaint() is called - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { panel.resetPaintRectangle(); button.repaint(); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { Rectangle pr = panel.getPaintRectangle(); @@ -78,7 +76,7 @@ public class bug6989617 { // Testing the panel as NOT a painting origin // the panel.paintImmediately() must NOT be triggered // when button.repaint() is called - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { panel.resetPaintRectangle(); @@ -89,7 +87,7 @@ public class bug6989617 { button.repaint(); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { if(panel.getPaintRectangle() != null) { diff --git a/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java b/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java index cf732a9c5f2..369f05f17a7 100644 --- a/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java +++ b/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java @@ -25,10 +25,9 @@ * @bug 4492274 * @summary Tests if JEditorPane.getPage() correctly returns anchor reference. * @author Denis Sharypov + * @run main bug4492274 */ -import sun.awt.SunToolkit; - import javax.swing.*; import javax.swing.text.html.HTMLEditorKit; import java.awt.*; @@ -42,8 +41,8 @@ public class bug4492274 { private static JEditorPane jep; public static void main(String args[]) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { @@ -51,7 +50,7 @@ public class bug4492274 { } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -65,7 +64,7 @@ public class bug4492274 { } }); - toolkit.realSync(); + robot.waitForIdle(); if (getPageAnchor() == null) { throw new RuntimeException("JEditorPane.getPage() returns null anchor reference"); diff --git a/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java b/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java index 304d0582407..281b7ec08cd 100644 --- a/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java +++ b/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java @@ -24,6 +24,8 @@ @bug 4251301 @summary Keybinding for show/hide the system menu. @author Andrey Pikalev + @library ../../../../lib/testlibrary + @build jdk.testlibrary.OSInfo @run main/manual bug4251301 */ @@ -32,12 +34,10 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.*; -import sun.awt.OSInfo; -import sun.awt.SunToolkit; +import jdk.testlibrary.OSInfo; public class bug4251301 { - private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); static Test test = new Test(); public static void main(String[] args) throws Exception { if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) { @@ -50,7 +50,8 @@ public class bug4251301 { createAndShowGUI(); } }); - toolkit.realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); test.waitTestResult(); } diff --git a/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java b/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java index de27c8f2a70..8bb1ffc92e1 100644 --- a/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java +++ b/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java @@ -26,10 +26,11 @@ * @summary Checks that iconified internal frame follows * the main frame borders properly. * @author Mikhail Lapshin + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main bug6647340 */ -import sun.awt.SunToolkit; - import javax.swing.*; import java.awt.*; import java.beans.PropertyVetoException; @@ -38,6 +39,7 @@ public class bug6647340 { private JFrame frame; private Point location; private JInternalFrame jif; + private static ExtendedRobot robot = createRobot(); public static void main(String[] args) throws Exception { final bug6647340 test = new bug6647340(); @@ -74,13 +76,13 @@ public class bug6647340 { } private void test() throws Exception { - realSync(); + sync(); test1(); - realSync(); + sync(); check1(); - realSync(); + sync(); test2(); - realSync(); + sync(); check2(); } @@ -101,14 +103,14 @@ public class bug6647340 { setIcon(false); } }); - realSync(); + sync(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { Dimension size = frame.getSize(); frame.setSize(size.width - 100, size.height - 100); } }); - realSync(); + sync(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { setIcon(true); @@ -132,8 +134,17 @@ public class bug6647340 { } } - private static void realSync() { - ((SunToolkit) (Toolkit.getDefaultToolkit())).realSync(); + private static void sync() { + robot.waitForIdle(); + } + private static ExtendedRobot createRobot() { + try { + ExtendedRobot robot = new ExtendedRobot(); + return robot; + }catch(Exception ex) { + ex.printStackTrace(); + throw new Error("Unexpected Failure"); + } } private void setIcon(boolean b) { diff --git a/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java b/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java index 87443b4529f..6fb9b655b77 100644 --- a/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java +++ b/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java @@ -26,6 +26,9 @@ * @summary Checks that JInternalFrame's system menu * can be localized during run-time * @author Mikhail Lapshin + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main bug6725409 */ import javax.swing.*; @@ -36,6 +39,7 @@ public class bug6725409 { private JInternalFrame iFrame; private TestTitlePane testTitlePane; private boolean passed; + private static ExtendedRobot robot = createRobot(); public static void main(String[] args) throws Exception { try { @@ -53,19 +57,19 @@ public class bug6725409 { bug6725409.setupUIStep1(); } }); - realSync(); + sync(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { bug6725409.setupUIStep2(); } }); - realSync(); + sync(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { bug6725409.test(); } }); - realSync(); + sync(); bug6725409.checkResult(); } finally { if (bug6725409.frame != null) { @@ -137,8 +141,17 @@ public class bug6725409 { } } - private static void realSync() { - ((sun.awt.SunToolkit) (Toolkit.getDefaultToolkit())).realSync(); + private static void sync() { + robot.waitForIdle(); + } + private static ExtendedRobot createRobot() { + try { + ExtendedRobot robot = new ExtendedRobot(); + return robot; + }catch(Exception ex) { + ex.printStackTrace(); + throw new Error("Unexpected Failure"); + } } // Extend WindowsInternalFrameTitlePane to get access to systemPopupMenu diff --git a/jdk/test/javax/swing/JLayer/6824395/bug6824395.java b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java index 1b428697da2..f2040f4b327 100644 --- a/jdk/test/javax/swing/JLayer/6824395/bug6824395.java +++ b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java @@ -25,11 +25,12 @@ * @test * @summary Checks that JLayer inside JViewport works is correctly laid out * @author Alexander Potochkin + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot * @run main bug6824395 */ -import sun.awt.SunToolkit; import javax.swing.*; import javax.swing.plaf.LayerUI; @@ -40,7 +41,6 @@ public class bug6824395 { static JScrollPane scrollPane; public static void main(String[] args) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { JFrame frame = new JFrame("testing"); @@ -68,7 +68,13 @@ public class bug6824395 { frame.setVisible(true); } }); - toolkit.realSync(); + try { + ExtendedRobot robot = new ExtendedRobot(); + robot.waitForIdle(300); + }catch(Exception ex) { + ex.printStackTrace(); + throw new Error("Unexpected Failure"); + } SwingUtilities.invokeAndWait(new Runnable() { public void run() { if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) { diff --git a/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java b/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java new file mode 100644 index 00000000000..d44c221093d --- /dev/null +++ b/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 6583251 +@summary One more ClassCastException in Swing with TrayIcon +@author Alexander Potochkin +@run main bug6583251 +*/ + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; + +public class bug6583251 { + private static JFrame frame; + private static JPopupMenu menu; + + private static void createGui() { + frame = new JFrame(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel panel = new JPanel(); + menu = new JPopupMenu(); + menu.add(new JMenuItem("item")); + panel.setComponentPopupMenu(menu); + frame.add(panel); + + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createGui(); + } + }); + + Robot robot = new Robot(); + robot.waitForIdle(); + menu.show(frame, 0, 0); + robot.waitForIdle(); + + TrayIcon trayIcon = new TrayIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB)); + MouseEvent ev = new MouseEvent( + new JButton(), MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 0, 0, 1, false); + ev.setSource(trayIcon); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ev); + } +} diff --git a/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java b/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java index c1c16ee5a2c..f07ebd19a35 100644 --- a/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java +++ b/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java @@ -31,8 +31,6 @@ * @run main bug6691503 */ -import sun.awt.SunToolkit; - import javax.swing.*; import java.awt.*; @@ -93,7 +91,13 @@ public class bug6691503 { } private void checkResult() { - ((SunToolkit)(Toolkit.getDefaultToolkit())).realSync(); + try { + Robot robot = new Robot(); + robot.waitForIdle(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } if (!isAlwaysOnTop1 || isAlwaysOnTop2) { throw new RuntimeException("Malicious applet can show always-on-top " + "popup menu which has whole screen size"); diff --git a/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java index 045cc68066f..3e6c4be0c69 100644 --- a/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java +++ b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java @@ -32,25 +32,25 @@ import javax.swing.*; import java.awt.*; -import sun.awt.SunToolkit; import java.security.Permission; -import sun.awt.AWTPermissions; public class bug6694823 { private static JFrame frame; private static JPopupMenu popup; - private static SunToolkit toolkit; + private static Toolkit toolkit; private static Insets screenInsets; + private static Robot robot; public static void main(String[] args) throws Exception { - toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + robot = new Robot(); + toolkit = Toolkit.getDefaultToolkit(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { createGui(); } }); - toolkit.realSync(); + robot.waitForIdle(); // Get screen insets screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration()); @@ -61,12 +61,9 @@ public class bug6694823 { System.setSecurityManager(new SecurityManager(){ - private String allowsAlwaysOnTopPermission = - AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName(); - @Override public void checkPermission(Permission perm) { - if (allowsAlwaysOnTopPermission.equals(perm.getName())) { + if (perm.getName().equals("setWindowAlwaysOnTop") ) { throw new SecurityException(); } } @@ -107,7 +104,7 @@ public class bug6694823 { }); // Ensure frame is visible - toolkit.realSync(); + robot.waitForIdle(); final Point point = new Point(); SwingUtilities.invokeAndWait(new Runnable() { @@ -120,7 +117,7 @@ public class bug6694823 { }); // Ensure popup is visible - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { diff --git a/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java b/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java index 8a1a8045fd7..2bf5be45b2d 100644 --- a/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java +++ b/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java @@ -33,15 +33,14 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; -import sun.awt.SunToolkit; public class bug4865918 { private static TestScrollBar sbar; public static void main(String[] argv) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -49,7 +48,7 @@ public class bug4865918 { } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @@ -59,7 +58,7 @@ public class bug4865918 { } }); - toolkit.realSync(); + robot.waitForIdle(); int value = getValue(); diff --git a/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java b/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java new file mode 100644 index 00000000000..1783c0f81b1 --- /dev/null +++ b/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2011, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 6274267 + @summary Checks that ScrollPaneLayout properly calculates preferred + layout size. + @author Mikhail Lapshin + @run main bug6274267 +*/ + +import javax.swing.*; +import java.awt.*; + +public class bug6274267 { + private JFrame frame; + private Component left; + + public static void main(String[] args) throws Exception { + final bug6274267 test = new bug6274267(); + Robot robot = new Robot(); + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + test.setupUI1(); + } + }); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + test.setupUI2(); + } + }); + test.test(); + } finally { + if (test.frame != null) { + test.frame.dispose(); + } + } + } + + private void setupUI1() { + frame = new JFrame(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + left = new JPanel(); + left.setPreferredSize(new Dimension(100, 100)); + + JPanel rightPanel = new JPanel(); + rightPanel.setPreferredSize(new Dimension(100, 50)); + Component right = new JScrollPane(rightPanel); + + JSplitPane split = + new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right); + + frame = new JFrame(); + frame.add(split); + frame.pack(); + } + + // It is important to separate frame.pack() from frame.setVisible(true). + // Otherwise the repaint manager will combine validate() calls and + // the bug won't appear. + private void setupUI2() { + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private void test() throws Exception { + if (left.getSize().width == 100) { + System.out.println("Test passed"); + } else { + throw new RuntimeException("ScrollPaneLayout sometimes improperly " + + "calculates the preferred layout size. "); + } + } +} diff --git a/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java b/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java index 63e07730090..3cbe7a61d03 100644 --- a/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java +++ b/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java @@ -22,7 +22,7 @@ */ import java.awt.ComponentOrientation; -import java.awt.Toolkit; +import java.awt.Robot; import java.util.Calendar; import java.util.Date; import javax.swing.JFrame; @@ -32,7 +32,6 @@ import javax.swing.SpinnerDateModel; import javax.swing.SpinnerModel; import javax.swing.SpinnerNumberModel; import javax.swing.SwingUtilities; -import sun.awt.SunToolkit; /** * @test @@ -43,19 +42,19 @@ import sun.awt.SunToolkit; */ public class bug8008657 { - private static SunToolkit toolkit; + private static Robot robot; private static JSpinner spinner; public static void main(String[] args) throws Exception { - toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + robot = new Robot(); SwingUtilities.invokeAndWait(() -> { createDateSpinner(); createAndShowUI(); }); - toolkit.realSync(); + robot.waitForIdle(); testSpinner(false); SwingUtilities.invokeAndWait(() -> { @@ -63,7 +62,7 @@ public class bug8008657 { createAndShowUI(); }); - toolkit.realSync(); + robot.waitForIdle(); testSpinner(true); } @@ -73,7 +72,7 @@ public class bug8008657 { SwingUtilities.invokeAndWait(() -> { spinner.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> { @@ -91,7 +90,7 @@ public class bug8008657 { spinner.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> { JTextField textField = getTextField(); @@ -152,4 +151,4 @@ public class bug8008657 { frame.getContentPane().add(spinner); frame.setVisible(true); } -} \ No newline at end of file +} diff --git a/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java index 0b3247f9746..11296836916 100644 --- a/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java +++ b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java @@ -30,7 +30,6 @@ import javax.swing.*; import java.awt.*; import java.lang.reflect.*; -import sun.awt.SunToolkit; public class bug4816114 { @@ -46,14 +45,14 @@ public class bug4816114 { static bug4816114 test = new bug4816114(); - public static void main(String[] args) throws InterruptedException, InvocationTargetException { + public static void main(String[] args) throws InterruptedException, InvocationTargetException, AWTException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { test.createAndShowGUI(); } }); - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); - toolkit.realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); Thread.sleep(1000); Thread.sleep(2000); diff --git a/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java index 228aa008567..e18f4aac8c4 100644 --- a/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java +++ b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java @@ -22,7 +22,6 @@ */ import java.awt.BorderLayout; -import sun.awt.SunToolkit; import java.awt.Container; import java.awt.Rectangle; @@ -41,7 +40,10 @@ import javax.swing.UIManager.LookAndFeelInfo; * @test * @bug 7024235 * @summary Tests JFrame.pack() with the JTabbedPane + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot * @author Sergey Malenkov + * @run main Test7024235 */ public class Test7024235 implements Runnable { @@ -50,13 +52,17 @@ public class Test7024235 implements Runnable { public static void main(String[] args) throws Exception { Test7024235 test = new Test7024235(); - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { UIManager.setLookAndFeel(info.getClassName()); test.test(); - toolkit.realSync(); - Thread.sleep(1000); + try { + ExtendedRobot robot = new ExtendedRobot(); + robot.waitForIdle(1000); + }catch(Exception ex) { + ex.printStackTrace(); + throw new Error("Unexpected Failure"); + } test.test(); } } diff --git a/jdk/test/javax/swing/JTabbedPane/7170310/bug7170310.java b/jdk/test/javax/swing/JTabbedPane/7170310/bug7170310.java index 2ceb8a45ccb..94eaa6e3ce1 100644 --- a/jdk/test/javax/swing/JTabbedPane/7170310/bug7170310.java +++ b/jdk/test/javax/swing/JTabbedPane/7170310/bug7170310.java @@ -34,13 +34,14 @@ import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.plaf.metal.MetalLookAndFeel; -import sun.awt.SunToolkit; /** * @test * @bug 7170310 * @author Alexey Ivanov * @summary Selected tab should be scrolled into view. + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot * @run main bug7170310 */ public class bug7170310 { @@ -58,12 +59,11 @@ public class bug7170310 { UIManager.setLookAndFeel(new MetalLookAndFeel()); SwingUtilities.invokeAndWait(bug7170310::createAndShowUI); - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); - toolkit.realSync(); + sync(); for (int i = 0; i < TABS_NUMBER; i++) { SwingUtilities.invokeAndWait(bug7170310::addTab); - toolkit.realSync(); + sync(); } SwingUtilities.invokeAndWait(bug7170310::check); @@ -121,4 +121,13 @@ public class bug7170310 { exception = e; } } + private static void sync() { + try { + ExtendedRobot robot = new ExtendedRobot(); + robot.waitForIdle(300); + }catch(Exception ex) { + ex.printStackTrace(); + throw new Error("Unexpected Failure"); + } + } } diff --git a/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java b/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java index db99233f577..5a71726e631 100644 --- a/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java +++ b/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java @@ -22,12 +22,12 @@ */ import java.awt.BorderLayout; import java.awt.Toolkit; +import java.awt.Robot; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTabbedPane; import javax.swing.SwingUtilities; import javax.swing.plaf.metal.MetalLookAndFeel; -import sun.awt.SunToolkit; /** * @test @@ -45,6 +45,7 @@ public class bug8017284 { public static void main(String[] args) throws Exception { + Robot robot = new Robot(); SwingUtilities.invokeAndWait(() -> { frame = new JFrame(); frame.setSize(500, 500); @@ -61,7 +62,7 @@ public class bug8017284 { frame.setVisible(true); }); - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> { for (int j = 0; j < ITERATIONS; j++) { @@ -70,7 +71,7 @@ public class bug8017284 { } } }); - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> frame.dispose()); } diff --git a/jdk/test/javax/swing/JTable/8032874/bug8032874.java b/jdk/test/javax/swing/JTable/8032874/bug8032874.java index e5d6da00ccf..1116aebe267 100644 --- a/jdk/test/javax/swing/JTable/8032874/bug8032874.java +++ b/jdk/test/javax/swing/JTable/8032874/bug8032874.java @@ -37,15 +37,13 @@ import javax.swing.*; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableRowSorter; -import sun.awt.SunToolkit; - public class bug8032874 { private static final int ROW_COUNT = 5; private static JTable table; private static TestTableModel tableModel; public static void main(String args[]) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -53,7 +51,7 @@ public class bug8032874 { createAndShowUI(); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -63,7 +61,7 @@ public class bug8032874 { table.setRowSelectionInterval(1, 2); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override diff --git a/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java b/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java index d6e232618dd..36d328fe1e8 100644 --- a/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java +++ b/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java @@ -31,8 +31,6 @@ * @author Sean Chou */ -import sun.awt.SunToolkit; - import javax.swing.*; import javax.swing.text.DefaultCaret; import java.awt.*; @@ -53,7 +51,7 @@ public class bug7049024 { public static void main(String[] args) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { @@ -70,7 +68,7 @@ public class bug7049024 { frame.setVisible(true); } }); - toolkit.realSync(); + robot.waitForIdle(); clipboard = textField.getToolkit().getSystemSelection(); if (null == clipboard) { @@ -83,7 +81,7 @@ public class bug7049024 { textField.requestFocusInWindow(); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -93,7 +91,7 @@ public class bug7049024 { caret.moveDot(4); } }); - toolkit.realSync(); + robot.waitForIdle(); String oldSelection = (String) clipboard.getData(DataFlavor.stringFlavor); System.out.println("oldSelection is " + oldSelection); @@ -104,7 +102,7 @@ public class bug7049024 { button.requestFocusInWindow(); } }); - toolkit.realSync(); // So JTextField loses the focus. + robot.waitForIdle(); // So JTextField loses the focus. SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -113,7 +111,7 @@ public class bug7049024 { caret.moveDot(6); } }); - toolkit.realSync(); + robot.waitForIdle(); String newSelection = (String) clipboard.getData(DataFlavor.stringFlavor); System.out.println("newSelection is " + newSelection); diff --git a/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java b/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java new file mode 100644 index 00000000000..61e96b728b0 --- /dev/null +++ b/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2004, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 4529206 + @summary JToolBar - setFloating does not work correctly + @author Konstantin Eremin + @run main bug4529206 +*/ + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class bug4529206 extends JFrame { + static JFrame frame; + static JToolBar jToolBar1; + public bug4529206() { + setDefaultCloseOperation(EXIT_ON_CLOSE); + JPanel jPanFrame = (JPanel) this.getContentPane(); + jPanFrame.setLayout(new BorderLayout()); + this.setSize(new Dimension(200, 100)); + this.setLocation(125, 75); + this.setTitle("Test Floating Toolbar"); + jToolBar1 = new JToolBar(); + JButton jButton1 = new JButton("Float"); + jPanFrame.add(jToolBar1, BorderLayout.NORTH); + JTextField tf = new JTextField("click here"); + jPanFrame.add(tf); + jToolBar1.add(jButton1, null); + jButton1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + buttonPressed(e); + } + }); + makeToolbarFloat(); + setVisible(true); + } + + private void makeToolbarFloat() { + javax.swing.plaf.basic.BasicToolBarUI ui = (javax.swing.plaf.basic.BasicToolBarUI) jToolBar1.getUI(); + if (!ui.isFloating()) { + ui.setFloatingLocation(100, 100); + ui.setFloating(true, jToolBar1.getLocation()); + } + } + + private void buttonPressed(ActionEvent e) { + makeToolbarFloat(); + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new bug4529206(); + } + }); + Robot robot = new Robot(); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (frame.isFocused()) { + throw (new RuntimeException("setFloating does not work correctly")); + } + } + }); + } +} diff --git a/jdk/test/javax/swing/JViewport/7107099/bug7107099.java b/jdk/test/javax/swing/JViewport/7107099/bug7107099.java index eff27bccdae..a6bdce4b445 100644 --- a/jdk/test/javax/swing/JViewport/7107099/bug7107099.java +++ b/jdk/test/javax/swing/JViewport/7107099/bug7107099.java @@ -27,8 +27,6 @@ @author Pavel Porvatov */ -import sun.awt.SunToolkit; - import javax.swing.*; import java.awt.*; @@ -43,7 +41,8 @@ public class bug7107099 { private static int extent; public static void main(String[] args) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + java.awt.Robot robot = new java.awt.Robot(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -61,7 +60,7 @@ public class bug7107099 { } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override @@ -81,7 +80,7 @@ public class bug7107099 { } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override diff --git a/jdk/test/javax/swing/Popup/6514582/bug6514582.java b/jdk/test/javax/swing/Popup/6514582/bug6514582.java new file mode 100644 index 00000000000..94fee3f4f82 --- /dev/null +++ b/jdk/test/javax/swing/Popup/6514582/bug6514582.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 6514582 + @summary SubMenu of a JMenu with no items paints a single pixel tiny menu. + @author Alexander Potochkin + @run main bug6514582 +*/ + +import javax.swing.*; +import java.awt.*; + +public class bug6514582 { + private static JPopupMenu popup; + + public static void main(String ...args) throws Exception { + Robot robot = new Robot(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + popup = new JPopupMenu(); + popup.add(new JMenuItem("item")); + popup.setVisible(true); + + } + }); + + robot.waitForIdle(); + + if (!popup.isShowing()) { + throw new RuntimeException("Where is my popup ?"); + } + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + popup.setVisible(false); + popup.removeAll(); + popup.setVisible(true); + } + }); + + robot.waitForIdle(); + + if (popup.isShowing()) { + throw new RuntimeException("Empty popup is shown"); + } + + popup.setVisible(false); + } +} diff --git a/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java b/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java index cbe6d2230de..5d4198cc669 100644 --- a/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java +++ b/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java @@ -31,7 +31,6 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; -import sun.awt.*; public class IconifyTest { private static volatile boolean windowIconifiedIsCalled = false; @@ -40,7 +39,7 @@ public class IconifyTest { static JButton button; public static void main(String[] args) throws Throwable { - SunToolkit toolkit = (SunToolkit) SunToolkit.getDefaultToolkit(); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame = new JFrame(); @@ -61,14 +60,14 @@ public class IconifyTest { frame.setVisible(true); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setExtendedState(Frame.ICONIFIED); } }); - toolkit.realSync(); + robot.waitForIdle(); if (!windowIconifiedIsCalled) { throw new Exception("Test failed: window was not iconified."); diff --git a/jdk/test/javax/swing/Security/6657138/ComponentTest.java b/jdk/test/javax/swing/Security/6657138/ComponentTest.java index bfd818eb6f6..2ee7b84bbfa 100644 --- a/jdk/test/javax/swing/Security/6657138/ComponentTest.java +++ b/jdk/test/javax/swing/Security/6657138/ComponentTest.java @@ -28,8 +28,6 @@ * @author Alexander Potochkin */ -import sun.awt.SunToolkit; - import javax.swing.*; import java.awt.*; @@ -50,14 +48,14 @@ public class ComponentTest extends JFrame { public static void main(String[] args) throws Exception { - SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame = new ComponentTest(); frame.setVisible(true); } }); - toolkit.realSync(); + robot.waitForIdle(); UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); for (final UIManager.LookAndFeelInfo laf : lafs) { SwingUtilities.invokeAndWait(new Runnable() { @@ -70,7 +68,7 @@ public class ComponentTest extends JFrame { SwingUtilities.updateComponentTreeUI(frame); } }); - toolkit.realSync(); + robot.waitForIdle(); } } } diff --git a/jdk/test/javax/swing/SwingTest.java b/jdk/test/javax/swing/SwingTest.java index ef8dfea27e0..f7f6889f635 100644 --- a/jdk/test/javax/swing/SwingTest.java +++ b/jdk/test/javax/swing/SwingTest.java @@ -21,7 +21,6 @@ * questions. */ -import sun.awt.SunToolkit; import java.awt.Toolkit; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -134,11 +133,8 @@ final class SwingTest implements Runnable { else { SwingUtilities.invokeLater(this); // invoke on the event dispatch thread } - Toolkit tk = Toolkit.getDefaultToolkit(); - if (tk instanceof SunToolkit) { - SunToolkit stk = (SunToolkit) tk; - stk.realSync(); // wait until done - } + java.awt.Robot robot = new java.awt.Robot(); + robot.waitForIdle(); } while (this.frame != null); if (this.error != null) { diff --git a/jdk/test/javax/swing/text/Utilities/bug7045593.java b/jdk/test/javax/swing/text/Utilities/bug7045593.java index 84beb0d53b9..1de7cc142c2 100644 --- a/jdk/test/javax/swing/text/Utilities/bug7045593.java +++ b/jdk/test/javax/swing/text/Utilities/bug7045593.java @@ -28,8 +28,6 @@ * @author Pavel Porvatov */ -import sun.awt.SunToolkit; - import javax.swing.*; import javax.swing.text.BadLocationException; import java.awt.*; @@ -49,7 +47,8 @@ public class bug7045593 { } }); - ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { diff --git a/jdk/test/javax/swing/text/View/8048110/bug8048110.java b/jdk/test/javax/swing/text/View/8048110/bug8048110.java index 2151e3fb502..85ae35708e5 100644 --- a/jdk/test/javax/swing/text/View/8048110/bug8048110.java +++ b/jdk/test/javax/swing/text/View/8048110/bug8048110.java @@ -28,8 +28,6 @@ * @run main bug8048110 */ -import sun.awt.SunToolkit; - import javax.swing.*; import javax.swing.text.Element; import javax.swing.text.html.HTMLDocument; @@ -37,7 +35,7 @@ import javax.swing.text.html.HTMLEditorKit; import java.awt.*; public class bug8048110 { - private static SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); + private static Robot robot; private static Object lock = new Object(); private static boolean isRealSyncPerformed = false; private static final String htmlText = "" + @@ -45,6 +43,7 @@ public class bug8048110 { "
PCOk
"; public static void main(String[] args) throws Exception { + robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { @@ -55,7 +54,7 @@ public class bug8048110 { Thread thread = new Thread() { @Override public void run() { - toolkit.realSync(); + robot.waitForIdle(); synchronized (lock) { isRealSyncPerformed = true; lock.notifyAll(); diff --git a/jdk/test/javax/swing/text/html/7189299/bug7189299.java b/jdk/test/javax/swing/text/html/7189299/bug7189299.java index 83862122ec2..609635c4fc5 100644 --- a/jdk/test/javax/swing/text/html/7189299/bug7189299.java +++ b/jdk/test/javax/swing/text/html/7189299/bug7189299.java @@ -25,7 +25,7 @@ * Portions Copyright (c) 2013 IBM Corporation */ import java.awt.BorderLayout; -import java.awt.Toolkit; +import java.awt.Robot; import java.awt.event.ActionListener; import javax.swing.DefaultButtonModel; @@ -35,7 +35,6 @@ import javax.swing.SwingUtilities; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; import javax.swing.text.html.HTMLEditorKit; -import sun.awt.SunToolkit; /* @@ -111,7 +110,7 @@ public class bug7189299 { } public static void main(String[] args) throws Exception { - final SunToolkit toolkit = ((SunToolkit) Toolkit.getDefaultToolkit()); + final Robot robot = new Robot(); SwingUtilities.invokeAndWait(new Runnable() { @@ -120,7 +119,7 @@ public class bug7189299 { setup(); } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override diff --git a/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java b/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java index 2378fd2e334..86ebdbb963f 100644 --- a/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java +++ b/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java @@ -28,8 +28,6 @@ * @run main bug8058120 */ -import sun.awt.SunToolkit; - import javax.swing.*; import javax.swing.text.Element; import javax.swing.text.html.HTML; @@ -38,12 +36,18 @@ import javax.swing.text.html.HTMLEditorKit; import java.awt.*; public class bug8058120 { - private static SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); private static HTMLDocument document = null; private static final String text = "

ab

"; private static final String textToInsert = "c"; public static void main(String[] args) { + Robot robot; + try { + robot = new Robot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Unexpected failure"); + } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { @@ -51,7 +55,7 @@ public class bug8058120 { } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeLater(new Runnable() { @Override @@ -64,7 +68,7 @@ public class bug8058120 { } }); - toolkit.realSync(); + robot.waitForIdle(); SwingUtilities.invokeLater(new Runnable() { @Override diff --git a/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java index c18dccd02de..835990fa142 100644 --- a/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java +++ b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java @@ -27,8 +27,6 @@ @author Peter Zhelezniakov */ -import sun.awt.SunToolkit; - import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -85,7 +83,8 @@ public class bug4242228 { } }); - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { @Override diff --git a/jdk/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java b/jdk/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java index 2c89050ef4a..339e52f1e70 100644 --- a/jdk/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java +++ b/jdk/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java @@ -28,9 +28,8 @@ @run main bug7165725 */ -import sun.awt.SunToolkit; - import java.awt.BorderLayout; +import java.awt.Robot; import java.io.File; import java.io.FileReader; import java.io.IOException; @@ -127,7 +126,8 @@ public class bug7165725 extends JFrame { } }); - ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + Robot robot = new Robot(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { From bdac8228110c81efccee4fffe2eddcb4cc42e528 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 10 Nov 2014 19:04:38 +0300 Subject: [PATCH 050/159] 8059624: Test task: WhiteBox API for testing segmented codecache feature Reviewed-by: kvn, thartmann --- hotspot/src/share/vm/code/codeBlob.cpp | 2 +- hotspot/src/share/vm/code/codeBlob.hpp | 4 +- hotspot/src/share/vm/code/codeCache.cpp | 2 +- hotspot/src/share/vm/code/codeCache.hpp | 3 +- .../src/share/vm/compiler/compileBroker.cpp | 7 + hotspot/src/share/vm/prims/whitebox.cpp | 153 +++++++++++++++++- hotspot/src/share/vm/prims/whitebox.hpp | 9 +- hotspot/src/share/vm/runtime/mutexLocker.cpp | 5 +- hotspot/src/share/vm/runtime/mutexLocker.hpp | 1 + hotspot/src/share/vm/runtime/sweeper.hpp | 5 +- .../whitebox/AllocationCodeBlobTest.java | 128 +++++++++++++++ .../whitebox/GetCodeHeapEntriesTest.java | 95 +++++++++++ .../compiler/whitebox/GetNMethodTest.java | 43 ++++- .../whitebox/LockCompilationTest.java | 91 +++++++++++ .../whitebox/sun/hotspot/WhiteBox.java | 6 + .../whitebox/sun/hotspot/code/BlobType.java | 79 +++++++++ .../whitebox/sun/hotspot/code/CodeBlob.java | 61 +++++++ .../whitebox/sun/hotspot/code/NMethod.java | 28 ++-- 18 files changed, 687 insertions(+), 35 deletions(-) create mode 100644 hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java create mode 100644 hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java create mode 100644 hotspot/test/compiler/whitebox/LockCompilationTest.java create mode 100644 hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java create mode 100644 hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp index 98b7ec0f23c..3cf66665d87 100644 --- a/hotspot/src/share/vm/code/codeBlob.cpp +++ b/hotspot/src/share/vm/code/codeBlob.cpp @@ -43,7 +43,7 @@ #include "c1/c1_Runtime1.hpp" #endif -unsigned int align_code_offset(int offset) { +unsigned int CodeBlob::align_code_offset(int offset) { // align the size to CodeEntryAlignment return ((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1)) diff --git a/hotspot/src/share/vm/code/codeBlob.hpp b/hotspot/src/share/vm/code/codeBlob.hpp index 2c066788657..e1f83936158 100644 --- a/hotspot/src/share/vm/code/codeBlob.hpp +++ b/hotspot/src/share/vm/code/codeBlob.hpp @@ -83,6 +83,7 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC { public: // Returns the space needed for CodeBlob static unsigned int allocation_size(CodeBuffer* cb, int header_size); + static unsigned int align_code_offset(int offset); // Creation // a) simple CodeBlob @@ -207,7 +208,7 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC { } }; - +class WhiteBox; //---------------------------------------------------------------------------------------------------- // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc. @@ -215,6 +216,7 @@ class BufferBlob: public CodeBlob { friend class VMStructs; friend class AdapterBlob; friend class MethodHandlesAdapterBlob; + friend class WhiteBox; private: // Creation support diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp index 4876a40111d..b3942454ab8 100644 --- a/hotspot/src/share/vm/code/codeCache.cpp +++ b/hotspot/src/share/vm/code/codeCache.cpp @@ -305,7 +305,7 @@ void CodeCache::add_heap(ReservedSpace rs, const char* name, size_t size_initial MemoryService::add_code_heap_memory_pool(heap, name); } -CodeHeap* CodeCache::get_code_heap(CodeBlob* cb) { +CodeHeap* CodeCache::get_code_heap(const CodeBlob* cb) { assert(cb != NULL, "CodeBlob is null"); FOR_ALL_HEAPS(heap) { if ((*heap)->contains(cb)) { diff --git a/hotspot/src/share/vm/code/codeCache.hpp b/hotspot/src/share/vm/code/codeCache.hpp index fd7fb286c31..25c5288cdde 100644 --- a/hotspot/src/share/vm/code/codeCache.hpp +++ b/hotspot/src/share/vm/code/codeCache.hpp @@ -77,6 +77,7 @@ class DepChange; class CodeCache : AllStatic { friend class VMStructs; friend class NMethodIterator; + friend class WhiteBox; private: // CodeHeaps of the cache static GrowableArray* _heaps; @@ -98,7 +99,7 @@ class CodeCache : AllStatic { static void initialize_heaps(); // Initializes the CodeHeaps // Creates a new heap with the given name and size, containing CodeBlobs of the given type static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type); - static CodeHeap* get_code_heap(CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob + static CodeHeap* get_code_heap(const CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob static CodeHeap* get_code_heap(int code_blob_type); // Returns the CodeHeap for the given CodeBlobType // Returns the name of the VM option to set the size of the corresponding CodeHeap static const char* get_code_heap_flag_name(int code_blob_type); diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index 330fa0214ef..0ab0dae2dd6 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -35,6 +35,7 @@ #include "oops/method.hpp" #include "oops/oop.inline.hpp" #include "prims/nativeLookup.hpp" +#include "prims/whitebox.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/compilationPolicy.hpp" @@ -1963,6 +1964,12 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { if (comp == NULL) { ci_env.record_method_not_compilable("no compiler", !TieredCompilation); } else { + if (WhiteBoxAPI && WhiteBox::compilation_locked) { + MonitorLockerEx locker(Compilation_lock, Mutex::_no_safepoint_check_flag); + while (WhiteBox::compilation_locked) { + locker.wait(Mutex::_no_safepoint_check_flag); + } + } comp->compile_method(&ci_env, target, osr_bci); } diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index 0bc2b71c892..f412484cbe0 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -24,6 +24,8 @@ #include "precompiled.hpp" +#include + #include "code/codeCache.hpp" #include "memory/metadataFactory.hpp" #include "memory/universe.hpp" @@ -37,9 +39,11 @@ #include "runtime/thread.hpp" #include "runtime/arguments.hpp" +#include "runtime/deoptimization.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" +#include "runtime/sweeper.hpp" #include "utilities/array.hpp" #include "utilities/debug.hpp" @@ -67,6 +71,7 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC #define SIZE_T_MAX_VALUE ((size_t) -1) bool WhiteBox::_used = false; +volatile bool WhiteBox::compilation_locked = false; WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj)) return (jlong)(void*)JNIHandles::resolve(obj); @@ -302,13 +307,12 @@ WB_END WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size)) jlong addr = 0; - addr = (jlong)(uintptr_t)os::reserve_memory(size); - MemTracker::record_virtual_memory_type((address)addr, mtTest); + addr = (jlong)(uintptr_t)os::reserve_memory(size); + MemTracker::record_virtual_memory_type((address)addr, mtTest); return addr; WB_END - WB_ENTRY(void, WB_NMTCommitMemory(JNIEnv* env, jobject o, jlong addr, jlong size)) os::commit_memory((char *)(uintptr_t)addr, size, !ExecMem); MemTracker::record_virtual_memory_type((address)(uintptr_t)addr, mtTest); @@ -728,6 +732,29 @@ WB_ENTRY(void, WB_SetStringVMFlag(JNIEnv* env, jobject o, jstring name, jstring WB_END +WB_ENTRY(void, WB_LockCompilation(JNIEnv* env, jobject o, jlong timeout)) + WhiteBox::compilation_locked = true; +WB_END + +WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o)) + MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag); + WhiteBox::compilation_locked = false; + mo.notify_all(); +WB_END + +void WhiteBox::force_sweep() { + guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled"); + { + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); + NMethodSweeper::_should_sweep = true; + } + NMethodSweeper::possibly_sweep(); +} + +WB_ENTRY(void, WB_ForceNMethodSweep(JNIEnv* env, jobject o)) + WhiteBox::force_sweep(); +WB_END + WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) ResourceMark rm(THREAD); int len; @@ -774,6 +801,46 @@ WB_ENTRY(jstring, WB_GetCPUFeatures(JNIEnv* env, jobject o)) return features_string; WB_END +int WhiteBox::get_blob_type(const CodeBlob* code) { + guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled"); + return CodeCache::get_code_heap(code)->code_blob_type(); +} + +CodeHeap* WhiteBox::get_code_heap(int blob_type) { + guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled"); + return CodeCache::get_code_heap(blob_type); +} + +struct CodeBlobStub { + CodeBlobStub(const CodeBlob* blob) : + name(os::strdup(blob->name())), + size(blob->size()), + blob_type(WhiteBox::get_blob_type(blob)) { } + ~CodeBlobStub() { os::free((void*) name); } + const char* const name; + const int size; + const int blob_type; +}; + +static jobjectArray codeBlob2objectArray(JavaThread* thread, JNIEnv* env, CodeBlobStub* cb) { + jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string()); + CHECK_JNI_EXCEPTION_(env, NULL); + jobjectArray result = env->NewObjectArray(3, clazz, NULL); + + jstring name = env->NewStringUTF(cb->name); + CHECK_JNI_EXCEPTION_(env, NULL); + env->SetObjectArrayElement(result, 0, name); + + jobject obj = integerBox(thread, env, cb->size); + CHECK_JNI_EXCEPTION_(env, NULL); + env->SetObjectArrayElement(result, 1, obj); + + obj = integerBox(thread, env, cb->blob_type); + CHECK_JNI_EXCEPTION_(env, NULL); + env->SetObjectArrayElement(result, 2, obj); + + return result; +} WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr)) ResourceMark rm(THREAD); @@ -790,27 +857,93 @@ WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jbo ThreadToNativeFromVM ttn(thread); jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string()); CHECK_JNI_EXCEPTION_(env, NULL); - result = env->NewObjectArray(3, clazz, NULL); + result = env->NewObjectArray(4, clazz, NULL); if (result == NULL) { return result; } + CodeBlobStub stub(code); + jobjectArray codeBlob = codeBlob2objectArray(thread, env, &stub); + env->SetObjectArrayElement(result, 0, codeBlob); + jobject level = integerBox(thread, env, code->comp_level()); CHECK_JNI_EXCEPTION_(env, NULL); - env->SetObjectArrayElement(result, 0, level); + env->SetObjectArrayElement(result, 1, level); jbyteArray insts = env->NewByteArray(insts_size); CHECK_JNI_EXCEPTION_(env, NULL); env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin()); - env->SetObjectArrayElement(result, 1, insts); + env->SetObjectArrayElement(result, 2, insts); jobject id = integerBox(thread, env, code->compile_id()); CHECK_JNI_EXCEPTION_(env, NULL); - env->SetObjectArrayElement(result, 2, id); + env->SetObjectArrayElement(result, 3, id); return result; WB_END +CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) { + guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled"); + BufferBlob* blob; + int full_size = CodeBlob::align_code_offset(sizeof(BufferBlob)); + if (full_size < size) { + full_size += round_to(size - full_size, oopSize); + } + { + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); + blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type); + } + // Track memory usage statistic after releasing CodeCache_lock + MemoryService::track_code_cache_memory_usage(); + ::new (blob) BufferBlob("WB::DummyBlob", full_size); + return blob; +} + +WB_ENTRY(jlong, WB_AllocateCodeBlob(JNIEnv* env, jobject o, jint size, jint blob_type)) + return (jlong) WhiteBox::allocate_code_blob(size, blob_type); +WB_END + +WB_ENTRY(void, WB_FreeCodeBlob(JNIEnv* env, jobject o, jlong addr)) + BufferBlob::free((BufferBlob*) addr); +WB_END + +WB_ENTRY(jobjectArray, WB_GetCodeHeapEntries(JNIEnv* env, jobject o, jint blob_type)) + ResourceMark rm; + GrowableArray blobs; + { + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); + CodeHeap* heap = WhiteBox::get_code_heap(blob_type); + if (heap == NULL) { + return NULL; + } + for (CodeBlob* cb = (CodeBlob*) heap->first(); + cb != NULL; cb = (CodeBlob*) heap->next(cb)) { + CodeBlobStub* stub = NEW_RESOURCE_OBJ(CodeBlobStub); + new (stub) CodeBlobStub(cb); + blobs.append(stub); + } + } + if (blobs.length() == 0) { + return NULL; + } + ThreadToNativeFromVM ttn(thread); + jobjectArray result = NULL; + jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string()); + CHECK_JNI_EXCEPTION_(env, NULL); + result = env->NewObjectArray(blobs.length(), clazz, NULL); + if (result == NULL) { + return result; + } + int i = 0; + for (GrowableArrayIterator it = blobs.begin(); + it != blobs.end(); ++it) { + jobjectArray obj = codeBlob2objectArray(thread, env, *it); + env->SetObjectArrayElement(result, i, obj); + ++i; + } + return result; +WB_END + WB_ENTRY(jlong, WB_GetThreadStackSize(JNIEnv* env, jobject o)) return (jlong) Thread::current()->stack_size(); WB_END @@ -1018,6 +1151,8 @@ static JNINativeMethod methods[] = { CC"(Ljava/lang/reflect/Executable;II)Z", (void*)&WB_EnqueueMethodForCompilation}, {CC"clearMethodState", CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState}, + {CC"lockCompilation", CC"()V", (void*)&WB_LockCompilation}, + {CC"unlockCompilation", CC"()V", (void*)&WB_UnlockCompilation}, {CC"isConstantVMFlag", CC"(Ljava/lang/String;)Z", (void*)&WB_IsConstantVMFlag}, {CC"isLockedVMFlag", CC"(Ljava/lang/String;)Z", (void*)&WB_IsLockedVMFlag}, {CC"setBooleanVMFlag", CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag}, @@ -1055,6 +1190,10 @@ static JNINativeMethod methods[] = { {CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures }, {CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;", (void*)&WB_GetNMethod }, + {CC"forceNMethodSweep", CC"()V", (void*)&WB_ForceNMethodSweep }, + {CC"allocateCodeBlob", CC"(II)J", (void*)&WB_AllocateCodeBlob }, + {CC"freeCodeBlob", CC"(J)V", (void*)&WB_FreeCodeBlob }, + {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries }, {CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize }, {CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize }, }; diff --git a/hotspot/src/share/vm/prims/whitebox.hpp b/hotspot/src/share/vm/prims/whitebox.hpp index 6461d1eb812..6325eef1568 100644 --- a/hotspot/src/share/vm/prims/whitebox.hpp +++ b/hotspot/src/share/vm/prims/whitebox.hpp @@ -54,17 +54,24 @@ } \ } while (0) +class CodeBlob; +class CodeHeap; + class WhiteBox : public AllStatic { private: static bool _used; public: + static volatile bool compilation_locked; static bool used() { return _used; } static void set_used() { _used = true; } static int offset_for_field(const char* field_name, oop object, Symbol* signature_symbol); static const char* lookup_jstring(const char* field_name, oop object); static bool lookup_bool(const char* field_name, oop object); - + static void force_sweep(); + static int get_blob_type(const CodeBlob* code); + static CodeHeap* get_code_heap(int blob_type); + static CodeBlob* allocate_code_blob(int blob_type, int size); static int array_bytes_to_length(size_t bytes); static void register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread, JNINativeMethod* method_array, int method_count); diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp index 25a897a142f..9c8a3f0dc5e 100644 --- a/hotspot/src/share/vm/runtime/mutexLocker.cpp +++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp @@ -88,6 +88,7 @@ Mutex* DerivedPointerTableGC_lock = NULL; Mutex* Compile_lock = NULL; Monitor* MethodCompileQueue_lock = NULL; Monitor* CompileThread_lock = NULL; +Monitor* Compilation_lock = NULL; Mutex* CompileTaskAlloc_lock = NULL; Mutex* CompileStatistics_lock = NULL; Mutex* MultiArray_lock = NULL; @@ -278,7 +279,9 @@ void mutex_init() { def(ProfileVM_lock , Monitor, special, false); // used for profiling of the VMThread def(CompileThread_lock , Monitor, nonleaf+5, false ); def(PeriodicTask_lock , Monitor, nonleaf+5, true); - + if (WhiteBoxAPI) { + def(Compilation_lock , Monitor, leaf, false ); + } #ifdef INCLUDE_TRACE def(JfrMsg_lock , Monitor, leaf, true); def(JfrBuffer_lock , Mutex, leaf, true); diff --git a/hotspot/src/share/vm/runtime/mutexLocker.hpp b/hotspot/src/share/vm/runtime/mutexLocker.hpp index 94d8adec813..6bfb0fd6533 100644 --- a/hotspot/src/share/vm/runtime/mutexLocker.hpp +++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp @@ -91,6 +91,7 @@ extern Mutex* EvacFailureStack_lock; // guards the evac failure scan extern Mutex* Compile_lock; // a lock held when Compilation is updating code (used to block CodeCache traversal, CHA updates, etc) extern Monitor* MethodCompileQueue_lock; // a lock held when method compilations are enqueued, dequeued extern Monitor* CompileThread_lock; // a lock held by compile threads during compilation system initialization +extern Monitor* Compilation_lock; // a lock used to pause compilation extern Mutex* CompileTaskAlloc_lock; // a lock held when CompileTasks are allocated extern Mutex* CompileStatistics_lock; // a lock held when updating compilation statistics extern Mutex* MultiArray_lock; // a lock used to guard allocation of multi-dim arrays diff --git a/hotspot/src/share/vm/runtime/sweeper.hpp b/hotspot/src/share/vm/runtime/sweeper.hpp index 2da9425390e..e66c96adb23 100644 --- a/hotspot/src/share/vm/runtime/sweeper.hpp +++ b/hotspot/src/share/vm/runtime/sweeper.hpp @@ -25,6 +25,8 @@ #ifndef SHARE_VM_RUNTIME_SWEEPER_HPP #define SHARE_VM_RUNTIME_SWEEPER_HPP +class WhiteBox; + #include "utilities/ticks.hpp" // An NmethodSweeper is an incremental cleaner for: // - cleanup inline caches @@ -52,6 +54,8 @@ // nmethod's space is freed. class NMethodSweeper : public AllStatic { + friend class WhiteBox; + private: static long _traversals; // Stack scan count, also sweep ID. static long _total_nof_code_cache_sweeps; // Total number of full sweeps of the code cache static long _time_counter; // Virtual time used to periodically invoke sweeper @@ -88,7 +92,6 @@ class NMethodSweeper : public AllStatic { static void handle_safepoint_request(); static void do_stack_scanning(); static void possibly_sweep(); - public: static long traversal_count() { return _traversals; } static int total_nof_methods_reclaimed() { return _total_nof_methods_reclaimed; } diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java new file mode 100644 index 00000000000..3738b35b375 --- /dev/null +++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java @@ -0,0 +1,128 @@ +/* + * 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. + * + */ + +import java.lang.management.MemoryPoolMXBean; +import java.util.EnumSet; +import java.util.ArrayList; + +import sun.hotspot.WhiteBox; +import sun.hotspot.code.BlobType; +import com.oracle.java.testlibrary.Asserts; + +/* + * @test AllocationCodeBlobTest + * @bug 8059624 + * @library /testlibrary /testlibrary/whitebox + * @build AllocationCodeBlobTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:-SegmentedCodeCache AllocationCodeBlobTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:+SegmentedCodeCache AllocationCodeBlobTest + * @summary testing of WB::allocate/freeCodeBlob() + */ +public class AllocationCodeBlobTest { + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static final long CODE_CACHE_SIZE + = WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize"); + private static final int SIZE = 1; + + public static void main(String[] args) { + // check that Sweeper handels dummy blobs correctly + new ForcedSweeper(500).start(); + EnumSet blobTypes = BlobType.getAvailable(); + for (BlobType type : blobTypes) { + new AllocationCodeBlobTest(type).test(); + } + } + + private final BlobType type; + private final MemoryPoolMXBean bean; + private AllocationCodeBlobTest(BlobType type) { + this.type = type; + bean = type.getMemoryPool(); + } + + private void test() { + System.out.printf("type %s%n", type); + long start = getUsage(); + long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id); + Asserts.assertNE(0, addr, "allocation failed"); + + long firstAllocation = getUsage(); + Asserts.assertLTE(start + SIZE, firstAllocation, + "allocation should increase memory usage: " + + start + " + " + SIZE + " <= " + firstAllocation); + + WHITE_BOX.freeCodeBlob(addr); + long firstFree = getUsage(); + Asserts.assertLTE(firstFree, firstAllocation, + "free shouldn't increase memory usage: " + + firstFree + " <= " + firstAllocation); + + addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id); + Asserts.assertNE(0, addr, "allocation failed"); + + long secondAllocation = getUsage(); + Asserts.assertEQ(firstAllocation, secondAllocation); + + WHITE_BOX.freeCodeBlob(addr); + System.out.println("allocating till possible..."); + ArrayList blobs = new ArrayList<>(); + int size = (int) (CODE_CACHE_SIZE >> 7); + while ((addr = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) { + blobs.add(addr); + } + for (Long blob : blobs) { + WHITE_BOX.freeCodeBlob(blob); + } + } + + private long getUsage() { + return bean.getUsage().getUsed(); + } + + private static class ForcedSweeper extends Thread { + private final int millis; + public ForcedSweeper(int millis) { + super("ForcedSweeper"); + setDaemon(true); + this.millis = millis; + } + public void run() { + try { + while (true) { + WHITE_BOX.forceNMethodSweep(); + Thread.sleep(millis); + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new Error(e); + } + } + } +} diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java new file mode 100644 index 00000000000..0fb35424efc --- /dev/null +++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java @@ -0,0 +1,95 @@ +/* + * 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. + * + */ + +import java.util.Arrays; +import java.util.EnumSet; + +import sun.hotspot.WhiteBox; +import sun.hotspot.code.CodeBlob; +import sun.hotspot.code.BlobType; +import com.oracle.java.testlibrary.Asserts; + +/* + * @test GetCodeHeapEntriesTest + * @bug 8059624 + * @library /testlibrary /testlibrary/whitebox + * @build GetCodeHeapEntriesTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache + * GetCodeHeapEntriesTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache + * GetCodeHeapEntriesTest + * @summary testing of WB::getCodeHeapEntries() + */ +public class GetCodeHeapEntriesTest { + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static final int SIZE = 1024; + private static final String DUMMY_NAME = "WB::DummyBlob"; + private static EnumSet SEGMENTED_TYPES + = EnumSet.complementOf(EnumSet.of(BlobType.All)); + + public static void main(String[] args) { + EnumSet blobTypes = BlobType.getAvailable(); + for (BlobType type : blobTypes) { + new GetCodeHeapEntriesTest(type).test(); + } + } + + private final BlobType type; + private GetCodeHeapEntriesTest(BlobType type) { + this.type = type; + } + + private void test() { + System.out.printf("type %s%n", type); + long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id); + Asserts.assertNE(0, addr, "allocation failed"); + CodeBlob[] blobs = CodeBlob.getCodeBlobs(type); + Asserts.assertNotNull(blobs); + CodeBlob blob = Arrays.stream(blobs) + .filter(GetCodeHeapEntriesTest::filter) + .findAny() + .get(); + Asserts.assertNotNull(blob); + Asserts.assertEQ(blob.code_blob_type, type); + Asserts.assertGTE(blob.size, SIZE); + + WHITE_BOX.freeCodeBlob(addr); + blobs = CodeBlob.getCodeBlobs(type); + long count = Arrays.stream(blobs) + .filter(GetCodeHeapEntriesTest::filter) + .count(); + Asserts.assertEQ(0L, count); + } + + private static boolean filter(CodeBlob blob) { + if (blob == null) { + return false; + } + return DUMMY_NAME.equals(blob.name); + } +} diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java index 25373808fd2..dc3d35d42e0 100644 --- a/hotspot/test/compiler/whitebox/GetNMethodTest.java +++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java @@ -22,7 +22,9 @@ * */ +import sun.hotspot.code.BlobType; import sun.hotspot.code.NMethod; +import com.oracle.java.testlibrary.Asserts; /* * @test GetNMethodTest @@ -52,21 +54,46 @@ public class GetNMethodTest extends CompilerWhiteBoxTest { compile(); checkCompiled(); + NMethod nmethod = NMethod.get(method, testCase.isOsr()); if (IS_VERBOSE) { System.out.println("nmethod = " + nmethod); } - if (nmethod == null) { - throw new RuntimeException("nmethod of compiled method is null"); - } - if (nmethod.insts.length == 0) { - throw new RuntimeException("compiled method's instructions is empty"); + Asserts.assertNotNull(nmethod, + "nmethod of compiled method is null"); + Asserts.assertNotNull(nmethod.insts, + "nmethod.insts of compiled method is null"); + Asserts.assertGT(nmethod.insts.length, 0, + "compiled method's instructions is empty"); + Asserts.assertNotNull(nmethod.code_blob_type, "blob type is null"); + if (WHITE_BOX.getBooleanVMFlag("SegmentedCodeCache")) { + Asserts.assertNE(nmethod.code_blob_type, BlobType.All); + switch (nmethod.comp_level) { + case 1: + case 4: + checkBlockType(nmethod, BlobType.MethodNonProfiled); + break; + case 2: + case 3: + checkBlockType(nmethod, BlobType.MethodNonProfiled); + break; + default: + throw new Error("unexpected comp level " + nmethod); + } + } else { + Asserts.assertEQ(nmethod.code_blob_type, BlobType.All); } + deoptimize(); checkNotCompiled(); nmethod = NMethod.get(method, testCase.isOsr()); - if (nmethod != null) { - throw new RuntimeException("nmethod of non-compiled method isn't null"); - } + Asserts.assertNull(nmethod, + "nmethod of non-compiled method isn't null"); + } + + private void checkBlockType(NMethod nmethod, BlobType expectedType) { + Asserts.assertEQ(nmethod.code_blob_type, expectedType, + String.format("blob_type[%s] for %d level isn't %s", + nmethod.code_blob_type, nmethod.comp_level, expectedType)); } } diff --git a/hotspot/test/compiler/whitebox/LockCompilationTest.java b/hotspot/test/compiler/whitebox/LockCompilationTest.java new file mode 100644 index 00000000000..5f16481a6de --- /dev/null +++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java @@ -0,0 +1,91 @@ +/* + * 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 LockCompilationTest + * @bug 8059624 + * @library /testlibrary /testlibrary/whitebox + * @build LockCompilationTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* LockCompilationTest + * @summary testing of WB::lock/unlockCompilation() + */ + +import java.io.OutputStream; +import java.io.PrintWriter; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; + +import com.oracle.java.testlibrary.Asserts; + +public class LockCompilationTest extends CompilerWhiteBoxTest { + public static void main(String[] args) throws Exception { + CompilerWhiteBoxTest.main(LockCompilationTest::new, args); + } + + private LockCompilationTest(TestCase testCase) { + super(testCase); + // to prevent inlining of #method + WHITE_BOX.testSetDontInlineMethod(method, true); + } + + protected void test() throws Exception { + checkNotCompiled(); + + System.out.println("locking compilation"); + WHITE_BOX.lockCompilation(); + + try { + System.out.println("trying to compile"); + compile(); + // to check if it works correctly w/ safepoints + System.out.println("going to safepoint"); + WHITE_BOX.fullGC(); + waitBackgroundCompilation(); + Asserts.assertTrue( + WHITE_BOX.isMethodQueuedForCompilation(method), + method + " must be in queue"); + Asserts.assertFalse( + WHITE_BOX.isMethodCompiled(method, false), + method + " must be not compiled"); + Asserts.assertEQ( + WHITE_BOX.getMethodCompilationLevel(method, false), 0, + method + " comp_level must be == 0"); + Asserts.assertFalse( + WHITE_BOX.isMethodCompiled(method, true), + method + " must be not osr_compiled"); + Asserts.assertEQ( + WHITE_BOX.getMethodCompilationLevel(method, true), 0, + method + " osr_comp_level must be == 0"); + } finally { + System.out.println("unlocking compilation"); + WHITE_BOX.unlockCompilation(); + } + waitBackgroundCompilation(); + Asserts.assertFalse( + WHITE_BOX.isMethodQueuedForCompilation(method), + method + " must not be in queue"); + } +} + diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java index a5a07947954..08e8c80863d 100644 --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java @@ -143,8 +143,14 @@ public class WhiteBox { } public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci); public native void clearMethodState(Executable method); + public native void lockCompilation(); + public native void unlockCompilation(); public native int getMethodEntryBci(Executable method); public native Object[] getNMethod(Executable method, boolean isOsr); + public native long allocateCodeBlob(int size, int type); + public native void freeCodeBlob(long addr); + public native void forceNMethodSweep(); + public native Object[] getCodeHeapEntries(int type); // Intered strings public native boolean isInStringTable(String str); diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java new file mode 100644 index 00000000000..ee273bcd916 --- /dev/null +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java @@ -0,0 +1,79 @@ +/* + * 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. + * + */ + +package sun.hotspot.code; + +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryPoolMXBean; +import java.util.EnumSet; + +import sun.hotspot.WhiteBox; + +public enum BlobType { + // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods) + MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'"), + // Execution level 2 and 3 (profiled) nmethods + MethodProfiled(1, "CodeHeap 'profiled nmethods'"), + // Non-nmethods like Buffers, Adapters and Runtime Stubs + NonNMethod(2, "CodeHeap 'non-nmethods'"), + // All types (No code cache segmentation) + All(3, "CodeCache"); + + public final int id; + private final String beanName; + + private BlobType(int id, String beanName) { + this.id = id; + this.beanName = beanName; + } + + public MemoryPoolMXBean getMemoryPool() { + for (MemoryPoolMXBean bean : ManagementFactory.getMemoryPoolMXBeans()) { + String name = bean.getName(); + if (beanName.equals(name)) { + return bean; + } + } + return null; + } + public static EnumSet getAvailable() { + WhiteBox whiteBox = WhiteBox.getWhiteBox(); + if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) { + // only All for non segmented world + return EnumSet.of(All); + } + if (System.getProperty("java.vm.info").startsWith("interpreted ")) { + // only NonNMethod for -Xint + return EnumSet.of(NonNMethod); + } + + EnumSet result = EnumSet.complementOf(EnumSet.of(All)); + if (!whiteBox.getBooleanVMFlag("TieredCompilation") + || whiteBox.getIntxVMFlag("TieredStopAtLevel") <= 1) { + // there is no MethodProfiled in non tiered world or pure C1 + result.remove(MethodProfiled); + } + return result; + } +} diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java new file mode 100644 index 00000000000..66556ddaa7c --- /dev/null +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java @@ -0,0 +1,61 @@ +/* + * 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. + * + */ + +package sun.hotspot.code; + +import sun.hotspot.WhiteBox; + +public class CodeBlob { + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + public static CodeBlob[] getCodeBlobs(BlobType type) { + Object[] obj = WB.getCodeHeapEntries(type.id); + if (obj == null) { + return null; + } + CodeBlob[] result = new CodeBlob[obj.length]; + for (int i = 0, n = result.length; i < n; ++i) { + result[i] = new CodeBlob((Object[]) obj[i]); + } + return result; + } + protected CodeBlob(Object[] obj) { + assert obj.length == 3; + name = (String) obj[0]; + size = (Integer) obj[1]; + code_blob_type = BlobType.values()[(Integer) obj[2]]; + assert code_blob_type.id == (Integer) obj[2]; + } + public final String name; + public final int size; + public final BlobType code_blob_type; + + @Override + public String toString() { + return "CodeBlob{" + + "name=" + name + + ", size=" + size + + ", code_blob_type=" + code_blob_type + + '}'; + } +} diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java index 9ac182df343..f82b38d8710 100644 --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java @@ -27,28 +27,30 @@ package sun.hotspot.code; import java.lang.reflect.Executable; import sun.hotspot.WhiteBox; -public class NMethod { +public class NMethod extends CodeBlob { private static final WhiteBox wb = WhiteBox.getWhiteBox(); public static NMethod get(Executable method, boolean isOsr) { Object[] obj = wb.getNMethod(method, isOsr); return obj == null ? null : new NMethod(obj); } private NMethod(Object[] obj) { - assert obj.length == 3; - comp_level = (Integer) obj[0]; - insts = (byte[]) obj[1]; - compile_id = (Integer) obj[2]; + super((Object[])obj[0]); + assert obj.length == 4; + comp_level = (Integer) obj[1]; + insts = (byte[]) obj[2]; + compile_id = (Integer) obj[3]; } - public byte[] insts; - public int comp_level; - public int compile_id; + public final byte[] insts; + public final int comp_level; + public final int compile_id; @Override public String toString() { - return "NMethod{" + - "insts=" + insts + - ", comp_level=" + comp_level + - ", compile_id=" + compile_id + - '}'; + return "NMethod{" + + super.toString() + + ", insts=" + insts + + ", comp_level=" + comp_level + + ", compile_id=" + compile_id + + '}'; } } From 5ccaf44879591eaef30f9a3df35febac4401b325 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Mon, 10 Nov 2014 10:13:10 -0800 Subject: [PATCH 051/159] 8060721: Test runtime/SharedArchiveFile/LimitSharedSizes.java fails in jdk 9 fcs new platforms/compiler Replaced strcat() with jio_snprintf() Reviewed-by: dholmes, iklam, dlong, minqi --- hotspot/src/share/vm/memory/metaspaceShared.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp index f71baaed660..d7025cc4d4b 100644 --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp @@ -715,15 +715,17 @@ void MetaspaceShared::preload_and_dump(TRAPS) { if (class_list_path_len >= 3) { if (strcmp(class_list_path_str + class_list_path_len - 3, "lib") != 0) { if (class_list_path_len < JVM_MAXPATHLEN - 4) { - strncat(class_list_path_str, os::file_separator(), 1); - strncat(class_list_path_str, "lib", 3); + jio_snprintf(class_list_path_str + class_list_path_len, + sizeof(class_list_path_str) - class_list_path_len, + "%slib", os::file_separator()); + class_list_path_len += 4; } } } - class_list_path_len = (int)strlen(class_list_path_str); if (class_list_path_len < JVM_MAXPATHLEN - 10) { - strncat(class_list_path_str, os::file_separator(), 1); - strncat(class_list_path_str, "classlist", 9); + jio_snprintf(class_list_path_str + class_list_path_len, + sizeof(class_list_path_str) - class_list_path_len, + "%sclasslist", os::file_separator()); } class_list_path = class_list_path_str; } else { From 935c33a50c4f510438c5346a5521774a37a7df18 Mon Sep 17 00:00:00 2001 From: Eric McCorkle Date: Mon, 10 Nov 2014 15:06:13 -0500 Subject: [PATCH 052/159] 8062556: Add jdk tests for JDK-8058322 and JDK-8058313 Add tests for two hotspot reflection fixes. Reviewed-by: dholmes --- .../lang/reflect/Parameter/BadClassFiles.java | 239 +++++++++++++++--- .../java/lang/reflect/Parameter/NoName.java | 121 +++++++++ 2 files changed, 323 insertions(+), 37 deletions(-) create mode 100644 jdk/test/java/lang/reflect/Parameter/NoName.java diff --git a/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java b/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java index 581d4ef6f5f..55e67f32710 100644 --- a/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java +++ b/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java @@ -81,10 +81,23 @@ public class BadClassFiles { 0,25,0,0,0,3,0,0, 0,1,-79,0,0,0,1,0, 7,0,0,0,6,0,1,0, - 0,0,2,0,10,0,0,0, - 9,2,0,11,0,0,0,12, - 0,0,0,1,0,13,0,0, - 0,2,0,14 + 0,0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadModifiers_bytes = { @@ -121,10 +134,23 @@ public class BadClassFiles { 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,51,51,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 51,51, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadNameIndex_bytes = { @@ -161,10 +187,23 @@ public class BadClassFiles { 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,1,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,1, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] NameIndexOutOfBounds_bytes = { @@ -203,11 +242,23 @@ public class BadClassFiles { 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,-1,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 - + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,-1, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] ExtraParams_bytes = { @@ -244,10 +295,26 @@ public class BadClassFiles { 0,0,3,0,0,0,1,-79, 0,0,0,1,0,7,0,0, 0,6,0,1,0,0,0,2, - 0,10,0,0,0,13,3,0, - 11,0,0,0,12,0,0,0, - 11,0,0,0,1,0,13,0, - 0,0,2,0,14 + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,13, + // parameter_count + 3, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // third parameter name + 0,11, + // third parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadName1_bytes = { @@ -283,10 +350,23 @@ public class BadClassFiles { 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadName2_bytes = { @@ -322,10 +402,23 @@ public class BadClassFiles { 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadName3_bytes = { @@ -361,10 +454,23 @@ public class BadClassFiles { 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadName4_bytes = { @@ -400,10 +506,68 @@ public class BadClassFiles { 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 + }; + + private static final byte[] BadParams_bytes = { + -54,-2,-70,-66,0,0,0, + 52,0,18,10,0,3,0,15, + 7,0,16,7,0,17,1,0,6, + 60,105,110,105,116,62, + 1,0,3,40,41,86,1,0,4, + 67,111,100,101,1,0,15, + 76,105,110,101,78,117, + 109,98,101,114,84,97, + 98,108,101,1,0,1,109, + 1,0,5,40,73,73,41,86, + 1,0,16,77,101,116,104, + 111,100,80,97,114,97, + 109,101,116,101,114,115, + 1,0,1,97,1,0,1,98,1, + 0,10,83,111,117,114, + 99,101,70,105,108,101, + 1,0,14,66,97,100,80,97, + 114,97,109,115,46,106, + 97,118,97,12,0,4,0,5, + 1,0,9,66,97,100,80,97, + 114,97,109,115,1,0,16, + 106,97,118,97,47,108,97, + 110,103,47,79,98,106, + 101,99,116,0,33,0, + 2,0,3,0,0,0,0,0,2, + 0,1,0,4,0,5,0,1,0, + 6,0,0,0,29,0,1,0,1, + 0,0,0,5,42,-73,0,1, + -79,0,0,0,1,0,7,0,0, + 0,6,0,1,0,0,0,1,0,1, + 0,8,0,9,0,2,0,6,0,0, + 0,25,0,0,0,3,0,0,0,1, + -79,0,0,0,1,0,7,0,0, + 0,6,0,1,0,0,0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,1, + // parameter_count + 0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static class InMemoryClassLoader extends ClassLoader { @@ -423,6 +587,7 @@ public class BadClassFiles { loader.defineClass("BadNameIndex", BadNameIndex_bytes), loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes), loader.defineClass("ExtraParams", ExtraParams_bytes), + loader.defineClass("BadParams", BadParams_bytes), // Name with . loader.defineClass("BadName1", BadName1_bytes), // Name with [ diff --git a/jdk/test/java/lang/reflect/Parameter/NoName.java b/jdk/test/java/lang/reflect/Parameter/NoName.java new file mode 100644 index 00000000000..7f3a1f69580 --- /dev/null +++ b/jdk/test/java/lang/reflect/Parameter/NoName.java @@ -0,0 +1,121 @@ +/* + * 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 + * @run main NoName + * @summary The reflection API should report parameters with no name properly. + */ +import java.lang.Class; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.lang.reflect.MalformedParametersException; +import java.lang.ClassLoader; +import java.lang.ClassNotFoundException; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +public class NoName { + + private static final byte[] NoName_bytes = { + -54,-2,-70,-66,0,0,0,52, + 0,18,10,0,3,0,15,7, + 0,16,7,0,17,1,0,6, + 60,105,110,105,116,62,1,0, + 3,40,41,86,1,0,4,67, + 111,100,101,1,0,15,76,105, + 110,101,78,117,109,98,101,114, + 84,97,98,108,101,1,0,1, + 109,1,0,5,40,73,73,41, + 86,1,0,16,77,101,116,104, + 111,100,80,97,114,97,109,101, + 116,101,114,115,1,0,0,1, + 0,1,98,1,0,10,83,111, + 117,114,99,101,70,105,108,101, + 1,0,14,69,109,112,116,121, + 78,97,109,101,46,106,97,118, + 97,12,0,4,0,5,1,0, + 9,69,109,112,116,121,78,97, + 109,101,1,0,16,106,97,118, + 97,47,108,97,110,103,47,79, + 98,106,101,99,116,0,33,0, + 2,0,3,0,0,0,0,0, + 2,0,1,0,4,0,5,0, + 1,0,6,0,0,0,29,0, + 1,0,1,0,0,0,5,42, + -73,0,1,-79,0,0,0,1, + 0,7,0,0,0,6,0,1, + 0,0,0,1,0,1,0,8, + 0,9,0,2,0,6,0,0, + 0,25,0,0,0,3,0,0, + 0,1,-79,0,0,0,1,0, + 7,0,0,0,6,0,1,0, + 0,0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,0, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 + }; + + private static class InMemoryClassLoader extends ClassLoader { + public Class defineClass(String name, byte[] b) { + return defineClass(name, b, 0, b.length); + } + }; + + private static final InMemoryClassLoader loader = new InMemoryClassLoader(); + + private final Class noName; + + private NoName() throws ClassNotFoundException { + noName = loader.defineClass("EmptyName", NoName_bytes); + } + + public static void main(String... args) + throws NoSuchMethodException, IOException, ClassNotFoundException { + new NoName().run(); + } + + public void run() throws NoSuchMethodException { + final Class cls = noName; + System.err.println("Trying " + cls); + final Method method = cls.getMethod("m", int.class, int.class); + final Parameter[] params = method.getParameters(); + System.err.println("Name " + params[0].getName()); + System.err.println("Name " + params[1].getName()); + } + +} From bbd7b058d18c5dd72c9a8748f88d8a928e3bddae Mon Sep 17 00:00:00 2001 From: Eric McCorkle Date: Mon, 10 Nov 2014 16:45:46 -0500 Subject: [PATCH 053/159] 8058313: Mismatch of method descriptor and MethodParameters.parameters_count should cause MalformedParameterException Allow hotspot to store and report zero-length MethodParameters attribute data Reviewed-by: coleenp, jiangli --- hotspot/src/share/vm/classfile/classFileParser.cpp | 7 ++++--- hotspot/src/share/vm/oops/constMethod.cpp | 12 ++++++++---- hotspot/src/share/vm/oops/constMethod.hpp | 5 +++++ hotspot/src/share/vm/prims/jvm.cpp | 14 +++++++++++--- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index fe9f2443a80..da2f897ed0d 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -2059,7 +2059,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface, u2** localvariable_table_start; u2* localvariable_type_table_length; u2** localvariable_type_table_start; - u2 method_parameters_length = 0; + int method_parameters_length = -1; u1* method_parameters_data = NULL; bool method_parameters_seen = false; bool parsed_code_attribute = false; @@ -2278,7 +2278,8 @@ methodHandle ClassFileParser::parse_method(bool is_interface, } method_parameters_seen = true; method_parameters_length = cfs->get_u1_fast(); - if (method_attribute_length != (method_parameters_length * 4u) + 1u) { + const u2 real_length = (method_parameters_length * 4u) + 1u; + if (method_attribute_length != real_length) { classfile_parse_error( "Invalid MethodParameters method attribute length %u in class file", method_attribute_length, CHECK_(nullHandle)); @@ -2288,7 +2289,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface, cfs->skip_u2_fast(method_parameters_length); // ignore this attribute if it cannot be reflected if (!SystemDictionary::Parameter_klass_loaded()) - method_parameters_length = 0; + method_parameters_length = -1; } else if (method_attribute_name == vmSymbols::tag_synthetic()) { if (method_attribute_length != 0) { classfile_parse_error( diff --git a/hotspot/src/share/vm/oops/constMethod.cpp b/hotspot/src/share/vm/oops/constMethod.cpp index ea51a2c02c4..e3703be0c59 100644 --- a/hotspot/src/share/vm/oops/constMethod.cpp +++ b/hotspot/src/share/vm/oops/constMethod.cpp @@ -116,7 +116,11 @@ int ConstMethod::size(int code_size, if (sizes->generic_signature_index() != 0) { extra_bytes += sizeof(u2); } - if (sizes->method_parameters_length() > 0) { + // This has to be a less-than-or-equal check, because we might be + // storing information from a zero-length MethodParameters + // attribute. We have to store these, because in some cases, they + // cause the reflection API to throw a MalformedParametersException. + if (sizes->method_parameters_length() >= 0) { extra_bytes += sizeof(u2); extra_bytes += sizes->method_parameters_length() * sizeof(MethodParametersElement); } @@ -237,7 +241,7 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) { _flags |= _has_linenumber_table; if (sizes->generic_signature_index() != 0) _flags |= _has_generic_signature; - if (sizes->method_parameters_length() > 0) + if (sizes->method_parameters_length() >= 0) _flags |= _has_method_parameters; if (sizes->checked_exceptions_length() > 0) _flags |= _has_checked_exceptions; @@ -272,7 +276,7 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) { if (sizes->generic_signature_index() != 0) *(generic_signature_index_addr()) = sizes->generic_signature_index(); // New data should probably go here. - if (sizes->method_parameters_length() > 0) + if (sizes->method_parameters_length() >= 0) *(method_parameters_length_addr()) = sizes->method_parameters_length(); if (sizes->checked_exceptions_length() > 0) *(checked_exceptions_length_addr()) = sizes->checked_exceptions_length(); @@ -283,7 +287,7 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) { } int ConstMethod::method_parameters_length() const { - return has_method_parameters() ? *(method_parameters_length_addr()) : 0; + return has_method_parameters() ? *(method_parameters_length_addr()) : -1; } MethodParametersElement* ConstMethod::method_parameters_start() const { diff --git a/hotspot/src/share/vm/oops/constMethod.hpp b/hotspot/src/share/vm/oops/constMethod.hpp index 830a8f98a72..3f3ae19ea01 100644 --- a/hotspot/src/share/vm/oops/constMethod.hpp +++ b/hotspot/src/share/vm/oops/constMethod.hpp @@ -372,6 +372,11 @@ public: ExceptionTableElement* exception_table_start() const; // method parameters table + + // This returns -1 if no parameters are present, a non-negative + // value otherwise. Note: sometimes, there are 0-length parameters + // attributes that must be reported up to the reflection API all the + // same. int method_parameters_length() const; MethodParametersElement* method_parameters_start() const; diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index a9eab534820..419abd6d0f0 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -1657,7 +1657,17 @@ JVM_ENTRY(jobjectArray, JVM_GetMethodParameters(JNIEnv *env, jobject method)) Handle reflected_method (THREAD, JNIHandles::resolve_non_null(method)); const int num_params = mh->method_parameters_length(); - if (0 != num_params) { + if (num_params < 0) { + // A -1 return value from method_parameters_length means there is no + // parameter data. Return null to indicate this to the reflection + // API. + assert(num_params == -1, "num_params should be -1 if it is less than zero"); + return (jobjectArray)NULL; + } else { + // Otherwise, we return something up to reflection, even if it is + // a zero-length array. Why? Because in some cases this can + // trigger a MalformedParametersException. + // make sure all the symbols are properly formatted for (int i = 0; i < num_params; i++) { MethodParametersElement* params = mh->method_parameters_start(); @@ -1685,8 +1695,6 @@ JVM_ENTRY(jobjectArray, JVM_GetMethodParameters(JNIEnv *env, jobject method)) result->obj_at_put(i, param); } return (jobjectArray)JNIHandles::make_local(env, result()); - } else { - return (jobjectArray)NULL; } } JVM_END From 4f4c4bbd5c4a2ed359579cc6899fb53054ae5eb0 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Mon, 10 Nov 2014 19:28:51 -0500 Subject: [PATCH 054/159] 8064375: Change certain errors to warnings in CDS output Change CDS non-fatal preloading errors to warnings. Reviewed-by: minqi, mseledtsov, coleenp --- hotspot/src/share/vm/classfile/classLoader.cpp | 2 +- hotspot/src/share/vm/classfile/dictionary.cpp | 2 +- hotspot/src/share/vm/memory/metaspaceShared.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index 780fea1c2a3..4def66bb3b0 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -1120,7 +1120,7 @@ instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) { h = context.record_result(classpath_index, e, result, THREAD); } else { if (DumpSharedSpaces) { - tty->print_cr("Preload Error: Cannot find %s", class_name); + tty->print_cr("Preload Warning: Cannot find %s", class_name); } } diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp index 37381afbd65..5e8f5a5ec16 100644 --- a/hotspot/src/share/vm/classfile/dictionary.cpp +++ b/hotspot/src/share/vm/classfile/dictionary.cpp @@ -223,7 +223,7 @@ void Dictionary::remove_classes_in_error_state() { } free_entry(probe); ResourceMark rm; - tty->print_cr("Removed error class: %s", ik->external_name()); + tty->print_cr("Preload Warning: Removed error class: %s", ik->external_name()); continue; } diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp index ab0d5de72b0..b50ca8e58bd 100644 --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp @@ -846,7 +846,7 @@ bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) { ik->link_class(THREAD); if (HAS_PENDING_EXCEPTION) { ResourceMark rm; - tty->print_cr("Preload Error: Verification failed for %s", + tty->print_cr("Preload Warning: Verification failed for %s", ik->external_name()); CLEAR_PENDING_EXCEPTION; ik->set_in_error_state(); From cba5bd26387dc2ecb31ac8d6bea21bcc01da0cd5 Mon Sep 17 00:00:00 2001 From: Eric McCorkle Date: Mon, 10 Nov 2014 19:37:32 -0500 Subject: [PATCH 055/159] 8058322: Zero name_index item of MethodParameters attribute cause MalformedParameterException Allow hotspot to report null for 0 parameter_name index in MethodParameters attribute Reviewed-by: coleenp, dholmes --- hotspot/src/share/vm/runtime/reflection.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp index c6cb79ce7a4..c5bff3c1603 100644 --- a/hotspot/src/share/vm/runtime/reflection.cpp +++ b/hotspot/src/share/vm/runtime/reflection.cpp @@ -806,17 +806,16 @@ oop Reflection::new_field(fieldDescriptor* fd, TRAPS) { oop Reflection::new_parameter(Handle method, int index, Symbol* sym, int flags, TRAPS) { - Handle name; - - // A null symbol here translates to the empty string - if(NULL != sym) { - name = java_lang_String::create_from_symbol(sym, CHECK_NULL); - } else { - name = java_lang_String::create_from_str("", CHECK_NULL); - } Handle rh = java_lang_reflect_Parameter::create(CHECK_NULL); - java_lang_reflect_Parameter::set_name(rh(), name()); + + if(NULL != sym) { + Handle name = java_lang_String::create_from_symbol(sym, CHECK_NULL); + java_lang_reflect_Parameter::set_name(rh(), name()); + } else { + java_lang_reflect_Parameter::set_name(rh(), NULL); + } + java_lang_reflect_Parameter::set_modifiers(rh(), flags); java_lang_reflect_Parameter::set_executable(rh(), method()); java_lang_reflect_Parameter::set_index(rh(), index); From 00aa20db4a29174d4fa530b7d02dbee6a1af705a Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Tue, 11 Nov 2014 11:05:41 +0100 Subject: [PATCH 056/159] 8056071: compiler/whitebox/IsMethodCompilableTest.java fails with 'method() is not compilable after 3 iterations' Always use MDO if valid and always compile trivial methods with C1 if available. Reviewed-by: kvn, iveresov --- hotspot/src/share/vm/interpreter/bytecodes.hpp | 2 ++ hotspot/src/share/vm/oops/method.cpp | 9 +++++++++ hotspot/src/share/vm/oops/method.hpp | 3 +++ hotspot/src/share/vm/oops/methodData.cpp | 2 +- hotspot/src/share/vm/oops/methodData.hpp | 7 ++++--- .../vm/runtime/advancedThresholdPolicy.cpp | 4 ++-- .../runtime/simpleThresholdPolicy.inline.hpp | 18 +++++++++++------- .../whitebox/IsMethodCompilableTest.java | 2 +- 8 files changed, 33 insertions(+), 14 deletions(-) diff --git a/hotspot/src/share/vm/interpreter/bytecodes.hpp b/hotspot/src/share/vm/interpreter/bytecodes.hpp index 04a1f564abc..d66ceb46033 100644 --- a/hotspot/src/share/vm/interpreter/bytecodes.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp @@ -401,8 +401,10 @@ class Bytecodes: AllStatic { static bool is_astore (Code code) { return (code == _astore || code == _astore_0 || code == _astore_1 || code == _astore_2 || code == _astore_3); } + static bool is_const (Code code) { return (_aconst_null <= code && code <= _ldc2_w); } static bool is_zero_const (Code code) { return (code == _aconst_null || code == _iconst_0 || code == _fconst_0 || code == _dconst_0); } + static bool is_return (Code code) { return (_ireturn <= code && code <= _return); } static bool is_invoke (Code code) { return (_invokevirtual <= code && code <= _invokedynamic); } static bool has_receiver (Code code) { assert(is_invoke(code), ""); return code == _invokevirtual || code == _invokespecial || diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp index e60245ba052..9a248ce3e27 100644 --- a/hotspot/src/share/vm/oops/method.cpp +++ b/hotspot/src/share/vm/oops/method.cpp @@ -588,6 +588,15 @@ bool Method::is_accessor() const { return true; } +bool Method::is_constant_getter() const { + int last_index = code_size() - 1; + // Check if the first 1-3 bytecodes are a constant push + // and the last bytecode is a return. + return (2 <= code_size() && code_size() <= 4 && + Bytecodes::is_const(java_code_at(0)) && + Bytecodes::length_for(java_code_at(0)) == last_index && + Bytecodes::is_return(java_code_at(last_index))); +} bool Method::is_initializer() const { return name() == vmSymbols::object_initializer_name() || is_static_initializer(); diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp index b2b4d791fc9..8b279341dc8 100644 --- a/hotspot/src/share/vm/oops/method.hpp +++ b/hotspot/src/share/vm/oops/method.hpp @@ -595,6 +595,9 @@ class Method : public Metadata { // returns true if the method is an accessor function (setter/getter). bool is_accessor() const; + // returns true if the method does nothing but return a constant of primitive type + bool is_constant_getter() const; + // returns true if the method is an initializer ( or ). bool is_initializer() const; diff --git a/hotspot/src/share/vm/oops/methodData.cpp b/hotspot/src/share/vm/oops/methodData.cpp index 95fdb621301..b93f3a0b5c8 100644 --- a/hotspot/src/share/vm/oops/methodData.cpp +++ b/hotspot/src/share/vm/oops/methodData.cpp @@ -1134,7 +1134,7 @@ void MethodData::init() { _tenure_traps = 0; _num_loops = 0; _num_blocks = 0; - _would_profile = true; + _would_profile = unknown; #if INCLUDE_RTM_OPT _rtm_state = NoRTM; // No RTM lock eliding by default diff --git a/hotspot/src/share/vm/oops/methodData.hpp b/hotspot/src/share/vm/oops/methodData.hpp index cd273f50bad..49768dd001e 100644 --- a/hotspot/src/share/vm/oops/methodData.hpp +++ b/hotspot/src/share/vm/oops/methodData.hpp @@ -2096,7 +2096,8 @@ private: short _num_loops; short _num_blocks; // Does this method contain anything worth profiling? - bool _would_profile; + enum WouldProfile {unknown, no_profile, profile}; + WouldProfile _would_profile; // Size of _data array in bytes. (Excludes header and extra_data fields.) int _data_size; @@ -2270,8 +2271,8 @@ public: } #endif - void set_would_profile(bool p) { _would_profile = p; } - bool would_profile() const { return _would_profile; } + void set_would_profile(bool p) { _would_profile = p ? profile : no_profile; } + bool would_profile() const { return _would_profile != no_profile; } int num_loops() const { return _num_loops; } void set_num_loops(int n) { _num_loops = n; } diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp index e6ceddba295..bd78c3dec77 100644 --- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp +++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp @@ -317,8 +317,8 @@ void AdvancedThresholdPolicy::create_mdo(methodHandle mh, JavaThread* THREAD) { * c. 0 -> (3->2) -> 4. * In this case we enqueue a method for compilation at level 3, but the C1 queue is long enough * to enable the profiling to fully occur at level 0. In this case we change the compilation level - * of the method to 2, because it'll allow it to run much faster without full profiling while c2 - * is compiling. + * of the method to 2 while the request is still in-queue, because it'll allow it to run much faster + * without full profiling while c2 is compiling. * * d. 0 -> 3 -> 1 or 0 -> 2 -> 1. * After a method was once compiled with C1 it can be identified as trivial and be compiled to diff --git a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp index a142fa8abca..ff0a6cf8330 100644 --- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp +++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp @@ -54,13 +54,17 @@ bool SimpleThresholdPolicy::loop_predicate_helper(int i, int b, double scale) { // Simple methods are as good being compiled with C1 as C2. // Determine if a given method is such a case. bool SimpleThresholdPolicy::is_trivial(Method* method) { - if (method->is_accessor()) return true; - if (method->code() != NULL) { - MethodData* mdo = method->method_data(); - if (mdo != NULL && mdo->num_loops() == 0 && - (method->code_size() < 5 || (mdo->num_blocks() < 4) && (method->code_size() < 15))) { - return !mdo->would_profile(); - } + if (method->is_accessor() || + method->is_constant_getter()) { + return true; + } + if (method->has_loops() || method->code_size() >= 15) { + return false; + } + MethodData* mdo = method->method_data(); + if (mdo != NULL && !mdo->would_profile() && + (method->code_size() < 5 || (mdo->num_blocks() < 4))) { + return true; } return false; } diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java index 0e340f9b238..2f301c75520 100644 --- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java +++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java @@ -29,7 +29,7 @@ * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform - * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest + * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest * @summary testing of WB::isMethodCompilable() * @author igor.ignatyev@oracle.com */ From 21527b2ff25dc83e2c251d1eb37c631697d89cdc Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Tue, 11 Nov 2014 15:07:09 +0300 Subject: [PATCH 057/159] 8015272: Make @Contended within the same group to use the same oop map Reviewed-by: coleenp, dholmes --- .../share/vm/classfile/classFileParser.cpp | 32 +++++-- .../runtime/contended/OopMapsSameGroup.java | 95 +++++++++++++++++++ 2 files changed, 117 insertions(+), 10 deletions(-) create mode 100644 hotspot/test/runtime/contended/OopMapsSameGroup.java diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index da2f897ed0d..40bc6075faf 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -3492,17 +3492,18 @@ void ClassFileParser::layout_fields(Handle class_loader, real_offset = next_nonstatic_oop_offset; next_nonstatic_oop_offset += heapOopSize; } - // Update oop maps + + // Record this oop in the oop maps if( nonstatic_oop_map_count > 0 && nonstatic_oop_offsets[nonstatic_oop_map_count - 1] == real_offset - int(nonstatic_oop_counts[nonstatic_oop_map_count - 1]) * heapOopSize ) { - // Extend current oop map + // This oop is adjacent to the previous one, add to current oop map assert(nonstatic_oop_map_count - 1 < max_nonstatic_oop_maps, "range check"); nonstatic_oop_counts[nonstatic_oop_map_count - 1] += 1; } else { - // Create new oop map + // This oop is not adjacent to the previous one, create new oop map assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check"); nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset; nonstatic_oop_counts [nonstatic_oop_map_count] = 1; @@ -3624,13 +3625,24 @@ void ClassFileParser::layout_fields(Handle class_loader, real_offset = next_nonstatic_padded_offset; next_nonstatic_padded_offset += heapOopSize; - // Create new oop map - assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check"); - nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset; - nonstatic_oop_counts [nonstatic_oop_map_count] = 1; - nonstatic_oop_map_count += 1; - if( first_nonstatic_oop_offset == 0 ) { // Undefined - first_nonstatic_oop_offset = real_offset; + // Record this oop in the oop maps + if( nonstatic_oop_map_count > 0 && + nonstatic_oop_offsets[nonstatic_oop_map_count - 1] == + real_offset - + int(nonstatic_oop_counts[nonstatic_oop_map_count - 1]) * + heapOopSize ) { + // This oop is adjacent to the previous one, add to current oop map + assert(nonstatic_oop_map_count - 1 < max_nonstatic_oop_maps, "range check"); + nonstatic_oop_counts[nonstatic_oop_map_count - 1] += 1; + } else { + // This oop is not adjacent to the previous one, create new oop map + assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check"); + nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset; + nonstatic_oop_counts [nonstatic_oop_map_count] = 1; + nonstatic_oop_map_count += 1; + if( first_nonstatic_oop_offset == 0 ) { // Undefined + first_nonstatic_oop_offset = real_offset; + } } break; diff --git a/hotspot/test/runtime/contended/OopMapsSameGroup.java b/hotspot/test/runtime/contended/OopMapsSameGroup.java new file mode 100644 index 00000000000..4f4bbfee272 --- /dev/null +++ b/hotspot/test/runtime/contended/OopMapsSameGroup.java @@ -0,0 +1,95 @@ +/* + * 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. + */ + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.lang.Class; +import java.lang.String; +import java.lang.System; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CyclicBarrier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import sun.misc.Unsafe; +import sun.misc.Contended; + +/* + * @test + * @bug 8015272 + * @summary \@Contended within the same group to use the same oop map + * + * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMapsSameGroup + */ +public class OopMapsSameGroup { + + public static final int COUNT = 10000; + + public static void main(String[] args) throws Exception { + Object o01 = new Object(); + Object o02 = new Object(); + Object o03 = new Object(); + Object o04 = new Object(); + + R[] rs = new R[COUNT]; + + for (int i = 0; i < COUNT; i++) { + R r = new R(); + r.o01 = o01; + r.o02 = o02; + r.o03 = o03; + r.o04 = o04; + rs[i] = r; + } + + System.gc(); + + for (int i = 0; i < COUNT; i++) { + R r = rs[i]; + if (r.o01 != o01) throw new Error("Test Error: o01"); + if (r.o02 != o02) throw new Error("Test Error: o02"); + if (r.o03 != o03) throw new Error("Test Error: o03"); + if (r.o04 != o04) throw new Error("Test Error: o04"); + } + } + + public static class R { + @Contended("group1") + Object o01; + + @Contended("group1") + Object o02; + + @Contended("group2") + Object o03; + + @Contended("group2") + Object o04; + } + +} + From fb8f27e2afd505808e5e7ba29f540c3a410098b2 Mon Sep 17 00:00:00 2001 From: Dmitry Samersoff Date: Tue, 11 Nov 2014 04:34:56 -0800 Subject: [PATCH 058/159] 8059131: sawindbg.dll is not compiled with /SAFESEH Make variable SAFESEH_FLAG replaced with /SAFESEH link option. Reviewed-by: mgronlun, sla --- hotspot/make/windows/makefiles/sa.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/windows/makefiles/sa.make b/hotspot/make/windows/makefiles/sa.make index 0ecb3278b15..44c39a74fdf 100644 --- a/hotspot/make/windows/makefiles/sa.make +++ b/hotspot/make/windows/makefiles/sa.make @@ -122,7 +122,7 @@ SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE) SA_LFLAGS = $(SA_LFLAGS) -map -debug !endif !if "$(BUILDARCH)" == "i486" -SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS) +SA_LFLAGS = /SAFESEH $(SA_LFLAGS) !endif SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG) From 3e0d07ed5c17c693f2ae85d4b9fe3f877258c352 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Tue, 11 Nov 2014 04:46:13 -0800 Subject: [PATCH 059/159] 8060147: SIGSEGV in Metadata::mark_on_stack() while marking metadata in ciEnv Reviewed-by: kvn, roland, coleenp, mgerdin --- hotspot/src/share/vm/ci/ciMethod.cpp | 6 ++- hotspot/src/share/vm/ci/ciMethod.hpp | 2 +- hotspot/src/share/vm/ci/ciObjectFactory.cpp | 43 ++++++++++++++------- hotspot/src/share/vm/ci/ciObjectFactory.hpp | 2 +- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciMethod.cpp b/hotspot/src/share/vm/ci/ciMethod.cpp index 27b913ca177..d32df16bcbb 100644 --- a/hotspot/src/share/vm/ci/ciMethod.cpp +++ b/hotspot/src/share/vm/ci/ciMethod.cpp @@ -68,7 +68,10 @@ // ciMethod::ciMethod // // Loaded method. -ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) { +ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) : + ciMetadata(h_m()), + _holder(holder) +{ assert(h_m() != NULL, "no null method"); // These fields are always filled in in loaded methods. @@ -124,7 +127,6 @@ ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) { // generating _signature may allow GC and therefore move m. // These fields are always filled in. _name = env->get_symbol(h_m()->name()); - _holder = env->get_instance_klass(h_m()->method_holder()); ciSymbol* sig_symbol = env->get_symbol(h_m()->signature()); constantPoolHandle cpool = h_m()->constants(); _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol); diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp index c1641000f93..5a46fc483c9 100644 --- a/hotspot/src/share/vm/ci/ciMethod.hpp +++ b/hotspot/src/share/vm/ci/ciMethod.hpp @@ -91,7 +91,7 @@ class ciMethod : public ciMetadata { BCEscapeAnalyzer* _bcea; #endif - ciMethod(methodHandle h_m); + ciMethod(methodHandle h_m, ciInstanceKlass* holder); ciMethod(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature, ciInstanceKlass* accessor); Method* get_Method() const { diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.cpp b/hotspot/src/share/vm/ci/ciObjectFactory.cpp index aaa607ff135..c7415310a17 100644 --- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp +++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp @@ -239,7 +239,7 @@ void ciObjectFactory::remove_symbols() { ciObject* ciObjectFactory::get(oop key) { ASSERT_IN_VM; - assert(key == NULL || Universe::heap()->is_in_reserved(key), "must be"); + assert(Universe::heap()->is_in_reserved(key), "must be"); NonPermObject* &bucket = find_non_perm(key); if (bucket != NULL) { @@ -260,10 +260,10 @@ ciObject* ciObjectFactory::get(oop key) { } // ------------------------------------------------------------------ -// ciObjectFactory::get +// ciObjectFactory::get_metadata // -// Get the ciObject corresponding to some oop. If the ciObject has -// already been created, it is returned. Otherwise, a new ciObject +// Get the ciMetadata corresponding to some Metadata. If the ciMetadata has +// already been created, it is returned. Otherwise, a new ciMetadata // is created. ciMetadata* ciObjectFactory::get_metadata(Metadata* key) { ASSERT_IN_VM; @@ -290,9 +290,9 @@ ciMetadata* ciObjectFactory::get_metadata(Metadata* key) { } #endif if (!is_found_at(index, key, _ci_metadata)) { - // The ciObject does not yet exist. Create it and insert it + // The ciMetadata does not yet exist. Create it and insert it // into the cache. - ciMetadata* new_object = create_new_object(key); + ciMetadata* new_object = create_new_metadata(key); init_ident_of(new_object); assert(new_object->is_metadata(), "must be"); @@ -344,15 +344,28 @@ ciObject* ciObjectFactory::create_new_object(oop o) { } // ------------------------------------------------------------------ -// ciObjectFactory::create_new_object +// ciObjectFactory::create_new_metadata // -// Create a new ciObject from a Metadata*. +// Create a new ciMetadata from a Metadata*. // -// Implementation note: this functionality could be virtual behavior -// of the oop itself. For now, we explicitly marshal the object. -ciMetadata* ciObjectFactory::create_new_object(Metadata* o) { +// Implementation note: in order to keep Metadata live, an auxiliary ciObject +// is used, which points to it's holder. +ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) { EXCEPTION_CONTEXT; + // Hold metadata from unloading by keeping it's holder alive. + if (_initialized && o->is_klass()) { + Klass* holder = ((Klass*)o); + if (holder->oop_is_instance() && InstanceKlass::cast(holder)->is_anonymous()) { + // Though ciInstanceKlass records class loader oop, it's not enough to keep + // VM anonymous classes alive (loader == NULL). Klass holder should be used instead. + // It is enough to record a ciObject, since cached elements are never removed + // during ciObjectFactory lifetime. ciObjectFactory itself is created for + // every compilation and lives for the whole duration of the compilation. + ciObject* h = get(holder->klass_holder()); + } + } + if (o->is_klass()) { KlassHandle h_k(THREAD, (Klass*)o); Klass* k = (Klass*)o; @@ -365,14 +378,16 @@ ciMetadata* ciObjectFactory::create_new_object(Metadata* o) { } } else if (o->is_method()) { methodHandle h_m(THREAD, (Method*)o); - return new (arena()) ciMethod(h_m); + ciEnv *env = CURRENT_THREAD_ENV; + ciInstanceKlass* holder = env->get_instance_klass(h_m()->method_holder()); + return new (arena()) ciMethod(h_m, holder); } else if (o->is_methodData()) { // Hold methodHandle alive - might not be necessary ??? methodHandle h_m(THREAD, ((MethodData*)o)->method()); return new (arena()) ciMethodData((MethodData*)o); } - // The oop is of some type not supported by the compiler interface. + // The Metadata* is of some type not supported by the compiler interface. ShouldNotReachHere(); return NULL; } @@ -701,7 +716,7 @@ static ciObjectFactory::NonPermObject* emptyBucket = NULL; // If there is no entry in the cache corresponding to this oop, return // the null tail of the bucket into which the oop should be inserted. ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm(oop key) { - assert(Universe::heap()->is_in_reserved_or_null(key), "must be"); + assert(Universe::heap()->is_in_reserved(key), "must be"); ciMetadata* klass = get_metadata(key->klass()); NonPermObject* *bp = &_non_perm_bucket[(unsigned) klass->hash() % NON_PERM_BUCKETS]; for (NonPermObject* p; (p = (*bp)) != NULL; bp = &p->next()) { diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.hpp b/hotspot/src/share/vm/ci/ciObjectFactory.hpp index 6c228e09d40..4cdcc69beac 100644 --- a/hotspot/src/share/vm/ci/ciObjectFactory.hpp +++ b/hotspot/src/share/vm/ci/ciObjectFactory.hpp @@ -73,7 +73,7 @@ private: void insert(int index, ciMetadata* obj, GrowableArray* objects); ciObject* create_new_object(oop o); - ciMetadata* create_new_object(Metadata* o); + ciMetadata* create_new_metadata(Metadata* o); void ensure_metadata_alive(ciMetadata* m); From d6de9519474f3f6aaa9892d0ee07c3c495e68f0e Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 11 Nov 2014 09:59:50 -0500 Subject: [PATCH 060/159] 8062870: src/share/vm/services/mallocTracker.hpp:64 assert(_count > 0) failed: Negative counter Signed bitfield size y can only have (1 << y)-1 values. Reviewed-by: shade, dholmes, jrose, ctornqvi, gtriantafill --- hotspot/src/share/vm/services/mallocTracker.hpp | 8 ++++---- hotspot/test/runtime/NMT/MallocSiteHashOverflow.java | 1 - hotspot/test/runtime/NMT/MallocTrackingVerify.java | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/services/mallocTracker.hpp b/hotspot/src/share/vm/services/mallocTracker.hpp index 00f1b0027d5..3c61aa4327a 100644 --- a/hotspot/src/share/vm/services/mallocTracker.hpp +++ b/hotspot/src/share/vm/services/mallocTracker.hpp @@ -243,15 +243,15 @@ class MallocHeader VALUE_OBJ_CLASS_SPEC { size_t _flags : 8; size_t _pos_idx : 16; size_t _bucket_idx: 40; -#define MAX_MALLOCSITE_TABLE_SIZE ((size_t)1 << 40) -#define MAX_BUCKET_LENGTH ((size_t)(1 << 16)) +#define MAX_MALLOCSITE_TABLE_SIZE right_n_bits(40) +#define MAX_BUCKET_LENGTH right_n_bits(16) #else size_t _size : 32; size_t _flags : 8; size_t _pos_idx : 8; size_t _bucket_idx: 16; -#define MAX_MALLOCSITE_TABLE_SIZE ((size_t)(1 << 16)) -#define MAX_BUCKET_LENGTH ((size_t)(1 << 8)) +#define MAX_MALLOCSITE_TABLE_SIZE right_n_bits(16) +#define MAX_BUCKET_LENGTH right_n_bits(8) #endif // _LP64 public: diff --git a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java index 0e3109b52bb..8f3404cbc42 100644 --- a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java +++ b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java @@ -27,7 +27,6 @@ * @requires sun.arch.data.model == "32" * @key nmt jcmd stress * @library /testlibrary /testlibrary/whitebox - * @ignore 8062870 * @build MallocSiteHashOverflow * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow diff --git a/hotspot/test/runtime/NMT/MallocTrackingVerify.java b/hotspot/test/runtime/NMT/MallocTrackingVerify.java index 3ed900fc0a4..2403a70ab9d 100644 --- a/hotspot/test/runtime/NMT/MallocTrackingVerify.java +++ b/hotspot/test/runtime/NMT/MallocTrackingVerify.java @@ -27,7 +27,6 @@ * @summary Test to verify correctness of malloc tracking * @key nmt jcmd * @library /testlibrary /testlibrary/whitebox - * @ignore 8058251 * @build MallocTrackingVerify * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocTrackingVerify From cc2452b769b8d326c560bdfd08a5fbc072c9ea44 Mon Sep 17 00:00:00 2001 From: Serguei Spitsyn Date: Tue, 11 Nov 2014 21:46:02 -0800 Subject: [PATCH 061/159] 6988950: JDWP exit error JVMTI_ERROR_WRONG_PHASE(112) Synchronize the jdwp VirtualMachine command functions with the VM_DEATH event Reviewed-by: dcubed, dsamersoff, dholmes --- .../share/native/libjdwp/debugLoop.c | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c index 388e6ae228b..f49b53c7a69 100644 --- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c +++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, 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 @@ -45,7 +45,7 @@ struct PacketList { static volatile struct PacketList *cmdQueue; static jrawMonitorID cmdQueueLock; -static jrawMonitorID resumeLock; +static jrawMonitorID vmDeathLock; static jboolean transportError; static jboolean @@ -60,28 +60,17 @@ lastCommand(jdwpCmdPacket *cmd) } } -static jboolean -resumeCommand(jdwpCmdPacket *cmd) -{ - if ( (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)) && - (cmd->cmd == JDWP_COMMAND(VirtualMachine, Resume)) ) { - return JNI_TRUE; - } else { - return JNI_FALSE; - } -} - void debugLoop_initialize(void) { - resumeLock = debugMonitorCreate("JDWP Resume Lock"); + vmDeathLock = debugMonitorCreate("JDWP VM_DEATH Lock"); } void debugLoop_sync(void) { - debugMonitorEnter(resumeLock); - debugMonitorExit(resumeLock); + debugMonitorEnter(vmDeathLock); + debugMonitorExit(vmDeathLock); } /* @@ -136,14 +125,14 @@ debugLoop_run(void) jboolean replyToSender = JNI_TRUE; /* - * For VirtualMachine.Resume commands we hold the resumeLock + * For VirtualMachine commands we hold the vmDeathLock * while executing and replying to the command. This ensures - * that a Resume after VM_DEATH will be allowed to complete + * that a VM command after VM_DEATH will be allowed to complete * before the thread posting the VM_DEATH continues VM * termination. */ - if (resumeCommand(cmd)) { - debugMonitorEnter(resumeLock); + if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){ + debugMonitorEnter(vmDeathLock); } /* Initialize the input and output streams */ @@ -181,10 +170,10 @@ debugLoop_run(void) } /* - * Release the resumeLock as the reply has been posted. + * Release the vmDeathLock as the reply has been posted. */ - if (resumeCommand(cmd)) { - debugMonitorExit(resumeLock); + if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){ + debugMonitorExit(vmDeathLock); } inStream_destroy(&in); From afd3405c2f668f752bfaa8e111ac745e3b506220 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Wed, 12 Nov 2014 13:12:35 -0500 Subject: [PATCH 062/159] 8054008: Using -XX:-LazyBootClassLoader crashes with ACCESS_VIOLATION on Win 64bit Only enable the assert for current_stack_pointer after stub routines become available. Reviewed-by: dholmes, roland, lfoltan --- hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp index 5325e0ee807..4686c81cf44 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp @@ -635,7 +635,11 @@ void os::setup_fpu() { #ifndef PRODUCT void os::verify_stack_alignment() { #ifdef AMD64 - assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment"); + // The current_stack_pointer() calls generated get_previous_sp stub routine. + // Only enable the assert after the routine becomes available. + if (StubRoutines::code1() != NULL) { + assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment"); + } #endif } #endif From 4a8e05977e15402904e2b19351ab4c5e8765d5c4 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 13 Nov 2014 01:55:21 +0300 Subject: [PATCH 063/159] 8059677: Thread.getName() instantiates Strings Reviewed-by: chegar, dholmes, sla, rriggs --- .../java.base/share/classes/java/lang/Thread.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/Thread.java b/jdk/src/java.base/share/classes/java/lang/Thread.java index adcc982cf9e..e7477416ecb 100644 --- a/jdk/src/java.base/share/classes/java/lang/Thread.java +++ b/jdk/src/java.base/share/classes/java/lang/Thread.java @@ -145,7 +145,7 @@ class Thread implements Runnable { registerNatives(); } - private volatile char name[]; + private volatile String name; private int priority; private Thread threadQ; private long eetop; @@ -366,7 +366,7 @@ class Thread implements Runnable { throw new NullPointerException("name cannot be null"); } - this.name = name.toCharArray(); + this.name = name; Thread parent = currentThread(); SecurityManager security = System.getSecurityManager(); @@ -1119,7 +1119,11 @@ class Thread implements Runnable { */ public final synchronized void setName(String name) { checkAccess(); - this.name = name.toCharArray(); + if (name == null) { + throw new NullPointerException("name cannot be null"); + } + + this.name = name; if (threadStatus != 0) { setNativeName(name); } @@ -1132,7 +1136,7 @@ class Thread implements Runnable { * @see #setName(String) */ public final String getName() { - return new String(name, true); + return name; } /** From f8712e7800e1d611018d05e0a4b6bf402f079f90 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 13 Nov 2014 01:57:09 +0300 Subject: [PATCH 064/159] 8059677: Thread.getName() instantiates Strings Reviewed-by: coleenp, dholmes, sla --- .../classes/sun/jvm/hotspot/oops/OopUtilities.java | 4 ++-- hotspot/src/share/vm/classfile/javaClasses.cpp | 11 ++++------- hotspot/src/share/vm/classfile/javaClasses.hpp | 4 ++-- hotspot/src/share/vm/prims/jvmtiEnv.cpp | 6 +++--- hotspot/src/share/vm/prims/jvmtiTrace.cpp | 6 +++--- hotspot/src/share/vm/runtime/thread.cpp | 8 +++----- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java index fe93d6238a8..ef8a7e1849e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java @@ -219,7 +219,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState { if (threadNameField == null) { SystemDictionary sysDict = VM.getVM().getSystemDictionary(); InstanceKlass k = sysDict.getThreadKlass(); - threadNameField = (OopField) k.findField("name", "[C"); + threadNameField = (OopField) k.findField("name", "Ljava/lang/String;"); threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;"); threadEETopField = (LongField) k.findField("eetop", "J"); threadTIDField = (LongField) k.findField("tid", "J"); @@ -258,7 +258,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState { public static String threadOopGetName(Oop threadOop) { initThreadFields(); - return charArrayToString((TypeArray) threadNameField.getValue(threadOop)); + return stringOopToString(threadNameField.getValue(threadOop)); } /** May return null if, e.g., thread was not started */ diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 075dea57d81..754134bdafa 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -944,7 +944,7 @@ void java_lang_Thread::compute_offsets() { assert(_group_offset == 0, "offsets should be initialized only once"); Klass* k = SystemDictionary::Thread_klass(); - compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::char_array_signature()); + compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); compute_offset(_group_offset, k, vmSymbols::group_name(), vmSymbols::threadgroup_signature()); compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature()); compute_offset(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), vmSymbols::accesscontrolcontext_signature()); @@ -974,15 +974,12 @@ void java_lang_Thread::set_thread(oop java_thread, JavaThread* thread) { } -typeArrayOop java_lang_Thread::name(oop java_thread) { - oop name = java_thread->obj_field(_name_offset); - assert(name == NULL || (name->is_typeArray() && TypeArrayKlass::cast(name->klass())->element_type() == T_CHAR), "just checking"); - return typeArrayOop(name); +oop java_lang_Thread::name(oop java_thread) { + return java_thread->obj_field(_name_offset); } -void java_lang_Thread::set_name(oop java_thread, typeArrayOop name) { - assert(java_thread->obj_field(_name_offset) == NULL, "name should be NULL"); +void java_lang_Thread::set_name(oop java_thread, oop name) { java_thread->obj_field_put(_name_offset, name); } diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index ef3e8ec78b0..c7890d20720 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -345,8 +345,8 @@ class java_lang_Thread : AllStatic { // Set JavaThread for instance static void set_thread(oop java_thread, JavaThread* thread); // Name - static typeArrayOop name(oop java_thread); - static void set_name(oop java_thread, typeArrayOop name); + static oop name(oop java_thread); + static void set_name(oop java_thread, oop name); // Priority static ThreadPriority priority(oop java_thread); static void set_priority(oop java_thread, ThreadPriority priority); diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp index 840fd65cc85..5ddbf130e66 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp @@ -942,7 +942,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) { return JVMTI_ERROR_INVALID_THREAD; Handle thread_obj(current_thread, thread_oop); - typeArrayHandle name; + Handle name; ThreadPriority priority; Handle thread_group; Handle context_class_loader; @@ -950,7 +950,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) { { MutexLocker mu(Threads_lock); - name = typeArrayHandle(current_thread, java_lang_Thread::name(thread_obj())); + name = Handle(current_thread, java_lang_Thread::name(thread_obj())); priority = java_lang_Thread::priority(thread_obj()); thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj())); is_daemon = java_lang_Thread::is_daemon(thread_obj()); @@ -961,7 +961,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) { { const char *n; if (name() != NULL) { - n = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + n = java_lang_String::as_utf8_string(name()); } else { n = UNICODE::as_utf8(NULL, 0); } diff --git a/hotspot/src/share/vm/prims/jvmtiTrace.cpp b/hotspot/src/share/vm/prims/jvmtiTrace.cpp index 279e23ab3c6..1cc63efe074 100644 --- a/hotspot/src/share/vm/prims/jvmtiTrace.cpp +++ b/hotspot/src/share/vm/prims/jvmtiTrace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -266,11 +266,11 @@ const char *JvmtiTrace::safe_get_thread_name(Thread *thread) { if (threadObj == NULL) { return "NULL"; } - typeArrayOop name = java_lang_Thread::name(threadObj); + oop name = java_lang_Thread::name(threadObj); if (name == NULL) { return ""; } - return UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + return java_lang_String::as_utf8_string(name); } diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 4e406f9efbe..75e2f1e18ba 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -2872,14 +2872,12 @@ const char* JavaThread::get_thread_name_string(char* buf, int buflen) const { const char* name_str; oop thread_obj = threadObj(); if (thread_obj != NULL) { - typeArrayOop name = java_lang_Thread::name(thread_obj); + oop name = java_lang_Thread::name(thread_obj); if (name != NULL) { if (buf == NULL) { - name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), - name->length()); + name_str = java_lang_String::as_utf8_string(name); } else { - name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), - name->length(), buf, buflen); + name_str = java_lang_String::as_utf8_string(name, buf, buflen); } } else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306 name_str = ""; From 959631d58da1c852c94eff94a0bf9248c88ab4dd Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 12 Nov 2014 19:05:59 -0500 Subject: [PATCH 065/159] 8062307: 'Reference handler' thread triggers assert w/ TraceThreadEvents Removed unused and non-working TraceThreadEvents option Reviewed-by: coleenp, jiangli --- hotspot/src/share/vm/runtime/globals.hpp | 3 -- hotspot/src/share/vm/runtime/thread.cpp | 45 ------------------------ hotspot/src/share/vm/runtime/thread.hpp | 3 -- 3 files changed, 51 deletions(-) diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index e74b9bbdf20..c71bd2084f9 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1335,9 +1335,6 @@ class CommandLineFlags { develop(bool, TraceJNIHandleAllocation, false, \ "Trace allocation/deallocation of JNI handle blocks") \ \ - develop(bool, TraceThreadEvents, false, \ - "Trace all thread events") \ - \ develop(bool, TraceBytecodes, false, \ "Trace bytecode execution") \ \ diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 4e406f9efbe..25649d8cd65 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -374,42 +374,7 @@ void check_for_dangling_thread_pointer(Thread *thread) { } #endif - -#ifndef PRODUCT -// Tracing method for basic thread operations -void Thread::trace(const char* msg, const Thread* const thread) { - if (!TraceThreadEvents) return; - ResourceMark rm; - ThreadCritical tc; - const char *name = "non-Java thread"; - int prio = -1; - if (thread->is_Java_thread() - && !thread->is_Compiler_thread()) { - // The Threads_lock must be held to get information about - // this thread but may not be in some situations when - // tracing thread events. - bool release_Threads_lock = false; - if (!Threads_lock->owned_by_self()) { - Threads_lock->lock(); - release_Threads_lock = true; - } - JavaThread* jt = (JavaThread *)thread; - name = (char *)jt->get_thread_name(); - oop thread_oop = jt->threadObj(); - if (thread_oop != NULL) { - prio = java_lang_Thread::priority(thread_oop); - } - if (release_Threads_lock) { - Threads_lock->unlock(); - } - } - tty->print_cr("Thread::%s " INTPTR_FORMAT " [%lx] %s (prio: %d)", msg, thread, thread->osthread()->thread_id(), name, prio); -} -#endif - - ThreadPriority Thread::get_priority(const Thread* const thread) { - trace("get priority", thread); ThreadPriority priority; // Can return an error! (void)os::get_priority(thread, priority); @@ -418,7 +383,6 @@ ThreadPriority Thread::get_priority(const Thread* const thread) { } void Thread::set_priority(Thread* thread, ThreadPriority priority) { - trace("set priority", thread); debug_only(check_for_dangling_thread_pointer(thread);) // Can return an error! (void)os::set_priority(thread, priority); @@ -426,7 +390,6 @@ void Thread::set_priority(Thread* thread, ThreadPriority priority) { void Thread::start(Thread* thread) { - trace("start", thread); // Start is different from resume in that its safety is guaranteed by context or // being called from a Java method synchronized on the Thread object. if (!DisableStartThread) { @@ -769,13 +732,11 @@ bool JavaThread::profile_last_Java_frame(frame* _fr) { } void Thread::interrupt(Thread* thread) { - trace("interrupt", thread); debug_only(check_for_dangling_thread_pointer(thread);) os::interrupt(thread); } bool Thread::is_interrupted(Thread* thread, bool clear_interrupted) { - trace("is_interrupted", thread); debug_only(check_for_dangling_thread_pointer(thread);) // Note: If clear_interrupted==false, this simply fetches and // returns the value of the field osthread()->interrupted(). @@ -1563,9 +1524,6 @@ JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : _dirty_card_queue(&_dirty_card_queue_set) #endif // INCLUDE_ALL_GCS { - if (TraceThreadEvents) { - tty->print_cr("creating thread %p", this); - } initialize(); _jni_attach_state = _not_attaching_via_jni; set_entry_point(entry_point); @@ -1588,9 +1546,6 @@ JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : } JavaThread::~JavaThread() { - if (TraceThreadEvents) { - tty->print_cr("terminate thread %p", this); - } // JSR166 -- return the parker to the free list Parker::Release(_parker); diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index c39b2eff624..67043b9d245 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -212,9 +212,6 @@ class Thread: public ThreadShadow { bool is_inside_signal_handler() const { return _num_nested_signal > 0; } private: - // Debug tracing - static void trace(const char* msg, const Thread* const thread) PRODUCT_RETURN; - // Active_handles points to a block of handles JNIHandleBlock* _active_handles; From 1f7d2d4c0dc454d7830c3fe7c532408227c3d4ec Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Wed, 12 Nov 2014 16:22:12 -0800 Subject: [PATCH 066/159] 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification No need to use the /export linker option on windows 64-bit platform Reviewed-by: ctornqvi, minqi --- hotspot/make/windows/makefiles/vm.make | 31 +++++++++++-------- .../tools/ProjectCreator/BuildConfig.java | 4 ++- .../ProjectCreator/WinGammaPlatformVC10.java | 22 +++++++------ 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make index 6145a4aa828..9267a71aac9 100644 --- a/hotspot/make/windows/makefiles/vm.make +++ b/hotspot/make/windows/makefiles/vm.make @@ -89,19 +89,24 @@ AGCT_EXPORT=/export:AsyncGetCallTrace # If you modify exports below please do the corresponding changes in # src/share/tools/ProjectCreator/WinGammaPlatformVC7.java -LD_FLAGS=$(LD_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \ - /export:JNI_GetDefaultJavaVMInitArgs \ - /export:JNI_CreateJavaVM \ - /export:JVM_FindClassFromBootLoader \ - /export:JNI_GetCreatedJavaVMs \ - /export:jio_snprintf \ - /export:jio_printf \ - /export:jio_fprintf \ - /export:jio_vfprintf \ - /export:jio_vsnprintf \ - $(AGCT_EXPORT) \ - /export:JVM_GetVersionInfo \ - /export:JVM_InitAgentProperties +!if "$(BUILDARCH)" == "amd64" +EXPORT_LIST= +!else +EXPORT_LIST=/export:JNI_GetDefaultJavaVMInitArgs \ + /export:JNI_CreateJavaVM \ + /export:JVM_FindClassFromBootLoader \ + /export:JNI_GetCreatedJavaVMs \ + /export:jio_snprintf \ + /export:jio_printf \ + /export:jio_fprintf \ + /export:jio_vfprintf \ + /export:jio_vsnprintf \ + $(AGCT_EXPORT) \ + /export:JVM_GetVersionInfo \ + /export:JVM_InitAgentProperties +!endif + +LD_FLAGS=$(LD_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 $(EXPORT_LIST) CXX_INCLUDE_DIRS=/I "..\generated" diff --git a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java b/hotspot/src/share/tools/ProjectCreator/BuildConfig.java index f743cf27e9e..9cd3cc3ee4e 100644 --- a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java +++ b/hotspot/src/share/tools/ProjectCreator/BuildConfig.java @@ -512,7 +512,9 @@ abstract class GenericDebugConfig extends BuildConfig { abstract class GenericDebugNonKernelConfig extends GenericDebugConfig { protected void init(Vector includes, Vector defines) { super.init(includes, defines); - getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags")); + if (get("PlatformName").equals("Win32")) { + getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags")); + } } } diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java index 543b0ddc88b..0f8af0f6fd5 100644 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java +++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java @@ -401,16 +401,18 @@ class CompilerInterfaceVC10 extends CompilerInterface { Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { Vector rv = new Vector(); - addAttr(rv, "AdditionalOptions", - "/export:JNI_GetDefaultJavaVMInitArgs " + - "/export:JNI_CreateJavaVM " + - "/export:JVM_FindClassFromBootLoader "+ - "/export:JNI_GetCreatedJavaVMs "+ - "/export:jio_snprintf /export:jio_printf "+ - "/export:jio_fprintf /export:jio_vfprintf "+ - "/export:jio_vsnprintf "+ - "/export:JVM_GetVersionInfo "+ - "/export:JVM_InitAgentProperties"); + if(platformName.equals("Win32")) { + addAttr(rv, "AdditionalOptions", + "/export:JNI_GetDefaultJavaVMInitArgs " + + "/export:JNI_CreateJavaVM " + + "/export:JVM_FindClassFromBootLoader "+ + "/export:JNI_GetCreatedJavaVMs "+ + "/export:jio_snprintf /export:jio_printf "+ + "/export:jio_fprintf /export:jio_vfprintf "+ + "/export:jio_vsnprintf "+ + "/export:JVM_GetVersionInfo "+ + "/export:JVM_InitAgentProperties"); + } addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib;version.lib"); addAttr(rv, "OutputFile", outDll); addAttr(rv, "SuppressStartupBanner", "true"); From bc52e8443ead19ed758a12a758673f9922a57eeb Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Thu, 13 Nov 2014 14:42:54 +0100 Subject: [PATCH 067/159] 8061256: com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java timed out Must not be at safepoint when taking CompileQueue_lock Reviewed-by: kvn, anoll --- .../src/share/vm/compiler/compileBroker.cpp | 28 +++++++++---------- .../src/share/vm/compiler/compileBroker.hpp | 5 +--- .../src/share/vm/runtime/vm_operations.hpp | 1 + 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index 0ab0dae2dd6..2fa80c675dd 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -594,7 +594,7 @@ void CompileTask::log_task_done(CompileLog* log) { * Add a CompileTask to a CompileQueue. */ void CompileQueue::add(CompileTask* task) { - assert(lock()->owned_by_self(), "must own lock"); + assert(MethodCompileQueue_lock->owned_by_self(), "must own lock"); task->set_next(NULL); task->set_prev(NULL); @@ -625,7 +625,7 @@ void CompileQueue::add(CompileTask* task) { } // Notify CompilerThreads that a task is available. - lock()->notify_all(); + MethodCompileQueue_lock->notify_all(); } /** @@ -635,7 +635,7 @@ void CompileQueue::add(CompileTask* task) { * compilation is disabled. */ void CompileQueue::free_all() { - MutexLocker mu(lock()); + MutexLocker mu(MethodCompileQueue_lock); CompileTask* next = _first; // Iterate over all tasks in the compile queue @@ -653,14 +653,14 @@ void CompileQueue::free_all() { _first = NULL; // Wake up all threads that block on the queue. - lock()->notify_all(); + MethodCompileQueue_lock->notify_all(); } /** * Get the next CompileTask from a CompileQueue */ CompileTask* CompileQueue::get() { - MutexLocker locker(lock()); + MutexLocker locker(MethodCompileQueue_lock); // If _first is NULL we have no more compile jobs. There are two reasons for // having no compile jobs: First, we compiled everything we wanted. Second, // we ran out of code cache so compilation has been disabled. In the latter @@ -681,7 +681,7 @@ CompileTask* CompileQueue::get() { // We need a timed wait here, since compiler threads can exit if compilation // is disabled forever. We use 5 seconds wait time; the exiting of compiler threads // is not critical and we do not want idle compiler threads to wake up too often. - lock()->wait(!Mutex::_no_safepoint_check_flag, 5*1000); + MethodCompileQueue_lock->wait(!Mutex::_no_safepoint_check_flag, 5*1000); } if (CompileBroker::is_compilation_disabled_forever()) { @@ -701,7 +701,7 @@ CompileTask* CompileQueue::get() { // Clean & deallocate stale compile tasks. // Temporarily releases MethodCompileQueue lock. void CompileQueue::purge_stale_tasks() { - assert(lock()->owned_by_self(), "must own lock"); + assert(MethodCompileQueue_lock->owned_by_self(), "must own lock"); if (_first_stale != NULL) { // Stale tasks are purged when MCQ lock is released, // but _first_stale updates are protected by MCQ lock. @@ -710,7 +710,7 @@ void CompileQueue::purge_stale_tasks() { CompileTask* head = _first_stale; _first_stale = NULL; { - MutexUnlocker ul(lock()); + MutexUnlocker ul(MethodCompileQueue_lock); for (CompileTask* task = head; task != NULL; ) { CompileTask* next_task = task->next(); CompileTaskWrapper ctw(task); // Frees the task @@ -722,7 +722,7 @@ void CompileQueue::purge_stale_tasks() { } void CompileQueue::remove(CompileTask* task) { - assert(lock()->owned_by_self(), "must own lock"); + assert(MethodCompileQueue_lock->owned_by_self(), "must own lock"); if (task->prev() != NULL) { task->prev()->set_next(task->next()); } else { @@ -742,7 +742,7 @@ void CompileQueue::remove(CompileTask* task) { } void CompileQueue::remove_and_mark_stale(CompileTask* task) { - assert(lock()->owned_by_self(), "must own lock"); + assert(MethodCompileQueue_lock->owned_by_self(), "must own lock"); remove(task); // Enqueue the task for reclamation (should be done outside MCQ lock) @@ -780,7 +780,7 @@ void CompileBroker::print_compile_queues(outputStream* st) { } void CompileQueue::print(outputStream* st) { - assert(lock()->owned_by_self(), "must own lock"); + assert(MethodCompileQueue_lock->owned_by_self(), "must own lock"); st->print_cr("Contents of %s", name()); st->print_cr("----------------------------"); CompileTask* task = _first; @@ -1066,11 +1066,11 @@ void CompileBroker::init_compiler_sweeper_threads(int c1_compiler_count, int c2_ #endif // !ZERO && !SHARK // Initialize the compilation queue if (c2_compiler_count > 0) { - _c2_compile_queue = new CompileQueue("C2 compile queue", MethodCompileQueue_lock); + _c2_compile_queue = new CompileQueue("C2 compile queue"); _compilers[1]->set_num_compiler_threads(c2_compiler_count); } if (c1_compiler_count > 0) { - _c1_compile_queue = new CompileQueue("C1 compile queue", MethodCompileQueue_lock); + _c1_compile_queue = new CompileQueue("C1 compile queue"); _compilers[0]->set_num_compiler_threads(c1_compiler_count); } @@ -1214,7 +1214,7 @@ void CompileBroker::compile_method_base(methodHandle method, // Acquire our lock. { - MutexLocker locker(queue->lock(), thread); + MutexLocker locker(MethodCompileQueue_lock, thread); // Make sure the method has not slipped into the queues since // last we checked; note that those checks were "fast bail-outs". diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp index e5b0484fc4c..e6d8bb9bdb9 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.hpp +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp @@ -195,7 +195,6 @@ class CompilerCounters : public CHeapObj { class CompileQueue : public CHeapObj { private: const char* _name; - Monitor* _lock; CompileTask* _first; CompileTask* _last; @@ -206,9 +205,8 @@ class CompileQueue : public CHeapObj { void purge_stale_tasks(); public: - CompileQueue(const char* name, Monitor* lock) { + CompileQueue(const char* name) { _name = name; - _lock = lock; _first = NULL; _last = NULL; _size = 0; @@ -216,7 +214,6 @@ class CompileQueue : public CHeapObj { } const char* name() const { return _name; } - Monitor* lock() const { return _lock; } void add(CompileTask* task); void remove(CompileTask* task); diff --git a/hotspot/src/share/vm/runtime/vm_operations.hpp b/hotspot/src/share/vm/runtime/vm_operations.hpp index c8b4a3855fc..ae710ebf782 100644 --- a/hotspot/src/share/vm/runtime/vm_operations.hpp +++ b/hotspot/src/share/vm/runtime/vm_operations.hpp @@ -432,6 +432,7 @@ class VM_PrintCompileQueue: public VM_Operation { public: VM_PrintCompileQueue(outputStream* st) : _out(st) {} VMOp_Type type() const { return VMOp_PrintCompileQueue; } + Mode evaluation_mode() const { return _no_safepoint; } void doit(); }; From f81bd8ff29e46c32439e51559916cc041eee087c Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 17 Nov 2014 12:57:49 +0300 Subject: [PATCH 068/159] 8059732: improve hotspot_*test targets Reviewed-by: kvn, dholmes --- hotspot/test/Makefile | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/hotspot/test/Makefile b/hotspot/test/Makefile index 479851a3e5a..e0526fcf35c 100644 --- a/hotspot/test/Makefile +++ b/hotspot/test/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1995, 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 @@ -26,6 +26,10 @@ # Makefile to run various hotspot tests # +ALT_MAKE ?= closed + +-include $(ALT_MAKE)/Makefile + GETMIXEDPATH=echo # Utilities used @@ -305,14 +309,27 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) PHONY_LIST += jtreg_tests +# flags used to execute java in test targets +TEST_FLAGS += -version -Xinternalversion -X -help + +sanitytest: prep $(PRODUCT_HOME) + @for flag in $(TEST_FLAGS); \ + do \ + echo Executing java $(JAVA_OPTIONS) $$flag; \ + $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) $$flag; \ + res=$$?; \ + if [ $$res -ne 0 ]; then \ + exit $$res; \ + fi; \ + done + +PHONY_LIST += sanitytest + ################################################################ # clienttest (make sure various basic java client options work) -hotspot_clienttest clienttest: prep $(PRODUCT_HOME) - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X +hotspot_clienttest clienttest: sanitytest $(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes.jsa $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump @@ -323,10 +340,7 @@ PHONY_LIST += hotspot_clienttest clienttest # minimaltest (make sure various basic java minimal options work) -hotspot_minimaltest minimaltest: prep $(PRODUCT_HOME) - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X +hotspot_minimaltest minimaltest: sanitytest PHONY_LIST += hotspot_minimaltest minimaltest @@ -334,10 +348,7 @@ PHONY_LIST += hotspot_minimaltest minimaltest # servertest (make sure various basic java server options work) -hotspot_servertest servertest: prep $(PRODUCT_HOME) - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help - $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X +hotspot_servertest servertest: sanitytest PHONY_LIST += hotspot_servertest servertest From f3d9096e4dac9a267d8e888945d13dd18732c304 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 17 Nov 2014 14:02:45 -0800 Subject: [PATCH 069/159] 8062258: compiler/debug/TraceIterativeGVN.java segfaults in trace_PhaseIterGVN Reviewed-by: kvn --- hotspot/src/share/vm/opto/machnode.cpp | 4 +++- hotspot/src/share/vm/opto/memnode.cpp | 2 ++ hotspot/src/share/vm/opto/memnode.hpp | 6 +++++- hotspot/src/share/vm/opto/multnode.cpp | 4 +++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/opto/machnode.cpp b/hotspot/src/share/vm/opto/machnode.cpp index a2112199f26..39c30782936 100644 --- a/hotspot/src/share/vm/opto/machnode.cpp +++ b/hotspot/src/share/vm/opto/machnode.cpp @@ -561,7 +561,9 @@ const Type *MachProjNode::bottom_type() const { const TypePtr *MachProjNode::adr_type() const { if (bottom_type() == Type::MEMORY) { // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM - const TypePtr* adr_type = in(0)->adr_type(); + Node* ctrl = in(0); + if (ctrl == NULL) return NULL; // node is dead + const TypePtr* adr_type = ctrl->adr_type(); #ifdef ASSERT if (!is_error_reported() && !Node::in_dump()) assert(adr_type != NULL, "source must have adr_type"); diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index 1be984c4e74..702cc9bbd7e 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -52,6 +52,7 @@ uint MemNode::size_of() const { return sizeof(*this); } const TypePtr *MemNode::adr_type() const { Node* adr = in(Address); + if (adr == NULL) return NULL; // node is dead const TypePtr* cross_check = NULL; DEBUG_ONLY(cross_check = _adr_type); return calculate_adr_type(adr->bottom_type(), cross_check); @@ -2741,6 +2742,7 @@ LoadStoreConditionalNode::LoadStoreConditionalNode( Node *c, Node *mem, Node *ad // Do we Match on this edge index or not? Do not match memory const TypePtr* ClearArrayNode::adr_type() const { Node *adr = in(3); + if (adr == NULL) return NULL; // node is dead return MemNode::calculate_adr_type(adr->bottom_type()); } diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp index cbdd689fe8b..d32a4fa0c09 100644 --- a/hotspot/src/share/vm/opto/memnode.hpp +++ b/hotspot/src/share/vm/opto/memnode.hpp @@ -730,7 +730,11 @@ public: virtual int Opcode() const; virtual bool is_CFG() const { return false; } virtual const Type *bottom_type() const {return Type::MEMORY;} - virtual const TypePtr *adr_type() const { return in(0)->in(MemNode::Memory)->adr_type();} + virtual const TypePtr *adr_type() const { + Node* ctrl = in(0); + if (ctrl == NULL) return NULL; // node is dead + return ctrl->in(MemNode::Memory)->adr_type(); + } virtual uint ideal_reg() const { return 0;} // memory projections don't have a register virtual const Type *Value( PhaseTransform *phase ) const; #ifndef PRODUCT diff --git a/hotspot/src/share/vm/opto/multnode.cpp b/hotspot/src/share/vm/opto/multnode.cpp index 1da4b7789f4..c4d167faae9 100644 --- a/hotspot/src/share/vm/opto/multnode.cpp +++ b/hotspot/src/share/vm/opto/multnode.cpp @@ -102,7 +102,9 @@ const Type *ProjNode::bottom_type() const { const TypePtr *ProjNode::adr_type() const { if (bottom_type() == Type::MEMORY) { // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM - const TypePtr* adr_type = in(0)->adr_type(); + Node* ctrl = in(0); + if (ctrl == NULL) return NULL; // node is dead + const TypePtr* adr_type = ctrl->adr_type(); #ifdef ASSERT if (!is_error_reported() && !Node::in_dump()) assert(adr_type != NULL, "source must have adr_type"); From 68b0d32b05be03cd0851327105e08bd17717bc1c Mon Sep 17 00:00:00 2001 From: Zoltan Majo Date: Tue, 18 Nov 2014 19:44:45 +0100 Subject: [PATCH 070/159] 8062854: move compiler jtreg test to corresponding subfolders and use those in TEST.groups Move all test from directories to /; update TEST.groups to execute more tests Reviewed-by: drchase, kvn --- hotspot/test/TEST.groups | 317 +++++------------- .../{ => c1}/6478991/NullCheckTest.java | 0 .../{ => c1}/6579789/Test6579789.java | 0 .../{ => c1}/6756768/Test6756768.java | 0 .../{ => c1}/6756768/Test6756768_2.java | 0 .../{ => c1}/6757316/Test6757316.java | 0 .../{ => c1}/6758234/Test6758234.java | 0 .../6769124/TestArrayCopy6769124.java | 0 .../{ => c1}/6769124/TestDeoptInt6769124.java | 0 .../6769124/TestUnalignedLoad6769124.java | 0 .../{ => c1}/6795465/Test6795465.java | 0 .../test/compiler/{ => c1}/6849574/Test.java | 0 .../{ => c1}/6855215/Test6855215.java | 0 .../{ => c1}/6932496/Test6932496.java | 0 .../{ => c1}/7042153/Test7042153.java | 0 .../{ => c1}/7090976/Test7090976.java | 0 .../{ => c1}/7103261/Test7103261.java | 0 .../{ => c1}/7123108/Test7123108.java | 0 .../{ => c1}/8004051/Test8004051.java | 0 .../{ => c1}/8011706/Test8011706.java | 0 .../{ => c1}/8011771/Test8011771.java | 0 .../{ => c2}/5057225/Test5057225.java | 0 .../{ => c2}/5091921/Test5091921.java | 0 .../{ => c2}/5091921/Test6186134.java | 0 .../{ => c2}/5091921/Test6196102.java | 0 .../{ => c2}/5091921/Test6357214.java | 0 .../{ => c2}/5091921/Test6559156.java | 0 .../{ => c2}/5091921/Test6753639.java | 0 .../{ => c2}/5091921/Test6850611.java | 0 .../{ => c2}/5091921/Test6890943.java | 0 .../{ => c2}/5091921/Test6897150.java | 0 .../{ => c2}/5091921/Test6905845.java | 0 .../{ => c2}/5091921/Test6931567.java | 0 .../{ => c2}/5091921/Test6935022.java | 0 .../{ => c2}/5091921/Test6959129.java | 0 .../{ => c2}/5091921/Test6985295.java | 0 .../{ => c2}/5091921/Test6992759.java | 0 .../{ => c2}/5091921/Test7005594.java | 0 .../compiler/{ => c2}/5091921/Test7005594.sh | 2 +- .../{ => c2}/5091921/Test7020614.java | 0 .../{ => c2}/5091921/input6890943.txt | 0 .../{ => c2}/5091921/output6890943.txt | 0 .../{ => c2}/6340864/TestByteVect.java | 0 .../{ => c2}/6340864/TestDoubleVect.java | 0 .../{ => c2}/6340864/TestFloatVect.java | 0 .../{ => c2}/6340864/TestIntVect.java | 0 .../{ => c2}/6340864/TestLongVect.java | 0 .../{ => c2}/6340864/TestShortVect.java | 0 .../{ => c2}/6443505/Test6443505.java | 0 .../6589834/InlinedArrayCloneTestCase.java | 0 .../compiler/{ => c2}/6589834/Test_ia32.java | 0 .../test/compiler/{ => c2}/6603011/Test.java | 0 .../test/compiler/{ => c2}/6636138/Test1.java | 0 .../test/compiler/{ => c2}/6636138/Test2.java | 0 .../test/compiler/{ => c2}/6646019/Test.java | 0 .../compiler/{ => c2}/6646020/Tester.java | 0 .../test/compiler/{ => c2}/6661247/Test.java | 0 .../compiler/{ => c2}/6663621/IVTest.java | 0 .../compiler/{ => c2}/6663848/Tester.java | 0 .../{ => c2}/6663854/Test6663854.java | 0 .../test/compiler/{ => c2}/6695810/Test.java | 0 .../{ => c2}/6700047/Test6700047.java | 0 .../test/compiler/{ => c2}/6711100/Test.java | 0 .../test/compiler/{ => c2}/6711117/Test.java | 0 .../{ => c2}/6712835/Test6712835.java | 0 .../compiler/{ => c2}/6714694/Tester.java | 0 .../test/compiler/{ => c2}/6724218/Test.java | 0 .../{ => c2}/6732154/Test6732154.java | 0 .../compiler/{ => c2}/6741738/Tester.java | 0 .../{ => c2}/6772683/InterruptedTest.java | 0 .../{ => c2}/6792161/Test6792161.java | 0 .../{ => c2}/6795362/Test6795362.java | 0 .../{ => c2}/6796786/Test6796786.java | 0 .../test/compiler/{ => c2}/6799693/Test.java | 0 .../{ => c2}/6800154/Test6800154.java | 0 .../{ => c2}/6805724/Test6805724.java | 0 .../test/compiler/{ => c2}/6823453/Test.java | 0 .../test/compiler/{ => c2}/6832293/Test.java | 0 .../{ => c2}/6837011/Test6837011.java | 0 .../test/compiler/{ => c2}/6837094/Test.java | 0 .../test/compiler/{ => c2}/6843752/Test.java | 0 .../test/compiler/{ => c2}/6851282/Test.java | 0 .../{ => c2}/6852078/Test6852078.java | 0 .../{ => c2}/6857159/Test6857159.java | 0 .../compiler/{ => c2}/6857159/Test6857159.sh | 2 +- .../{ => c2}/6863155/Test6863155.java | 0 .../test/compiler/{ => c2}/6865031/Test.java | 0 .../test/compiler/{ => c2}/6866651/Test.java | 0 .../test/compiler/{ => c2}/6877254/Test.java | 0 .../{ => c2}/6880034/Test6880034.java | 0 .../{ => c2}/6885584/Test6885584.java | 0 .../{ => c2}/6894807/IsInstanceTest.java | 0 .../compiler/{ => c2}/6894807/Test6894807.sh | 2 +- .../test/compiler/{ => c2}/6901572/Test.java | 0 .../test/compiler/{ => c2}/6910484/Test.java | 0 .../test/compiler/{ => c2}/6910605/Test.java | 0 .../test/compiler/{ => c2}/6910618/Test.java | 0 .../test/compiler/{ => c2}/6912517/Test.java | 0 .../{ => c2}/6916644/Test6916644.java | 0 .../6921969/TestMultiplyLongHiZero.java | 0 .../{ => c2}/6930043/Test6930043.java | 0 .../6946040/TestCharShortByteSwap.java | 0 .../{ => c2}/6956668/Test6956668.java | 0 .../test/compiler/{ => c2}/6958485/Test.java | 0 .../{ => c2}/6968348/Test6968348.java | 0 .../test/compiler/{ => c2}/6973329/Test.java | 0 .../{ => c2}/7002666/Test7002666.java | 0 .../{ => c2}/7009359/Test7009359.java | 0 .../test/compiler/{ => c2}/7017746/Test.java | 0 .../{ => c2}/7024475/Test7024475.java | 0 .../test/compiler/{ => c2}/7029152/Test.java | 0 .../{ => c2}/7041100/Test7041100.java | 0 .../{ => c2}/7046096/Test7046096.java | 0 .../{ => c2}/7047069/Test7047069.java | 0 .../{ => c2}/7048332/Test7048332.java | 0 .../{ => c2}/7068051/Test7068051.java | 0 .../compiler/{ => c2}/7070134/Stemmer.java | 0 .../compiler/{ => c2}/7070134/Test7070134.sh | 2 +- hotspot/test/compiler/{ => c2}/7070134/words | 0 .../{ => c2}/7110586/Test7110586.java | 0 .../{ => c2}/7125879/Test7125879.java | 0 .../{ => c2}/7160610/Test7160610.java | 0 .../{ => c2}/7169782/Test7169782.java | 0 .../{ => c2}/7174363/Test7174363.java | 0 .../{ => c2}/7177917/Test7177917.java | 0 .../{ => c2}/7179138/Test7179138_1.java | 0 .../{ => c2}/7179138/Test7179138_2.java | 0 .../{ => c2}/7190310/Test7190310.java | 0 .../{ => c2}/7190310/Test7190310_unsafe.java | 0 .../{ => c2}/7192963/TestByteVect.java | 0 .../{ => c2}/7192963/TestDoubleVect.java | 0 .../{ => c2}/7192963/TestFloatVect.java | 0 .../{ => c2}/7192963/TestIntVect.java | 0 .../{ => c2}/7192963/TestLongVect.java | 0 .../{ => c2}/7192963/TestShortVect.java | 0 .../{ => c2}/7199742/Test7199742.java | 0 .../compiler/{ => c2}/7200264/Test7200264.sh | 2 +- .../{ => c2}/7200264/TestIntVect.java | 0 .../{ => c2}/8000805/Test8000805.java | 0 .../{ => c2}/8002069/Test8002069.java | 0 .../{ => c2}/8004741/Test8004741.java | 0 .../{ => c2}/8004867/TestIntAtomicCAS.java | 0 .../8004867/TestIntAtomicOrdered.java | 0 .../8004867/TestIntAtomicVolatile.java | 0 .../{ => c2}/8004867/TestIntUnsafeCAS.java | 0 .../8004867/TestIntUnsafeOrdered.java | 0 .../8004867/TestIntUnsafeVolatile.java | 0 .../{ => c2}/8005956/PolynomialRoot.java | 0 .../{ => c2}/8007294/Test8007294.java | 0 .../{ => c2}/8007722/Test8007722.java | 0 .../{ => codegen}/6378821/Test6378821.java | 0 .../compiler/{ => codegen}/6431242/Test.java | 0 .../{ => codegen}/6797305/Test6797305.java | 0 .../{ => codegen}/6814842/Test6814842.java | 0 .../{ => codegen}/6823354/Test6823354.java | 0 .../compiler/{ => codegen}/6875866/Test.java | 0 .../{ => codegen}/6879902/Test6879902.java | 0 .../{ => codegen}/6896617/Test6896617.java | 0 .../{ => codegen}/6909839/Test6909839.java | 0 .../compiler/{ => codegen}/6935535/Test.java | 0 .../compiler/{ => codegen}/6942326/Test.java | 0 .../{ => codegen}/7009231/Test7009231.java | 0 .../{ => codegen}/7088419/CRCTest.java | 0 .../{ => codegen}/7100757/Test7100757.java | 0 .../7119644/TestBooleanVect.java | 0 .../7119644/TestByteDoubleVect.java | 0 .../7119644/TestByteFloatVect.java | 0 .../7119644/TestByteIntVect.java | 0 .../7119644/TestByteLongVect.java | 0 .../7119644/TestByteShortVect.java | 0 .../{ => codegen}/7119644/TestByteVect.java | 0 .../7119644/TestCharShortVect.java | 0 .../{ => codegen}/7119644/TestCharVect.java | 0 .../{ => codegen}/7119644/TestDoubleVect.java | 0 .../7119644/TestFloatDoubleVect.java | 0 .../{ => codegen}/7119644/TestFloatVect.java | 0 .../7119644/TestIntDoubleVect.java | 0 .../7119644/TestIntFloatVect.java | 0 .../7119644/TestIntLongVect.java | 0 .../{ => codegen}/7119644/TestIntVect.java | 0 .../7119644/TestLongDoubleVect.java | 0 .../7119644/TestLongFloatVect.java | 0 .../{ => codegen}/7119644/TestLongVect.java | 0 .../7119644/TestShortDoubleVect.java | 0 .../7119644/TestShortFloatVect.java | 0 .../7119644/TestShortIntVect.java | 0 .../7119644/TestShortLongVect.java | 0 .../{ => codegen}/7119644/TestShortVect.java | 0 .../{ => codegen}/7184394/TestAESBase.java | 0 .../{ => codegen}/7184394/TestAESDecode.java | 0 .../{ => codegen}/7184394/TestAESEncode.java | 0 .../{ => codegen}/7184394/TestAESMain.java | 0 .../{ => codegen}/8001183/TestCharVect.java | 0 .../{ => codegen}/8005033/Test8005033.java | 0 .../{ => codegen}/8011901/Test8011901.java | 0 .../6934604/TestByteBoxing.java | 0 .../6934604/TestDoubleBoxing.java | 0 .../6934604/TestFloatBoxing.java | 0 .../6934604/TestIntBoxing.java | 0 .../6934604/TestLongBoxing.java | 0 .../6934604/TestShortBoxing.java | 0 .../UnsignedLoads.java | 0 .../{ => escapeAnalysis}/6689060/Test.java | 0 .../{ => escapeAnalysis}/6716441/Tester.java | 0 .../{ => escapeAnalysis}/6726999/Test.java | 0 .../{ => escapeAnalysis}/6775880/Test.java | 0 .../{ => escapeAnalysis}/6795161/Test.java | 0 .../{ => escapeAnalysis}/6895383/Test.java | 0 .../{ => escapeAnalysis}/6896727/Test.java | 0 .../Test8020215.java | 0 .../TestAllocatedEscapesPtrComparison.java | 0 ...tUnsafePutAddressNullObjMustNotEscape.java | 0 .../TestIntegerComparison.java | 0 .../{ => interpreter}/6539464/Test.java | 0 .../{ => interpreter}/6833129/Test.java | 0 .../{ => interpreter}/7116216/LargeFrame.java | 0 .../7116216/StackOverflow.java | 0 .../{ => intrinsics}/6982370/Test6982370.java | 0 .../{ => intrinsics}/8005419/Test8005419.java | 0 .../{ => jsr292}/6990212/Test6990212.java | 0 .../{ => jsr292}/7082949/Test7082949.java | 0 .../compiler/{ => loopopts}/6659207/Test.java | 0 .../compiler/{ => loopopts}/6855164/Test.java | 0 .../compiler/{ => loopopts}/6860469/Test.java | 0 .../{ => loopopts}/7044738/Test7044738.java | 0 .../{ => loopopts}/7052494/Test7052494.java | 0 .../compiler/{ => runtime}/6778657/Test.java | 0 .../compiler/{ => runtime}/6826736/Test.java | 0 .../{ => runtime}/6859338/Test6859338.java | 0 .../compiler/{ => runtime}/6863420/Test.java | 0 .../6865265/StackOverflowBug.java | 0 .../{ => runtime}/6891750/Test6891750.java | 0 .../compiler/{ => runtime}/6892265/Test.java | 0 .../{ => runtime}/7088020/Test7088020.java | 0 .../{ => runtime}/7141637/SpreadNullArg.java | 0 .../{ => runtime}/7196199/Test7196199.java | 0 .../{ => runtime}/8010927/Test8010927.java | 0 .../{ => runtime}/8015436/Test8015436.java | 0 .../8009761/Test8009761.java | 0 239 files changed, 83 insertions(+), 244 deletions(-) rename hotspot/test/compiler/{ => c1}/6478991/NullCheckTest.java (100%) rename hotspot/test/compiler/{ => c1}/6579789/Test6579789.java (100%) rename hotspot/test/compiler/{ => c1}/6756768/Test6756768.java (100%) rename hotspot/test/compiler/{ => c1}/6756768/Test6756768_2.java (100%) rename hotspot/test/compiler/{ => c1}/6757316/Test6757316.java (100%) rename hotspot/test/compiler/{ => c1}/6758234/Test6758234.java (100%) rename hotspot/test/compiler/{ => c1}/6769124/TestArrayCopy6769124.java (100%) rename hotspot/test/compiler/{ => c1}/6769124/TestDeoptInt6769124.java (100%) rename hotspot/test/compiler/{ => c1}/6769124/TestUnalignedLoad6769124.java (100%) rename hotspot/test/compiler/{ => c1}/6795465/Test6795465.java (100%) rename hotspot/test/compiler/{ => c1}/6849574/Test.java (100%) rename hotspot/test/compiler/{ => c1}/6855215/Test6855215.java (100%) rename hotspot/test/compiler/{ => c1}/6932496/Test6932496.java (100%) rename hotspot/test/compiler/{ => c1}/7042153/Test7042153.java (100%) rename hotspot/test/compiler/{ => c1}/7090976/Test7090976.java (100%) rename hotspot/test/compiler/{ => c1}/7103261/Test7103261.java (100%) rename hotspot/test/compiler/{ => c1}/7123108/Test7123108.java (100%) rename hotspot/test/compiler/{ => c1}/8004051/Test8004051.java (100%) rename hotspot/test/compiler/{ => c1}/8011706/Test8011706.java (100%) rename hotspot/test/compiler/{ => c1}/8011771/Test8011771.java (100%) rename hotspot/test/compiler/{ => c2}/5057225/Test5057225.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test5091921.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6186134.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6196102.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6357214.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6559156.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6753639.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6850611.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6890943.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6897150.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6905845.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6931567.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6935022.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6959129.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6985295.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test6992759.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test7005594.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/Test7005594.sh (98%) rename hotspot/test/compiler/{ => c2}/5091921/Test7020614.java (100%) rename hotspot/test/compiler/{ => c2}/5091921/input6890943.txt (100%) rename hotspot/test/compiler/{ => c2}/5091921/output6890943.txt (100%) rename hotspot/test/compiler/{ => c2}/6340864/TestByteVect.java (100%) rename hotspot/test/compiler/{ => c2}/6340864/TestDoubleVect.java (100%) rename hotspot/test/compiler/{ => c2}/6340864/TestFloatVect.java (100%) rename hotspot/test/compiler/{ => c2}/6340864/TestIntVect.java (100%) rename hotspot/test/compiler/{ => c2}/6340864/TestLongVect.java (100%) rename hotspot/test/compiler/{ => c2}/6340864/TestShortVect.java (100%) rename hotspot/test/compiler/{ => c2}/6443505/Test6443505.java (100%) rename hotspot/test/compiler/{ => c2}/6589834/InlinedArrayCloneTestCase.java (100%) rename hotspot/test/compiler/{ => c2}/6589834/Test_ia32.java (100%) rename hotspot/test/compiler/{ => c2}/6603011/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6636138/Test1.java (100%) rename hotspot/test/compiler/{ => c2}/6636138/Test2.java (100%) rename hotspot/test/compiler/{ => c2}/6646019/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6646020/Tester.java (100%) rename hotspot/test/compiler/{ => c2}/6661247/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6663621/IVTest.java (100%) rename hotspot/test/compiler/{ => c2}/6663848/Tester.java (100%) rename hotspot/test/compiler/{ => c2}/6663854/Test6663854.java (100%) rename hotspot/test/compiler/{ => c2}/6695810/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6700047/Test6700047.java (100%) rename hotspot/test/compiler/{ => c2}/6711100/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6711117/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6712835/Test6712835.java (100%) rename hotspot/test/compiler/{ => c2}/6714694/Tester.java (100%) rename hotspot/test/compiler/{ => c2}/6724218/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6732154/Test6732154.java (100%) rename hotspot/test/compiler/{ => c2}/6741738/Tester.java (100%) rename hotspot/test/compiler/{ => c2}/6772683/InterruptedTest.java (100%) rename hotspot/test/compiler/{ => c2}/6792161/Test6792161.java (100%) rename hotspot/test/compiler/{ => c2}/6795362/Test6795362.java (100%) rename hotspot/test/compiler/{ => c2}/6796786/Test6796786.java (100%) rename hotspot/test/compiler/{ => c2}/6799693/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6800154/Test6800154.java (100%) rename hotspot/test/compiler/{ => c2}/6805724/Test6805724.java (100%) rename hotspot/test/compiler/{ => c2}/6823453/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6832293/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6837011/Test6837011.java (100%) rename hotspot/test/compiler/{ => c2}/6837094/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6843752/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6851282/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6852078/Test6852078.java (100%) rename hotspot/test/compiler/{ => c2}/6857159/Test6857159.java (100%) rename hotspot/test/compiler/{ => c2}/6857159/Test6857159.sh (98%) rename hotspot/test/compiler/{ => c2}/6863155/Test6863155.java (100%) rename hotspot/test/compiler/{ => c2}/6865031/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6866651/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6877254/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6880034/Test6880034.java (100%) rename hotspot/test/compiler/{ => c2}/6885584/Test6885584.java (100%) rename hotspot/test/compiler/{ => c2}/6894807/IsInstanceTest.java (100%) rename hotspot/test/compiler/{ => c2}/6894807/Test6894807.sh (97%) rename hotspot/test/compiler/{ => c2}/6901572/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6910484/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6910605/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6910618/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6912517/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6916644/Test6916644.java (100%) rename hotspot/test/compiler/{ => c2}/6921969/TestMultiplyLongHiZero.java (100%) rename hotspot/test/compiler/{ => c2}/6930043/Test6930043.java (100%) rename hotspot/test/compiler/{ => c2}/6946040/TestCharShortByteSwap.java (100%) rename hotspot/test/compiler/{ => c2}/6956668/Test6956668.java (100%) rename hotspot/test/compiler/{ => c2}/6958485/Test.java (100%) rename hotspot/test/compiler/{ => c2}/6968348/Test6968348.java (100%) rename hotspot/test/compiler/{ => c2}/6973329/Test.java (100%) rename hotspot/test/compiler/{ => c2}/7002666/Test7002666.java (100%) rename hotspot/test/compiler/{ => c2}/7009359/Test7009359.java (100%) rename hotspot/test/compiler/{ => c2}/7017746/Test.java (100%) rename hotspot/test/compiler/{ => c2}/7024475/Test7024475.java (100%) rename hotspot/test/compiler/{ => c2}/7029152/Test.java (100%) rename hotspot/test/compiler/{ => c2}/7041100/Test7041100.java (100%) rename hotspot/test/compiler/{ => c2}/7046096/Test7046096.java (100%) rename hotspot/test/compiler/{ => c2}/7047069/Test7047069.java (100%) rename hotspot/test/compiler/{ => c2}/7048332/Test7048332.java (100%) rename hotspot/test/compiler/{ => c2}/7068051/Test7068051.java (100%) rename hotspot/test/compiler/{ => c2}/7070134/Stemmer.java (100%) rename hotspot/test/compiler/{ => c2}/7070134/Test7070134.sh (97%) rename hotspot/test/compiler/{ => c2}/7070134/words (100%) rename hotspot/test/compiler/{ => c2}/7110586/Test7110586.java (100%) rename hotspot/test/compiler/{ => c2}/7125879/Test7125879.java (100%) rename hotspot/test/compiler/{ => c2}/7160610/Test7160610.java (100%) rename hotspot/test/compiler/{ => c2}/7169782/Test7169782.java (100%) rename hotspot/test/compiler/{ => c2}/7174363/Test7174363.java (100%) rename hotspot/test/compiler/{ => c2}/7177917/Test7177917.java (100%) rename hotspot/test/compiler/{ => c2}/7179138/Test7179138_1.java (100%) rename hotspot/test/compiler/{ => c2}/7179138/Test7179138_2.java (100%) rename hotspot/test/compiler/{ => c2}/7190310/Test7190310.java (100%) rename hotspot/test/compiler/{ => c2}/7190310/Test7190310_unsafe.java (100%) rename hotspot/test/compiler/{ => c2}/7192963/TestByteVect.java (100%) rename hotspot/test/compiler/{ => c2}/7192963/TestDoubleVect.java (100%) rename hotspot/test/compiler/{ => c2}/7192963/TestFloatVect.java (100%) rename hotspot/test/compiler/{ => c2}/7192963/TestIntVect.java (100%) rename hotspot/test/compiler/{ => c2}/7192963/TestLongVect.java (100%) rename hotspot/test/compiler/{ => c2}/7192963/TestShortVect.java (100%) rename hotspot/test/compiler/{ => c2}/7199742/Test7199742.java (100%) rename hotspot/test/compiler/{ => c2}/7200264/Test7200264.sh (99%) rename hotspot/test/compiler/{ => c2}/7200264/TestIntVect.java (100%) rename hotspot/test/compiler/{ => c2}/8000805/Test8000805.java (100%) rename hotspot/test/compiler/{ => c2}/8002069/Test8002069.java (100%) rename hotspot/test/compiler/{ => c2}/8004741/Test8004741.java (100%) rename hotspot/test/compiler/{ => c2}/8004867/TestIntAtomicCAS.java (100%) rename hotspot/test/compiler/{ => c2}/8004867/TestIntAtomicOrdered.java (100%) rename hotspot/test/compiler/{ => c2}/8004867/TestIntAtomicVolatile.java (100%) rename hotspot/test/compiler/{ => c2}/8004867/TestIntUnsafeCAS.java (100%) rename hotspot/test/compiler/{ => c2}/8004867/TestIntUnsafeOrdered.java (100%) rename hotspot/test/compiler/{ => c2}/8004867/TestIntUnsafeVolatile.java (100%) rename hotspot/test/compiler/{ => c2}/8005956/PolynomialRoot.java (100%) rename hotspot/test/compiler/{ => c2}/8007294/Test8007294.java (100%) rename hotspot/test/compiler/{ => c2}/8007722/Test8007722.java (100%) rename hotspot/test/compiler/{ => codegen}/6378821/Test6378821.java (100%) rename hotspot/test/compiler/{ => codegen}/6431242/Test.java (100%) rename hotspot/test/compiler/{ => codegen}/6797305/Test6797305.java (100%) rename hotspot/test/compiler/{ => codegen}/6814842/Test6814842.java (100%) rename hotspot/test/compiler/{ => codegen}/6823354/Test6823354.java (100%) rename hotspot/test/compiler/{ => codegen}/6875866/Test.java (100%) rename hotspot/test/compiler/{ => codegen}/6879902/Test6879902.java (100%) rename hotspot/test/compiler/{ => codegen}/6896617/Test6896617.java (100%) rename hotspot/test/compiler/{ => codegen}/6909839/Test6909839.java (100%) rename hotspot/test/compiler/{ => codegen}/6935535/Test.java (100%) rename hotspot/test/compiler/{ => codegen}/6942326/Test.java (100%) rename hotspot/test/compiler/{ => codegen}/7009231/Test7009231.java (100%) rename hotspot/test/compiler/{ => codegen}/7088419/CRCTest.java (100%) rename hotspot/test/compiler/{ => codegen}/7100757/Test7100757.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestBooleanVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestByteDoubleVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestByteFloatVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestByteIntVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestByteLongVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestByteShortVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestByteVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestCharShortVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestCharVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestDoubleVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestFloatDoubleVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestFloatVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestIntDoubleVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestIntFloatVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestIntLongVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestIntVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestLongDoubleVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestLongFloatVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestLongVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestShortDoubleVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestShortFloatVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestShortIntVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestShortLongVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7119644/TestShortVect.java (100%) rename hotspot/test/compiler/{ => codegen}/7184394/TestAESBase.java (100%) rename hotspot/test/compiler/{ => codegen}/7184394/TestAESDecode.java (100%) rename hotspot/test/compiler/{ => codegen}/7184394/TestAESEncode.java (100%) rename hotspot/test/compiler/{ => codegen}/7184394/TestAESMain.java (100%) rename hotspot/test/compiler/{ => codegen}/8001183/TestCharVect.java (100%) rename hotspot/test/compiler/{ => codegen}/8005033/Test8005033.java (100%) rename hotspot/test/compiler/{ => codegen}/8011901/Test8011901.java (100%) rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestByteBoxing.java (100%) rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestDoubleBoxing.java (100%) rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestFloatBoxing.java (100%) rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestIntBoxing.java (100%) rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestLongBoxing.java (100%) rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestShortBoxing.java (100%) rename hotspot/test/compiler/{EliminateAutoBox => eliminateAutobox}/UnsignedLoads.java (100%) rename hotspot/test/compiler/{ => escapeAnalysis}/6689060/Test.java (100%) rename hotspot/test/compiler/{ => escapeAnalysis}/6716441/Tester.java (100%) rename hotspot/test/compiler/{ => escapeAnalysis}/6726999/Test.java (100%) rename hotspot/test/compiler/{ => escapeAnalysis}/6775880/Test.java (100%) rename hotspot/test/compiler/{ => escapeAnalysis}/6795161/Test.java (100%) rename hotspot/test/compiler/{ => escapeAnalysis}/6895383/Test.java (100%) rename hotspot/test/compiler/{ => escapeAnalysis}/6896727/Test.java (100%) rename hotspot/test/compiler/{EscapeAnalysis => escapeAnalysis}/Test8020215.java (100%) rename hotspot/test/compiler/{EscapeAnalysis => escapeAnalysis}/TestAllocatedEscapesPtrComparison.java (100%) rename hotspot/test/compiler/{EscapeAnalysis => escapeAnalysis}/TestUnsafePutAddressNullObjMustNotEscape.java (100%) rename hotspot/test/compiler/{IntegerArithmetic => integerArithmetic}/TestIntegerComparison.java (100%) rename hotspot/test/compiler/{ => interpreter}/6539464/Test.java (100%) rename hotspot/test/compiler/{ => interpreter}/6833129/Test.java (100%) rename hotspot/test/compiler/{ => interpreter}/7116216/LargeFrame.java (100%) rename hotspot/test/compiler/{ => interpreter}/7116216/StackOverflow.java (100%) rename hotspot/test/compiler/{ => intrinsics}/6982370/Test6982370.java (100%) rename hotspot/test/compiler/{ => intrinsics}/8005419/Test8005419.java (100%) rename hotspot/test/compiler/{ => jsr292}/6990212/Test6990212.java (100%) rename hotspot/test/compiler/{ => jsr292}/7082949/Test7082949.java (100%) rename hotspot/test/compiler/{ => loopopts}/6659207/Test.java (100%) rename hotspot/test/compiler/{ => loopopts}/6855164/Test.java (100%) rename hotspot/test/compiler/{ => loopopts}/6860469/Test.java (100%) rename hotspot/test/compiler/{ => loopopts}/7044738/Test7044738.java (100%) rename hotspot/test/compiler/{ => loopopts}/7052494/Test7052494.java (100%) rename hotspot/test/compiler/{ => runtime}/6778657/Test.java (100%) rename hotspot/test/compiler/{ => runtime}/6826736/Test.java (100%) rename hotspot/test/compiler/{ => runtime}/6859338/Test6859338.java (100%) rename hotspot/test/compiler/{ => runtime}/6863420/Test.java (100%) rename hotspot/test/compiler/{ => runtime}/6865265/StackOverflowBug.java (100%) rename hotspot/test/compiler/{ => runtime}/6891750/Test6891750.java (100%) rename hotspot/test/compiler/{ => runtime}/6892265/Test.java (100%) rename hotspot/test/compiler/{ => runtime}/7088020/Test7088020.java (100%) rename hotspot/test/compiler/{ => runtime}/7141637/SpreadNullArg.java (100%) rename hotspot/test/compiler/{ => runtime}/7196199/Test7196199.java (100%) rename hotspot/test/compiler/{ => runtime}/8010927/Test8010927.java (100%) rename hotspot/test/compiler/{ => runtime}/8015436/Test8015436.java (100%) rename hotspot/test/compiler/{ => uncommontrap}/8009761/Test8009761.java (100%) diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index 8ea66a65e68..e4dbf572f06 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -107,8 +107,8 @@ jre = \ # Tests that require the full JRE # needs_jre = \ - compiler/6852078/Test6852078.java \ - compiler/7047069/Test7047069.java \ + compiler/c2/6852078/Test6852078.java \ + compiler/c2/7047069/Test7047069.java \ runtime/6294277/SourceDebugExtension.java \ runtime/ClassFile/JsrRewriting.java \ runtime/ClassFile/OomWhileParsingRepeatedJsr.java @@ -325,245 +325,84 @@ hotspot_wbapitest = \ sanity/ hotspot_compiler_1 = \ - compiler/5057225/Test5057225.java \ - compiler/5091921/Test5091921.java \ - compiler/5091921/Test6186134.java \ - compiler/5091921/Test6196102.java \ - compiler/5091921/Test6357214.java \ - compiler/5091921/Test6559156.java \ - compiler/5091921/Test6753639.java \ - compiler/5091921/Test6935022.java \ - compiler/5091921/Test6959129.java \ - compiler/5091921/Test6985295.java \ - compiler/5091921/Test6992759.java \ - compiler/5091921/Test7005594.java \ - compiler/5091921/Test7020614.java \ - compiler/6378821/Test6378821.java \ - compiler/6431242/Test.java \ - compiler/6443505/Test6443505.java \ - compiler/6478991/NullCheckTest.java \ - compiler/6539464/Test.java \ - compiler/6579789/Test6579789.java \ - compiler/6636138/ \ - compiler/6646019/Test.java \ - compiler/6659207/Test.java \ - compiler/6661247/Test.java \ - compiler/6663621/IVTest.java \ - compiler/6689060/Test.java \ - compiler/6695810/Test.java \ - compiler/6700047/Test6700047.java \ - compiler/6711100/Test.java \ - compiler/6724218/Test.java \ - compiler/6732154/Test6732154.java \ - compiler/6758234/Test6758234.java \ - compiler/6769124/ \ - compiler/6772683/InterruptedTest.java \ - compiler/6778657/Test.java \ - compiler/6795161/Test.java \ - compiler/6795362/Test6795362.java \ - compiler/6795465/Test6795465.java \ - compiler/6796786/Test6796786.java \ - compiler/6799693/Test.java \ - compiler/6805724/Test6805724.java \ - compiler/6814842/Test6814842.java \ - compiler/6823453/Test.java \ - compiler/6833129/Test.java \ - compiler/6837011/Test6837011.java \ - compiler/6843752/Test.java \ - compiler/6849574/Test.java \ - compiler/6855164/Test.java \ - compiler/6855215/Test6855215.java \ - compiler/6857159/Test6857159.java \ - compiler/6860469/Test.java \ - compiler/6863155/Test6863155.java \ - compiler/6863420/Test.java \ - compiler/6865265/StackOverflowBug.java \ - compiler/6879902/Test6879902.java \ - compiler/6880034/Test6880034.java \ - compiler/6891750/Test6891750.java \ - compiler/6892265/Test.java \ - compiler/6894807/IsInstanceTest.java \ - compiler/6901572/Test.java \ - compiler/6909839/Test6909839.java \ - compiler/6910484/Test.java \ - compiler/6910605/Test.java \ - compiler/6910618/Test.java \ - compiler/6916644/Test6916644.java \ - compiler/6921969/TestMultiplyLongHiZero.java \ - compiler/6930043/Test6930043.java \ - compiler/6932496/Test6932496.java \ - compiler/6956668/Test6956668.java \ - compiler/6968348/Test6968348.java \ - compiler/6973329/Test.java - -hotspot_compiler_2 = \ - compiler/6982370/Test6982370.java \ - compiler/7009231/Test7009231.java \ - compiler/7009359/Test7009359.java \ - compiler/7017746/Test.java \ - compiler/7024475/Test7024475.java \ - compiler/7041100/Test7041100.java \ - compiler/7044738/Test7044738.java \ - compiler/7046096/Test7046096.java \ - compiler/7048332/Test7048332.java \ - compiler/7068051/Test7068051.java \ - compiler/7082949/Test7082949.java \ - compiler/7088020/Test7088020.java \ - compiler/7090976/Test7090976.java \ - compiler/7103261/Test7103261.java \ - compiler/7110586/Test7110586.java \ - compiler/7119644/ \ - compiler/7141637/SpreadNullArg.java \ - compiler/7169782/Test7169782.java \ - compiler/7174363/Test7174363.java \ - compiler/7179138/ \ - compiler/7190310/ \ - compiler/7192963/ \ - compiler/7200264/TestIntVect.java \ - compiler/8000805/Test8000805.java \ - compiler/8002069/Test8002069.java \ - compiler/8004741/Test8004741.java \ - compiler/8005033/Test8005033.java \ - compiler/8005419/Test8005419.java \ - compiler/8005956/PolynomialRoot.java \ - compiler/8007294/Test8007294.java \ - compiler/EliminateAutoBox/UnsignedLoads.java - -hotspot_compiler_3 = \ - compiler/8007722/Test8007722.java \ - compiler/8009761/Test8009761.java \ - compiler/8010927/Test8010927.java \ - compiler/8011706/Test8011706.java \ - compiler/8011771/Test8011771.java \ - compiler/8011901/Test8011901.java \ - compiler/arraycopy/TestMissingControl.java \ - compiler/ciReplay/TestVM_no_comp_level.sh \ - compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java \ - compiler/codecache/CheckSegmentedCodeCache.java \ - compiler/codecache/CheckUpperLimit.java \ - compiler/codegen/ \ - compiler/cpuflags/RestoreMXCSR.java \ - compiler/EscapeAnalysis/ \ - compiler/exceptions/ \ - compiler/floatingpoint/ModNaN.java \ - compiler/gcbarriers/G1CrashTest.java \ - compiler/inlining/ \ - compiler/IntegerArithmetic/TestIntegerComparison.java \ - compiler/intrinsics/bmi/TestAndnI.java \ - compiler/intrinsics/bmi/TestAndnI.java \ - compiler/intrinsics/bmi/TestAndnL.java \ - compiler/intrinsics/bmi/TestBlsiI.java \ - compiler/intrinsics/bmi/TestBlsiL.java \ - compiler/intrinsics/bmi/TestBlsmskI.java \ - compiler/intrinsics/bmi/TestBlsmskL.java \ - compiler/intrinsics/bmi/TestBlsrI.java \ - compiler/intrinsics/bmi/TestBlsrL.java \ - compiler/intrinsics/bmi/TestLzcntI.java \ - compiler/intrinsics/bmi/TestLzcntL.java \ - compiler/intrinsics/bmi/TestTzcntI.java \ - compiler/intrinsics/bmi/TestTzcntL.java \ - compiler/intrinsics/clone/TestObjectClone.java \ - compiler/intrinsics/hashcode/TestHashCode.java \ - compiler/intrinsics/mathexact/CompareTest.java \ - compiler/intrinsics/mathexact/GVNTest.java \ - compiler/intrinsics/mathexact/NegExactILoadTest.java \ - compiler/intrinsics/mathexact/NegExactILoopDependentTest.java \ - compiler/intrinsics/mathexact/NegExactINonConstantTest.java \ - compiler/intrinsics/mathexact/SubExactICondTest.java \ - compiler/intrinsics/mathexact/SubExactILoadTest.java \ - compiler/intrinsics/mathexact/SubExactILoopDependentTest.java \ - compiler/intrinsics/stringequals/TestStringEqualsBadLength.java \ - compiler/intrinsics/unsafe/UnsafeGetAddressTest.java \ - compiler/intrinsics/classcast/NullCheckDroppingsTest.java \ - compiler/jsr292/ConcurrentClassLoadingTest.java \ - compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java \ - compiler/loopopts/TestLogSum.java \ - compiler/macronodes/TestEliminateAllocationPhi.java \ - compiler/membars/TestMemBarAcquire.java \ - compiler/osr/TestOSRWithNonEmptyStack.java \ - compiler/profiling/TestMethodHandleInvokesIntrinsic.java \ - compiler/profiling/TestSpecTrapClassUnloading.java \ - compiler/profiling/TestUnexpectedProfilingMismatch.java \ - compiler/regalloc/C1ObjectSpillInLogicOp.java \ - compiler/startup/NumCompilerThreadsCheck.java \ - compiler/startup/SmallCodeCacheStartup.java \ - compiler/types/TestSpeculationFailedHigherEqual.java \ - compiler/types/TypeSpeculation.java \ - compiler/uncommontrap/StackOverflowGuardPagesOff.java \ - compiler/uncommontrap/TestStackBangMonitorOwned.java \ - compiler/uncommontrap/TestStackBangRbp.java \ - compiler/unsafe/GetUnsafeObjectG1PreBarrier.java + compiler/arraycopy/ \ + compiler/c1/ \ + compiler/c2/ \ + -compiler/c2/5091921/Test6850611.java \ + -compiler/c2/5091921/Test6890943.java \ + -compiler/c2/5091921/Test6905845.java \ + -compiler/c2/6340864 \ + -compiler/c2/6589834 \ + -compiler/c2/6603011 \ + -compiler/c2/6912517 \ + -compiler/c2/6792161 \ + -compiler/c2/7070134 \ + -compiler/c2/8004867 +hotspot_compiler_2 = \ + compiler/classUnloading/ \ + compiler/codecache/ \ + compiler/codegen/ \ + compiler/cpuflags/ \ + compiler/eliminateAutobox/ \ + compiler/escapeAnalysis/ \ + compiler/exceptions/ \ + compiler/floatingpoint/ \ + compiler/gcbarriers/ \ + compiler/inlining/ \ + compiler/integerArithmetic/ \ + compiler/interpreter/ \ + -compiler/codegen/7184394 + +hotspot_compiler_3 = \ + compiler/intrinsics/ \ + compiler/jsr292/ \ + compiler/loopopts/ \ + compiler/macronodes/ \ + compiler/osr/ \ + compiler/regalloc/ \ + compiler/runtime/ \ + compiler/startup/ \ + compiler/types/ \ + compiler/uncommontrap/ \ + compiler/unsafe/ \ + -compiler/intrinsics/bmi/verifycode \ + -compiler/intrinsics/mathexact \ + -compiler/intrinsics/multiplytolen \ + -compiler/intrinsics/sha \ + -compiler/loopopts/7052494 \ + -compiler/runtime/6826736 hotspot_compiler_closed = \ - closed/compiler/4292742/Test.java \ - closed/compiler/4474154/Test4474154.java \ - closed/compiler/4482613/Test4482613.java \ - closed/compiler/4490177/tctest.java \ - closed/compiler/4495990/Application.java \ - closed/compiler/4522874/Test4522874.sh \ - closed/compiler/4629512/Test4629512.java \ - closed/compiler/4647299/Looper.java \ - closed/compiler/4655758/TestClass.java \ - closed/compiler/4671453/LongCompTest.java \ - closed/compiler/4671460/CharArrTest.java \ - closed/compiler/4709105/StringTest2.java \ - closed/compiler/4732721/Bug.java \ - closed/compiler/4750681/ReadTest.java \ - closed/compiler/4787943/LongCrash.java \ - closed/compiler/4819903/Base64Test.java \ - closed/compiler/4903383/Test.java \ - closed/compiler/4906393/Test.java \ - closed/compiler/4907999/Uidtest.java \ - closed/compiler/4917709/Tester.java \ - closed/compiler/4957832/Test.java \ - closed/compiler/4965430/LoopTest.java \ - closed/compiler/4979449/T4979449.java \ - closed/compiler/5031274/Test.java \ - closed/compiler/5043395/T5043395.java \ - closed/compiler/5049410/Test.java \ - closed/compiler/5098422/Test.java \ - closed/compiler/6173783/Test.java \ - closed/compiler/6272923/Test6272923.sh \ - closed/compiler/6290963/Test.java \ - closed/compiler/6305546/Test.java \ - closed/compiler/6309806/Test.java \ - closed/compiler/6311859/Test.java \ - closed/compiler/6321689/Test.java \ - closed/compiler/6326935/Test.java \ - closed/compiler/6367889/Test.java \ - closed/compiler/6371167/Test.java \ - closed/compiler/6389127/Test.java \ - closed/compiler/6397650/Test.java \ - closed/compiler/6414932/Test.java \ - closed/compiler/6421619/Test_6421619.java \ - closed/compiler/6427750/UnsafeVolatile.java \ - closed/compiler/6431243/Test.java \ - closed/compiler/6433572/TestSyncJSR.java \ - closed/compiler/6433840/clinit.java \ - closed/compiler/6457854/Test.java \ - closed/compiler/6476804/Test.java \ - closed/compiler/6512111/CorruptFinalLong.java \ - closed/compiler/6551887/Test.java \ - closed/compiler/6571539/Test.java \ - closed/compiler/6587132/Test.java \ - closed/compiler/6588045/Test.java \ - closed/compiler/6588598/etype.java \ - closed/compiler/6661918/Test6661918.java \ - closed/compiler/6707044/Test.java \ - closed/compiler/6730716/Test.java \ - closed/compiler/6772368/Test6772368.sh \ - closed/compiler/6897150/Test6897150.java \ - closed/compiler/6931567/Test6931567.java \ - closed/compiler/7196857/Test7196857.java \ - closed/compiler/8009699/Test8009699.java \ - closed/compiler/8009699/Test8009699B.java \ - closed/compiler/8014811/Test8014811.java \ - closed/compiler/8029507/InvokePrivate.java \ - closed/compiler/callingConvention/Arg9Double.java \ - closed/compiler/deoptimization/DeoptArithmetic.java \ - closed/compiler/deoptimization/TestDoubleLocals.java \ - closed/compiler/deoptimization/TestDoubleMerge.java + closed/compiler/c1/ \ + closed/compiler/c2/ \ + closed/compiler/codegen/ \ + closed/compiler/escapeAnalysis/ \ + closed/compiler/interpreter/ \ + closed/compiler/jsr292/ \ + closed/compiler/loopopts/ \ + closed/compiler/oracle/ \ + closed/compiler/runtime/ \ + closed/compiler/symantec/ \ + -closed/compiler/c1/4477197 \ + -closed/compiler/c1/5040872 \ + -closed/compiler/c1/6507107 \ + -closed/compiler/c2/4344895 \ + -closed/compiler/c2/4485006 \ + -closed/compiler/c2/4523683 \ + -closed/compiler/c2/4620290 \ + -closed/compiler/c2/4998314 \ + -closed/compiler/c2/6329104 \ + -closed/compiler/c2/6434117 \ + -closed/compiler/c2/6547163 \ + -closed/compiler/c2/6563987 \ + -closed/compiler/c2/6595044 \ + -closed/compiler/codegen/6440479 \ + -closed/compiler/codegen/6603011 \ + -closed/compiler/interpreter/5034475 \ + -closed/compiler/jsr292/LongLambdaFormDynamicStackDepth.java \ + -closed/compiler/loopopts/4463485 \ + -closed/compiler/loopopts/8021898 hotspot_gc = \ sanity/ExecuteInternalVMTests.java @@ -609,4 +448,4 @@ needs_nashorn = \ # not_needs_nashorn = \ :jdk \ - -:needs_nashorh + -:needs_nashorn diff --git a/hotspot/test/compiler/6478991/NullCheckTest.java b/hotspot/test/compiler/c1/6478991/NullCheckTest.java similarity index 100% rename from hotspot/test/compiler/6478991/NullCheckTest.java rename to hotspot/test/compiler/c1/6478991/NullCheckTest.java diff --git a/hotspot/test/compiler/6579789/Test6579789.java b/hotspot/test/compiler/c1/6579789/Test6579789.java similarity index 100% rename from hotspot/test/compiler/6579789/Test6579789.java rename to hotspot/test/compiler/c1/6579789/Test6579789.java diff --git a/hotspot/test/compiler/6756768/Test6756768.java b/hotspot/test/compiler/c1/6756768/Test6756768.java similarity index 100% rename from hotspot/test/compiler/6756768/Test6756768.java rename to hotspot/test/compiler/c1/6756768/Test6756768.java diff --git a/hotspot/test/compiler/6756768/Test6756768_2.java b/hotspot/test/compiler/c1/6756768/Test6756768_2.java similarity index 100% rename from hotspot/test/compiler/6756768/Test6756768_2.java rename to hotspot/test/compiler/c1/6756768/Test6756768_2.java diff --git a/hotspot/test/compiler/6757316/Test6757316.java b/hotspot/test/compiler/c1/6757316/Test6757316.java similarity index 100% rename from hotspot/test/compiler/6757316/Test6757316.java rename to hotspot/test/compiler/c1/6757316/Test6757316.java diff --git a/hotspot/test/compiler/6758234/Test6758234.java b/hotspot/test/compiler/c1/6758234/Test6758234.java similarity index 100% rename from hotspot/test/compiler/6758234/Test6758234.java rename to hotspot/test/compiler/c1/6758234/Test6758234.java diff --git a/hotspot/test/compiler/6769124/TestArrayCopy6769124.java b/hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java similarity index 100% rename from hotspot/test/compiler/6769124/TestArrayCopy6769124.java rename to hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java diff --git a/hotspot/test/compiler/6769124/TestDeoptInt6769124.java b/hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java similarity index 100% rename from hotspot/test/compiler/6769124/TestDeoptInt6769124.java rename to hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java diff --git a/hotspot/test/compiler/6769124/TestUnalignedLoad6769124.java b/hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java similarity index 100% rename from hotspot/test/compiler/6769124/TestUnalignedLoad6769124.java rename to hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java diff --git a/hotspot/test/compiler/6795465/Test6795465.java b/hotspot/test/compiler/c1/6795465/Test6795465.java similarity index 100% rename from hotspot/test/compiler/6795465/Test6795465.java rename to hotspot/test/compiler/c1/6795465/Test6795465.java diff --git a/hotspot/test/compiler/6849574/Test.java b/hotspot/test/compiler/c1/6849574/Test.java similarity index 100% rename from hotspot/test/compiler/6849574/Test.java rename to hotspot/test/compiler/c1/6849574/Test.java diff --git a/hotspot/test/compiler/6855215/Test6855215.java b/hotspot/test/compiler/c1/6855215/Test6855215.java similarity index 100% rename from hotspot/test/compiler/6855215/Test6855215.java rename to hotspot/test/compiler/c1/6855215/Test6855215.java diff --git a/hotspot/test/compiler/6932496/Test6932496.java b/hotspot/test/compiler/c1/6932496/Test6932496.java similarity index 100% rename from hotspot/test/compiler/6932496/Test6932496.java rename to hotspot/test/compiler/c1/6932496/Test6932496.java diff --git a/hotspot/test/compiler/7042153/Test7042153.java b/hotspot/test/compiler/c1/7042153/Test7042153.java similarity index 100% rename from hotspot/test/compiler/7042153/Test7042153.java rename to hotspot/test/compiler/c1/7042153/Test7042153.java diff --git a/hotspot/test/compiler/7090976/Test7090976.java b/hotspot/test/compiler/c1/7090976/Test7090976.java similarity index 100% rename from hotspot/test/compiler/7090976/Test7090976.java rename to hotspot/test/compiler/c1/7090976/Test7090976.java diff --git a/hotspot/test/compiler/7103261/Test7103261.java b/hotspot/test/compiler/c1/7103261/Test7103261.java similarity index 100% rename from hotspot/test/compiler/7103261/Test7103261.java rename to hotspot/test/compiler/c1/7103261/Test7103261.java diff --git a/hotspot/test/compiler/7123108/Test7123108.java b/hotspot/test/compiler/c1/7123108/Test7123108.java similarity index 100% rename from hotspot/test/compiler/7123108/Test7123108.java rename to hotspot/test/compiler/c1/7123108/Test7123108.java diff --git a/hotspot/test/compiler/8004051/Test8004051.java b/hotspot/test/compiler/c1/8004051/Test8004051.java similarity index 100% rename from hotspot/test/compiler/8004051/Test8004051.java rename to hotspot/test/compiler/c1/8004051/Test8004051.java diff --git a/hotspot/test/compiler/8011706/Test8011706.java b/hotspot/test/compiler/c1/8011706/Test8011706.java similarity index 100% rename from hotspot/test/compiler/8011706/Test8011706.java rename to hotspot/test/compiler/c1/8011706/Test8011706.java diff --git a/hotspot/test/compiler/8011771/Test8011771.java b/hotspot/test/compiler/c1/8011771/Test8011771.java similarity index 100% rename from hotspot/test/compiler/8011771/Test8011771.java rename to hotspot/test/compiler/c1/8011771/Test8011771.java diff --git a/hotspot/test/compiler/5057225/Test5057225.java b/hotspot/test/compiler/c2/5057225/Test5057225.java similarity index 100% rename from hotspot/test/compiler/5057225/Test5057225.java rename to hotspot/test/compiler/c2/5057225/Test5057225.java diff --git a/hotspot/test/compiler/5091921/Test5091921.java b/hotspot/test/compiler/c2/5091921/Test5091921.java similarity index 100% rename from hotspot/test/compiler/5091921/Test5091921.java rename to hotspot/test/compiler/c2/5091921/Test5091921.java diff --git a/hotspot/test/compiler/5091921/Test6186134.java b/hotspot/test/compiler/c2/5091921/Test6186134.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6186134.java rename to hotspot/test/compiler/c2/5091921/Test6186134.java diff --git a/hotspot/test/compiler/5091921/Test6196102.java b/hotspot/test/compiler/c2/5091921/Test6196102.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6196102.java rename to hotspot/test/compiler/c2/5091921/Test6196102.java diff --git a/hotspot/test/compiler/5091921/Test6357214.java b/hotspot/test/compiler/c2/5091921/Test6357214.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6357214.java rename to hotspot/test/compiler/c2/5091921/Test6357214.java diff --git a/hotspot/test/compiler/5091921/Test6559156.java b/hotspot/test/compiler/c2/5091921/Test6559156.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6559156.java rename to hotspot/test/compiler/c2/5091921/Test6559156.java diff --git a/hotspot/test/compiler/5091921/Test6753639.java b/hotspot/test/compiler/c2/5091921/Test6753639.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6753639.java rename to hotspot/test/compiler/c2/5091921/Test6753639.java diff --git a/hotspot/test/compiler/5091921/Test6850611.java b/hotspot/test/compiler/c2/5091921/Test6850611.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6850611.java rename to hotspot/test/compiler/c2/5091921/Test6850611.java diff --git a/hotspot/test/compiler/5091921/Test6890943.java b/hotspot/test/compiler/c2/5091921/Test6890943.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6890943.java rename to hotspot/test/compiler/c2/5091921/Test6890943.java diff --git a/hotspot/test/compiler/5091921/Test6897150.java b/hotspot/test/compiler/c2/5091921/Test6897150.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6897150.java rename to hotspot/test/compiler/c2/5091921/Test6897150.java diff --git a/hotspot/test/compiler/5091921/Test6905845.java b/hotspot/test/compiler/c2/5091921/Test6905845.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6905845.java rename to hotspot/test/compiler/c2/5091921/Test6905845.java diff --git a/hotspot/test/compiler/5091921/Test6931567.java b/hotspot/test/compiler/c2/5091921/Test6931567.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6931567.java rename to hotspot/test/compiler/c2/5091921/Test6931567.java diff --git a/hotspot/test/compiler/5091921/Test6935022.java b/hotspot/test/compiler/c2/5091921/Test6935022.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6935022.java rename to hotspot/test/compiler/c2/5091921/Test6935022.java diff --git a/hotspot/test/compiler/5091921/Test6959129.java b/hotspot/test/compiler/c2/5091921/Test6959129.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6959129.java rename to hotspot/test/compiler/c2/5091921/Test6959129.java diff --git a/hotspot/test/compiler/5091921/Test6985295.java b/hotspot/test/compiler/c2/5091921/Test6985295.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6985295.java rename to hotspot/test/compiler/c2/5091921/Test6985295.java diff --git a/hotspot/test/compiler/5091921/Test6992759.java b/hotspot/test/compiler/c2/5091921/Test6992759.java similarity index 100% rename from hotspot/test/compiler/5091921/Test6992759.java rename to hotspot/test/compiler/c2/5091921/Test6992759.java diff --git a/hotspot/test/compiler/5091921/Test7005594.java b/hotspot/test/compiler/c2/5091921/Test7005594.java similarity index 100% rename from hotspot/test/compiler/5091921/Test7005594.java rename to hotspot/test/compiler/c2/5091921/Test7005594.java diff --git a/hotspot/test/compiler/5091921/Test7005594.sh b/hotspot/test/compiler/c2/5091921/Test7005594.sh similarity index 98% rename from hotspot/test/compiler/5091921/Test7005594.sh rename to hotspot/test/compiler/c2/5091921/Test7005594.sh index 4fa458ca723..cd6fd807b9d 100644 --- a/hotspot/test/compiler/5091921/Test7005594.sh +++ b/hotspot/test/compiler/c2/5091921/Test7005594.sh @@ -30,7 +30,7 @@ then fi echo "TESTSRC=${TESTSRC}" ## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh +. ${TESTSRC}/../../../test_env.sh # Amount of physical memory in megabytes MEM=0 diff --git a/hotspot/test/compiler/5091921/Test7020614.java b/hotspot/test/compiler/c2/5091921/Test7020614.java similarity index 100% rename from hotspot/test/compiler/5091921/Test7020614.java rename to hotspot/test/compiler/c2/5091921/Test7020614.java diff --git a/hotspot/test/compiler/5091921/input6890943.txt b/hotspot/test/compiler/c2/5091921/input6890943.txt similarity index 100% rename from hotspot/test/compiler/5091921/input6890943.txt rename to hotspot/test/compiler/c2/5091921/input6890943.txt diff --git a/hotspot/test/compiler/5091921/output6890943.txt b/hotspot/test/compiler/c2/5091921/output6890943.txt similarity index 100% rename from hotspot/test/compiler/5091921/output6890943.txt rename to hotspot/test/compiler/c2/5091921/output6890943.txt diff --git a/hotspot/test/compiler/6340864/TestByteVect.java b/hotspot/test/compiler/c2/6340864/TestByteVect.java similarity index 100% rename from hotspot/test/compiler/6340864/TestByteVect.java rename to hotspot/test/compiler/c2/6340864/TestByteVect.java diff --git a/hotspot/test/compiler/6340864/TestDoubleVect.java b/hotspot/test/compiler/c2/6340864/TestDoubleVect.java similarity index 100% rename from hotspot/test/compiler/6340864/TestDoubleVect.java rename to hotspot/test/compiler/c2/6340864/TestDoubleVect.java diff --git a/hotspot/test/compiler/6340864/TestFloatVect.java b/hotspot/test/compiler/c2/6340864/TestFloatVect.java similarity index 100% rename from hotspot/test/compiler/6340864/TestFloatVect.java rename to hotspot/test/compiler/c2/6340864/TestFloatVect.java diff --git a/hotspot/test/compiler/6340864/TestIntVect.java b/hotspot/test/compiler/c2/6340864/TestIntVect.java similarity index 100% rename from hotspot/test/compiler/6340864/TestIntVect.java rename to hotspot/test/compiler/c2/6340864/TestIntVect.java diff --git a/hotspot/test/compiler/6340864/TestLongVect.java b/hotspot/test/compiler/c2/6340864/TestLongVect.java similarity index 100% rename from hotspot/test/compiler/6340864/TestLongVect.java rename to hotspot/test/compiler/c2/6340864/TestLongVect.java diff --git a/hotspot/test/compiler/6340864/TestShortVect.java b/hotspot/test/compiler/c2/6340864/TestShortVect.java similarity index 100% rename from hotspot/test/compiler/6340864/TestShortVect.java rename to hotspot/test/compiler/c2/6340864/TestShortVect.java diff --git a/hotspot/test/compiler/6443505/Test6443505.java b/hotspot/test/compiler/c2/6443505/Test6443505.java similarity index 100% rename from hotspot/test/compiler/6443505/Test6443505.java rename to hotspot/test/compiler/c2/6443505/Test6443505.java diff --git a/hotspot/test/compiler/6589834/InlinedArrayCloneTestCase.java b/hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java similarity index 100% rename from hotspot/test/compiler/6589834/InlinedArrayCloneTestCase.java rename to hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java diff --git a/hotspot/test/compiler/6589834/Test_ia32.java b/hotspot/test/compiler/c2/6589834/Test_ia32.java similarity index 100% rename from hotspot/test/compiler/6589834/Test_ia32.java rename to hotspot/test/compiler/c2/6589834/Test_ia32.java diff --git a/hotspot/test/compiler/6603011/Test.java b/hotspot/test/compiler/c2/6603011/Test.java similarity index 100% rename from hotspot/test/compiler/6603011/Test.java rename to hotspot/test/compiler/c2/6603011/Test.java diff --git a/hotspot/test/compiler/6636138/Test1.java b/hotspot/test/compiler/c2/6636138/Test1.java similarity index 100% rename from hotspot/test/compiler/6636138/Test1.java rename to hotspot/test/compiler/c2/6636138/Test1.java diff --git a/hotspot/test/compiler/6636138/Test2.java b/hotspot/test/compiler/c2/6636138/Test2.java similarity index 100% rename from hotspot/test/compiler/6636138/Test2.java rename to hotspot/test/compiler/c2/6636138/Test2.java diff --git a/hotspot/test/compiler/6646019/Test.java b/hotspot/test/compiler/c2/6646019/Test.java similarity index 100% rename from hotspot/test/compiler/6646019/Test.java rename to hotspot/test/compiler/c2/6646019/Test.java diff --git a/hotspot/test/compiler/6646020/Tester.java b/hotspot/test/compiler/c2/6646020/Tester.java similarity index 100% rename from hotspot/test/compiler/6646020/Tester.java rename to hotspot/test/compiler/c2/6646020/Tester.java diff --git a/hotspot/test/compiler/6661247/Test.java b/hotspot/test/compiler/c2/6661247/Test.java similarity index 100% rename from hotspot/test/compiler/6661247/Test.java rename to hotspot/test/compiler/c2/6661247/Test.java diff --git a/hotspot/test/compiler/6663621/IVTest.java b/hotspot/test/compiler/c2/6663621/IVTest.java similarity index 100% rename from hotspot/test/compiler/6663621/IVTest.java rename to hotspot/test/compiler/c2/6663621/IVTest.java diff --git a/hotspot/test/compiler/6663848/Tester.java b/hotspot/test/compiler/c2/6663848/Tester.java similarity index 100% rename from hotspot/test/compiler/6663848/Tester.java rename to hotspot/test/compiler/c2/6663848/Tester.java diff --git a/hotspot/test/compiler/6663854/Test6663854.java b/hotspot/test/compiler/c2/6663854/Test6663854.java similarity index 100% rename from hotspot/test/compiler/6663854/Test6663854.java rename to hotspot/test/compiler/c2/6663854/Test6663854.java diff --git a/hotspot/test/compiler/6695810/Test.java b/hotspot/test/compiler/c2/6695810/Test.java similarity index 100% rename from hotspot/test/compiler/6695810/Test.java rename to hotspot/test/compiler/c2/6695810/Test.java diff --git a/hotspot/test/compiler/6700047/Test6700047.java b/hotspot/test/compiler/c2/6700047/Test6700047.java similarity index 100% rename from hotspot/test/compiler/6700047/Test6700047.java rename to hotspot/test/compiler/c2/6700047/Test6700047.java diff --git a/hotspot/test/compiler/6711100/Test.java b/hotspot/test/compiler/c2/6711100/Test.java similarity index 100% rename from hotspot/test/compiler/6711100/Test.java rename to hotspot/test/compiler/c2/6711100/Test.java diff --git a/hotspot/test/compiler/6711117/Test.java b/hotspot/test/compiler/c2/6711117/Test.java similarity index 100% rename from hotspot/test/compiler/6711117/Test.java rename to hotspot/test/compiler/c2/6711117/Test.java diff --git a/hotspot/test/compiler/6712835/Test6712835.java b/hotspot/test/compiler/c2/6712835/Test6712835.java similarity index 100% rename from hotspot/test/compiler/6712835/Test6712835.java rename to hotspot/test/compiler/c2/6712835/Test6712835.java diff --git a/hotspot/test/compiler/6714694/Tester.java b/hotspot/test/compiler/c2/6714694/Tester.java similarity index 100% rename from hotspot/test/compiler/6714694/Tester.java rename to hotspot/test/compiler/c2/6714694/Tester.java diff --git a/hotspot/test/compiler/6724218/Test.java b/hotspot/test/compiler/c2/6724218/Test.java similarity index 100% rename from hotspot/test/compiler/6724218/Test.java rename to hotspot/test/compiler/c2/6724218/Test.java diff --git a/hotspot/test/compiler/6732154/Test6732154.java b/hotspot/test/compiler/c2/6732154/Test6732154.java similarity index 100% rename from hotspot/test/compiler/6732154/Test6732154.java rename to hotspot/test/compiler/c2/6732154/Test6732154.java diff --git a/hotspot/test/compiler/6741738/Tester.java b/hotspot/test/compiler/c2/6741738/Tester.java similarity index 100% rename from hotspot/test/compiler/6741738/Tester.java rename to hotspot/test/compiler/c2/6741738/Tester.java diff --git a/hotspot/test/compiler/6772683/InterruptedTest.java b/hotspot/test/compiler/c2/6772683/InterruptedTest.java similarity index 100% rename from hotspot/test/compiler/6772683/InterruptedTest.java rename to hotspot/test/compiler/c2/6772683/InterruptedTest.java diff --git a/hotspot/test/compiler/6792161/Test6792161.java b/hotspot/test/compiler/c2/6792161/Test6792161.java similarity index 100% rename from hotspot/test/compiler/6792161/Test6792161.java rename to hotspot/test/compiler/c2/6792161/Test6792161.java diff --git a/hotspot/test/compiler/6795362/Test6795362.java b/hotspot/test/compiler/c2/6795362/Test6795362.java similarity index 100% rename from hotspot/test/compiler/6795362/Test6795362.java rename to hotspot/test/compiler/c2/6795362/Test6795362.java diff --git a/hotspot/test/compiler/6796786/Test6796786.java b/hotspot/test/compiler/c2/6796786/Test6796786.java similarity index 100% rename from hotspot/test/compiler/6796786/Test6796786.java rename to hotspot/test/compiler/c2/6796786/Test6796786.java diff --git a/hotspot/test/compiler/6799693/Test.java b/hotspot/test/compiler/c2/6799693/Test.java similarity index 100% rename from hotspot/test/compiler/6799693/Test.java rename to hotspot/test/compiler/c2/6799693/Test.java diff --git a/hotspot/test/compiler/6800154/Test6800154.java b/hotspot/test/compiler/c2/6800154/Test6800154.java similarity index 100% rename from hotspot/test/compiler/6800154/Test6800154.java rename to hotspot/test/compiler/c2/6800154/Test6800154.java diff --git a/hotspot/test/compiler/6805724/Test6805724.java b/hotspot/test/compiler/c2/6805724/Test6805724.java similarity index 100% rename from hotspot/test/compiler/6805724/Test6805724.java rename to hotspot/test/compiler/c2/6805724/Test6805724.java diff --git a/hotspot/test/compiler/6823453/Test.java b/hotspot/test/compiler/c2/6823453/Test.java similarity index 100% rename from hotspot/test/compiler/6823453/Test.java rename to hotspot/test/compiler/c2/6823453/Test.java diff --git a/hotspot/test/compiler/6832293/Test.java b/hotspot/test/compiler/c2/6832293/Test.java similarity index 100% rename from hotspot/test/compiler/6832293/Test.java rename to hotspot/test/compiler/c2/6832293/Test.java diff --git a/hotspot/test/compiler/6837011/Test6837011.java b/hotspot/test/compiler/c2/6837011/Test6837011.java similarity index 100% rename from hotspot/test/compiler/6837011/Test6837011.java rename to hotspot/test/compiler/c2/6837011/Test6837011.java diff --git a/hotspot/test/compiler/6837094/Test.java b/hotspot/test/compiler/c2/6837094/Test.java similarity index 100% rename from hotspot/test/compiler/6837094/Test.java rename to hotspot/test/compiler/c2/6837094/Test.java diff --git a/hotspot/test/compiler/6843752/Test.java b/hotspot/test/compiler/c2/6843752/Test.java similarity index 100% rename from hotspot/test/compiler/6843752/Test.java rename to hotspot/test/compiler/c2/6843752/Test.java diff --git a/hotspot/test/compiler/6851282/Test.java b/hotspot/test/compiler/c2/6851282/Test.java similarity index 100% rename from hotspot/test/compiler/6851282/Test.java rename to hotspot/test/compiler/c2/6851282/Test.java diff --git a/hotspot/test/compiler/6852078/Test6852078.java b/hotspot/test/compiler/c2/6852078/Test6852078.java similarity index 100% rename from hotspot/test/compiler/6852078/Test6852078.java rename to hotspot/test/compiler/c2/6852078/Test6852078.java diff --git a/hotspot/test/compiler/6857159/Test6857159.java b/hotspot/test/compiler/c2/6857159/Test6857159.java similarity index 100% rename from hotspot/test/compiler/6857159/Test6857159.java rename to hotspot/test/compiler/c2/6857159/Test6857159.java diff --git a/hotspot/test/compiler/6857159/Test6857159.sh b/hotspot/test/compiler/c2/6857159/Test6857159.sh similarity index 98% rename from hotspot/test/compiler/6857159/Test6857159.sh rename to hotspot/test/compiler/c2/6857159/Test6857159.sh index cb790127c9c..0762fe17ca8 100644 --- a/hotspot/test/compiler/6857159/Test6857159.sh +++ b/hotspot/test/compiler/c2/6857159/Test6857159.sh @@ -30,7 +30,7 @@ then fi echo "TESTSRC=${TESTSRC}" ## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh +. ${TESTSRC}/../../../test_env.sh set -x diff --git a/hotspot/test/compiler/6863155/Test6863155.java b/hotspot/test/compiler/c2/6863155/Test6863155.java similarity index 100% rename from hotspot/test/compiler/6863155/Test6863155.java rename to hotspot/test/compiler/c2/6863155/Test6863155.java diff --git a/hotspot/test/compiler/6865031/Test.java b/hotspot/test/compiler/c2/6865031/Test.java similarity index 100% rename from hotspot/test/compiler/6865031/Test.java rename to hotspot/test/compiler/c2/6865031/Test.java diff --git a/hotspot/test/compiler/6866651/Test.java b/hotspot/test/compiler/c2/6866651/Test.java similarity index 100% rename from hotspot/test/compiler/6866651/Test.java rename to hotspot/test/compiler/c2/6866651/Test.java diff --git a/hotspot/test/compiler/6877254/Test.java b/hotspot/test/compiler/c2/6877254/Test.java similarity index 100% rename from hotspot/test/compiler/6877254/Test.java rename to hotspot/test/compiler/c2/6877254/Test.java diff --git a/hotspot/test/compiler/6880034/Test6880034.java b/hotspot/test/compiler/c2/6880034/Test6880034.java similarity index 100% rename from hotspot/test/compiler/6880034/Test6880034.java rename to hotspot/test/compiler/c2/6880034/Test6880034.java diff --git a/hotspot/test/compiler/6885584/Test6885584.java b/hotspot/test/compiler/c2/6885584/Test6885584.java similarity index 100% rename from hotspot/test/compiler/6885584/Test6885584.java rename to hotspot/test/compiler/c2/6885584/Test6885584.java diff --git a/hotspot/test/compiler/6894807/IsInstanceTest.java b/hotspot/test/compiler/c2/6894807/IsInstanceTest.java similarity index 100% rename from hotspot/test/compiler/6894807/IsInstanceTest.java rename to hotspot/test/compiler/c2/6894807/IsInstanceTest.java diff --git a/hotspot/test/compiler/6894807/Test6894807.sh b/hotspot/test/compiler/c2/6894807/Test6894807.sh similarity index 97% rename from hotspot/test/compiler/6894807/Test6894807.sh rename to hotspot/test/compiler/c2/6894807/Test6894807.sh index 609af074eda..bf10ba263bf 100644 --- a/hotspot/test/compiler/6894807/Test6894807.sh +++ b/hotspot/test/compiler/c2/6894807/Test6894807.sh @@ -30,7 +30,7 @@ fi echo "TESTSRC=${TESTSRC}" ## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh +. ${TESTSRC}/../../../test_env.sh ${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} IsInstanceTest > test.out 2>&1 diff --git a/hotspot/test/compiler/6901572/Test.java b/hotspot/test/compiler/c2/6901572/Test.java similarity index 100% rename from hotspot/test/compiler/6901572/Test.java rename to hotspot/test/compiler/c2/6901572/Test.java diff --git a/hotspot/test/compiler/6910484/Test.java b/hotspot/test/compiler/c2/6910484/Test.java similarity index 100% rename from hotspot/test/compiler/6910484/Test.java rename to hotspot/test/compiler/c2/6910484/Test.java diff --git a/hotspot/test/compiler/6910605/Test.java b/hotspot/test/compiler/c2/6910605/Test.java similarity index 100% rename from hotspot/test/compiler/6910605/Test.java rename to hotspot/test/compiler/c2/6910605/Test.java diff --git a/hotspot/test/compiler/6910618/Test.java b/hotspot/test/compiler/c2/6910618/Test.java similarity index 100% rename from hotspot/test/compiler/6910618/Test.java rename to hotspot/test/compiler/c2/6910618/Test.java diff --git a/hotspot/test/compiler/6912517/Test.java b/hotspot/test/compiler/c2/6912517/Test.java similarity index 100% rename from hotspot/test/compiler/6912517/Test.java rename to hotspot/test/compiler/c2/6912517/Test.java diff --git a/hotspot/test/compiler/6916644/Test6916644.java b/hotspot/test/compiler/c2/6916644/Test6916644.java similarity index 100% rename from hotspot/test/compiler/6916644/Test6916644.java rename to hotspot/test/compiler/c2/6916644/Test6916644.java diff --git a/hotspot/test/compiler/6921969/TestMultiplyLongHiZero.java b/hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java similarity index 100% rename from hotspot/test/compiler/6921969/TestMultiplyLongHiZero.java rename to hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java diff --git a/hotspot/test/compiler/6930043/Test6930043.java b/hotspot/test/compiler/c2/6930043/Test6930043.java similarity index 100% rename from hotspot/test/compiler/6930043/Test6930043.java rename to hotspot/test/compiler/c2/6930043/Test6930043.java diff --git a/hotspot/test/compiler/6946040/TestCharShortByteSwap.java b/hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java similarity index 100% rename from hotspot/test/compiler/6946040/TestCharShortByteSwap.java rename to hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java diff --git a/hotspot/test/compiler/6956668/Test6956668.java b/hotspot/test/compiler/c2/6956668/Test6956668.java similarity index 100% rename from hotspot/test/compiler/6956668/Test6956668.java rename to hotspot/test/compiler/c2/6956668/Test6956668.java diff --git a/hotspot/test/compiler/6958485/Test.java b/hotspot/test/compiler/c2/6958485/Test.java similarity index 100% rename from hotspot/test/compiler/6958485/Test.java rename to hotspot/test/compiler/c2/6958485/Test.java diff --git a/hotspot/test/compiler/6968348/Test6968348.java b/hotspot/test/compiler/c2/6968348/Test6968348.java similarity index 100% rename from hotspot/test/compiler/6968348/Test6968348.java rename to hotspot/test/compiler/c2/6968348/Test6968348.java diff --git a/hotspot/test/compiler/6973329/Test.java b/hotspot/test/compiler/c2/6973329/Test.java similarity index 100% rename from hotspot/test/compiler/6973329/Test.java rename to hotspot/test/compiler/c2/6973329/Test.java diff --git a/hotspot/test/compiler/7002666/Test7002666.java b/hotspot/test/compiler/c2/7002666/Test7002666.java similarity index 100% rename from hotspot/test/compiler/7002666/Test7002666.java rename to hotspot/test/compiler/c2/7002666/Test7002666.java diff --git a/hotspot/test/compiler/7009359/Test7009359.java b/hotspot/test/compiler/c2/7009359/Test7009359.java similarity index 100% rename from hotspot/test/compiler/7009359/Test7009359.java rename to hotspot/test/compiler/c2/7009359/Test7009359.java diff --git a/hotspot/test/compiler/7017746/Test.java b/hotspot/test/compiler/c2/7017746/Test.java similarity index 100% rename from hotspot/test/compiler/7017746/Test.java rename to hotspot/test/compiler/c2/7017746/Test.java diff --git a/hotspot/test/compiler/7024475/Test7024475.java b/hotspot/test/compiler/c2/7024475/Test7024475.java similarity index 100% rename from hotspot/test/compiler/7024475/Test7024475.java rename to hotspot/test/compiler/c2/7024475/Test7024475.java diff --git a/hotspot/test/compiler/7029152/Test.java b/hotspot/test/compiler/c2/7029152/Test.java similarity index 100% rename from hotspot/test/compiler/7029152/Test.java rename to hotspot/test/compiler/c2/7029152/Test.java diff --git a/hotspot/test/compiler/7041100/Test7041100.java b/hotspot/test/compiler/c2/7041100/Test7041100.java similarity index 100% rename from hotspot/test/compiler/7041100/Test7041100.java rename to hotspot/test/compiler/c2/7041100/Test7041100.java diff --git a/hotspot/test/compiler/7046096/Test7046096.java b/hotspot/test/compiler/c2/7046096/Test7046096.java similarity index 100% rename from hotspot/test/compiler/7046096/Test7046096.java rename to hotspot/test/compiler/c2/7046096/Test7046096.java diff --git a/hotspot/test/compiler/7047069/Test7047069.java b/hotspot/test/compiler/c2/7047069/Test7047069.java similarity index 100% rename from hotspot/test/compiler/7047069/Test7047069.java rename to hotspot/test/compiler/c2/7047069/Test7047069.java diff --git a/hotspot/test/compiler/7048332/Test7048332.java b/hotspot/test/compiler/c2/7048332/Test7048332.java similarity index 100% rename from hotspot/test/compiler/7048332/Test7048332.java rename to hotspot/test/compiler/c2/7048332/Test7048332.java diff --git a/hotspot/test/compiler/7068051/Test7068051.java b/hotspot/test/compiler/c2/7068051/Test7068051.java similarity index 100% rename from hotspot/test/compiler/7068051/Test7068051.java rename to hotspot/test/compiler/c2/7068051/Test7068051.java diff --git a/hotspot/test/compiler/7070134/Stemmer.java b/hotspot/test/compiler/c2/7070134/Stemmer.java similarity index 100% rename from hotspot/test/compiler/7070134/Stemmer.java rename to hotspot/test/compiler/c2/7070134/Stemmer.java diff --git a/hotspot/test/compiler/7070134/Test7070134.sh b/hotspot/test/compiler/c2/7070134/Test7070134.sh similarity index 97% rename from hotspot/test/compiler/7070134/Test7070134.sh rename to hotspot/test/compiler/c2/7070134/Test7070134.sh index 87618616c97..b79b5b16e5a 100644 --- a/hotspot/test/compiler/7070134/Test7070134.sh +++ b/hotspot/test/compiler/c2/7070134/Test7070134.sh @@ -30,7 +30,7 @@ then fi echo "TESTSRC=${TESTSRC}" ## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh +. ${TESTSRC}/../../../test_env.sh set -x diff --git a/hotspot/test/compiler/7070134/words b/hotspot/test/compiler/c2/7070134/words similarity index 100% rename from hotspot/test/compiler/7070134/words rename to hotspot/test/compiler/c2/7070134/words diff --git a/hotspot/test/compiler/7110586/Test7110586.java b/hotspot/test/compiler/c2/7110586/Test7110586.java similarity index 100% rename from hotspot/test/compiler/7110586/Test7110586.java rename to hotspot/test/compiler/c2/7110586/Test7110586.java diff --git a/hotspot/test/compiler/7125879/Test7125879.java b/hotspot/test/compiler/c2/7125879/Test7125879.java similarity index 100% rename from hotspot/test/compiler/7125879/Test7125879.java rename to hotspot/test/compiler/c2/7125879/Test7125879.java diff --git a/hotspot/test/compiler/7160610/Test7160610.java b/hotspot/test/compiler/c2/7160610/Test7160610.java similarity index 100% rename from hotspot/test/compiler/7160610/Test7160610.java rename to hotspot/test/compiler/c2/7160610/Test7160610.java diff --git a/hotspot/test/compiler/7169782/Test7169782.java b/hotspot/test/compiler/c2/7169782/Test7169782.java similarity index 100% rename from hotspot/test/compiler/7169782/Test7169782.java rename to hotspot/test/compiler/c2/7169782/Test7169782.java diff --git a/hotspot/test/compiler/7174363/Test7174363.java b/hotspot/test/compiler/c2/7174363/Test7174363.java similarity index 100% rename from hotspot/test/compiler/7174363/Test7174363.java rename to hotspot/test/compiler/c2/7174363/Test7174363.java diff --git a/hotspot/test/compiler/7177917/Test7177917.java b/hotspot/test/compiler/c2/7177917/Test7177917.java similarity index 100% rename from hotspot/test/compiler/7177917/Test7177917.java rename to hotspot/test/compiler/c2/7177917/Test7177917.java diff --git a/hotspot/test/compiler/7179138/Test7179138_1.java b/hotspot/test/compiler/c2/7179138/Test7179138_1.java similarity index 100% rename from hotspot/test/compiler/7179138/Test7179138_1.java rename to hotspot/test/compiler/c2/7179138/Test7179138_1.java diff --git a/hotspot/test/compiler/7179138/Test7179138_2.java b/hotspot/test/compiler/c2/7179138/Test7179138_2.java similarity index 100% rename from hotspot/test/compiler/7179138/Test7179138_2.java rename to hotspot/test/compiler/c2/7179138/Test7179138_2.java diff --git a/hotspot/test/compiler/7190310/Test7190310.java b/hotspot/test/compiler/c2/7190310/Test7190310.java similarity index 100% rename from hotspot/test/compiler/7190310/Test7190310.java rename to hotspot/test/compiler/c2/7190310/Test7190310.java diff --git a/hotspot/test/compiler/7190310/Test7190310_unsafe.java b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java similarity index 100% rename from hotspot/test/compiler/7190310/Test7190310_unsafe.java rename to hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java diff --git a/hotspot/test/compiler/7192963/TestByteVect.java b/hotspot/test/compiler/c2/7192963/TestByteVect.java similarity index 100% rename from hotspot/test/compiler/7192963/TestByteVect.java rename to hotspot/test/compiler/c2/7192963/TestByteVect.java diff --git a/hotspot/test/compiler/7192963/TestDoubleVect.java b/hotspot/test/compiler/c2/7192963/TestDoubleVect.java similarity index 100% rename from hotspot/test/compiler/7192963/TestDoubleVect.java rename to hotspot/test/compiler/c2/7192963/TestDoubleVect.java diff --git a/hotspot/test/compiler/7192963/TestFloatVect.java b/hotspot/test/compiler/c2/7192963/TestFloatVect.java similarity index 100% rename from hotspot/test/compiler/7192963/TestFloatVect.java rename to hotspot/test/compiler/c2/7192963/TestFloatVect.java diff --git a/hotspot/test/compiler/7192963/TestIntVect.java b/hotspot/test/compiler/c2/7192963/TestIntVect.java similarity index 100% rename from hotspot/test/compiler/7192963/TestIntVect.java rename to hotspot/test/compiler/c2/7192963/TestIntVect.java diff --git a/hotspot/test/compiler/7192963/TestLongVect.java b/hotspot/test/compiler/c2/7192963/TestLongVect.java similarity index 100% rename from hotspot/test/compiler/7192963/TestLongVect.java rename to hotspot/test/compiler/c2/7192963/TestLongVect.java diff --git a/hotspot/test/compiler/7192963/TestShortVect.java b/hotspot/test/compiler/c2/7192963/TestShortVect.java similarity index 100% rename from hotspot/test/compiler/7192963/TestShortVect.java rename to hotspot/test/compiler/c2/7192963/TestShortVect.java diff --git a/hotspot/test/compiler/7199742/Test7199742.java b/hotspot/test/compiler/c2/7199742/Test7199742.java similarity index 100% rename from hotspot/test/compiler/7199742/Test7199742.java rename to hotspot/test/compiler/c2/7199742/Test7199742.java diff --git a/hotspot/test/compiler/7200264/Test7200264.sh b/hotspot/test/compiler/c2/7200264/Test7200264.sh similarity index 99% rename from hotspot/test/compiler/7200264/Test7200264.sh rename to hotspot/test/compiler/c2/7200264/Test7200264.sh index 5e7e508a5f2..a8fee1b7835 100644 --- a/hotspot/test/compiler/7200264/Test7200264.sh +++ b/hotspot/test/compiler/c2/7200264/Test7200264.sh @@ -31,7 +31,7 @@ then fi echo "TESTSRC=${TESTSRC}" ## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh +. ${TESTSRC}/../../../test_env.sh ${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xinternalversion | sed 's/amd64/x86/' | grep "x86" | grep "Server VM" | grep "debug" diff --git a/hotspot/test/compiler/7200264/TestIntVect.java b/hotspot/test/compiler/c2/7200264/TestIntVect.java similarity index 100% rename from hotspot/test/compiler/7200264/TestIntVect.java rename to hotspot/test/compiler/c2/7200264/TestIntVect.java diff --git a/hotspot/test/compiler/8000805/Test8000805.java b/hotspot/test/compiler/c2/8000805/Test8000805.java similarity index 100% rename from hotspot/test/compiler/8000805/Test8000805.java rename to hotspot/test/compiler/c2/8000805/Test8000805.java diff --git a/hotspot/test/compiler/8002069/Test8002069.java b/hotspot/test/compiler/c2/8002069/Test8002069.java similarity index 100% rename from hotspot/test/compiler/8002069/Test8002069.java rename to hotspot/test/compiler/c2/8002069/Test8002069.java diff --git a/hotspot/test/compiler/8004741/Test8004741.java b/hotspot/test/compiler/c2/8004741/Test8004741.java similarity index 100% rename from hotspot/test/compiler/8004741/Test8004741.java rename to hotspot/test/compiler/c2/8004741/Test8004741.java diff --git a/hotspot/test/compiler/8004867/TestIntAtomicCAS.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java similarity index 100% rename from hotspot/test/compiler/8004867/TestIntAtomicCAS.java rename to hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java diff --git a/hotspot/test/compiler/8004867/TestIntAtomicOrdered.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java similarity index 100% rename from hotspot/test/compiler/8004867/TestIntAtomicOrdered.java rename to hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java diff --git a/hotspot/test/compiler/8004867/TestIntAtomicVolatile.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java similarity index 100% rename from hotspot/test/compiler/8004867/TestIntAtomicVolatile.java rename to hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java similarity index 100% rename from hotspot/test/compiler/8004867/TestIntUnsafeCAS.java rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeOrdered.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java similarity index 100% rename from hotspot/test/compiler/8004867/TestIntUnsafeOrdered.java rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java similarity index 100% rename from hotspot/test/compiler/8004867/TestIntUnsafeVolatile.java rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java diff --git a/hotspot/test/compiler/8005956/PolynomialRoot.java b/hotspot/test/compiler/c2/8005956/PolynomialRoot.java similarity index 100% rename from hotspot/test/compiler/8005956/PolynomialRoot.java rename to hotspot/test/compiler/c2/8005956/PolynomialRoot.java diff --git a/hotspot/test/compiler/8007294/Test8007294.java b/hotspot/test/compiler/c2/8007294/Test8007294.java similarity index 100% rename from hotspot/test/compiler/8007294/Test8007294.java rename to hotspot/test/compiler/c2/8007294/Test8007294.java diff --git a/hotspot/test/compiler/8007722/Test8007722.java b/hotspot/test/compiler/c2/8007722/Test8007722.java similarity index 100% rename from hotspot/test/compiler/8007722/Test8007722.java rename to hotspot/test/compiler/c2/8007722/Test8007722.java diff --git a/hotspot/test/compiler/6378821/Test6378821.java b/hotspot/test/compiler/codegen/6378821/Test6378821.java similarity index 100% rename from hotspot/test/compiler/6378821/Test6378821.java rename to hotspot/test/compiler/codegen/6378821/Test6378821.java diff --git a/hotspot/test/compiler/6431242/Test.java b/hotspot/test/compiler/codegen/6431242/Test.java similarity index 100% rename from hotspot/test/compiler/6431242/Test.java rename to hotspot/test/compiler/codegen/6431242/Test.java diff --git a/hotspot/test/compiler/6797305/Test6797305.java b/hotspot/test/compiler/codegen/6797305/Test6797305.java similarity index 100% rename from hotspot/test/compiler/6797305/Test6797305.java rename to hotspot/test/compiler/codegen/6797305/Test6797305.java diff --git a/hotspot/test/compiler/6814842/Test6814842.java b/hotspot/test/compiler/codegen/6814842/Test6814842.java similarity index 100% rename from hotspot/test/compiler/6814842/Test6814842.java rename to hotspot/test/compiler/codegen/6814842/Test6814842.java diff --git a/hotspot/test/compiler/6823354/Test6823354.java b/hotspot/test/compiler/codegen/6823354/Test6823354.java similarity index 100% rename from hotspot/test/compiler/6823354/Test6823354.java rename to hotspot/test/compiler/codegen/6823354/Test6823354.java diff --git a/hotspot/test/compiler/6875866/Test.java b/hotspot/test/compiler/codegen/6875866/Test.java similarity index 100% rename from hotspot/test/compiler/6875866/Test.java rename to hotspot/test/compiler/codegen/6875866/Test.java diff --git a/hotspot/test/compiler/6879902/Test6879902.java b/hotspot/test/compiler/codegen/6879902/Test6879902.java similarity index 100% rename from hotspot/test/compiler/6879902/Test6879902.java rename to hotspot/test/compiler/codegen/6879902/Test6879902.java diff --git a/hotspot/test/compiler/6896617/Test6896617.java b/hotspot/test/compiler/codegen/6896617/Test6896617.java similarity index 100% rename from hotspot/test/compiler/6896617/Test6896617.java rename to hotspot/test/compiler/codegen/6896617/Test6896617.java diff --git a/hotspot/test/compiler/6909839/Test6909839.java b/hotspot/test/compiler/codegen/6909839/Test6909839.java similarity index 100% rename from hotspot/test/compiler/6909839/Test6909839.java rename to hotspot/test/compiler/codegen/6909839/Test6909839.java diff --git a/hotspot/test/compiler/6935535/Test.java b/hotspot/test/compiler/codegen/6935535/Test.java similarity index 100% rename from hotspot/test/compiler/6935535/Test.java rename to hotspot/test/compiler/codegen/6935535/Test.java diff --git a/hotspot/test/compiler/6942326/Test.java b/hotspot/test/compiler/codegen/6942326/Test.java similarity index 100% rename from hotspot/test/compiler/6942326/Test.java rename to hotspot/test/compiler/codegen/6942326/Test.java diff --git a/hotspot/test/compiler/7009231/Test7009231.java b/hotspot/test/compiler/codegen/7009231/Test7009231.java similarity index 100% rename from hotspot/test/compiler/7009231/Test7009231.java rename to hotspot/test/compiler/codegen/7009231/Test7009231.java diff --git a/hotspot/test/compiler/7088419/CRCTest.java b/hotspot/test/compiler/codegen/7088419/CRCTest.java similarity index 100% rename from hotspot/test/compiler/7088419/CRCTest.java rename to hotspot/test/compiler/codegen/7088419/CRCTest.java diff --git a/hotspot/test/compiler/7100757/Test7100757.java b/hotspot/test/compiler/codegen/7100757/Test7100757.java similarity index 100% rename from hotspot/test/compiler/7100757/Test7100757.java rename to hotspot/test/compiler/codegen/7100757/Test7100757.java diff --git a/hotspot/test/compiler/7119644/TestBooleanVect.java b/hotspot/test/compiler/codegen/7119644/TestBooleanVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestBooleanVect.java rename to hotspot/test/compiler/codegen/7119644/TestBooleanVect.java diff --git a/hotspot/test/compiler/7119644/TestByteDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestByteDoubleVect.java rename to hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java diff --git a/hotspot/test/compiler/7119644/TestByteFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestByteFloatVect.java rename to hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java diff --git a/hotspot/test/compiler/7119644/TestByteIntVect.java b/hotspot/test/compiler/codegen/7119644/TestByteIntVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestByteIntVect.java rename to hotspot/test/compiler/codegen/7119644/TestByteIntVect.java diff --git a/hotspot/test/compiler/7119644/TestByteLongVect.java b/hotspot/test/compiler/codegen/7119644/TestByteLongVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestByteLongVect.java rename to hotspot/test/compiler/codegen/7119644/TestByteLongVect.java diff --git a/hotspot/test/compiler/7119644/TestByteShortVect.java b/hotspot/test/compiler/codegen/7119644/TestByteShortVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestByteShortVect.java rename to hotspot/test/compiler/codegen/7119644/TestByteShortVect.java diff --git a/hotspot/test/compiler/7119644/TestByteVect.java b/hotspot/test/compiler/codegen/7119644/TestByteVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestByteVect.java rename to hotspot/test/compiler/codegen/7119644/TestByteVect.java diff --git a/hotspot/test/compiler/7119644/TestCharShortVect.java b/hotspot/test/compiler/codegen/7119644/TestCharShortVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestCharShortVect.java rename to hotspot/test/compiler/codegen/7119644/TestCharShortVect.java diff --git a/hotspot/test/compiler/7119644/TestCharVect.java b/hotspot/test/compiler/codegen/7119644/TestCharVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestCharVect.java rename to hotspot/test/compiler/codegen/7119644/TestCharVect.java diff --git a/hotspot/test/compiler/7119644/TestDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestDoubleVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestDoubleVect.java rename to hotspot/test/compiler/codegen/7119644/TestDoubleVect.java diff --git a/hotspot/test/compiler/7119644/TestFloatDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestFloatDoubleVect.java rename to hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java diff --git a/hotspot/test/compiler/7119644/TestFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestFloatVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestFloatVect.java rename to hotspot/test/compiler/codegen/7119644/TestFloatVect.java diff --git a/hotspot/test/compiler/7119644/TestIntDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestIntDoubleVect.java rename to hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java diff --git a/hotspot/test/compiler/7119644/TestIntFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestIntFloatVect.java rename to hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java diff --git a/hotspot/test/compiler/7119644/TestIntLongVect.java b/hotspot/test/compiler/codegen/7119644/TestIntLongVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestIntLongVect.java rename to hotspot/test/compiler/codegen/7119644/TestIntLongVect.java diff --git a/hotspot/test/compiler/7119644/TestIntVect.java b/hotspot/test/compiler/codegen/7119644/TestIntVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestIntVect.java rename to hotspot/test/compiler/codegen/7119644/TestIntVect.java diff --git a/hotspot/test/compiler/7119644/TestLongDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestLongDoubleVect.java rename to hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java diff --git a/hotspot/test/compiler/7119644/TestLongFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestLongFloatVect.java rename to hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java diff --git a/hotspot/test/compiler/7119644/TestLongVect.java b/hotspot/test/compiler/codegen/7119644/TestLongVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestLongVect.java rename to hotspot/test/compiler/codegen/7119644/TestLongVect.java diff --git a/hotspot/test/compiler/7119644/TestShortDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestShortDoubleVect.java rename to hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java diff --git a/hotspot/test/compiler/7119644/TestShortFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestShortFloatVect.java rename to hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java diff --git a/hotspot/test/compiler/7119644/TestShortIntVect.java b/hotspot/test/compiler/codegen/7119644/TestShortIntVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestShortIntVect.java rename to hotspot/test/compiler/codegen/7119644/TestShortIntVect.java diff --git a/hotspot/test/compiler/7119644/TestShortLongVect.java b/hotspot/test/compiler/codegen/7119644/TestShortLongVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestShortLongVect.java rename to hotspot/test/compiler/codegen/7119644/TestShortLongVect.java diff --git a/hotspot/test/compiler/7119644/TestShortVect.java b/hotspot/test/compiler/codegen/7119644/TestShortVect.java similarity index 100% rename from hotspot/test/compiler/7119644/TestShortVect.java rename to hotspot/test/compiler/codegen/7119644/TestShortVect.java diff --git a/hotspot/test/compiler/7184394/TestAESBase.java b/hotspot/test/compiler/codegen/7184394/TestAESBase.java similarity index 100% rename from hotspot/test/compiler/7184394/TestAESBase.java rename to hotspot/test/compiler/codegen/7184394/TestAESBase.java diff --git a/hotspot/test/compiler/7184394/TestAESDecode.java b/hotspot/test/compiler/codegen/7184394/TestAESDecode.java similarity index 100% rename from hotspot/test/compiler/7184394/TestAESDecode.java rename to hotspot/test/compiler/codegen/7184394/TestAESDecode.java diff --git a/hotspot/test/compiler/7184394/TestAESEncode.java b/hotspot/test/compiler/codegen/7184394/TestAESEncode.java similarity index 100% rename from hotspot/test/compiler/7184394/TestAESEncode.java rename to hotspot/test/compiler/codegen/7184394/TestAESEncode.java diff --git a/hotspot/test/compiler/7184394/TestAESMain.java b/hotspot/test/compiler/codegen/7184394/TestAESMain.java similarity index 100% rename from hotspot/test/compiler/7184394/TestAESMain.java rename to hotspot/test/compiler/codegen/7184394/TestAESMain.java diff --git a/hotspot/test/compiler/8001183/TestCharVect.java b/hotspot/test/compiler/codegen/8001183/TestCharVect.java similarity index 100% rename from hotspot/test/compiler/8001183/TestCharVect.java rename to hotspot/test/compiler/codegen/8001183/TestCharVect.java diff --git a/hotspot/test/compiler/8005033/Test8005033.java b/hotspot/test/compiler/codegen/8005033/Test8005033.java similarity index 100% rename from hotspot/test/compiler/8005033/Test8005033.java rename to hotspot/test/compiler/codegen/8005033/Test8005033.java diff --git a/hotspot/test/compiler/8011901/Test8011901.java b/hotspot/test/compiler/codegen/8011901/Test8011901.java similarity index 100% rename from hotspot/test/compiler/8011901/Test8011901.java rename to hotspot/test/compiler/codegen/8011901/Test8011901.java diff --git a/hotspot/test/compiler/6934604/TestByteBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java similarity index 100% rename from hotspot/test/compiler/6934604/TestByteBoxing.java rename to hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java diff --git a/hotspot/test/compiler/6934604/TestDoubleBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java similarity index 100% rename from hotspot/test/compiler/6934604/TestDoubleBoxing.java rename to hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java diff --git a/hotspot/test/compiler/6934604/TestFloatBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java similarity index 100% rename from hotspot/test/compiler/6934604/TestFloatBoxing.java rename to hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java diff --git a/hotspot/test/compiler/6934604/TestIntBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java similarity index 100% rename from hotspot/test/compiler/6934604/TestIntBoxing.java rename to hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java diff --git a/hotspot/test/compiler/6934604/TestLongBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java similarity index 100% rename from hotspot/test/compiler/6934604/TestLongBoxing.java rename to hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java diff --git a/hotspot/test/compiler/6934604/TestShortBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java similarity index 100% rename from hotspot/test/compiler/6934604/TestShortBoxing.java rename to hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java diff --git a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java similarity index 100% rename from hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java rename to hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java diff --git a/hotspot/test/compiler/6689060/Test.java b/hotspot/test/compiler/escapeAnalysis/6689060/Test.java similarity index 100% rename from hotspot/test/compiler/6689060/Test.java rename to hotspot/test/compiler/escapeAnalysis/6689060/Test.java diff --git a/hotspot/test/compiler/6716441/Tester.java b/hotspot/test/compiler/escapeAnalysis/6716441/Tester.java similarity index 100% rename from hotspot/test/compiler/6716441/Tester.java rename to hotspot/test/compiler/escapeAnalysis/6716441/Tester.java diff --git a/hotspot/test/compiler/6726999/Test.java b/hotspot/test/compiler/escapeAnalysis/6726999/Test.java similarity index 100% rename from hotspot/test/compiler/6726999/Test.java rename to hotspot/test/compiler/escapeAnalysis/6726999/Test.java diff --git a/hotspot/test/compiler/6775880/Test.java b/hotspot/test/compiler/escapeAnalysis/6775880/Test.java similarity index 100% rename from hotspot/test/compiler/6775880/Test.java rename to hotspot/test/compiler/escapeAnalysis/6775880/Test.java diff --git a/hotspot/test/compiler/6795161/Test.java b/hotspot/test/compiler/escapeAnalysis/6795161/Test.java similarity index 100% rename from hotspot/test/compiler/6795161/Test.java rename to hotspot/test/compiler/escapeAnalysis/6795161/Test.java diff --git a/hotspot/test/compiler/6895383/Test.java b/hotspot/test/compiler/escapeAnalysis/6895383/Test.java similarity index 100% rename from hotspot/test/compiler/6895383/Test.java rename to hotspot/test/compiler/escapeAnalysis/6895383/Test.java diff --git a/hotspot/test/compiler/6896727/Test.java b/hotspot/test/compiler/escapeAnalysis/6896727/Test.java similarity index 100% rename from hotspot/test/compiler/6896727/Test.java rename to hotspot/test/compiler/escapeAnalysis/6896727/Test.java diff --git a/hotspot/test/compiler/EscapeAnalysis/Test8020215.java b/hotspot/test/compiler/escapeAnalysis/Test8020215.java similarity index 100% rename from hotspot/test/compiler/EscapeAnalysis/Test8020215.java rename to hotspot/test/compiler/escapeAnalysis/Test8020215.java diff --git a/hotspot/test/compiler/EscapeAnalysis/TestAllocatedEscapesPtrComparison.java b/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java similarity index 100% rename from hotspot/test/compiler/EscapeAnalysis/TestAllocatedEscapesPtrComparison.java rename to hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java diff --git a/hotspot/test/compiler/EscapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java similarity index 100% rename from hotspot/test/compiler/EscapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java rename to hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java diff --git a/hotspot/test/compiler/IntegerArithmetic/TestIntegerComparison.java b/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java similarity index 100% rename from hotspot/test/compiler/IntegerArithmetic/TestIntegerComparison.java rename to hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java diff --git a/hotspot/test/compiler/6539464/Test.java b/hotspot/test/compiler/interpreter/6539464/Test.java similarity index 100% rename from hotspot/test/compiler/6539464/Test.java rename to hotspot/test/compiler/interpreter/6539464/Test.java diff --git a/hotspot/test/compiler/6833129/Test.java b/hotspot/test/compiler/interpreter/6833129/Test.java similarity index 100% rename from hotspot/test/compiler/6833129/Test.java rename to hotspot/test/compiler/interpreter/6833129/Test.java diff --git a/hotspot/test/compiler/7116216/LargeFrame.java b/hotspot/test/compiler/interpreter/7116216/LargeFrame.java similarity index 100% rename from hotspot/test/compiler/7116216/LargeFrame.java rename to hotspot/test/compiler/interpreter/7116216/LargeFrame.java diff --git a/hotspot/test/compiler/7116216/StackOverflow.java b/hotspot/test/compiler/interpreter/7116216/StackOverflow.java similarity index 100% rename from hotspot/test/compiler/7116216/StackOverflow.java rename to hotspot/test/compiler/interpreter/7116216/StackOverflow.java diff --git a/hotspot/test/compiler/6982370/Test6982370.java b/hotspot/test/compiler/intrinsics/6982370/Test6982370.java similarity index 100% rename from hotspot/test/compiler/6982370/Test6982370.java rename to hotspot/test/compiler/intrinsics/6982370/Test6982370.java diff --git a/hotspot/test/compiler/8005419/Test8005419.java b/hotspot/test/compiler/intrinsics/8005419/Test8005419.java similarity index 100% rename from hotspot/test/compiler/8005419/Test8005419.java rename to hotspot/test/compiler/intrinsics/8005419/Test8005419.java diff --git a/hotspot/test/compiler/6990212/Test6990212.java b/hotspot/test/compiler/jsr292/6990212/Test6990212.java similarity index 100% rename from hotspot/test/compiler/6990212/Test6990212.java rename to hotspot/test/compiler/jsr292/6990212/Test6990212.java diff --git a/hotspot/test/compiler/7082949/Test7082949.java b/hotspot/test/compiler/jsr292/7082949/Test7082949.java similarity index 100% rename from hotspot/test/compiler/7082949/Test7082949.java rename to hotspot/test/compiler/jsr292/7082949/Test7082949.java diff --git a/hotspot/test/compiler/6659207/Test.java b/hotspot/test/compiler/loopopts/6659207/Test.java similarity index 100% rename from hotspot/test/compiler/6659207/Test.java rename to hotspot/test/compiler/loopopts/6659207/Test.java diff --git a/hotspot/test/compiler/6855164/Test.java b/hotspot/test/compiler/loopopts/6855164/Test.java similarity index 100% rename from hotspot/test/compiler/6855164/Test.java rename to hotspot/test/compiler/loopopts/6855164/Test.java diff --git a/hotspot/test/compiler/6860469/Test.java b/hotspot/test/compiler/loopopts/6860469/Test.java similarity index 100% rename from hotspot/test/compiler/6860469/Test.java rename to hotspot/test/compiler/loopopts/6860469/Test.java diff --git a/hotspot/test/compiler/7044738/Test7044738.java b/hotspot/test/compiler/loopopts/7044738/Test7044738.java similarity index 100% rename from hotspot/test/compiler/7044738/Test7044738.java rename to hotspot/test/compiler/loopopts/7044738/Test7044738.java diff --git a/hotspot/test/compiler/7052494/Test7052494.java b/hotspot/test/compiler/loopopts/7052494/Test7052494.java similarity index 100% rename from hotspot/test/compiler/7052494/Test7052494.java rename to hotspot/test/compiler/loopopts/7052494/Test7052494.java diff --git a/hotspot/test/compiler/6778657/Test.java b/hotspot/test/compiler/runtime/6778657/Test.java similarity index 100% rename from hotspot/test/compiler/6778657/Test.java rename to hotspot/test/compiler/runtime/6778657/Test.java diff --git a/hotspot/test/compiler/6826736/Test.java b/hotspot/test/compiler/runtime/6826736/Test.java similarity index 100% rename from hotspot/test/compiler/6826736/Test.java rename to hotspot/test/compiler/runtime/6826736/Test.java diff --git a/hotspot/test/compiler/6859338/Test6859338.java b/hotspot/test/compiler/runtime/6859338/Test6859338.java similarity index 100% rename from hotspot/test/compiler/6859338/Test6859338.java rename to hotspot/test/compiler/runtime/6859338/Test6859338.java diff --git a/hotspot/test/compiler/6863420/Test.java b/hotspot/test/compiler/runtime/6863420/Test.java similarity index 100% rename from hotspot/test/compiler/6863420/Test.java rename to hotspot/test/compiler/runtime/6863420/Test.java diff --git a/hotspot/test/compiler/6865265/StackOverflowBug.java b/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java similarity index 100% rename from hotspot/test/compiler/6865265/StackOverflowBug.java rename to hotspot/test/compiler/runtime/6865265/StackOverflowBug.java diff --git a/hotspot/test/compiler/6891750/Test6891750.java b/hotspot/test/compiler/runtime/6891750/Test6891750.java similarity index 100% rename from hotspot/test/compiler/6891750/Test6891750.java rename to hotspot/test/compiler/runtime/6891750/Test6891750.java diff --git a/hotspot/test/compiler/6892265/Test.java b/hotspot/test/compiler/runtime/6892265/Test.java similarity index 100% rename from hotspot/test/compiler/6892265/Test.java rename to hotspot/test/compiler/runtime/6892265/Test.java diff --git a/hotspot/test/compiler/7088020/Test7088020.java b/hotspot/test/compiler/runtime/7088020/Test7088020.java similarity index 100% rename from hotspot/test/compiler/7088020/Test7088020.java rename to hotspot/test/compiler/runtime/7088020/Test7088020.java diff --git a/hotspot/test/compiler/7141637/SpreadNullArg.java b/hotspot/test/compiler/runtime/7141637/SpreadNullArg.java similarity index 100% rename from hotspot/test/compiler/7141637/SpreadNullArg.java rename to hotspot/test/compiler/runtime/7141637/SpreadNullArg.java diff --git a/hotspot/test/compiler/7196199/Test7196199.java b/hotspot/test/compiler/runtime/7196199/Test7196199.java similarity index 100% rename from hotspot/test/compiler/7196199/Test7196199.java rename to hotspot/test/compiler/runtime/7196199/Test7196199.java diff --git a/hotspot/test/compiler/8010927/Test8010927.java b/hotspot/test/compiler/runtime/8010927/Test8010927.java similarity index 100% rename from hotspot/test/compiler/8010927/Test8010927.java rename to hotspot/test/compiler/runtime/8010927/Test8010927.java diff --git a/hotspot/test/compiler/8015436/Test8015436.java b/hotspot/test/compiler/runtime/8015436/Test8015436.java similarity index 100% rename from hotspot/test/compiler/8015436/Test8015436.java rename to hotspot/test/compiler/runtime/8015436/Test8015436.java diff --git a/hotspot/test/compiler/8009761/Test8009761.java b/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java similarity index 100% rename from hotspot/test/compiler/8009761/Test8009761.java rename to hotspot/test/compiler/uncommontrap/8009761/Test8009761.java From 5ef6d4e99d568bb59de16c526d039bed80807b5c Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Thu, 20 Nov 2014 11:06:26 +0100 Subject: [PATCH 071/159] 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer Ignore non-instance Klasses in the subclass hierarchy. Reviewed-by: kvn, iignatyev, jrose --- hotspot/src/share/vm/code/dependencies.cpp | 58 +++++++------ hotspot/test/TEST.groups | 1 + .../TestMonomorphicObjectCall.java | 73 ++++++++++++++++ .../java/lang/Object.java | 87 +++++++++++++++++++ 4 files changed, 192 insertions(+), 27 deletions(-) create mode 100644 hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java create mode 100644 hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp index f995a2f9999..fbefd4a9b1e 100644 --- a/hotspot/src/share/vm/code/dependencies.cpp +++ b/hotspot/src/share/vm/code/dependencies.cpp @@ -912,6 +912,8 @@ class ClassHierarchyWalker { bool is_witness(Klass* k) { if (doing_subtype_search()) { return Dependencies::is_concrete_klass(k); + } else if (!k->oop_is_instance()) { + return false; // no methods to find in an array type } else { Method* m = InstanceKlass::cast(k)->find_method(_name, _signature); if (m == NULL || !Dependencies::is_concrete_method(m)) return false; @@ -1118,7 +1120,7 @@ Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type, Klass* chain; // scratch variable #define ADD_SUBCLASS_CHAIN(k) { \ assert(chaini < CHAINMAX, "oob"); \ - chain = InstanceKlass::cast(k)->subklass(); \ + chain = k->subklass(); \ if (chain != NULL) chains[chaini++] = chain; } // Look for non-abstract subclasses. @@ -1129,35 +1131,37 @@ Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type, // (Their subclasses are additional indirect implementors. // See InstanceKlass::add_implementor.) // (Note: nof_implementors is always zero for non-interfaces.) - int nof_impls = InstanceKlass::cast(context_type)->nof_implementors(); - if (nof_impls > 1) { - // Avoid this case: *I.m > { A.m, C }; B.m > C - // Here, I.m has 2 concrete implementations, but m appears unique - // as A.m, because the search misses B.m when checking C. - // The inherited method B.m was getting missed by the walker - // when interface 'I' was the starting point. - // %%% Until this is fixed more systematically, bail out. - // (Old CHA had the same limitation.) - return context_type; - } - if (nof_impls > 0) { - Klass* impl = InstanceKlass::cast(context_type)->implementor(); - assert(impl != NULL, "just checking"); - // If impl is the same as the context_type, then more than one - // implementor has seen. No exact info in this case. - if (impl == context_type) { - return context_type; // report an inexact witness to this sad affair + if (top_level_call) { + int nof_impls = InstanceKlass::cast(context_type)->nof_implementors(); + if (nof_impls > 1) { + // Avoid this case: *I.m > { A.m, C }; B.m > C + // Here, I.m has 2 concrete implementations, but m appears unique + // as A.m, because the search misses B.m when checking C. + // The inherited method B.m was getting missed by the walker + // when interface 'I' was the starting point. + // %%% Until this is fixed more systematically, bail out. + // (Old CHA had the same limitation.) + return context_type; } - if (do_counts) - { NOT_PRODUCT(deps_find_witness_steps++); } - if (is_participant(impl)) { - if (!participants_hide_witnesses) { + if (nof_impls > 0) { + Klass* impl = InstanceKlass::cast(context_type)->implementor(); + assert(impl != NULL, "just checking"); + // If impl is the same as the context_type, then more than one + // implementor has seen. No exact info in this case. + if (impl == context_type) { + return context_type; // report an inexact witness to this sad affair + } + if (do_counts) + { NOT_PRODUCT(deps_find_witness_steps++); } + if (is_participant(impl)) { + if (!participants_hide_witnesses) { + ADD_SUBCLASS_CHAIN(impl); + } + } else if (is_witness(impl) && !ignore_witness(impl)) { + return impl; + } else { ADD_SUBCLASS_CHAIN(impl); } - } else if (is_witness(impl) && !ignore_witness(impl)) { - return impl; - } else { - ADD_SUBCLASS_CHAIN(impl); } } diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index e4dbf572f06..f94cb702179 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -344,6 +344,7 @@ hotspot_compiler_2 = \ compiler/codecache/ \ compiler/codegen/ \ compiler/cpuflags/ \ + compiler/dependencies/ \ compiler/eliminateAutobox/ \ compiler/escapeAnalysis/ \ compiler/exceptions/ \ diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java new file mode 100644 index 00000000000..932599013cf --- /dev/null +++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java @@ -0,0 +1,73 @@ +/* + * 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. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; + +import com.oracle.java.testlibrary.*; + +/* + * @test + * @bug 8050079 + * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA. + * @library /testlibrary + * @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java + * @run main TestMonomorphicObjectCall + */ +public class TestMonomorphicObjectCall { + final static String testClasses = System.getProperty("test.classes") + File.separator; + + private static void callFinalize(Object object) throws Throwable { + // Call modified version of java.lang.Object::finalize() that is + // not overridden by any subclass. C1 CHA should mark the call site + // as monomorphic and inline the method. + object.finalizeObject(); + } + + public static void main(String[] args) throws Throwable { + if (args.length == 0) { + // Execute new instance with modified java.lang.Object + executeTestJvm(); + } else { + // Trigger compilation of 'callFinalize' + callFinalize(new Object()); + } + } + + public static void executeTestJvm() throws Throwable { + // Execute test with modified version of java.lang.Object + // in -Xbootclasspath. + String[] vmOpts = new String[] { + "-Xbootclasspath/p:" + testClasses, + "-Xcomp", + "-XX:-VerifyDependencies", + "-XX:CompileOnly=TestMonomorphicObjectCall::callFinalize", + "-XX:CompileOnly=Object::finalizeObject", + "-XX:TieredStopAtLevel=1", + TestMonomorphicObjectCall.class.getName(), + "true"}; + OutputAnalyzer output = ProcessTools.executeTestJvm(vmOpts); + output.shouldHaveExitValue(0); + } +} diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java new file mode 100644 index 00000000000..aa983bcbd68 --- /dev/null +++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 1994, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package java.lang; + +/** + * Slightly modified version of java.lang.Object that replaces + * finalize() by finalizeObject() to avoid overriding in subclasses. + */ +public class Object { + + private static native void registerNatives(); + static { + registerNatives(); + } + + public final native Class getClass(); + + public native int hashCode(); + + public boolean equals(Object obj) { + return (this == obj); + } + + protected native Object clone() throws CloneNotSupportedException; + + public String toString() { + return getClass().getName() + "@" + Integer.toHexString(hashCode()); + } + + public final native void notify(); + + public final native void notifyAll(); + + public final native void wait(long timeout) throws InterruptedException; + + public final void wait(long timeout, int nanos) throws InterruptedException { + if (timeout < 0) { + throw new IllegalArgumentException("timeout value is negative"); + } + + if (nanos < 0 || nanos > 999999) { + throw new IllegalArgumentException( + "nanosecond timeout value out of range"); + } + + if (nanos >= 500000 || (nanos != 0 && timeout == 0)) { + timeout++; + } + + wait(timeout); + } + + public final void wait() throws InterruptedException { + wait(0); + } + + /** + * Replaces original finalize() method and is therefore not + * overridden by any subclasses of Object. + * @throws Throwable + */ + // protected void finalize() throws Throwable { } + public void finalizeObject() throws Throwable { } +} From bf5546e48d73a99da21a94e4dc8a542b1424235b Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 21 Nov 2014 17:27:11 +0300 Subject: [PATCH 072/159] 8059550: JEP-JDK-8043304: Test task: segment overflow w/ empty others Reviewed-by: kvn, thartmann, iignatyev --- .../src/share/vm/compiler/compileBroker.hpp | 1 + hotspot/src/share/vm/prims/whitebox.cpp | 13 +++ .../codecache/OverflowCodeCacheTest.java | 96 +++++++++++++++++++ .../whitebox/sun/hotspot/WhiteBox.java | 2 + .../whitebox/sun/hotspot/code/BlobType.java | 13 ++- .../whitebox/sun/hotspot/code/CodeBlob.java | 7 ++ 6 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 hotspot/test/compiler/codecache/OverflowCodeCacheTest.java diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp index e6d8bb9bdb9..b35d3766d5f 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.hpp +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp @@ -415,6 +415,7 @@ class CompileBroker: AllStatic { shutdown_compilaton = 2 }; + static jint get_compilation_activity_mode() { return _should_compile_new_jobs; } static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); } static bool set_should_compile_new_jobs(jint new_state) { // Return success if the current caller set it diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index f412484cbe0..1f18c63c37b 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -944,6 +944,16 @@ WB_ENTRY(jobjectArray, WB_GetCodeHeapEntries(JNIEnv* env, jobject o, jint blob_t return result; WB_END +WB_ENTRY(jint, WB_GetCompilationActivityMode(JNIEnv* env, jobject o)) + return CompileBroker::get_compilation_activity_mode(); +WB_END + +WB_ENTRY(jobjectArray, WB_GetCodeBlob(JNIEnv* env, jobject o, jlong addr)) + ThreadToNativeFromVM ttn(thread); + CodeBlobStub stub((CodeBlob*) addr); + return codeBlob2objectArray(thread, env, &stub); +WB_END + WB_ENTRY(jlong, WB_GetThreadStackSize(JNIEnv* env, jobject o)) return (jlong) Thread::current()->stack_size(); WB_END @@ -1194,6 +1204,9 @@ static JNINativeMethod methods[] = { {CC"allocateCodeBlob", CC"(II)J", (void*)&WB_AllocateCodeBlob }, {CC"freeCodeBlob", CC"(J)V", (void*)&WB_FreeCodeBlob }, {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries }, + {CC"getCompilationActivityMode", + CC"()I", (void*)&WB_GetCompilationActivityMode}, + {CC"getCodeBlob", CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob }, {CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize }, {CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize }, }; diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java new file mode 100644 index 00000000000..c772f4fbddc --- /dev/null +++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java @@ -0,0 +1,96 @@ +/* + * 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. + * + */ + +import java.lang.management.MemoryPoolMXBean; +import java.util.EnumSet; +import java.util.ArrayList; + +import sun.hotspot.WhiteBox; +import sun.hotspot.code.BlobType; +import sun.hotspot.code.CodeBlob; +import com.oracle.java.testlibrary.Asserts; + +/* + * @test OverflowCodeCacheTest + * @bug 8059550 + * @library /testlibrary /testlibrary/whitebox + * @build OverflowCodeCacheTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:-SegmentedCodeCache OverflowCodeCacheTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::* + * -XX:+SegmentedCodeCache OverflowCodeCacheTest + * @summary testing of code cache segments overflow + */ +public class OverflowCodeCacheTest { + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + + public static void main(String[] args) { + EnumSet blobTypes = BlobType.getAvailable(); + for (BlobType type : blobTypes) { + new OverflowCodeCacheTest(type).test(); + } + } + + private final BlobType type; + private final MemoryPoolMXBean bean; + private OverflowCodeCacheTest(BlobType type) { + this.type = type; + this.bean = type.getMemoryPool(); + } + + private void test() { + System.out.printf("type %s%n", type); + System.out.println("allocating till possible..."); + ArrayList blobs = new ArrayList<>(); + try { + long addr; + int size = (int) (getHeapSize() >> 7); + while ((addr = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) { + blobs.add(addr); + + BlobType actualType = CodeBlob.getCodeBlob(addr).code_blob_type; + if (actualType != type) { + // check we got allowed overflow handling + Asserts.assertTrue(type.allowTypeWhenOverflow(actualType), + type + " doesn't allow using " + actualType + " when overflow"); + } + } + Asserts.assertNotEquals(WHITE_BOX.getCompilationActivityMode(), 1 /* run_compilation*/, + "Compilation must be disabled when CodeCache(CodeHeap) overflows"); + } finally { + for (Long blob : blobs) { + WHITE_BOX.freeCodeBlob(blob); + } + } + } + + private long getHeapSize() { + return bean.getUsage().getMax(); + } + +} diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java index 1759d925731..f4bda72cf1d 100644 --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java @@ -151,6 +151,8 @@ public class WhiteBox { public native void freeCodeBlob(long addr); public native void forceNMethodSweep(); public native Object[] getCodeHeapEntries(int type); + public native int getCompilationActivityMode(); + public native Object[] getCodeBlob(long addr); // Intered strings public native boolean isInStringTable(String str); diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java index ee273bcd916..49d3a0a03d2 100644 --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java @@ -36,7 +36,13 @@ public enum BlobType { // Execution level 2 and 3 (profiled) nmethods MethodProfiled(1, "CodeHeap 'profiled nmethods'"), // Non-nmethods like Buffers, Adapters and Runtime Stubs - NonNMethod(2, "CodeHeap 'non-nmethods'"), + NonNMethod(2, "CodeHeap 'non-nmethods'") { + @Override + public boolean allowTypeWhenOverflow(BlobType type) { + return super.allowTypeWhenOverflow(type) + || type == BlobType.MethodNonProfiled; + } + }, // All types (No code cache segmentation) All(3, "CodeCache"); @@ -57,6 +63,11 @@ public enum BlobType { } return null; } + + public boolean allowTypeWhenOverflow(BlobType type) { + return type == this; + } + public static EnumSet getAvailable() { WhiteBox whiteBox = WhiteBox.getWhiteBox(); if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) { diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java index 66556ddaa7c..a5097f1c7e4 100644 --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java @@ -39,6 +39,13 @@ public class CodeBlob { } return result; } + public static CodeBlob getCodeBlob(long addr) { + Object[] obj = WB.getCodeBlob(addr); + if (obj == null) { + return null; + } + return new CodeBlob(obj); + } protected CodeBlob(Object[] obj) { assert obj.length == 3; name = (String) obj[0]; From 585ca822b81d8d5660b0e8aa41fd5b2b6ab500d0 Mon Sep 17 00:00:00 2001 From: Tatiana Pivovarova Date: Fri, 21 Nov 2014 17:28:29 +0300 Subject: [PATCH 073/159] 8064696: compiler/startup/SmallCodeCacheStartup.java doesn't check exit code Reviewed-by: kvn, anoll, iignatyev --- .../test/compiler/startup/SmallCodeCacheStartup.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java index 72583df8502..55eb7b2b27d 100644 --- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java +++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java @@ -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 @@ -33,14 +33,13 @@ import com.oracle.java.testlibrary.*; public class SmallCodeCacheStartup { public static void main(String[] args) throws Exception { - try { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m", "-XX:CICompilerCount=64", "-Xcomp", - "SmallCodeCacheStartup"); - pb.start(); - } catch (VirtualMachineError e) {} + "-version"); + OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); + analyzer.shouldHaveExitValue(0); - System.out.println("TEST PASSED"); + System.out.println("TEST PASSED"); } } From f36e847523819ea488b6fcf4a3c76382d62ec49e Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Fri, 21 Nov 2014 17:17:41 -0800 Subject: [PATCH 074/159] 8065618: C2 RA incorrectly removes kill projections Don't remove KILL projections if their "defining" nodes have SCMemProj projection (memory side effects). Reviewed-by: iveresov --- hotspot/src/share/vm/opto/ifg.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hotspot/src/share/vm/opto/ifg.cpp b/hotspot/src/share/vm/opto/ifg.cpp index 91b97f46777..61e13439637 100644 --- a/hotspot/src/share/vm/opto/ifg.cpp +++ b/hotspot/src/share/vm/opto/ifg.cpp @@ -527,6 +527,22 @@ bool PhaseChaitin::remove_node_if_not_used(Block* b, uint location, Node* n, uin Node* def = n->in(0); if (!n->is_Proj() || (_lrg_map.live_range_id(def) && !liveout->member(_lrg_map.live_range_id(def)))) { + if (n->is_MachProj()) { + // Don't remove KILL projections if their "defining" nodes have + // memory effects (have SCMemProj projection node) - + // they are not dead even when their result is not used. + // For example, compareAndSwapL (and other CAS) and EncodeISOArray nodes. + // The method add_input_to_liveout() keeps such nodes alive (put them on liveout list) + // when it sees SCMemProj node in a block. Unfortunately SCMemProj node could be placed + // in block in such order that KILL MachProj nodes are processed first. + uint cnt = def->outcnt(); + for (uint i = 0; i < cnt; i++) { + Node* proj = def->raw_out(i); + if (proj->Opcode() == Op_SCMemProj) { + return false; + } + } + } b->remove_node(location); LRG& lrg = lrgs(lid); if (lrg._def == n) { From 9adb455ba855e519714654272017d406aa71d2f9 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Mon, 24 Nov 2014 08:48:15 +0100 Subject: [PATCH 075/159] 8065339: Failed compilation does not always trigger a JFR event 'CompilerFailure' CompilerFailure JFR event should be triggered in ciEnv. Reviewed-by: kvn --- hotspot/src/share/vm/ci/ciEnv.cpp | 11 +++++++++++ hotspot/src/share/vm/ci/ciEnv.hpp | 3 ++- hotspot/src/share/vm/compiler/compileBroker.cpp | 1 + hotspot/src/share/vm/opto/c2compiler.cpp | 4 +++- hotspot/src/share/vm/opto/compile.cpp | 8 -------- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index ec16b8da1ee..5c6e12e5e75 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -53,6 +53,7 @@ #include "runtime/reflection.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/thread.inline.hpp" +#include "trace/tracing.hpp" #include "utilities/dtrace.hpp" #include "utilities/macros.hpp" #ifdef COMPILER1 @@ -1141,6 +1142,16 @@ void ciEnv::record_failure(const char* reason) { } } +void ciEnv::report_failure(const char* reason) { + // Create and fire JFR event + EventCompilerFailure event; + if (event.should_commit()) { + event.set_compileID(compile_id()); + event.set_failure(reason); + event.commit(); + } +} + // ------------------------------------------------------------------ // ciEnv::record_method_not_compilable() void ciEnv::record_method_not_compilable(const char* reason, bool all_tiers) { diff --git a/hotspot/src/share/vm/ci/ciEnv.hpp b/hotspot/src/share/vm/ci/ciEnv.hpp index ced8d895207..29e52c352af 100644 --- a/hotspot/src/share/vm/ci/ciEnv.hpp +++ b/hotspot/src/share/vm/ci/ciEnv.hpp @@ -450,7 +450,8 @@ public: // Check for changes to the system dictionary during compilation bool system_dictionary_modification_counter_changed(); - void record_failure(const char* reason); + void record_failure(const char* reason); // Record failure and report later + void report_failure(const char* reason); // Report failure immediately void record_method_not_compilable(const char* reason, bool all_tiers = true); void record_out_of_memory_failure(); diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index 2fa80c675dd..079d0835883 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -1985,6 +1985,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { if (ci_env.failing()) { task->set_failure_reason(ci_env.failure_reason()); + ci_env.report_failure(ci_env.failure_reason()); const char* retry_message = ci_env.retry_message(); if (_compilation_log != NULL) { _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message); diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp index 472ab4a8c22..71e2a0bbbab 100644 --- a/hotspot/src/share/vm/opto/c2compiler.cpp +++ b/hotspot/src/share/vm/opto/c2compiler.cpp @@ -102,23 +102,25 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { // Attempt to compile while subsuming loads into machine instructions. Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing); - // Check result and retry if appropriate. if (C.failure_reason() != NULL) { if (C.failure_reason_is(retry_no_subsuming_loads())) { assert(subsume_loads, "must make progress"); subsume_loads = false; + env->report_failure(C.failure_reason()); continue; // retry } if (C.failure_reason_is(retry_no_escape_analysis())) { assert(do_escape_analysis, "must make progress"); do_escape_analysis = false; + env->report_failure(C.failure_reason()); continue; // retry } if (C.has_boxed_value()) { // Recompile without boxing elimination regardless failure reason. assert(eliminate_boxing, "must make progress"); eliminate_boxing = false; + env->report_failure(C.failure_reason()); continue; // retry } // Pass any other failure reason up to the ciEnv. diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index ec74d5ef4a1..c2943720c60 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -67,7 +67,6 @@ #include "runtime/signature.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/timer.hpp" -#include "trace/tracing.hpp" #include "utilities/copy.hpp" @@ -3542,13 +3541,6 @@ void Compile::record_failure(const char* reason) { _failure_reason = reason; } - EventCompilerFailure event; - if (event.should_commit()) { - event.set_compileID(Compile::compile_id()); - event.set_failure(reason); - event.commit(); - } - if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) { C->print_method(PHASE_FAILURE); } From 5a00d5f6b559850dfd65488e56202586854b65cd Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 24 Nov 2014 07:29:03 -0800 Subject: [PATCH 076/159] 8058148: MaxNodeLimit and LiveNodeCountInliningCutoff Reviewed-by: kvn, roland --- hotspot/src/share/vm/ci/ciTypeFlow.cpp | 3 ++- hotspot/src/share/vm/opto/c2_globals.hpp | 2 +- hotspot/src/share/vm/opto/compile.cpp | 7 +++++-- hotspot/src/share/vm/opto/compile.hpp | 6 +++++- hotspot/src/share/vm/opto/doCall.cpp | 5 +++++ hotspot/src/share/vm/opto/escape.cpp | 2 +- hotspot/src/share/vm/opto/loopTransform.cpp | 9 ++++----- hotspot/src/share/vm/opto/loopUnswitch.cpp | 4 ++-- hotspot/src/share/vm/opto/loopopts.cpp | 2 +- hotspot/src/share/vm/opto/node.cpp | 4 ++-- 10 files changed, 28 insertions(+), 16 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp index 834f71be5e7..d78eb145624 100644 --- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp +++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp @@ -35,6 +35,7 @@ #include "interpreter/bytecode.hpp" #include "interpreter/bytecodes.hpp" #include "memory/allocation.inline.hpp" +#include "opto/compile.hpp" #include "runtime/deoptimization.hpp" #include "utilities/growableArray.hpp" @@ -2646,7 +2647,7 @@ void ciTypeFlow::df_flow_types(Block* start, assert (!blk->has_pre_order(), ""); blk->set_next_pre_order(); - if (_next_pre_order >= MaxNodeLimit / 2) { + if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) { // Too many basic blocks. Bail out. // This can happen when try/finally constructs are nested to depth N, // and there is O(2**N) cloning of jsr bodies. See bug 4697245! diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index a49f31641dc..b74dbe40bea 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -647,7 +647,7 @@ develop(bool, AlwaysIncrementalInline, false, \ "do all inlining incrementally") \ \ - product(intx, LiveNodeCountInliningCutoff, 20000, \ + product(intx, LiveNodeCountInliningCutoff, 40000, \ "max number of live nodes in a method") \ \ diagnostic(bool, OptimizeExpensiveOps, true, \ diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index c2943720c60..17ffca9e6ff 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -661,7 +661,8 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr _print_inlining_stream(NULL), _print_inlining_idx(0), _print_inlining_output(NULL), - _interpreter_frame_size(0) { + _interpreter_frame_size(0), + _max_node_limit(MaxNodeLimit) { C = this; CompileWrapper cw(this); @@ -974,7 +975,8 @@ Compile::Compile( ciEnv* ci_env, _print_inlining_idx(0), _print_inlining_output(NULL), _allowed_reasons(0), - _interpreter_frame_size(0) { + _interpreter_frame_size(0), + _max_node_limit(MaxNodeLimit) { C = this; TraceTime t1(NULL, &_t_totalCompilation, CITime, false); @@ -1087,6 +1089,7 @@ void Compile::Init(int aliaslevel) { set_do_method_data_update(false); set_age_code(has_method() && method()->profile_aging()); set_rtm_state(NoRTM); // No RTM lock eliding by default + method_has_option_value("MaxNodeLimit", _max_node_limit); #if INCLUDE_RTM_OPT if (UseRTMLocking && has_method() && (method()->method_data_or_null() != NULL)) { int rtm_state = method()->method_data()->rtm_state(); diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 137ba6b2b9d..c901da09405 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -289,6 +289,7 @@ class Compile : public Phase { int _freq_inline_size; // Max hot method inline size for this compilation int _fixed_slots; // count of frame slots not allocated by the register // allocator i.e. locks, original deopt pc, etc. + uintx _max_node_limit; // Max unique node count during a single compilation. // For deopt int _orig_pc_slot; int _orig_pc_slot_offset_in_bytes; @@ -597,6 +598,9 @@ class Compile : public Phase { void set_rtm_state(RTMState s) { _rtm_state = s; } bool use_rtm() const { return (_rtm_state & NoRTM) == 0; } bool profile_rtm() const { return _rtm_state == ProfileRTM; } + uint max_node_limit() const { return (uint)_max_node_limit; } + void set_max_node_limit(uint n) { _max_node_limit = n; } + // check the CompilerOracle for special behaviours for this compile bool method_has_option(const char * option) { return method() != NULL && method()->has_option(option); @@ -735,7 +739,7 @@ class Compile : public Phase { record_method_not_compilable(reason, true); } bool check_node_count(uint margin, const char* reason) { - if (live_nodes() + margin > (uint)MaxNodeLimit) { + if (live_nodes() + margin > max_node_limit()) { record_method_not_compilable(reason); return true; } else { diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index 9cf6bc4dfe8..7397f9e27cb 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -418,6 +418,11 @@ void Parse::do_call() { ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder); assert(declared_signature != NULL, "cannot be null"); + // Bump max node limit for JSR292 users + if (bc() == Bytecodes::_invokedynamic || orig_callee->is_method_handle_intrinsic()) { + C->set_max_node_limit(3*MaxNodeLimit); + } + // uncommon-trap when callee is unloaded, uninitialized or will not link // bailout when too many arguments for register representation if (!will_link || can_not_compile_call_site(orig_callee, klass)) { diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp index 9f09b62d761..355e02cc896 100644 --- a/hotspot/src/share/vm/opto/escape.cpp +++ b/hotspot/src/share/vm/opto/escape.cpp @@ -2417,7 +2417,7 @@ PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, Gro } } } - if ((int) (C->live_nodes() + 2*NodeLimitFudgeFactor) > MaxNodeLimit) { + if (C->live_nodes() + 2*NodeLimitFudgeFactor > C->max_node_limit()) { if (C->do_escape_analysis() == true && !C->failing()) { // Retry compilation without escape analysis. // If this is the first failure, the sentinel string will "stick" diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index 9701cfd2cf2..ad60d2d9ff9 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -272,10 +272,9 @@ void IdealLoopTree::reassociate_invariants(PhaseIdealLoop *phase) { bool IdealLoopTree::policy_peeling( PhaseIdealLoop *phase ) const { Node *test = ((IdealLoopTree*)this)->tail(); int body_size = ((IdealLoopTree*)this)->_body.size(); - int live_node_count = phase->C->live_nodes(); // Peeling does loop cloning which can result in O(N^2) node construction if( body_size > 255 /* Prevent overflow for large body_size */ - || (body_size * body_size + live_node_count > MaxNodeLimit) ) { + || (body_size * body_size + phase->C->live_nodes()) > phase->C->max_node_limit() ) { return false; // too large to safely clone } while( test != _head ) { // Scan till run off top of loop @@ -604,7 +603,7 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const { return false; if (new_body_size > unroll_limit || // Unrolling can result in a large amount of node construction - new_body_size >= MaxNodeLimit - (uint) phase->C->live_nodes()) { + new_body_size >= phase->C->max_node_limit() - phase->C->live_nodes()) { return false; } @@ -2281,8 +2280,8 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_ // Skip next optimizations if running low on nodes. Note that // policy_unswitching and policy_maximally_unroll have this check. - uint nodes_left = MaxNodeLimit - (uint) phase->C->live_nodes(); - if ((2 * _body.size()) > nodes_left) { + int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes(); + if ((int)(2 * _body.size()) > nodes_left) { return true; } diff --git a/hotspot/src/share/vm/opto/loopUnswitch.cpp b/hotspot/src/share/vm/opto/loopUnswitch.cpp index 43f2008f2aa..dab8fd387a8 100644 --- a/hotspot/src/share/vm/opto/loopUnswitch.cpp +++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp @@ -61,8 +61,8 @@ bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const { if (!_head->is_Loop()) { return false; } - uint nodes_left = MaxNodeLimit - phase->C->live_nodes(); - if (2 * _body.size() > nodes_left) { + int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes(); + if ((int)(2 * _body.size()) > nodes_left) { return false; // Too speculative if running low on nodes. } LoopNode* head = _head->as_Loop(); diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp index 20ad4ff1f6d..bfa483c0181 100644 --- a/hotspot/src/share/vm/opto/loopopts.cpp +++ b/hotspot/src/share/vm/opto/loopopts.cpp @@ -736,7 +736,7 @@ static bool merge_point_too_heavy(Compile* C, Node* region) { for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { weight += region->fast_out(i)->outcnt(); } - int nodes_left = MaxNodeLimit - C->live_nodes(); + int nodes_left = C->max_node_limit() - C->live_nodes(); if (weight * 8 > nodes_left) { #ifndef PRODUCT if (PrintOpto) diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index c7cd9cd5c37..29cd82e4acc 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -69,7 +69,7 @@ void Node::verify_construction() { Compile::set_debug_idx(new_debug_idx); set_debug_idx( new_debug_idx ); assert(Compile::current()->unique() < (INT_MAX - 1), "Node limit exceeded INT_MAX"); - assert(Compile::current()->live_nodes() < (uint)MaxNodeLimit, "Live Node limit exceeded limit"); + assert(Compile::current()->live_nodes() < Compile::current()->max_node_limit(), "Live Node limit exceeded limit"); if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) { tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx); BREAKPOINT; @@ -313,7 +313,7 @@ inline int Node::Init(int req) { Node::Node(uint req) : _idx(Init(req)) { - assert( req < (uint)(MaxNodeLimit - NodeLimitFudgeFactor), "Input limit exceeded" ); + assert( req < Compile::current()->max_node_limit() - NodeLimitFudgeFactor, "Input limit exceeded" ); debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); if (req == 0) { From 4bc2edad15cfc23acba8cffe0601e7c3915c6b31 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Thu, 13 Nov 2014 09:19:46 +0100 Subject: [PATCH 077/159] 8054478: C2: Incorrectly compiled char[] array access crashes JVM Dead backbranch in main loop results in erroneous array access Reviewed-by: kvn, iveresov --- hotspot/src/share/vm/opto/castnode.cpp | 95 +++++++++++++++++++ hotspot/src/share/vm/opto/castnode.hpp | 17 +++- hotspot/src/share/vm/opto/loopTransform.cpp | 33 +++++++ hotspot/src/share/vm/opto/loopnode.hpp | 2 + hotspot/src/share/vm/opto/phaseX.cpp | 39 +++++++- hotspot/src/share/vm/opto/subnode.cpp | 2 - hotspot/src/share/vm/opto/subnode.hpp | 2 - .../TestDeadBackbranchArrayAccess.java | 58 +++++++++++ 8 files changed, 238 insertions(+), 10 deletions(-) create mode 100644 hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java diff --git a/hotspot/src/share/vm/opto/castnode.cpp b/hotspot/src/share/vm/opto/castnode.cpp index afaddaf72fb..3f3c5cab2ed 100644 --- a/hotspot/src/share/vm/opto/castnode.cpp +++ b/hotspot/src/share/vm/opto/castnode.cpp @@ -83,6 +83,101 @@ Node *ConstraintCastNode::Ideal_DU_postCCP( PhaseCCP *ccp ) { return this; } +uint CastIINode::size_of() const { + return sizeof(*this); +} + +uint CastIINode::cmp(const Node &n) const { + return TypeNode::cmp(n) && ((CastIINode&)n)._carry_dependency == _carry_dependency; +} + +Node *CastIINode::Identity(PhaseTransform *phase) { + if (_carry_dependency) { + return this; + } + return ConstraintCastNode::Identity(phase); +} + +const Type *CastIINode::Value(PhaseTransform *phase) const { + const Type *res = ConstraintCastNode::Value(phase); + + // Try to improve the type of the CastII if we recognize a CmpI/If + // pattern. + if (_carry_dependency) { + if (in(0) != NULL && (in(0)->is_IfFalse() || in(0)->is_IfTrue())) { + Node* proj = in(0); + if (proj->in(0)->in(1)->is_Bool()) { + Node* b = proj->in(0)->in(1); + if (b->in(1)->Opcode() == Op_CmpI) { + Node* cmp = b->in(1); + if (cmp->in(1) == in(1) && phase->type(cmp->in(2))->isa_int()) { + const TypeInt* in2_t = phase->type(cmp->in(2))->is_int(); + const Type* t = TypeInt::INT; + BoolTest test = b->as_Bool()->_test; + if (proj->is_IfFalse()) { + test = test.negate(); + } + BoolTest::mask m = test._test; + jlong lo_long = min_jint; + jlong hi_long = max_jint; + if (m == BoolTest::le || m == BoolTest::lt) { + hi_long = in2_t->_hi; + if (m == BoolTest::lt) { + hi_long -= 1; + } + } else if (m == BoolTest::ge || m == BoolTest::gt) { + lo_long = in2_t->_lo; + if (m == BoolTest::gt) { + lo_long += 1; + } + } else if (m == BoolTest::eq) { + lo_long = in2_t->_lo; + hi_long = in2_t->_hi; + } else if (m == BoolTest::ne) { + // can't do any better + } else { + stringStream ss; + test.dump_on(&ss); + fatal(err_msg_res("unexpected comparison %s", ss.as_string())); + } + int lo_int = (int)lo_long; + int hi_int = (int)hi_long; + + if (lo_long != (jlong)lo_int) { + lo_int = min_jint; + } + if (hi_long != (jlong)hi_int) { + hi_int = max_jint; + } + + t = TypeInt::make(lo_int, hi_int, Type::WidenMax); + + res = res->filter_speculative(t); + + return res; + } + } + } + } + } + return res; +} + +Node *CastIINode::Ideal_DU_postCCP(PhaseCCP *ccp) { + if (_carry_dependency) { + return NULL; + } + return ConstraintCastNode::Ideal_DU_postCCP(ccp); +} + +#ifndef PRODUCT +void CastIINode::dump_spec(outputStream *st) const { + TypeNode::dump_spec(st); + if (_carry_dependency) { + st->print(" carry dependency"); + } +} +#endif //============================================================================= diff --git a/hotspot/src/share/vm/opto/castnode.hpp b/hotspot/src/share/vm/opto/castnode.hpp index d0f97c9b249..8b79562b045 100644 --- a/hotspot/src/share/vm/opto/castnode.hpp +++ b/hotspot/src/share/vm/opto/castnode.hpp @@ -48,10 +48,25 @@ class ConstraintCastNode: public TypeNode { //------------------------------CastIINode------------------------------------- // cast integer to integer (different range) class CastIINode: public ConstraintCastNode { + private: + // Can this node be removed post CCP or does it carry a required dependency? + const bool _carry_dependency; + + protected: + virtual uint cmp( const Node &n ) const; + virtual uint size_of() const; + public: - CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {} + CastIINode(Node *n, const Type *t, bool carry_dependency = false) + : ConstraintCastNode(n,t), _carry_dependency(carry_dependency) {} virtual int Opcode() const; virtual uint ideal_reg() const { return Op_RegI; } + virtual Node *Identity( PhaseTransform *phase ); + virtual const Type *Value( PhaseTransform *phase ) const; + virtual Node *Ideal_DU_postCCP( PhaseCCP * ); +#ifndef PRODUCT + virtual void dump_spec(outputStream *st) const; +#endif }; //------------------------------CastPPNode------------------------------------- diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index ad60d2d9ff9..b917ee113c0 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -27,6 +27,7 @@ #include "memory/allocation.inline.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" +#include "opto/castnode.hpp" #include "opto/connode.hpp" #include "opto/convertnode.hpp" #include "opto/divnode.hpp" @@ -884,6 +885,20 @@ Node *PhaseIdealLoop::clone_up_backedge_goo( Node *back_ctrl, Node *preheader_ct return n; } +bool PhaseIdealLoop::cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop) { + Node* castii = new CastIINode(incr, TypeInt::INT, true); + castii->set_req(0, ctrl); + register_new_node(castii, ctrl); + for (DUIterator_Fast imax, i = incr->fast_outs(imax); i < imax; i++) { + Node* n = incr->fast_out(i); + if (n->is_Phi() && n->in(0) == loop) { + int nrep = n->replace_edge(incr, castii); + return true; + } + } + return false; +} + //------------------------------insert_pre_post_loops-------------------------- // Insert pre and post loops. If peel_only is set, the pre-loop can not have // more iterations added. It acts as a 'peel' only, no lower-bound RCE, no @@ -1080,6 +1095,24 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ } } + // Nodes inside the loop may be control dependent on a predicate + // that was moved before the preloop. If the back branch of the main + // or post loops becomes dead, those nodes won't be dependent on the + // test that guards that loop nest anymore which could lead to an + // incorrect array access because it executes independently of the + // test that was guarding the loop nest. We add a special CastII on + // the if branch that enters the loop, between the input induction + // variable value and the induction variable Phi to preserve correct + // dependencies. + + // CastII for the post loop: + bool inserted = cast_incr_before_loop(zer_opaq->in(1), zer_taken, post_head); + assert(inserted, "no castII inserted"); + + // CastII for the main loop: + inserted = cast_incr_before_loop(pre_incr, min_taken, main_head); + assert(inserted, "no castII inserted"); + // Step B4: Shorten the pre-loop to run only 1 iteration (for now). // RCE and alignment may change this later. Node *cmp_end = pre_end->cmp_node(); diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp index 5c962ae9981..c884dd38b96 100644 --- a/hotspot/src/share/vm/opto/loopnode.hpp +++ b/hotspot/src/share/vm/opto/loopnode.hpp @@ -602,6 +602,8 @@ class PhaseIdealLoop : public PhaseTransform { return ctrl; } + bool cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop); + public: bool has_node( Node* n ) const { guarantee(n != NULL, "No Node."); diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp index 2b0688a90b8..3f5373b7a89 100644 --- a/hotspot/src/share/vm/opto/phaseX.cpp +++ b/hotspot/src/share/vm/opto/phaseX.cpp @@ -1392,15 +1392,27 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) { } } - if( use->is_Cmp() ) { // Enable CMP/BOOL optimization + uint use_op = use->Opcode(); + if(use->is_Cmp()) { // Enable CMP/BOOL optimization add_users_to_worklist(use); // Put Bool on worklist - // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the - // phi merging either 0 or 1 onto the worklist if (use->outcnt() > 0) { Node* bol = use->raw_out(0); if (bol->outcnt() > 0) { Node* iff = bol->raw_out(0); - if (iff->outcnt() == 2) { + if (use_op == Op_CmpI && + iff->is_CountedLoopEnd()) { + CountedLoopEndNode* cle = iff->as_CountedLoopEnd(); + if (cle->limit() == n && cle->phi() != NULL) { + // If an opaque node feeds into the limit condition of a + // CountedLoop, we need to process the Phi node for the + // induction variable when the opaque node is removed: + // the range of values taken by the Phi is now known and + // so its type is also known. + _worklist.push(cle->phi()); + } + } else if (iff->outcnt() == 2) { + // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the + // phi merging either 0 or 1 onto the worklist Node* ifproj0 = iff->raw_out(0); Node* ifproj1 = iff->raw_out(1); if (ifproj0->outcnt() > 0 && ifproj1->outcnt() > 0) { @@ -1412,9 +1424,26 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) { } } } + if (use_op == Op_CmpI) { + Node* in1 = use->in(1); + for (uint i = 0; i < in1->outcnt(); i++) { + if (in1->raw_out(i)->Opcode() == Op_CastII) { + Node* castii = in1->raw_out(i); + if (castii->in(0) != NULL && castii->in(0)->in(0) != NULL && castii->in(0)->in(0)->is_If()) { + Node* ifnode = castii->in(0)->in(0); + if (ifnode->in(1) != NULL && ifnode->in(1)->in(1) == use) { + // Reprocess a CastII node that may depend on an + // opaque node value when the opaque node is + // removed. In case it carries a dependency we can do + // a better job of computing its type. + _worklist.push(castii); + } + } + } + } + } } - uint use_op = use->Opcode(); // If changed Cast input, check Phi users for simple cycles if( use->is_ConstraintCast() || use->is_CheckCastPP() ) { for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) { diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index 1fe558c18d3..27cf544da11 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -1147,12 +1147,10 @@ const Type *BoolTest::cc2logical( const Type *CC ) const { //------------------------------dump_spec------------------------------------- // Print special per-node info -#ifndef PRODUCT void BoolTest::dump_on(outputStream *st) const { const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"}; st->print("%s", msg[_test]); } -#endif //============================================================================= uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); } diff --git a/hotspot/src/share/vm/opto/subnode.hpp b/hotspot/src/share/vm/opto/subnode.hpp index f809a3b90c7..4cc3dd700b5 100644 --- a/hotspot/src/share/vm/opto/subnode.hpp +++ b/hotspot/src/share/vm/opto/subnode.hpp @@ -275,9 +275,7 @@ struct BoolTest VALUE_OBJ_CLASS_SPEC { mask commute( ) const { return mask("032147658"[_test]-'0'); } mask negate( ) const { return mask(_test^4); } bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); } -#ifndef PRODUCT void dump_on(outputStream *st) const; -#endif }; //------------------------------BoolNode--------------------------------------- diff --git a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java new file mode 100644 index 00000000000..f2782383f71 --- /dev/null +++ b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java @@ -0,0 +1,58 @@ +/* + * 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 + * @bug 8054478 + * @summary dead backbranch in main loop results in erroneous array access + * @run main/othervm -XX:CompileOnly=TestDeadBackbranchArrayAccess -Xcomp TestDeadBackbranchArrayAccess + * + */ + +public class TestDeadBackbranchArrayAccess { + static char[] pattern0 = {0}; + static char[] pattern1 = {1}; + + static void test(char[] array) { + if (pattern1 == null) return; + + int i = 0; + int pos = 0; + char c = array[pos]; + + while (i >= 0 && (c == pattern0[i] || c == pattern1[i])) { + i--; + pos--; + if (pos != -1) { + c = array[pos]; + } + } + } + + public static void main(String[] args) { + for (int i = 0; i < 1000000; i++) { + test(new char[1]); + } + } +} From d8d026811c973db15eec4aedbca7492f724f7943 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Thu, 13 Nov 2014 12:00:39 +0300 Subject: [PATCH 078/159] 8064468: ownedWindowList access requires synchronization in Window.setAlwaysOnTop() method Reviewed-by: serb, pchelko --- .../share/classes/java/awt/Window.java | 13 +++- .../AlwaysOnTop/SyncAlwaysOnTopFieldTest.java | 62 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java diff --git a/jdk/src/java.desktop/share/classes/java/awt/Window.java b/jdk/src/java.desktop/share/classes/java/awt/Window.java index 4417314634c..b5a466cb7f3 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Window.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java @@ -2254,7 +2254,18 @@ public class Window extends Container implements Accessible { } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } - for (WeakReference ref : ownedWindowList) { + setOwnedWindowsAlwaysOnTop(alwaysOnTop); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + private void setOwnedWindowsAlwaysOnTop(boolean alwaysOnTop) { + WeakReference[] ownedWindowArray; + synchronized (ownedWindowList) { + ownedWindowArray = new WeakReference[ownedWindowList.size()]; + ownedWindowList.copyInto(ownedWindowArray); + } + + for (WeakReference ref : ownedWindowArray) { Window window = ref.get(); if (window != null) { try { diff --git a/jdk/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java b/jdk/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java new file mode 100644 index 00000000000..ed76fa8e0a2 --- /dev/null +++ b/jdk/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java @@ -0,0 +1,62 @@ +/* + * 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. + */ + +import java.awt.Window; + +/** + * @test + * @bug 8064468 + * @author Alexander Scherbatiy + * @summary ownedWindowList access requires synchronization in + * Window.setAlwaysOnTop() method + * @run main SyncAlwaysOnTopFieldTest + */ +public class SyncAlwaysOnTopFieldTest { + + private static final int WINDOWS_COUNT = 200; + private static final int STEPS_COUNT = 20; + + public static void main(String[] args) throws Exception { + final Window rootWindow = createWindow(null); + + new Thread(() -> { + for (int i = 0; i < WINDOWS_COUNT; i++) { + createWindow(rootWindow); + } + }).start(); + + boolean alwaysOnTop = true; + for (int i = 0; i < STEPS_COUNT; i++) { + Thread.sleep(10); + rootWindow.setAlwaysOnTop(alwaysOnTop); + alwaysOnTop = !alwaysOnTop; + } + } + + private static Window createWindow(Window parent) { + Window window = new Window(parent); + window.setSize(200, 200); + window.setVisible(true); + return window; + } +} \ No newline at end of file From 8f3190b805064eb1cb4b76aa5bc03da59baba9a1 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 13 Nov 2014 19:12:28 +0300 Subject: [PATCH 079/159] 8064749: -XX:-UseCompilerSafepoints breaks safepoint rendezvous Reviewed-by: dcubed, coleenp, kvn, dholmes --- hotspot/src/share/vm/runtime/arguments.cpp | 1 + hotspot/src/share/vm/runtime/globals.hpp | 3 --- hotspot/src/share/vm/runtime/safepoint.cpp | 10 ++++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index ff2a25fe1bc..511f316823d 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -313,6 +313,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = { { "UseFastAccessorMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "UseFastEmptyMethods", JDK_Version::jdk(9), JDK_Version::jdk(10) }, #endif // ZERO + { "UseCompilerSafepoints", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { NULL, JDK_Version(0), JDK_Version(0) } }; diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index e74b9bbdf20..e89fdc19a49 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -777,9 +777,6 @@ class CommandLineFlags { develop(bool, TraceHandleAllocation, false, \ "Print out warnings when suspiciously many handles are allocated")\ \ - product(bool, UseCompilerSafepoints, true, \ - "Stop at safepoints in compiled code") \ - \ product(bool, FailOverToOldVerifier, true, \ "Fail over to old verifier when split verifier fails") \ \ diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp index 05460b84dc0..d7c32ccb009 100644 --- a/hotspot/src/share/vm/runtime/safepoint.cpp +++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -182,7 +182,7 @@ void SafepointSynchronize::begin() { // Make interpreter safepoint aware Interpreter::notice_safepoints(); - if (UseCompilerSafepoints && DeferPollingPageLoopCount < 0) { + if (DeferPollingPageLoopCount < 0) { // Make polling safepoint aware guarantee (PageArmed == 0, "invariant") ; PageArmed = 1 ; @@ -288,7 +288,7 @@ void SafepointSynchronize::begin() { // 9. On windows consider using the return value from SwitchThreadTo() // to drive subsequent spin/SwitchThreadTo()/Sleep(N) decisions. - if (UseCompilerSafepoints && int(iterations) == DeferPollingPageLoopCount) { + if (int(iterations) == DeferPollingPageLoopCount) { guarantee (PageArmed == 0, "invariant") ; PageArmed = 1 ; os::make_polling_page_unreadable(); @@ -1074,7 +1074,7 @@ void SafepointSynchronize::deferred_initialize_stat() { guarantee(_safepoint_stats != NULL, "not enough memory for safepoint instrumentation data"); - if (UseCompilerSafepoints && DeferPollingPageLoopCount >= 0) { + if (DeferPollingPageLoopCount >= 0) { need_to_track_page_armed_status = true; } init_done = true; @@ -1241,9 +1241,7 @@ void SafepointSynchronize::print_stat_on_exit() { // Print out polling page sampling status. if (!need_to_track_page_armed_status) { - if (UseCompilerSafepoints) { - tty->print_cr("Polling page always armed"); - } + tty->print_cr("Polling page always armed"); } else { tty->print_cr("Defer polling page loop count = %d\n", DeferPollingPageLoopCount); From b259ede6922c13015f94b15391fc5161f8b55451 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Thu, 13 Nov 2014 10:39:35 -0800 Subject: [PATCH 080/159] 8033602: wrong stabs data in libjvm.debuginfo on JDK 8 - SPARC 8034005: cannot debug in synchronizer.o or objectMonitor.o on Solaris X86 Solaris needs objcopy version of 2.21.1 or newer is needed to create valid .debuginfo files. Reviewed-by: dsamersoff, sspitsyn, dholmes, ihse --- .../solaris/makefiles/add_gnu_debuglink.make | 54 ---- hotspot/make/solaris/makefiles/defs.make | 51 +++- hotspot/make/solaris/makefiles/dtrace.make | 37 +-- .../makefiles/fix_empty_sec_hdr_flags.make | 54 ---- hotspot/make/solaris/makefiles/jsig.make | 13 +- hotspot/make/solaris/makefiles/saproc.make | 13 +- hotspot/make/solaris/makefiles/vm.make | 21 +- .../add_gnu_debuglink/add_gnu_debuglink.c | 285 ------------------ .../fix_empty_sec_hdr_flags.c | 181 ----------- 9 files changed, 64 insertions(+), 645 deletions(-) delete mode 100644 hotspot/make/solaris/makefiles/add_gnu_debuglink.make delete mode 100644 hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make delete mode 100644 hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c delete mode 100644 hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c diff --git a/hotspot/make/solaris/makefiles/add_gnu_debuglink.make b/hotspot/make/solaris/makefiles/add_gnu_debuglink.make deleted file mode 100644 index ee75722fa99..00000000000 --- a/hotspot/make/solaris/makefiles/add_gnu_debuglink.make +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright (c) 2012, 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. -# -# - -# Rules to build add_gnu_debuglink, used by vm.make on Solaris - -# Allow $(ADD_GNU_DEBUGLINK) to be called from any directory. -# We don't set or use the GENERATED macro to avoid affecting -# other HotSpot Makefiles. -TOPDIR = $(shell echo `pwd`) -ADD_GNU_DEBUGLINK = $(TOPDIR)/../generated/add_gnu_debuglink - -ADD_GNU_DEBUGLINK_DIR = $(GAMMADIR)/src/os/solaris/add_gnu_debuglink -ADD_GNU_DEBUGLINK_SRC = $(ADD_GNU_DEBUGLINK_DIR)/add_gnu_debuglink.c -ADD_GNU_DEBUGLINK_FLAGS = -LIBS_ADD_GNU_DEBUGLINK += -lelf - -ifeq ("${Platform_compiler}", "sparcWorks") -# Enable the following ADD_GNU_DEBUGLINK_FLAGS addition if you need to -# compare the built ELF objects. -# -# The -g option makes static data global and the "-W0,-noglobal" -# option tells the compiler to not globalize static data using a unique -# globalization prefix. Instead force the use of a static globalization -# prefix based on the source filepath so the objects from two identical -# compilations are the same. -# -# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't -# seem to work. I got "-W0,-noglobal" from Kelly and that works. -#ADD_GNU_DEBUGLINK_FLAGS += -W0,-noglobal -endif # Platform_compiler == sparcWorks - -$(ADD_GNU_DEBUGLINK): $(ADD_GNU_DEBUGLINK_SRC) - $(CC) -g -o $@ $< $(ADD_GNU_DEBUGLINK_FLAGS) $(LIBS_ADD_GNU_DEBUGLINK) diff --git a/hotspot/make/solaris/makefiles/defs.make b/hotspot/make/solaris/makefiles/defs.make index 522d3288f96..0a0fe381503 100644 --- a/hotspot/make/solaris/makefiles/defs.make +++ b/hotspot/make/solaris/makefiles/defs.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 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 @@ -138,6 +138,55 @@ ifeq ($(JDK6_OR_EARLIER),0) OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif + ifneq ($(OBJCOPY),) + # OBJCOPY version check: + # - version number is last blank separate word on first line + # - version number formats that have been seen: + # - . + # - .. + # + # Full Debug Symbols on Solaris needs version 2.21.1 or newer. + # + OBJCOPY_VERS_CHK := $(shell \ + $(OBJCOPY) --version \ + | sed -n \ + -e 's/.* //' \ + -e '/^[01]\./b bad' \ + -e '/^2\./{' \ + -e ' s/^2\.//' \ + -e ' /^[0-9]$$/b bad' \ + -e ' /^[0-9]\./b bad' \ + -e ' /^1[0-9]$$/b bad' \ + -e ' /^1[0-9]\./b bad' \ + -e ' /^20\./b bad' \ + -e ' /^21\.0$$/b bad' \ + -e ' /^21\.0\./b bad' \ + -e '}' \ + -e ':good' \ + -e 's/.*/VALID_VERSION/p' \ + -e 'q' \ + -e ':bad' \ + -e 's/.*/BAD_VERSION/p' \ + -e 'q' \ + ) + ifeq ($(OBJCOPY_VERS_CHK),BAD_VERSION) + _JUNK_ := $(shell \ + echo >&2 "WARNING: $(OBJCOPY) --version info:"; \ + $(OBJCOPY) --version | sed -n -e 's/^/WARNING: /p' -e 'q' >&2; \ + echo >&2 "WARNING: an objcopy version of 2.21.1 or newer" \ + "is needed to create valid .debuginfo files."; \ + echo >&2 "WARNING: ignoring above objcopy command."; \ + echo >&2 "WARNING: patch 149063-01 or newer contains the" \ + "correct Solaris 10 SPARC version."; \ + echo >&2 "WARNING: patch 149064-01 or newer contains the" \ + "correct Solaris 10 X86 version."; \ + echo >&2 "WARNING: Solaris 11 Update 1 contains the" \ + "correct version."; \ + ) + OBJCOPY= + endif + endif + ifeq ($(OBJCOPY),) $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files.")) ENABLE_FULL_DEBUG_SYMBOLS=0 diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make index b76ff3cdb15..be6e71dba9e 100644 --- a/hotspot/make/solaris/makefiles/dtrace.make +++ b/hotspot/make/solaris/makefiles/dtrace.make @@ -101,25 +101,16 @@ XLIBJVM_DB_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DB_DIZ) XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO) XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ) -$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) +$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) @echo $(LOG_INFO) Making $@ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. -# Clear the SHF_ALLOC flag (if set) from empty section headers. -# An empty section header has sh_addr == 0 and sh_size == 0. -# This problem has only been seen on Solaris X64, but we call this tool -# on all Solaris builds just in case. - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO) -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. -# $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ; # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not # in the link name: - ( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ) + ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ) ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else @@ -136,20 +127,16 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif endif -$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) +$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo $(LOG_INFO) Making $@ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# Clear the SHF_ALLOC flag (if set) from empty section headers. - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO) -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. -# $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ; # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not # in the link name: - ( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ) + ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ) ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else @@ -206,17 +193,13 @@ $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp -$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) +$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) @echo $(LOG_INFO) Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# Clear the SHF_ALLOC flag (if set) from empty section headers. - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO) -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@ + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else @@ -231,17 +214,13 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif endif -$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) +$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo $(LOG_INFO) Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# Clear the SHF_ALLOC flag (if set) from empty section headers. - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO) -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@ + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else diff --git a/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make b/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make deleted file mode 100644 index bd763904480..00000000000 --- a/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright (c) 2012, 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. -# -# - -# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris - -# Allow $(FIX_EMPTY_SEC_HDR_FLAGS) to be called from any directory. -# We don't set or use the GENERATED macro to avoid affecting -# other HotSpot Makefiles. -TOPDIR = $(shell echo `pwd`) -FIX_EMPTY_SEC_HDR_FLAGS = $(TOPDIR)/../generated/fix_empty_sec_hdr_flags - -FIX_EMPTY_SEC_HDR_FLAGS_DIR = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags -FIX_EMPTY_SEC_HDR_FLAGS_SRC = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c -FIX_EMPTY_SEC_HDR_FLAGS_FLAGS = -LIBS_FIX_EMPTY_SEC_HDR_FLAGS += -lelf - -ifeq ("${Platform_compiler}", "sparcWorks") -# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to -# compare the built ELF objects. -# -# The -g option makes static data global and the "-W0,-noglobal" -# option tells the compiler to not globalize static data using a unique -# globalization prefix. Instead force the use of a static globalization -# prefix based on the source filepath so the objects from two identical -# compilations are the same. -# -# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't -# seem to work. I got "-W0,-noglobal" from Kelly and that works. -#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal -endif # Platform_compiler == sparcWorks - -$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC) - $(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS) diff --git a/hotspot/make/solaris/makefiles/jsig.make b/hotspot/make/solaris/makefiles/jsig.make index bb8d9b2e823..d8acd4ee93a 100644 --- a/hotspot/make/solaris/makefiles/jsig.make +++ b/hotspot/make/solaris/makefiles/jsig.make @@ -47,22 +47,13 @@ else LFLAGS_JSIG += -mt -xnolib endif -$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) +$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) @echo $(LOG_INFO) Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. -# Clear the SHF_ALLOC flag (if set) from empty section headers. -# An empty section header has sh_addr == 0 and sh_size == 0. -# This problem has only been seen on Solaris X64, but we call this tool -# on all Solaris builds just in case. - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@ + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else diff --git a/hotspot/make/solaris/makefiles/saproc.make b/hotspot/make/solaris/makefiles/saproc.make index e6adbf69997..c5558527121 100644 --- a/hotspot/make/solaris/makefiles/saproc.make +++ b/hotspot/make/solaris/makefiles/saproc.make @@ -90,7 +90,7 @@ $(shell uname -r -v \ #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER -$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE) +$(LIBSAPROC): $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE) $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ @@ -121,17 +121,8 @@ $(SADISOBJ): $(SADISSRCFILES) -c -o $(SADISOBJ) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. -# Clear the SHF_ALLOC flag (if set) from empty section headers. -# An empty section header has sh_addr == 0 and sh_size == 0. -# This problem has only been seen on Solaris X64, but we call this tool -# on all Solaris builds just in case. - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@ + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make index da906bcfad8..ea4ec4c1bf5 100644 --- a/hotspot/make/solaris/makefiles/vm.make +++ b/hotspot/make/solaris/makefiles/vm.make @@ -154,14 +154,6 @@ JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH) # jvm_db & dtrace include $(MAKEFILES_DIR)/dtrace.make -#---------------------------------------------------------------------- -# add_gnu_debuglink tool -include $(MAKEFILES_DIR)/add_gnu_debuglink.make - -#---------------------------------------------------------------------- -# fix_empty_sec_hdr_flags tool -include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make - #---------------------------------------------------------------------- # JVM @@ -302,7 +294,7 @@ else LINK_VM = $(LINK_LIB.CXX) endif # making the library: -$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE) +$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) @echo $(LOG_INFO) Linking vm... $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) @@ -310,17 +302,8 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) $(QUIETLY) $(LINK_LIB.CXX/POST_HOOK) $(QUIETLY) rm -f $@.1 && ln -s $@ $@.1 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. -# Clear the SHF_ALLOC flag (if set) from empty section headers. -# An empty section header has sh_addr == 0 and sh_size == 0. -# This problem has only been seen on Solaris X64, but we call this tool -# on all Solaris builds just in case. - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@ + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else diff --git a/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c b/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c deleted file mode 100644 index 3cb2dc489d4..00000000000 --- a/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - */ - -/* - * Name: add_gnu_debuglink.c - * - * Description: Add a ".gnu_debuglink" section that refers to the specified - * debug_info_path to the specified ELF object. - * - * This program is adapted from the example program shown on the - * elf(3elf) man page and from code from the Solaris compiler - * driver. - */ - -/* - * needed to define SHF_EXCLUDE - */ -#define ELF_TARGET_ALL - -#include -#include -#include -#include -#include -#include - -static void failure(void); -static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, - size_t len); - -void -main(int argc, char ** argv) { - /* new ELF section name */ - static char SEC_NAME[] = ".gnu_debuglink"; - - unsigned char buffer[8 * 1024]; /* I/O buffer */ - int buffer_len; /* buffer length */ - char * debug_info_path; /* debug info path */ - void * ehdr; /* ELF header */ - Elf * elf; /* ELF descriptor */ - char * elf_ident; /* ELF identity string */ - char * elf_obj; /* elf_obj file */ - int fd; /* descriptor for files */ - unsigned int file_crc = 0; /* CRC for debug info file */ - int is_elfclass64; /* is an ELFCLASS64 file? */ - Elf_Data * link_dat; /* ELF data for new debug info link */ - Elf_Data * name_dat; /* ELF data for new section name */ - Elf_Scn * new_scn; /* new ELF section descriptor */ - void * new_shdr; /* new ELF section header */ - Elf_Scn * scn; /* ELF section descriptor */ - void * shdr; /* ELF section header */ - - if (argc != 3) { - (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]); - exit(2); - } - - debug_info_path = argv[1]; /* save for later */ - if ((fd = open(debug_info_path, O_RDONLY)) == -1) { - (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path); - exit(3); - } - - (void) printf("Computing CRC for '%s'\n", debug_info_path); - (void) fflush(stdout); - /* compute CRC for the debug info file */ - for (;;) { - int len = read(fd, buffer, sizeof buffer); - if (len <= 0) { - break; - } - file_crc = gnu_debuglink_crc32(file_crc, buffer, len); - } - (void) close(fd); - - /* open the elf_obj */ - elf_obj = argv[2]; - if ((fd = open(elf_obj, O_RDWR)) == -1) { - (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj); - exit(4); - } - - (void) printf("Opening '%s' for update\n", elf_obj); - (void) fflush(stdout); - (void) elf_version(EV_CURRENT); /* coordinate ELF versions */ - - /* obtain the ELF descriptors from the input file */ - if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) { - failure(); - } - - /* determine if ELFCLASS64 or not? */ - elf_ident = elf_getident(elf, NULL); - is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64); - - /* get the ELF header */ - if (is_elfclass64) { - ehdr = elf64_getehdr(elf); - } else { - ehdr = elf32_getehdr(elf); - } - if (ehdr == NULL) { - failure(); - } - - /* get the ELF section descriptor */ - if (is_elfclass64) { - scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx); - } else { - scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx); - } - if (scn == NULL) { - failure(); - } - - /* get the section header */ - if (is_elfclass64) { - shdr = elf64_getshdr(scn); - } else { - shdr = elf32_getshdr(scn); - } - if (shdr == NULL) { - failure(); - } - - (void) printf("Adding ELF data for new section name\n"); - (void) fflush(stdout); - name_dat = elf_newdata(scn); - name_dat->d_buf = (void *) SEC_NAME; - if (is_elfclass64) { - name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1; - } else { - name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1; - } - name_dat->d_align = 1; - name_dat->d_size = strlen(SEC_NAME) + 1; - - new_scn = elf_newscn(elf); - - if (is_elfclass64) { - new_shdr = elf64_getshdr(new_scn); - ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE; - ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS; - ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size; - ((Elf64_Shdr *) new_shdr)->sh_addralign = 1; - ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1); - } else { - new_shdr = elf32_getshdr(new_scn); - ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE; - ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS; - ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size; - ((Elf32_Shdr *) new_shdr)->sh_addralign = 1; - ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1); - } - - (void) printf("Adding ELF data for debug_info_path value\n"); - (void) fflush(stdout); - (void) memset(buffer, 0, sizeof buffer); - buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */ - (void) strncpy((char *) buffer, debug_info_path, buffer_len); - if (buffer_len % 4 != 0) { - /* not on a 4 byte boundary so pad to the next one */ - buffer_len += (4 - buffer_len % 4); - } - /* save the CRC */ - (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc); - buffer_len += sizeof file_crc; - - link_dat = elf_newdata(new_scn); - link_dat->d_type = ELF_T_BYTE; - link_dat->d_size = buffer_len; - link_dat->d_buf = buffer; - link_dat->d_align = 1; - - (void) printf("Saving updates to '%s'\n", elf_obj); - (void) fflush(stdout); - (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */ - (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */ - (void) elf_end(elf); /* done with ELF obj */ - (void) close(fd); - - (void) printf("Done updating '%s'\n", elf_obj); - (void) fflush(stdout); - exit(0); -} /* end main */ - - -static void -failure() { - (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno())); - exit(5); -} - - -/* - * The CRC used in gnu_debuglink, retrieved from - * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files. - */ - -static unsigned int -gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) { - static const unsigned int crc32_table[256] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d - }; - - unsigned char *end; - - crc = ~crc & 0xffffffff; - for (end = buf + len; buf < end; ++buf) { - crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); - } - return ~crc & 0xffffffff; -} diff --git a/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c b/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c deleted file mode 100644 index 6582d950639..00000000000 --- a/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - */ - -/* - * Name: fix_empty_sec_hdr_flags.c - * - * Description: Remove the SHF_ALLOC flag from "empty" section headers. - * An "empty" section header has sh_addr == 0 and sh_size == 0. - * - * This program is adapted from the example program shown on the - * elf(3elf) man page and from code from the Solaris compiler - * driver. - */ - -#include -#include -#include -#include -#include -#include - -static void failure(void); - -void -main(int argc, char ** argv) { - void * ehdr; /* ELF header */ - unsigned int i; /* section counter */ - int fd; /* descriptor for file */ - Elf * elf; /* ELF descriptor */ - char * elf_ident; /* ELF identity string */ - char * elf_obj; /* elf_obj file */ - int fix_count; /* number of flags fixed */ - int is_elfclass64; /* is an ELFCLASS64 file? */ - Elf_Scn * scn; /* ELF section descriptor */ - void * shdr; /* ELF section header */ - Elf_Data * shstrtab; /* ELF section header string table */ - - if (argc != 2) { - (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]); - exit(2); - } - - /* open the elf_obj */ - elf_obj = argv[1]; - if ((fd = open(elf_obj, O_RDWR)) == -1) { - (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj); - exit(3); - } - - (void) printf("Opening '%s' for update\n", elf_obj); - (void) fflush(stdout); - (void) elf_version(EV_CURRENT); /* coordinate ELF versions */ - - /* obtain the ELF descriptors from the input file */ - if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) { - failure(); - } - - /* determine if ELFCLASS64 or not? */ - elf_ident = elf_getident(elf, NULL); - is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64); - - /* get the ELF header */ - if (is_elfclass64) { - ehdr = elf64_getehdr(elf); - } else { - ehdr = elf32_getehdr(elf); - } - if (ehdr == NULL) { - failure(); - } - - /* get the ELF section descriptor */ - if (is_elfclass64) { - scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx); - } else { - scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx); - } - if (scn == NULL) { - failure(); - } - - /* get the section header string table */ - shstrtab = elf_getdata(scn, NULL); - if (shstrtab == NULL) { - failure(); - } - - fix_count = 0; - - /* traverse the sections of the input file */ - for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) { - int has_flag_set; /* is SHF_ALLOC flag set? */ - int is_empty; /* is section empty? */ - char * name; /* short hand pointer */ - - /* get the section header */ - if (is_elfclass64) { - shdr = elf64_getshdr(scn); - } else { - shdr = elf32_getshdr(scn); - } - if (shdr == NULL) { - failure(); - } - - if (is_elfclass64) { - name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name; - } else { - name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name; - } - - if (is_elfclass64) { - has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC; - is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 && - ((Elf64_Shdr *) shdr)->sh_size == 0; - } else { - has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC; - is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 && - ((Elf32_Shdr *) shdr)->sh_size == 0; - } - - if (is_empty && has_flag_set) { - (void) printf("section[%u] '%s' is empty, " - "but SHF_ALLOC flag is set.\n", i, name); - (void) printf("Clearing the SHF_ALLOC flag.\n"); - - if (is_elfclass64) { - ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC; - } else { - ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC; - } - fix_count++; - } - } /* end for each ELF section */ - - if (fix_count > 0) { - (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj); - (void) fflush(stdout); - (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */ - (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */ - } else { - (void) printf("No SHF_ALLOC flags needed to be cleared.\n"); - } - - (void) elf_end(elf); /* done with ELF obj */ - (void) close(fd); - - (void) printf("Done %s '%s'\n", - (fix_count > 0) ? "updating" : "with", elf_obj); - (void) fflush(stdout); - exit(0); -} /* end main */ - - -static void -failure() { - (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno())); - exit(6); -} From 3e575a7078cf9f65240d99a600d07aaa63f7dfce Mon Sep 17 00:00:00 2001 From: Eric McCorkle Date: Fri, 14 Nov 2014 12:45:55 -0500 Subject: [PATCH 081/159] 8064571: java/lang/instrument/IsModifiableClassAgent.java: assert(length > 0) failed: should only be called if table is present Remove tautological assert Reviewed-by: coleenp, lfoltan, sspitsyn, jiangli --- hotspot/src/share/vm/oops/constMethod.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/hotspot/src/share/vm/oops/constMethod.cpp b/hotspot/src/share/vm/oops/constMethod.cpp index e3703be0c59..88d2c0ffee4 100644 --- a/hotspot/src/share/vm/oops/constMethod.cpp +++ b/hotspot/src/share/vm/oops/constMethod.cpp @@ -293,7 +293,6 @@ int ConstMethod::method_parameters_length() const { MethodParametersElement* ConstMethod::method_parameters_start() const { u2* addr = method_parameters_length_addr(); u2 length = *addr; - assert(length > 0, "should only be called if table is present"); addr -= length * sizeof(MethodParametersElement) / sizeof(u2); return (MethodParametersElement*) addr; } From 54d2060d4290181d7e1c688612b7d2f1c06c08e3 Mon Sep 17 00:00:00 2001 From: Max Ockner Date: Fri, 14 Nov 2014 13:09:53 -0500 Subject: [PATCH 082/159] 8060449: Obsolete command line flags accept arbitrary appendix Proper error messages for newly obsolete command line flags. Reviewed-by: lfoltan, dcubed, coleenp --- hotspot/src/share/vm/runtime/arguments.cpp | 17 +++++-- .../CommandLine/ObsoleteFlagErrorMessage.java | 44 +++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index ff2a25fe1bc..018cb0c5267 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -327,9 +327,12 @@ bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) { const ObsoleteFlag& flag_status = obsolete_jvm_flags[i]; // =xxx form // [-|+] form - if ((strncmp(flag_status.name, s, strlen(flag_status.name)) == 0) || + size_t len = strlen(flag_status.name); + if (((strncmp(flag_status.name, s, len) == 0) && + (strlen(s) == len)) || ((s[0] == '+' || s[0] == '-') && - (strncmp(flag_status.name, &s[1], strlen(flag_status.name)) == 0))) { + (strncmp(flag_status.name, &s[1], len) == 0) && + (strlen(&s[1]) == len))) { if (JDK_Version::current().compare(flag_status.accept_until) == -1) { *version = flag_status.obsoleted_in; return true; @@ -934,10 +937,18 @@ bool Arguments::process_argument(const char* arg, Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true); if (fuzzy_matched != NULL) { jio_fprintf(defaultStream::error_stream(), - "Did you mean '%s%s%s'?\n", + "Did you mean '%s%s%s'? ", (fuzzy_matched->is_bool()) ? "(+/-)" : "", fuzzy_matched->_name, (fuzzy_matched->is_bool()) ? "" : "="); + if (is_newly_obsolete(fuzzy_matched->_name, &since)) { + char version[256]; + since.to_string(version, sizeof(version)); + jio_fprintf(defaultStream::error_stream(), + "Warning: support for %s was removed in %s\n", + fuzzy_matched->_name, + version); + } } } diff --git a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java new file mode 100644 index 00000000000..3af8408fcbe --- /dev/null +++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java @@ -0,0 +1,44 @@ +/* + * 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 + * @bug 8060449 + * @summary Newly obsolete command line options should still give useful error messages when used improperly. + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.*; + +public class ObsoleteFlagErrorMessage { + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:UseBoundThreadsPlusJunk", "-version"); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("Unrecognized VM option 'UseBoundThreadsPlusJunk'"); // Must identify bad option. + output.shouldContain("UseBoundThreads"); // Should apply fuzzy matching to find correct option. + output.shouldContain("support").shouldContain("removed"); // Should warn user that the option they are trying to use is no longer supported. + output.shouldHaveExitValue(1); + } +} From c96487313bcbefdc14d03c09c0eabba1bce5a591 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Mon, 17 Nov 2014 11:26:43 -0500 Subject: [PATCH 083/159] 8064779: Add additional comments for "8062370: Various minor code improvements" Provide additional comments to jio_snprintf and jio_vsnprintf Reviewed-by: simonis, coleenp, mgronlun --- hotspot/src/share/vm/prims/jvm.cpp | 4 ++++ hotspot/src/share/vm/prims/jvm.h | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 419abd6d0f0..e28db7c4985 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -2593,6 +2593,10 @@ int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) { if ((intptr_t)count <= 0) return -1; int result = vsnprintf(str, count, fmt, args); + // Note: on truncation vsnprintf(3) on Unix returns numbers of + // characters which would have been written had the buffer been large + // enough; on Windows, it returns -1. We handle both cases here and + // always return -1, and perform null termination. if ((result > 0 && (size_t)result >= count) || result == -1) { str[count - 1] = '\0'; result = -1; diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h index e51b07f8f97..f3b045c9521 100644 --- a/hotspot/src/share/vm/prims/jvm.h +++ b/hotspot/src/share/vm/prims/jvm.h @@ -1167,10 +1167,14 @@ JVM_NativePath(char *); * be renamed to JVM_* in the future? */ -/* - * BE CAREFUL! The following functions do not implement the - * full feature set of standard C printf formats. - */ +/* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3), + * respectively, with the following differences: + * - The string written to str is always zero-terminated, also in case of + * truncation (count is too small to hold the result string), unless count + * is 0. In case of truncation count-1 characters are written and '\0' + * appendend. + * - If count is too small to hold the whole string, -1 is returned across + * all platforms. */ JNIEXPORT int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); From 8e5771854ad18e41e9ae5b380f01875c080d96dc Mon Sep 17 00:00:00 2001 From: Gunter Haug Date: Thu, 13 Nov 2014 16:58:56 +0100 Subject: [PATCH 084/159] 8064471: Port 8013895: G1: G1SummarizeRSetStats output on Linux needs improvement to AIX Reviewed-by: dholmes, simonis --- hotspot/src/os/aix/vm/os_aix.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index d0765c4c1fc..d7420ad820d 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -107,6 +107,12 @@ #include #include +// If RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling +// getrusage() is prepared to handle the associated failure. +#ifndef RUSAGE_THREAD +#define RUSAGE_THREAD (1) /* only the calling thread */ +#endif + // Add missing declarations (should be in procinfo.h but isn't until AIX 6.1). #if !defined(_AIXVERSION_610) extern "C" { @@ -1072,15 +1078,19 @@ jlong os::elapsed_frequency() { return (1000 * 1000); } -// For now, we say that linux does not support vtime. I have no idea -// whether it can actually be made to (DLD, 9/13/05). - -bool os::supports_vtime() { return false; } +bool os::supports_vtime() { return true; } bool os::enable_vtime() { return false; } bool os::vtime_enabled() { return false; } + double os::elapsedVTime() { - // better than nothing, but not much - return elapsedTime(); + struct rusage usage; + int retval = getrusage(RUSAGE_THREAD, &usage); + if (retval == 0) { + return usage.ru_utime.tv_sec + usage.ru_stime.tv_sec + (usage.ru_utime.tv_usec + usage.ru_stime.tv_usec) / (1000.0 * 1000); + } else { + // better than nothing, but not much + return elapsedTime(); + } } jlong os::javaTimeMillis() { From 9cc6c5c2c5812587eb9be4ee97231704038d52a3 Mon Sep 17 00:00:00 2001 From: Mikael Auno Date: Fri, 14 Nov 2014 10:22:43 +0100 Subject: [PATCH 085/159] 8064799: [TESTBUG] JT-Reg Serviceability tests to be run as part of JPRT submit job Reviewed-by: sla, alanb, dholmes, sspitsyn --- jdk/test/TEST.groups | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups index 6cee6e39d0d..b832f2335a4 100644 --- a/jdk/test/TEST.groups +++ b/jdk/test/TEST.groups @@ -290,6 +290,65 @@ jdk_desktop = \ :jdk_sound \ :jdk_imageio +############################################################################### +# +# Serviceability sanity groups +# +# These groups specify a subset of Serviceability tests that are supposed to +# guard against breakage of Serviceability features by other component teams. +# They are added to the "hotspot" testset in JPRT so that they will run on all +# full-forest pushes through JPRT. +# + +jdk_svc_sanity = \ + :jdk_management_sanity \ + :jdk_instrument_sanity \ + :jdk_jmx_sanity \ + :jdk_jdi_sanity \ + :svc_tools_sanity + +jdk_management_sanity = + +jdk_instrument_sanity = + +jdk_jmx_sanity = + +jdk_jdi_sanity = \ + com/sun/jdi/AcceptTimeout.java \ + com/sun/jdi/AccessSpecifierTest.java \ + com/sun/jdi/AfterThreadDeathTest.java \ + com/sun/jdi/ArrayRangeTest.java \ + com/sun/jdi/ConstantPoolInfo.java \ + com/sun/jdi/CountFilterTest.java \ + com/sun/jdi/EarlyReturnNegativeTest.java \ + com/sun/jdi/EarlyReturnTest.java \ + com/sun/jdi/FieldWatchpoints.java \ + com/sun/jdi/FramesTest.java \ + com/sun/jdi/InstanceFilter.java \ + com/sun/jdi/InterfaceMethodsTest.java \ + com/sun/jdi/InvokeTest.java \ + com/sun/jdi/LocalVariableEqual.java \ + com/sun/jdi/LocationTest.java \ + com/sun/jdi/ModificationWatchpoints.java \ + com/sun/jdi/MonitorEventTest.java \ + com/sun/jdi/MonitorFrameInfo.java \ + com/sun/jdi/NullThreadGroupNameTest.java \ + com/sun/jdi/PopAndStepTest.java \ + com/sun/jdi/PopAsynchronousTest.java \ + com/sun/jdi/ProcessAttachTest.java \ + com/sun/jdi/ReferrersTest.java \ + com/sun/jdi/RequestReflectionTest.java \ + com/sun/jdi/ResumeOneThreadTest.java \ + com/sun/jdi/RunToExit.java \ + com/sun/jdi/SourceNameFilterTest.java \ + com/sun/jdi/VarargsTest.java \ + com/sun/jdi/Vars.java \ + com/sun/jdi/redefineMethod/RedefineTest.java \ + com/sun/jdi/sde/MangleTest.java \ + com/sun/jdi/sde/TemperatureTableTest.java + +svc_tools_sanity = + ############################# # # Stable test groups From cb0c3ed7ae7ce6d8b2fb83f63e8ea1e9ddb933b1 Mon Sep 17 00:00:00 2001 From: Mikael Auno Date: Fri, 14 Nov 2014 10:29:01 +0100 Subject: [PATCH 086/159] 8064799: [TESTBUG] JT-Reg Serviceability tests to be run as part of JPRT submit job Reviewed-by: sla, alanb, dholmes, sspitsyn --- make/jprt.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/make/jprt.properties b/make/jprt.properties index 1a268de8353..31cd43b2981 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -491,4 +491,5 @@ my.make.rule.test.targets.hotspot= \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_runtime}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_runtime_closed}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_serviceability}, \ + ${my.make.rule.test.targets.hotspot.reg.group:GROUP=jdk_svc_sanity}, \ ${my.additional.make.rule.test.targets.hotspot} From 24c525eb116137aaebbd373e6ce22f1f7f799d25 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 14 Nov 2014 16:19:40 +0400 Subject: [PATCH 087/159] 8023723: Can not paste and copy the text from the text area into the editor Reviewed-by: serb, alexsch --- .../META-INF/services/sun.datatransfer.DesktopDatatransferService | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jdk/src/java.desktop/share/classes/{sun/awt/datatransfer => }/META-INF/services/sun.datatransfer.DesktopDatatransferService (100%) diff --git a/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/META-INF/services/sun.datatransfer.DesktopDatatransferService b/jdk/src/java.desktop/share/classes/META-INF/services/sun.datatransfer.DesktopDatatransferService similarity index 100% rename from jdk/src/java.desktop/share/classes/sun/awt/datatransfer/META-INF/services/sun.datatransfer.DesktopDatatransferService rename to jdk/src/java.desktop/share/classes/META-INF/services/sun.datatransfer.DesktopDatatransferService From da1287a38fd498ca58db1d7dace53816e5faa8b4 Mon Sep 17 00:00:00 2001 From: Andrey Zakharov Date: Fri, 14 Nov 2014 17:36:56 +0400 Subject: [PATCH 088/159] 8064716: TestHumongousShrinkHeap.java can not be run with -XX:+ExplicitGCInvokesConcurrent 8062957: Heap is not shrunk when deallocating under memory pressure Added explicit -XX:-ExplicitGCInvokesConcurrent to invocations Reviewed-by: brutisso, tschatzl --- hotspot/test/gc/g1/TestHumongousShrinkHeap.java | 7 +++++-- hotspot/test/gc/g1/TestShrinkAuxiliaryData.java | 1 + hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java index 97d60546b25..b350bcd8611 100644 --- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java +++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java @@ -24,9 +24,12 @@ /** * @test TestHumongousShrinkHeap * @bug 8036025 8056043 - * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects + * @summary Verify that heap shrinks after GC in the presence of fragmentation + * due to humongous objects * @library /testlibrary - * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap + * @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10 + * -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc + * TestHumongousShrinkHeap */ import java.lang.management.ManagementFactory; diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java index a185fe5d4e8..cba813882a5 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java @@ -45,6 +45,7 @@ public class TestShrinkAuxiliaryData { "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", "-XX:G1HeapRegionSize=1m", + "-XX:-ExplicitGCInvokesConcurrent", "-XX:+PrintGCDetails" }; diff --git a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java index 94eb690e97d..c23c8721af3 100644 --- a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java +++ b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java @@ -59,6 +59,7 @@ public class TestShrinkDefragmentedHeap { "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", "-XX:G1HeapRegionSize=" + REGION_SIZE, + "-XX:-ExplicitGCInvokesConcurrent", "-verbose:gc", GCTest.class.getName() ); From 5b4a9bc9764355ca732617c6a65e94e044fe13df Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Fri, 14 Nov 2014 17:53:46 +0300 Subject: [PATCH 089/159] 8059739: Dragged and Dropped data is corrupted for two data types Reviewed-by: serb, pchelko --- .../swing/plaf/basic/BasicTransferable.java | 15 +++- .../DataTransfer/8059739/bug8059739.java | 80 +++++++++++++++++++ 2 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/swing/DataTransfer/8059739/bug8059739.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java index 7ed4e3d53ba..544c2ebe731 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java @@ -24,6 +24,8 @@ */ package javax.swing.plaf.basic; +import sun.datatransfer.DataFlavorUtil; + import java.io.*; import java.awt.datatransfer.*; import javax.swing.plaf.UIResource; @@ -145,7 +147,7 @@ class BasicTransferable implements Transferable, UIResource { } else if (Reader.class.equals(flavor.getRepresentationClass())) { return new StringReader(data); } else if (InputStream.class.equals(flavor.getRepresentationClass())) { - return new StringBufferInputStream(data); + return createInputStream(flavor, data); } // fall through to unsupported } else if (isPlainFlavor(flavor)) { @@ -156,7 +158,7 @@ class BasicTransferable implements Transferable, UIResource { } else if (Reader.class.equals(flavor.getRepresentationClass())) { return new StringReader(data); } else if (InputStream.class.equals(flavor.getRepresentationClass())) { - return new StringBufferInputStream(data); + return createInputStream(flavor, data); } // fall through to unsupported @@ -168,6 +170,15 @@ class BasicTransferable implements Transferable, UIResource { throw new UnsupportedFlavorException(flavor); } + private InputStream createInputStream(DataFlavor flavor, String data) + throws IOException, UnsupportedFlavorException { + String cs = DataFlavorUtil.getTextCharset(flavor); + if (cs == null) { + throw new UnsupportedFlavorException(flavor); + } + return new ByteArrayInputStream(data.getBytes(cs)); + } + // --- richer subclass flavors ---------------------------------------------- protected boolean isRicherFlavor(DataFlavor flavor) { diff --git a/jdk/test/javax/swing/DataTransfer/8059739/bug8059739.java b/jdk/test/javax/swing/DataTransfer/8059739/bug8059739.java new file mode 100644 index 00000000000..b2b8bada4da --- /dev/null +++ b/jdk/test/javax/swing/DataTransfer/8059739/bug8059739.java @@ -0,0 +1,80 @@ +/* + * 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 + @bug 8059739 + @summary Dragged and Dropped data is corrupted for two data types + @author Anton Nashatyrev +*/ + +import javax.swing.*; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class bug8059739 { + + private static boolean passed = true; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + try { + runTest(); + } catch (Exception e) { + e.printStackTrace(); + passed = false; + } + } + }); + + if (!passed) { + throw new RuntimeException("Test FAILED."); + } else { + System.out.println("Passed."); + } + } + + private static void runTest() throws Exception { + String testString = "my string"; + JTextField tf = new JTextField(testString); + tf.selectAll(); + Clipboard clipboard = new Clipboard("clip"); + tf.getTransferHandler().exportToClipboard(tf, clipboard, TransferHandler.COPY); + DataFlavor[] dfs = clipboard.getAvailableDataFlavors(); + for (DataFlavor df: dfs) { + String charset = df.getParameter("charset"); + if (InputStream.class.isAssignableFrom(df.getRepresentationClass()) && + charset != null) { + BufferedReader br = new BufferedReader(new InputStreamReader( + (InputStream) clipboard.getData(df), charset)); + String s = br.readLine(); + System.out.println("Content: '" + s + "'"); + passed &= s.contains(testString); + } + } + } +} From 477b157f387116cf14f674e166eed72adce2363b Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Mon, 17 Nov 2014 23:56:53 +0100 Subject: [PATCH 090/159] 8065070: (fmt) Avoid creating substrings when building FormatSpecifier Reviewed-by: martin, shade --- .../share/classes/java/util/Formatter.java | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/Formatter.java b/jdk/src/java.base/share/classes/java/util/Formatter.java index a12952bde02..70298d5b59f 100644 --- a/jdk/src/java.base/share/classes/java/util/Formatter.java +++ b/jdk/src/java.base/share/classes/java/util/Formatter.java @@ -2624,10 +2624,11 @@ public final class Formatter implements Closeable, Flushable { private boolean dt = false; private char c; - private int index(String s) { - if (s != null) { + private int index(String s, int start, int end) { + if (start >= 0) { try { - index = Integer.parseInt(s.substring(0, s.length() - 1)); + // skip the trailing '$' + index = Integer.parseInt(s, start, end - 1, 10); } catch (NumberFormatException x) { assert(false); } @@ -2648,11 +2649,11 @@ public final class Formatter implements Closeable, Flushable { return f; } - private int width(String s) { + private int width(String s, int start, int end) { width = -1; - if (s != null) { + if (start >= 0) { try { - width = Integer.parseInt(s); + width = Integer.parseInt(s, start, end, 10); if (width < 0) throw new IllegalFormatWidthException(width); } catch (NumberFormatException x) { @@ -2662,12 +2663,12 @@ public final class Formatter implements Closeable, Flushable { return width; } - private int precision(String s) { + private int precision(String s, int start, int end) { precision = -1; - if (s != null) { + if (start >= 0) { try { - // remove the '.' - precision = Integer.parseInt(s.substring(1)); + // skip the leading '.' + precision = Integer.parseInt(s, start + 1, end, 10); if (precision < 0) throw new IllegalFormatPrecisionException(precision); } catch (NumberFormatException x) { @@ -2695,23 +2696,19 @@ public final class Formatter implements Closeable, Flushable { } FormatSpecifier(String s, Matcher m) { - int idx = 1; + index(s, m.start(1), m.end(1)); + flags(s, m.start(2), m.end(2)); + width(s, m.start(3), m.end(3)); + precision(s, m.start(4), m.end(4)); - index(m.group(idx++)); - flags(s, m.start(idx), m.end(idx++)); - width(m.group(idx++)); - precision(m.group(idx++)); - - int tTStart = m.start(idx); - int tTEnd = m.end(idx++); - if (tTStart != -1 && tTEnd != -1) { + int tTStart = m.start(5); + if (tTStart >= 0) { dt = true; - if (tTStart == tTEnd - 1 && s.charAt(tTStart) == 'T') { + if (s.charAt(tTStart) == 'T') { f.add(Flags.UPPERCASE); } } - - conversion(s.charAt(m.start(idx))); + conversion(s.charAt(m.start(6))); if (dt) checkDateTime(); From 53906a2cb4cc06f0817d97be68a405c60edf5efa Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Wed, 19 Nov 2014 21:22:22 -0500 Subject: [PATCH 091/159] 8064932: java/lang/ProcessBuilder/Basic.java: waitFor didn't take long enough Reviewed-by: dholmes, martin --- .../unix/classes/java/lang/UNIXProcess.java | 17 ++++++++++------- .../windows/classes/java/lang/ProcessImpl.java | 18 ++++++++++++++---- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java b/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java index 85f15407c8f..d3adac90cd2 100644 --- a/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java +++ b/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java @@ -406,14 +406,17 @@ final class UNIXProcess extends Process { if (hasExited) return true; if (timeout <= 0) return false; - long timeoutAsNanos = unit.toNanos(timeout); - long startTime = System.nanoTime(); - long rem = timeoutAsNanos; + long remainingNanos = unit.toNanos(timeout); + long deadline = System.nanoTime() + remainingNanos; - while (!hasExited && (rem > 0)) { - wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1)); - rem = timeoutAsNanos - (System.nanoTime() - startTime); - } + do { + // Round up to next millisecond + wait(TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L)); + if (hasExited) { + return true; + } + remainingNanos = deadline - System.nanoTime(); + } while (remainingNanos > 0); return hasExited; } diff --git a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java index 02e0c7bf346..ec90ea0da3a 100644 --- a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java +++ b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java @@ -461,11 +461,21 @@ final class ProcessImpl extends Process { if (getExitCodeProcess(handle) != STILL_ACTIVE) return true; if (timeout <= 0) return false; - long msTimeout = unit.toMillis(timeout); + long remainingNanos = unit.toNanos(timeout); + long deadline = System.nanoTime() + remainingNanos ; + + do { + // Round up to next millisecond + long msTimeout = TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L); + waitForTimeoutInterruptibly(handle, msTimeout); + if (Thread.interrupted()) + throw new InterruptedException(); + if (getExitCodeProcess(handle) != STILL_ACTIVE) { + return true; + } + remainingNanos = deadline - System.nanoTime(); + } while (remainingNanos > 0); - waitForTimeoutInterruptibly(handle, msTimeout); - if (Thread.interrupted()) - throw new InterruptedException(); return (getExitCodeProcess(handle) != STILL_ACTIVE); } From d5aaa2d8ffcc9fe9d6df7927089db4af38ee1f61 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Wed, 19 Nov 2014 21:28:26 -0500 Subject: [PATCH 092/159] 8065372: Object.wait(ms, ns) timeout returns early Reviewed-by: martin, dholmes --- jdk/src/java.base/share/classes/java/lang/Object.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/lang/Object.java b/jdk/src/java.base/share/classes/java/lang/Object.java index bf6133109d5..04ca33153d6 100644 --- a/jdk/src/java.base/share/classes/java/lang/Object.java +++ b/jdk/src/java.base/share/classes/java/lang/Object.java @@ -453,7 +453,7 @@ public class Object { "nanosecond timeout value out of range"); } - if (nanos >= 500000 || (nanos != 0 && timeout == 0)) { + if (nanos > 0) { timeout++; } From f4aff4270865de2eb699c156269bd95685429c54 Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Fri, 14 Nov 2014 13:46:19 -0800 Subject: [PATCH 093/159] 8064288: sun.management.Flag should loadLibrary() Call System.loadLibrary("management") from Flag static initializer Reviewed-by: mchung --- .../share/classes/sun/management/Flag.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jdk/src/java.management/share/classes/sun/management/Flag.java b/jdk/src/java.management/share/classes/sun/management/Flag.java index 4f52cb51495..52da43e8408 100644 --- a/jdk/src/java.management/share/classes/sun/management/Flag.java +++ b/jdk/src/java.management/share/classes/sun/management/Flag.java @@ -28,6 +28,7 @@ package sun.management; import java.util.*; import com.sun.management.VMOption; import com.sun.management.VMOption.Origin; +import java.security.AccessController; /** * Flag class is a helper class for constructing a VMOption. @@ -115,6 +116,13 @@ class Flag { static synchronized native void setStringValue(String name, String value); static { + AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Void run() { + System.loadLibrary("management"); + return null; + } + }); initialize(); } private static native void initialize(); From f50ee8896ab8c7fff4af38fc9d9ed86649a1c4f5 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Sun, 16 Nov 2014 15:03:46 +0100 Subject: [PATCH 094/159] 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width Reviewed-by: sherman --- .../java/util/Formatter/Basic-X.java.template | 44 ++++++++- .../java/util/Formatter/BasicBigDecimal.java | 73 ++++++++++++++- .../java/util/Formatter/BasicBigInteger.java | 89 ++++++++++++++++++- .../java/util/Formatter/BasicBoolean.java | 89 ++++++++++++++++++- .../util/Formatter/BasicBooleanObject.java | 89 ++++++++++++++++++- jdk/test/java/util/Formatter/BasicByte.java | 89 ++++++++++++++++++- .../java/util/Formatter/BasicByteObject.java | 89 ++++++++++++++++++- jdk/test/java/util/Formatter/BasicChar.java | 89 ++++++++++++++++++- .../java/util/Formatter/BasicCharObject.java | 89 ++++++++++++++++++- .../java/util/Formatter/BasicDateTime.java | 89 ++++++++++++++++++- jdk/test/java/util/Formatter/BasicDouble.java | 55 ++++++++++-- .../util/Formatter/BasicDoubleObject.java | 73 ++++++++++++++- jdk/test/java/util/Formatter/BasicFloat.java | 73 ++++++++++++++- .../java/util/Formatter/BasicFloatObject.java | 73 ++++++++++++++- jdk/test/java/util/Formatter/BasicInt.java | 89 ++++++++++++++++++- .../java/util/Formatter/BasicIntObject.java | 89 ++++++++++++++++++- jdk/test/java/util/Formatter/BasicLong.java | 89 ++++++++++++++++++- .../java/util/Formatter/BasicLongObject.java | 89 ++++++++++++++++++- jdk/test/java/util/Formatter/BasicShort.java | 89 ++++++++++++++++++- .../java/util/Formatter/BasicShortObject.java | 89 ++++++++++++++++++- jdk/test/java/util/Formatter/genBasic.sh | 2 +- 21 files changed, 1614 insertions(+), 25 deletions(-) diff --git a/jdk/test/java/util/Formatter/Basic-X.java.template b/jdk/test/java/util/Formatter/Basic-X.java.template index 2393cfaa59b..47c5516be49 100644 --- a/jdk/test/java/util/Formatter/Basic-X.java.template +++ b/jdk/test/java/util/Formatter/Basic-X.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class Basic$Type$ extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class Basic$Type$ extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -572,6 +580,14 @@ public class Basic$Type$ extends Basic { test("%(10d", " (12345)", negate(oneToFive)); test("%-10d", "12345 ", oneToFive); test("%-10d", "-12345 ", negate(oneToFive)); + // , variations: + test("% ,d", " 12,345", oneToFive); + test("% ,d", "-12,345", negate(oneToFive)); + test("%0,10d", "000012,345", oneToFive); + test("%0,10d", "-00012,345", negate(oneToFive)); + test("%(,10d", " (12,345)", negate(oneToFive)); + test("%-,10d", "12,345 ", oneToFive); + test("%-,10d", "-12,345 ", negate(oneToFive)); #else[short] #if[prim] @@ -594,6 +610,16 @@ public class Basic$Type$ extends Basic { test("%(10d", " (1234567)", negate(oneToSeven)); test("%-10d", "1234567 ", oneToSeven); test("%-10d", "-1234567 ", negate(oneToSeven)); + // , variations: + test("% ,d", " 1,234,567", oneToSeven); + test("% ,d", "-1,234,567", negate(oneToSeven)); + test("%+,10d", "+1,234,567", oneToSeven); + test("%0,10d", "01,234,567", oneToSeven); + test("%0,10d", "-1,234,567", negate(oneToSeven)); + test("%(,10d", "(1,234,567)", negate(oneToSeven)); + test("%-,10d", "1,234,567 ", oneToSeven); + test("%-,10d", "-1,234,567", negate(oneToSeven)); + #end[prim] #end[short] #end[byte] @@ -781,6 +807,14 @@ public class Basic$Type$ extends Basic { test("%+d", "-1234567", new BigInteger("-1234567", 10)); test("%-10d", "1234567 ", new BigInteger("1234567", 10)); test("%-10d", "-1234567 ", new BigInteger("-1234567", 10)); + // , variations: + test("%0,10d", "01,234,567", new BigInteger("1234567", 10)); + test("%0,10d", "-1,234,567", new BigInteger("-1234567", 10)); + test("%(,10d", "(1,234,567)", new BigInteger("-1234567", 10)); + test("%+,d", "+1,234,567", new BigInteger("1234567", 10)); + test("%+,d", "-1,234,567", new BigInteger("-1234567", 10)); + test("%-,10d", "1,234,567 ", new BigInteger("1234567", 10)); + test("%-,10d", "-1,234,567", new BigInteger("-1234567", 10)); //--------------------------------------------------------------------- // %o - BigInteger @@ -1039,6 +1073,14 @@ public class Basic$Type$ extends Basic { test("%3.0f", "1000000", 1000000.00); test("%3.0f", "10000000", 10000000.00); test("%3.0f", "100000000", 100000000.00); + test("%10.0f", " 1000000", 1000000.00); + test("%,10.0f", " 1,000,000", 1000000.00); + test("%,10.1f", "1,000,000.0", 1000000.00); + test("%,3.0f", "1,000,000", 1000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); #if[BigDecimal] //--------------------------------------------------------------------- // %f - BigDecimal diff --git a/jdk/test/java/util/Formatter/BasicBigDecimal.java b/jdk/test/java/util/Formatter/BasicBigDecimal.java index a622e5afd02..00a04f4535f 100644 --- a/jdk/test/java/util/Formatter/BasicBigDecimal.java +++ b/jdk/test/java/util/Formatter/BasicBigDecimal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicBigDecimal extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicBigDecimal extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -810,6 +818,32 @@ public class BasicBigDecimal extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1039,6 +1073,14 @@ public class BasicBigDecimal extends Basic { test("%3.0f", "1000000", 1000000.00); test("%3.0f", "10000000", 10000000.00); test("%3.0f", "100000000", 100000000.00); + test("%10.0f", " 1000000", 1000000.00); + test("%,10.0f", " 1,000,000", 1000000.00); + test("%,10.1f", "1,000,000.0", 1000000.00); + test("%,3.0f", "1,000,000", 1000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); //--------------------------------------------------------------------- // %f - BigDecimal @@ -1330,6 +1372,35 @@ public class BasicBigDecimal extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicBigInteger.java b/jdk/test/java/util/Formatter/BasicBigInteger.java index af3cac5e47b..aceecc67c81 100644 --- a/jdk/test/java/util/Formatter/BasicBigInteger.java +++ b/jdk/test/java/util/Formatter/BasicBigInteger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicBigInteger extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicBigInteger extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -735,6 +743,24 @@ public class BasicBigInteger extends Basic { + + + + + + + + + + + + + + + + + + @@ -781,6 +807,14 @@ public class BasicBigInteger extends Basic { test("%+d", "-1234567", new BigInteger("-1234567", 10)); test("%-10d", "1234567 ", new BigInteger("1234567", 10)); test("%-10d", "-1234567 ", new BigInteger("-1234567", 10)); + // , variations: + test("%0,10d", "01,234,567", new BigInteger("1234567", 10)); + test("%0,10d", "-1,234,567", new BigInteger("-1234567", 10)); + test("%(,10d", "(1,234,567)", new BigInteger("-1234567", 10)); + test("%+,d", "+1,234,567", new BigInteger("1234567", 10)); + test("%+,d", "-1,234,567", new BigInteger("-1234567", 10)); + test("%-,10d", "1,234,567 ", new BigInteger("1234567", 10)); + test("%-,10d", "-1,234,567", new BigInteger("-1234567", 10)); //--------------------------------------------------------------------- // %o - BigInteger @@ -1552,6 +1586,59 @@ public class BasicBigInteger extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicBoolean.java b/jdk/test/java/util/Formatter/BasicBoolean.java index 192a2192460..83f8accb1ab 100644 --- a/jdk/test/java/util/Formatter/BasicBoolean.java +++ b/jdk/test/java/util/Formatter/BasicBoolean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicBoolean extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicBoolean extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -1552,6 +1560,85 @@ public class BasicBoolean extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicBooleanObject.java b/jdk/test/java/util/Formatter/BasicBooleanObject.java index 830fe729788..86b940591d3 100644 --- a/jdk/test/java/util/Formatter/BasicBooleanObject.java +++ b/jdk/test/java/util/Formatter/BasicBooleanObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicBooleanObject extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicBooleanObject extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -1552,6 +1560,85 @@ public class BasicBooleanObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicByte.java b/jdk/test/java/util/Formatter/BasicByte.java index 4887e948b11..663153f6bd2 100644 --- a/jdk/test/java/util/Formatter/BasicByte.java +++ b/jdk/test/java/util/Formatter/BasicByte.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicByte extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicByte extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -578,6 +586,24 @@ public class BasicByte extends Basic { + + + + + + + + + + + + + + + + + + @@ -1552,6 +1578,67 @@ public class BasicByte extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicByteObject.java b/jdk/test/java/util/Formatter/BasicByteObject.java index 9a6dd23adbc..ac4aef83571 100644 --- a/jdk/test/java/util/Formatter/BasicByteObject.java +++ b/jdk/test/java/util/Formatter/BasicByteObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicByteObject extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicByteObject extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -578,6 +586,24 @@ public class BasicByteObject extends Basic { + + + + + + + + + + + + + + + + + + @@ -1552,6 +1578,67 @@ public class BasicByteObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicChar.java b/jdk/test/java/util/Formatter/BasicChar.java index 8fe4bd52323..ce0e5311b09 100644 --- a/jdk/test/java/util/Formatter/BasicChar.java +++ b/jdk/test/java/util/Formatter/BasicChar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicChar extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicChar extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -1552,6 +1560,85 @@ public class BasicChar extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicCharObject.java b/jdk/test/java/util/Formatter/BasicCharObject.java index 744103e8bd2..e1baf82cb80 100644 --- a/jdk/test/java/util/Formatter/BasicCharObject.java +++ b/jdk/test/java/util/Formatter/BasicCharObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicCharObject extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicCharObject extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -1552,6 +1560,85 @@ public class BasicCharObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicDateTime.java b/jdk/test/java/util/Formatter/BasicDateTime.java index 131d7234b65..f31238189d8 100644 --- a/jdk/test/java/util/Formatter/BasicDateTime.java +++ b/jdk/test/java/util/Formatter/BasicDateTime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicDateTime extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicDateTime extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -1552,6 +1560,85 @@ public class BasicDateTime extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicDouble.java b/jdk/test/java/util/Formatter/BasicDouble.java index 4d3bcae836e..11760f17f7f 100644 --- a/jdk/test/java/util/Formatter/BasicDouble.java +++ b/jdk/test/java/util/Formatter/BasicDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -36,6 +36,9 @@ import java.math.BigInteger; import java.text.DateFormatSymbols; import java.util.*; +import sun.misc.DoubleConsts; + + import static java.util.Calendar.*; @@ -48,6 +51,10 @@ public class BasicDouble extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -55,6 +62,10 @@ public class BasicDouble extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -838,6 +849,32 @@ public class BasicDouble extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1036,6 +1073,14 @@ public class BasicDouble extends Basic { test("%3.0f", "1000000", 1000000.00); test("%3.0f", "10000000", 10000000.00); test("%3.0f", "100000000", 100000000.00); + test("%10.0f", " 1000000", 1000000.00); + test("%,10.0f", " 1,000,000", 1000000.00); + test("%,10.1f", "1,000,000.0", 1000000.00); + test("%,3.0f", "1,000,000", 1000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); @@ -1310,12 +1355,12 @@ public class BasicDouble extends Basic { test("%.1a", "-0x1.0p0", -1.0); test("%.11a", "0x1.80000000000p1", 3.0); test("%.1a", "0x1.8p1", 3.0); - test("%.11a", "0x1.00000000000p-1022", Double.MIN_NORMAL); - test("%.1a", "0x1.0p-1022", Double.MIN_NORMAL); + test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL); + test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL); test("%.11a", "0x1.00000000000p-1022", - Math.nextDown(Double.MIN_NORMAL)); + Math.nextDown(DoubleConsts.MIN_NORMAL)); test("%.1a", "0x1.0p-1022", - Math.nextDown(Double.MIN_NORMAL)); + Math.nextDown(DoubleConsts.MIN_NORMAL)); test("%.11a", "0x1.ffffffffffep-1023", 0x0.fffffffffffp-1022); test("%.1a", "0x1.0p-1022", 0x0.fffffffffffp-1022); test("%.30a", "0x0.000000000000100000000000000000p-1022", Double.MIN_VALUE); diff --git a/jdk/test/java/util/Formatter/BasicDoubleObject.java b/jdk/test/java/util/Formatter/BasicDoubleObject.java index 8ecfc453d7a..3dea2a346b8 100644 --- a/jdk/test/java/util/Formatter/BasicDoubleObject.java +++ b/jdk/test/java/util/Formatter/BasicDoubleObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicDoubleObject extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicDoubleObject extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -851,6 +859,32 @@ public class BasicDoubleObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1039,6 +1073,14 @@ public class BasicDoubleObject extends Basic { test("%3.0f", "1000000", 1000000.00); test("%3.0f", "10000000", 10000000.00); test("%3.0f", "100000000", 100000000.00); + test("%10.0f", " 1000000", 1000000.00); + test("%,10.0f", " 1,000,000", 1000000.00); + test("%,10.1f", "1,000,000.0", 1000000.00); + test("%,3.0f", "1,000,000", 1000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); @@ -1330,6 +1372,35 @@ public class BasicDoubleObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicFloat.java b/jdk/test/java/util/Formatter/BasicFloat.java index 94eb867b4fb..0ac8a6f45f0 100644 --- a/jdk/test/java/util/Formatter/BasicFloat.java +++ b/jdk/test/java/util/Formatter/BasicFloat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicFloat extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicFloat extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -821,6 +829,32 @@ public class BasicFloat extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1039,6 +1073,14 @@ public class BasicFloat extends Basic { test("%3.0f", "1000000", 1000000.00); test("%3.0f", "10000000", 10000000.00); test("%3.0f", "100000000", 100000000.00); + test("%10.0f", " 1000000", 1000000.00); + test("%,10.0f", " 1,000,000", 1000000.00); + test("%,10.1f", "1,000,000.0", 1000000.00); + test("%,3.0f", "1,000,000", 1000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); @@ -1330,6 +1372,35 @@ public class BasicFloat extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicFloatObject.java b/jdk/test/java/util/Formatter/BasicFloatObject.java index 5dd9c44efec..d9fb5de7aa4 100644 --- a/jdk/test/java/util/Formatter/BasicFloatObject.java +++ b/jdk/test/java/util/Formatter/BasicFloatObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicFloatObject extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicFloatObject extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -831,6 +839,32 @@ public class BasicFloatObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1039,6 +1073,14 @@ public class BasicFloatObject extends Basic { test("%3.0f", "1000000", 1000000.00); test("%3.0f", "10000000", 10000000.00); test("%3.0f", "100000000", 100000000.00); + test("%10.0f", " 1000000", 1000000.00); + test("%,10.0f", " 1,000,000", 1000000.00); + test("%,10.1f", "1,000,000.0", 1000000.00); + test("%,3.0f", "1,000,000", 1000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); + test("%,3.0f", "10,000,000", 10000000.00); + test("%,3.0f", "100,000,000", 100000000.00); @@ -1330,6 +1372,35 @@ public class BasicFloatObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicInt.java b/jdk/test/java/util/Formatter/BasicInt.java index cc71a40172f..7cef571e086 100644 --- a/jdk/test/java/util/Formatter/BasicInt.java +++ b/jdk/test/java/util/Formatter/BasicInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicInt extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicInt extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -566,6 +574,14 @@ public class BasicInt extends Basic { + + + + + + + + @@ -594,6 +610,16 @@ public class BasicInt extends Basic { test("%(10d", " (1234567)", negate(oneToSeven)); test("%-10d", "1234567 ", oneToSeven); test("%-10d", "-1234567 ", negate(oneToSeven)); + // , variations: + test("% ,d", " 1,234,567", oneToSeven); + test("% ,d", "-1,234,567", negate(oneToSeven)); + test("%+,10d", "+1,234,567", oneToSeven); + test("%0,10d", "01,234,567", oneToSeven); + test("%0,10d", "-1,234,567", negate(oneToSeven)); + test("%(,10d", "(1,234,567)", negate(oneToSeven)); + test("%-,10d", "1,234,567 ", oneToSeven); + test("%-,10d", "-1,234,567", negate(oneToSeven)); + @@ -1552,6 +1578,67 @@ public class BasicInt extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicIntObject.java b/jdk/test/java/util/Formatter/BasicIntObject.java index 08b6bd56a5c..df2c2a26a63 100644 --- a/jdk/test/java/util/Formatter/BasicIntObject.java +++ b/jdk/test/java/util/Formatter/BasicIntObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicIntObject extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicIntObject extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -578,6 +586,24 @@ public class BasicIntObject extends Basic { + + + + + + + + + + + + + + + + + + @@ -1552,6 +1578,67 @@ public class BasicIntObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicLong.java b/jdk/test/java/util/Formatter/BasicLong.java index b26d6b0a03d..bcac973aaa0 100644 --- a/jdk/test/java/util/Formatter/BasicLong.java +++ b/jdk/test/java/util/Formatter/BasicLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicLong extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicLong extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -566,6 +574,14 @@ public class BasicLong extends Basic { + + + + + + + + @@ -594,6 +610,16 @@ public class BasicLong extends Basic { test("%(10d", " (1234567)", negate(oneToSeven)); test("%-10d", "1234567 ", oneToSeven); test("%-10d", "-1234567 ", negate(oneToSeven)); + // , variations: + test("% ,d", " 1,234,567", oneToSeven); + test("% ,d", "-1,234,567", negate(oneToSeven)); + test("%+,10d", "+1,234,567", oneToSeven); + test("%0,10d", "01,234,567", oneToSeven); + test("%0,10d", "-1,234,567", negate(oneToSeven)); + test("%(,10d", "(1,234,567)", negate(oneToSeven)); + test("%-,10d", "1,234,567 ", oneToSeven); + test("%-,10d", "-1,234,567", negate(oneToSeven)); + @@ -1552,6 +1578,67 @@ public class BasicLong extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicLongObject.java b/jdk/test/java/util/Formatter/BasicLongObject.java index 847b66c8db4..852bbc4127c 100644 --- a/jdk/test/java/util/Formatter/BasicLongObject.java +++ b/jdk/test/java/util/Formatter/BasicLongObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicLongObject extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicLongObject extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -578,6 +586,24 @@ public class BasicLongObject extends Basic { + + + + + + + + + + + + + + + + + + @@ -1552,6 +1578,67 @@ public class BasicLongObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicShort.java b/jdk/test/java/util/Formatter/BasicShort.java index f2b61b121cc..04923018da5 100644 --- a/jdk/test/java/util/Formatter/BasicShort.java +++ b/jdk/test/java/util/Formatter/BasicShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicShort extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicShort extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -572,6 +580,24 @@ public class BasicShort extends Basic { test("%(10d", " (12345)", negate(oneToFive)); test("%-10d", "12345 ", oneToFive); test("%-10d", "-12345 ", negate(oneToFive)); + // , variations: + test("% ,d", " 12,345", oneToFive); + test("% ,d", "-12,345", negate(oneToFive)); + test("%0,10d", "000012,345", oneToFive); + test("%0,10d", "-00012,345", negate(oneToFive)); + test("%(,10d", " (12,345)", negate(oneToFive)); + test("%-,10d", "12,345 ", oneToFive); + test("%-,10d", "-12,345 ", negate(oneToFive)); + + + + + + + + + + @@ -1552,6 +1578,67 @@ public class BasicShort extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/BasicShortObject.java b/jdk/test/java/util/Formatter/BasicShortObject.java index 1ed1263c729..1e8b7809a33 100644 --- a/jdk/test/java/util/Formatter/BasicShortObject.java +++ b/jdk/test/java/util/Formatter/BasicShortObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -51,6 +51,10 @@ public class BasicShortObject extends Basic { Formatter f = new Formatter(new StringBuilder(), Locale.US); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), Locale.US); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(Locale l, String fs, String exp, Object ... args) @@ -58,6 +62,10 @@ public class BasicShortObject extends Basic { Formatter f = new Formatter(new StringBuilder(), l); f.format(fs, args); ck(fs, exp, f.toString()); + + f = new Formatter(new StringBuilder(), l); + f.format("foo " + fs + " bar", args); + ck(fs, "foo " + exp + " bar", f.toString()); } private static void test(String fs, Object ... args) { @@ -578,6 +586,24 @@ public class BasicShortObject extends Basic { + + + + + + + + + + + + + + + + + + @@ -1552,6 +1578,67 @@ public class BasicShortObject extends Basic { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/java/util/Formatter/genBasic.sh b/jdk/test/java/util/Formatter/genBasic.sh index 0931cc15874..24bd5f786e0 100644 --- a/jdk/test/java/util/Formatter/genBasic.sh +++ b/jdk/test/java/util/Formatter/genBasic.sh @@ -23,7 +23,7 @@ # questions. # -javac -d . ../../../../make/tools/src/build/tools/spp/Spp.java +javac -d . ../../../../make/src/classes/build/tools/spp/Spp.java gen() { # if [ $3 = "true" ] From fdb39122a12686ade08ff71ab1309520d6ee19ad Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Mon, 17 Nov 2014 14:11:08 +0300 Subject: [PATCH 095/159] 8064914: tzdb.dat compilation failure when using tzdata2014j Reviewed-by: sherman, coffeys --- .../build/tools/tzdb/TzdbZoneRulesProvider.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java index 220de9276c7..a59ce61eff9 100644 --- a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java +++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java @@ -95,7 +95,17 @@ class TzdbZoneRulesProvider { obj = zones.get(zoneId); } if (obj == null) { - throw new ZoneRulesException("Unknown time-zone ID: " + zoneId0); + // Timezone link can be located in 'backward' file and it + // can refer to another link, so we need to check for + // link one more time, before throwing an exception + String zoneIdBack = zoneId; + if (links.containsKey(zoneId)) { + zoneId = links.get(zoneId); + obj = zones.get(zoneId); + } + if (obj == null) { + throw new ZoneRulesException("Unknown time-zone ID: " + zoneIdBack); + } } } if (obj instanceof ZoneRules) { From ee4d018bad9db3e102296ed419179080b72ae76e Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Mon, 17 Nov 2014 14:50:05 +0300 Subject: [PATCH 096/159] 8064560: (tz) Support tzdata2014j Reviewed-by: okutsu --- jdk/make/data/tzdata/VERSION | 2 +- jdk/make/data/tzdata/africa | 79 +++----- jdk/make/data/tzdata/asia | 87 +++++---- jdk/make/data/tzdata/australasia | 12 +- jdk/make/data/tzdata/europe | 18 +- jdk/make/data/tzdata/leapseconds | 4 +- jdk/make/data/tzdata/northamerica | 20 ++- jdk/make/data/tzdata/southamerica | 18 +- jdk/test/sun/util/calendar/zi/tzdata/VERSION | 2 +- jdk/test/sun/util/calendar/zi/tzdata/africa | 136 +++++--------- jdk/test/sun/util/calendar/zi/tzdata/asia | 169 ++++++++++++------ .../sun/util/calendar/zi/tzdata/australasia | 56 ++++-- jdk/test/sun/util/calendar/zi/tzdata/europe | 33 +++- .../sun/util/calendar/zi/tzdata/leapseconds | 4 +- .../sun/util/calendar/zi/tzdata/northamerica | 61 ++++--- .../sun/util/calendar/zi/tzdata/southamerica | 18 +- jdk/test/sun/util/calendar/zi/tzdata/zone.tab | 3 +- 17 files changed, 407 insertions(+), 315 deletions(-) diff --git a/jdk/make/data/tzdata/VERSION b/jdk/make/data/tzdata/VERSION index fa498de5234..9987fde6dcb 100644 --- a/jdk/make/data/tzdata/VERSION +++ b/jdk/make/data/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2014i +tzdata2014j diff --git a/jdk/make/data/tzdata/africa b/jdk/make/data/tzdata/africa index 92c0d4728f3..43103225577 100644 --- a/jdk/make/data/tzdata/africa +++ b/jdk/make/data/tzdata/africa @@ -29,20 +29,19 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2013-02-21): +# From Paul Eggert (2014-10-31): # -# A good source for time zone historical data outside the U.S. is +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. -# -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # Another source occasionally used is Edward W. Whitman, World Time Differences, # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which @@ -88,7 +87,6 @@ # 3:00 CAST Central Africa Summer Time (no longer used) # 3:00 SAST South Africa Summer Time (no longer used) # 3:00 EAT East Africa Time -# 4:00 EAST East Africa Summer Time (no longer used) # Algeria # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -169,9 +167,7 @@ Zone Africa/Ndjamena 1:00:12 - LMT 1912 # N'Djamena 1:00 - WAT # Comoros -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Comoro 2:53:04 - LMT 1911 Jul # Moroni, Gran Comoro - 3:00 - EAT +# See Africa/Nairobi. # Democratic Republic of the Congo # See Africa/Lagos for the western part and Africa/Maputo for the eastern. @@ -195,9 +191,7 @@ Link Africa/Abidjan Africa/Sao_Tome # São Tomé and Príncipe Link Africa/Abidjan Atlantic/St_Helena # St Helena # Djibouti -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Djibouti 2:52:36 - LMT 1911 Jul - 3:00 - EAT +# See Africa/Nairobi. ############################################################################### @@ -410,27 +404,8 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct # See Africa/Lagos. # Eritrea -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Asmara 2:35:32 - LMT 1870 - 2:35:32 - AMT 1890 # Asmara Mean Time - 2:35:20 - ADMT 1936 May 5 # Adis Dera MT - 3:00 - EAT - # Ethiopia -# From Paul Eggert (2014-07-31): -# Like the Swahili of Kenya and Tanzania, many Ethiopians keep a -# 12-hour clock starting at our 06:00, so their "8 o'clock" is our -# 02:00 or 14:00. Keep this in mind when you ask the time in Amharic. -# -# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time -# zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in -# 1890, and that they switched to 3:00 on 1936-05-05. Perhaps 38E50 -# was for Adis Dera. Quite likely the Shanks data entries are wrong -# anyway. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Addis_Ababa 2:34:48 - LMT 1870 - 2:35:20 - ADMT 1936 May 5 # Adis Dera MT - 3:00 - EAT +# See Africa/Nairobi. # Gabon # See Africa/Lagos. @@ -474,6 +449,15 @@ Zone Africa/Nairobi 2:27:16 - LMT 1928 Jul 2:30 - BEAT 1940 2:45 - BEAUT 1960 3:00 - EAT +Link Africa/Nairobi Africa/Addis_Ababa # Ethiopia +Link Africa/Nairobi Africa/Asmara # Eritrea +Link Africa/Nairobi Africa/Dar_es_Salaam # Tanzania +Link Africa/Nairobi Africa/Djibouti +Link Africa/Nairobi Africa/Kampala # Uganda +Link Africa/Nairobi Africa/Mogadishu # Somalia +Link Africa/Nairobi Indian/Antananarivo # Madagascar +Link Africa/Nairobi Indian/Comoro +Link Africa/Nairobi Indian/Mayotte # Lesotho # See Africa/Johannesburg. @@ -551,11 +535,7 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 2:00 - EET # Madagascar -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Antananarivo 3:10:04 - LMT 1911 Jul - 3:00 - EAT 1954 Feb 27 23:00s - 3:00 1:00 EAST 1954 May 29 23:00s - 3:00 - EAT +# See Africa/Nairobi. # Malawi # See Africa/Maputo. @@ -658,9 +638,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # no information; probably like Indian/Mauritius # Mayotte -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou - 3:00 - EAT +# See Africa/Nairobi. # Morocco # See the 'europe' file for Spanish Morocco (Africa/Ceuta). @@ -1072,11 +1050,7 @@ Zone Indian/Mahe 3:41:48 - LMT 1906 Jun # Victoria # See Africa/Abidjan. # Somalia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Mogadishu 3:01:28 - LMT 1893 Nov - 3:00 - EAT 1931 - 2:30 - BEAT 1957 - 3:00 - EAT +# See Africa/Nairobi. # South Africa # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1119,11 +1093,7 @@ Link Africa/Khartoum Africa/Juba # See Africa/Johannesburg. # Tanzania -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Dar_es_Salaam 2:37:08 - LMT 1931 - 3:00 - EAT 1948 - 2:45 - BEAUT 1961 - 3:00 - EAT +# See Africa/Nairobi. # Togo # See Africa/Abidjan. @@ -1229,12 +1199,7 @@ Zone Africa/Tunis 0:40:44 - LMT 1881 May 12 1:00 Tunisia CE%sT # Uganda -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Kampala 2:09:40 - LMT 1928 Jul - 3:00 - EAT 1930 - 2:30 - BEAT 1948 - 2:45 - BEAUT 1957 - 3:00 - EAT +# See Africa/Nairobi. # Zambia # Zimbabwe diff --git a/jdk/make/data/tzdata/asia b/jdk/make/data/tzdata/asia index 31754b2d567..960cab5062e 100644 --- a/jdk/make/data/tzdata/asia +++ b/jdk/make/data/tzdata/asia @@ -29,20 +29,19 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2013-08-11): +# From Paul Eggert (2014-10-31): # -# A good source for time zone historical data outside the U.S. is +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. -# -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # Another source occasionally used is Edward W. Whitman, World Time Differences, # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which @@ -1686,44 +1685,70 @@ Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 # Korea (North and South) # From Annie I. Bang (2006-07-10): -# http://www.koreaherald.co.kr/SITE/data/html_dir/2006/07/10/200607100012.asp -# The Ministry of Commerce, Industry and Energy has already -# commissioned a research project [to reintroduce DST] and has said -# the system may begin as early as 2008.... Korea ran a daylight -# saving program from 1949-61 but stopped it during the 1950-53 Korean War. +# http://www.koreaherald.com/view.php?ud=200607100012 +# Korea ran a daylight saving program from 1949-61 but stopped it +# during the 1950-53 Korean War. The system was temporarily enforced +# between 1987 and 1988 ... + +# From Sanghyuk Jung (2014-10-29): +# http://mm.icann.org/pipermail/tz/2014-October/021830.html +# According to the Korean Wikipedia +# http://ko.wikipedia.org/wiki/한국_표준시 +# [oldid=12896437 2014-09-04 08:03 UTC] +# DST in Republic of Korea was as follows.... And I checked old +# newspapers in Korean, all articles correspond with data in Wikipedia. +# For example, the article in 1948 (Korean Language) proved that DST +# started at June 1 in that year. For another example, the article in +# 1988 said that DST started at 2:00 AM in that year. -# From Shanks & Pottenger: # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule ROK 1960 only - May 15 0:00 1:00 D -Rule ROK 1960 only - Sep 13 0:00 0 S -Rule ROK 1987 1988 - May Sun>=8 0:00 1:00 D -Rule ROK 1987 1988 - Oct Sun>=8 0:00 0 S +Rule ROK 1948 only - Jun 1 0:00 1:00 D +Rule ROK 1948 only - Sep 13 0:00 0 S +Rule ROK 1949 only - Apr 3 0:00 1:00 D +Rule ROK 1949 1951 - Sep Sun>=8 0:00 0 S +Rule ROK 1950 only - Apr 1 0:00 1:00 D +Rule ROK 1951 only - May 6 0:00 1:00 D +Rule ROK 1955 only - May 5 0:00 1:00 D +Rule ROK 1955 only - Sep 9 0:00 0 S +Rule ROK 1956 only - May 20 0:00 1:00 D +Rule ROK 1956 only - Sep 30 0:00 0 S +Rule ROK 1957 1960 - May Sun>=1 0:00 1:00 D +Rule ROK 1957 1960 - Sep Sun>=18 0:00 0 S +Rule ROK 1987 1988 - May Sun>=8 2:00 1:00 D +Rule ROK 1987 1988 - Oct Sun>=8 3:00 0 S -# From Paul Eggert (2014-07-01): -# The following entries are from Shanks & Pottenger, except that I -# guessed that time zone abbreviations through 1945 followed the same +# From Paul Eggert (2014-10-30): +# The Korean Wikipedia entry gives the following sources for UT offsets: +# +# 1908: Official Journal Article No. 3994 (Edict No. 5) +# 1912: Governor-General of Korea Official Gazette Issue No. 367 +# (Announcement No. 338) +# 1954: Presidential Decree No. 876 (1954-03-17) +# 1961: Law No. 676 (1961-08-07) +# 1987: Law No. 3919 (1986-12-31) +# +# The Wikipedia entry also has confusing information about a change +# to UT+9 in April 1910, but then what would be the point of the later change +# to UT+9 on 1912-01-01? Omit the 1910 change for now. +# +# I guessed that time zone abbreviations through 1945 followed the same # rules as discussed under Taiwan, with nominal switches from JST to KST # when the respective cities were taken over by the Allies after WWII. +# +# For Pyongyang we have no information; guess no changes since World War II. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Seoul 8:27:52 - LMT 1890 - 8:30 - KST 1904 Dec - 9:00 - JCST 1928 - 8:30 - KST 1932 +Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 + 8:30 - KST 1912 Jan 1 9:00 - JCST 1937 Oct 1 9:00 - JST 1945 Sep 8 9:00 - KST 1954 Mar 21 - 8:00 ROK K%sT 1961 Aug 10 - 8:30 - KST 1968 Oct + 8:30 ROK K%sT 1961 Aug 10 9:00 ROK K%sT -Zone Asia/Pyongyang 8:23:00 - LMT 1890 - 8:30 - KST 1904 Dec - 9:00 - JCST 1928 - 8:30 - KST 1932 +Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1 + 8:30 - KST 1912 Jan 1 9:00 - JCST 1937 Oct 1 9:00 - JST 1945 Aug 24 - 9:00 - KST 1954 Mar 21 - 8:00 - KST 1961 Aug 10 9:00 - KST ############################################################################### diff --git a/jdk/make/data/tzdata/australasia b/jdk/make/data/tzdata/australasia index c45680ace6a..f2a89e8ee37 100644 --- a/jdk/make/data/tzdata/australasia +++ b/jdk/make/data/tzdata/australasia @@ -820,19 +820,19 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2013-02-21): -# A good source for time zone historical data outside the U.S. is +# From Paul Eggert (2014-10-31): +# +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. -# -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # Another source occasionally used is Edward W. Whitman, World Time Differences, # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which diff --git a/jdk/make/data/tzdata/europe b/jdk/make/data/tzdata/europe index fb24b87a754..2ed6ad36b5d 100644 --- a/jdk/make/data/tzdata/europe +++ b/jdk/make/data/tzdata/europe @@ -29,16 +29,19 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2014-05-31): -# A good source for time zone historical data outside the U.S. is +# From Paul Eggert (2014-10-31): +# +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). @@ -310,6 +313,14 @@ # "Timeball on the ballast office is down. Dunsink time." # -- James Joyce, Ulysses +# "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time +# was among various actions undertaken by the 'English' government that +# would 'put the whole country into the SF (Sinn Féin) camp'. She claimed +# Irish 'public feeling (was) outraged by forcing of English time on us'." +# -- Parsons M. Dublin lost its time zone - and 25 minutes - after 1916 Rising. +# Irish Times 2014-10-27. +# http://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411 + # From Joseph S. Myers (2005-01-26): # Irish laws are available online at . # These include various relating to legal time, for example: @@ -617,6 +628,7 @@ Rule Russia 1992 only - Sep lastSat 23:00 0 - Rule Russia 1993 2010 - Mar lastSun 2:00s 1:00 S Rule Russia 1993 1995 - Sep lastSun 2:00s 0 - Rule Russia 1996 2010 - Oct lastSun 2:00s 0 - +# As described below, Russia's 2014 change affects Zone data, not Rule data. # From Alexander Krivenyshev (2011-06-14): # According to Kremlin press service, Russian President Dmitry Medvedev diff --git a/jdk/make/data/tzdata/leapseconds b/jdk/make/data/tzdata/leapseconds index d38abd6a4bd..7612f2bc9b7 100644 --- a/jdk/make/data/tzdata/leapseconds +++ b/jdk/make/data/tzdata/leapseconds @@ -33,8 +33,8 @@ # The NTP Timescale and Leap Seconds # http://www.eecis.udel.edu/~mills/leap.html -# The International Earth Rotation Service periodically uses leap seconds -# to keep UTC to within 0.9 s of UT1 +# The International Earth Rotation and Reference Systems Service +# periodically uses leap seconds to keep UTC to within 0.9 s of UT1 # (which measures the true angular orientation of the earth in space); see # Terry J Quinn, The BIPM and the accurate measure of time, # Proc IEEE 79, 7 (July 1991), 894-905 . diff --git a/jdk/make/data/tzdata/northamerica b/jdk/make/data/tzdata/northamerica index 329b633ba98..86c9503a4eb 100644 --- a/jdk/make/data/tzdata/northamerica +++ b/jdk/make/data/tzdata/northamerica @@ -1014,19 +1014,19 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00 ################################################################################ -# From Paul Eggert (2006-03-22): -# A good source for time zone historical data outside the U.S. is +# From Paul Eggert (2014-10-31): +# +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. -# -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # Other sources occasionally used include: # @@ -3154,13 +3154,17 @@ Zone America/Miquelon -3:44:40 - LMT 1911 May 15 # St Pierre # From Paul Eggert (2014-08-19): # The 2014-08-13 Cabinet meeting decided to stay on UTC-4 year-round. See: # http://tcweeklynews.com/daylight-savings-time-to-be-maintained-p5353-127.htm -# Model this as a switch from EST/EDT to AST on 2014-11-02 at 02:00. +# Model this as a switch from EST/EDT to AST ... +# From Chris Walton (2014-11-04): +# ... the TCI government appears to have delayed the switch to +# "permanent daylight saving time" by one year.... +# http://tcweeklynews.com/time-change-to-go-ahead-this-november-p5437-127.htm # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Grand_Turk -4:44:32 - LMT 1890 -5:07:11 - KMT 1912 Feb # Kingston Mean Time -5:00 - EST 1979 - -5:00 US E%sT 2014 Nov 2 2:00 + -5:00 US E%sT 2015 Nov Sun>=1 2:00 -4:00 - AST # British Virgin Is diff --git a/jdk/make/data/tzdata/southamerica b/jdk/make/data/tzdata/southamerica index 398ec0e4f06..0b70dea5616 100644 --- a/jdk/make/data/tzdata/southamerica +++ b/jdk/make/data/tzdata/southamerica @@ -29,23 +29,23 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2006-03-22): -# A good source for time zone historical data outside the U.S. is +# From Paul Eggert (2014-10-31): +# +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). -# -# For data circa 1899, a common source is: -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. -# http://www.jstor.org/stable/1774359 +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# For data circa 1899, a common source is: +# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. +# http://www.jstor.org/stable/1774359 # # Earlier editions of these tables used the North American style (e.g. ARST and # ARDT for Argentine Standard and Daylight Time), but the following quote diff --git a/jdk/test/sun/util/calendar/zi/tzdata/VERSION b/jdk/test/sun/util/calendar/zi/tzdata/VERSION index 5e925ada8df..9987fde6dcb 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION +++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2014g +tzdata2014j diff --git a/jdk/test/sun/util/calendar/zi/tzdata/africa b/jdk/test/sun/util/calendar/zi/tzdata/africa index aa91f365ce1..43103225577 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/africa +++ b/jdk/test/sun/util/calendar/zi/tzdata/africa @@ -29,20 +29,19 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2013-02-21): +# From Paul Eggert (2014-10-31): # -# A good source for time zone historical data outside the U.S. is +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. -# -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # Another source occasionally used is Edward W. Whitman, World Time Differences, # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which @@ -88,7 +87,6 @@ # 3:00 CAST Central Africa Summer Time (no longer used) # 3:00 SAST South Africa Summer Time (no longer used) # 3:00 EAT East Africa Time -# 4:00 EAST East Africa Summer Time (no longer used) # Algeria # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -133,23 +131,13 @@ Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01 # See Africa/Lagos. # Botswana -# From Paul Eggert (2013-02-21): -# Milne says they were regulated by the Cape Town Signal in 1899; -# assume they switched to 2:00 when Cape Town did. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Gaborone 1:43:40 - LMT 1885 - 1:30 - SAST 1903 Mar - 2:00 - CAT 1943 Sep 19 2:00 - 2:00 1:00 CAST 1944 Mar 19 2:00 - 2:00 - CAT +# See Africa/Maputo. # Burkina Faso # See Africa/Abidjan. # Burundi -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Bujumbura 1:57:28 - LMT 1890 - 2:00 - CAT +# See Africa/Maputo. # Cameroon # See Africa/Lagos. @@ -179,15 +167,10 @@ Zone Africa/Ndjamena 1:00:12 - LMT 1912 # N'Djamena 1:00 - WAT # Comoros -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Comoro 2:53:04 - LMT 1911 Jul # Moroni, Gran Comoro - 3:00 - EAT +# See Africa/Nairobi. # Democratic Republic of the Congo -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Lubumbashi 1:49:52 - LMT 1897 Nov 9 - 2:00 - CAT -# The above is for the eastern part; see Africa/Lagos for the western part. +# See Africa/Lagos for the western part and Africa/Maputo for the eastern. # Republic of the Congo # See Africa/Lagos. @@ -208,9 +191,7 @@ Link Africa/Abidjan Africa/Sao_Tome # São Tomé and Príncipe Link Africa/Abidjan Atlantic/St_Helena # St Helena # Djibouti -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Djibouti 2:52:36 - LMT 1911 Jul - 3:00 - EAT +# See Africa/Nairobi. ############################################################################### @@ -339,7 +320,7 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # Egypt is to change back to Daylight system on May 15 # http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx -# From Gunther Vermier (2015-05-13): +# From Gunther Vermier (2014-05-13): # our Egypt office confirms that the change will be at 15 May "midnight" (24:00) # From Imed Chihi (2014-06-04): @@ -423,27 +404,8 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct # See Africa/Lagos. # Eritrea -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Asmara 2:35:32 - LMT 1870 - 2:35:32 - AMT 1890 # Asmara Mean Time - 2:35:20 - ADMT 1936 May 5 # Adis Dera MT - 3:00 - EAT - # Ethiopia -# From Paul Eggert (2014-07-31): -# Like the Swahili of Kenya and Tanzania, many Ethiopians keep a -# 12-hour clock starting at our 06:00, so their "8 o'clock" is our -# 02:00 or 14:00. Keep this in mind when you ask the time in Amharic. -# -# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time -# zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in -# 1890, and that they switched to 3:00 on 1936-05-05. Perhaps 38E50 -# was for Adis Dera. Quite likely the Shanks data entries are wrong -# anyway. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Addis_Ababa 2:34:48 - LMT 1870 - 2:35:20 - ADMT 1936 May 5 # Adis Dera MT - 3:00 - EAT +# See Africa/Nairobi. # Gabon # See Africa/Lagos. @@ -487,13 +449,18 @@ Zone Africa/Nairobi 2:27:16 - LMT 1928 Jul 2:30 - BEAT 1940 2:45 - BEAUT 1960 3:00 - EAT +Link Africa/Nairobi Africa/Addis_Ababa # Ethiopia +Link Africa/Nairobi Africa/Asmara # Eritrea +Link Africa/Nairobi Africa/Dar_es_Salaam # Tanzania +Link Africa/Nairobi Africa/Djibouti +Link Africa/Nairobi Africa/Kampala # Uganda +Link Africa/Nairobi Africa/Mogadishu # Somalia +Link Africa/Nairobi Indian/Antananarivo # Madagascar +Link Africa/Nairobi Indian/Comoro +Link Africa/Nairobi Indian/Mayotte # Lesotho -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Maseru 1:50:00 - LMT 1903 Mar - 2:00 - SAST 1943 Sep 19 2:00 - 2:00 1:00 SAST 1944 Mar 19 2:00 - 2:00 - SAST +# See Africa/Johannesburg. # Liberia # From Paul Eggert (2006-03-22): @@ -568,16 +535,10 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 2:00 - EET # Madagascar -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Antananarivo 3:10:04 - LMT 1911 Jul - 3:00 - EAT 1954 Feb 27 23:00s - 3:00 1:00 EAST 1954 May 29 23:00s - 3:00 - EAT +# See Africa/Nairobi. # Malawi -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Blantyre 2:20:00 - LMT 1903 Mar - 2:00 - CAT +# See Africa/Maputo. # Mali # Mauritania @@ -677,9 +638,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # no information; probably like Indian/Mauritius # Mayotte -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou - 3:00 - EAT +# See Africa/Nairobi. # Morocco # See the 'europe' file for Spanish Morocco (Africa/Ceuta). @@ -987,6 +946,13 @@ Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Maputo 2:10:20 - LMT 1903 Mar 2:00 - CAT +Link Africa/Maputo Africa/Blantyre # Malawi +Link Africa/Maputo Africa/Bujumbura # Burundi +Link Africa/Maputo Africa/Gaborone # Botswana +Link Africa/Maputo Africa/Harare # Zimbabwe +Link Africa/Maputo Africa/Kigali # Rwanda +Link Africa/Maputo Africa/Lubumbashi # E Dem. Rep. of Congo +Link Africa/Maputo Africa/Lusaka # Zambia # Namibia # The 1994-04-03 transition is from Shanks & Pottenger. @@ -1054,9 +1020,7 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Denis # Tromelin - inhabited until at least 1958 # Rwanda -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Kigali 2:00:16 - LMT 1935 Jun - 2:00 - CAT +# See Africa/Maputo. # St Helena # See Africa/Abidjan. @@ -1086,11 +1050,7 @@ Zone Indian/Mahe 3:41:48 - LMT 1906 Jun # Victoria # See Africa/Abidjan. # Somalia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Mogadishu 3:01:28 - LMT 1893 Nov - 3:00 - EAT 1931 - 2:30 - BEAT 1957 - 3:00 - EAT +# See Africa/Nairobi. # South Africa # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1100,6 +1060,9 @@ Rule SA 1943 1944 - Mar Sun>=15 2:00 0 - Zone Africa/Johannesburg 1:52:00 - LMT 1892 Feb 8 1:30 - SAST 1903 Mar 2:00 SA SAST +Link Africa/Johannesburg Africa/Maseru # Lesotho +Link Africa/Johannesburg Africa/Mbabane # Swaziland +# # Marion and Prince Edward Is # scientific station since 1947 # no information @@ -1127,16 +1090,10 @@ Zone Africa/Khartoum 2:10:08 - LMT 1931 Link Africa/Khartoum Africa/Juba # Swaziland -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Mbabane 2:04:24 - LMT 1903 Mar - 2:00 - SAST +# See Africa/Johannesburg. # Tanzania -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Dar_es_Salaam 2:37:08 - LMT 1931 - 3:00 - EAT 1948 - 2:45 - BEAUT 1961 - 3:00 - EAT +# See Africa/Nairobi. # Togo # See Africa/Abidjan. @@ -1242,19 +1199,8 @@ Zone Africa/Tunis 0:40:44 - LMT 1881 May 12 1:00 Tunisia CE%sT # Uganda -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Kampala 2:09:40 - LMT 1928 Jul - 3:00 - EAT 1930 - 2:30 - BEAT 1948 - 2:45 - BEAUT 1957 - 3:00 - EAT +# See Africa/Nairobi. # Zambia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Lusaka 1:53:08 - LMT 1903 Mar - 2:00 - CAT - # Zimbabwe -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Harare 2:04:12 - LMT 1903 Mar - 2:00 - CAT +# See Africa/Maputo. diff --git a/jdk/test/sun/util/calendar/zi/tzdata/asia b/jdk/test/sun/util/calendar/zi/tzdata/asia index 906c0a97cda..960cab5062e 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/asia +++ b/jdk/test/sun/util/calendar/zi/tzdata/asia @@ -29,20 +29,19 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2013-08-11): +# From Paul Eggert (2014-10-31): # -# A good source for time zone historical data outside the U.S. is +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. -# -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # Another source occasionally used is Edward W. Whitman, World Time Differences, # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which @@ -70,10 +69,11 @@ # 3:30 IRST IRDT Iran # 4:00 GST Gulf* # 5:30 IST India -# 7:00 ICT Indochina* +# 7:00 ICT Indochina, most times and locations* # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China +# 8:00 IDT Indochina, 1943-45, 1947-55, 1960-75 (some locations)* # 8:00 JWST Western Standard Time (Japan, 1896/1937)* # 9:00 JCST Central Standard Time (Japan, 1896/1937) # 9:00 WIT east Indonesia (Waktu Indonesia Timur) @@ -294,12 +294,8 @@ Zone Asia/Rangoon 6:24:40 - LMT 1880 # or Yangon 6:30 - MMT # Myanmar Time # Cambodia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Phnom_Penh 6:59:40 - LMT 1906 Jun 9 - 7:06:20 - SMT 1911 Mar 11 0:01 # Saigon MT? - 7:00 - ICT 1912 May - 8:00 - ICT 1931 May - 7:00 - ICT +# See Asia/Bangkok. + # China @@ -916,6 +912,10 @@ Zone Asia/Kolkata 5:53:28 - LMT 1880 # Kolkata # Indonesia # +# From Paul Eggert (2014-09-06): +# The 1876 Report of the Secretary of the [US] Navy, p 306 says that Batavia +# civil time was 7:07:12.5; round to even for Jakarta. +# # From Gwillim Law (2001-05-28), overriding Shanks & Pottenger: # http://www.sumatera-inc.com/go_to_invest/about_indonesia.asp#standtime # says that Indonesia's time zones changed on 1988-01-01. Looking at some @@ -1685,44 +1685,70 @@ Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 # Korea (North and South) # From Annie I. Bang (2006-07-10): -# http://www.koreaherald.co.kr/SITE/data/html_dir/2006/07/10/200607100012.asp -# The Ministry of Commerce, Industry and Energy has already -# commissioned a research project [to reintroduce DST] and has said -# the system may begin as early as 2008.... Korea ran a daylight -# saving program from 1949-61 but stopped it during the 1950-53 Korean War. +# http://www.koreaherald.com/view.php?ud=200607100012 +# Korea ran a daylight saving program from 1949-61 but stopped it +# during the 1950-53 Korean War. The system was temporarily enforced +# between 1987 and 1988 ... + +# From Sanghyuk Jung (2014-10-29): +# http://mm.icann.org/pipermail/tz/2014-October/021830.html +# According to the Korean Wikipedia +# http://ko.wikipedia.org/wiki/한국_표준시 +# [oldid=12896437 2014-09-04 08:03 UTC] +# DST in Republic of Korea was as follows.... And I checked old +# newspapers in Korean, all articles correspond with data in Wikipedia. +# For example, the article in 1948 (Korean Language) proved that DST +# started at June 1 in that year. For another example, the article in +# 1988 said that DST started at 2:00 AM in that year. -# From Shanks & Pottenger: # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule ROK 1960 only - May 15 0:00 1:00 D -Rule ROK 1960 only - Sep 13 0:00 0 S -Rule ROK 1987 1988 - May Sun>=8 0:00 1:00 D -Rule ROK 1987 1988 - Oct Sun>=8 0:00 0 S +Rule ROK 1948 only - Jun 1 0:00 1:00 D +Rule ROK 1948 only - Sep 13 0:00 0 S +Rule ROK 1949 only - Apr 3 0:00 1:00 D +Rule ROK 1949 1951 - Sep Sun>=8 0:00 0 S +Rule ROK 1950 only - Apr 1 0:00 1:00 D +Rule ROK 1951 only - May 6 0:00 1:00 D +Rule ROK 1955 only - May 5 0:00 1:00 D +Rule ROK 1955 only - Sep 9 0:00 0 S +Rule ROK 1956 only - May 20 0:00 1:00 D +Rule ROK 1956 only - Sep 30 0:00 0 S +Rule ROK 1957 1960 - May Sun>=1 0:00 1:00 D +Rule ROK 1957 1960 - Sep Sun>=18 0:00 0 S +Rule ROK 1987 1988 - May Sun>=8 2:00 1:00 D +Rule ROK 1987 1988 - Oct Sun>=8 3:00 0 S -# From Paul Eggert (2014-07-01): -# The following entries are from Shanks & Pottenger, except that I -# guessed that time zone abbreviations through 1945 followed the same +# From Paul Eggert (2014-10-30): +# The Korean Wikipedia entry gives the following sources for UT offsets: +# +# 1908: Official Journal Article No. 3994 (Edict No. 5) +# 1912: Governor-General of Korea Official Gazette Issue No. 367 +# (Announcement No. 338) +# 1954: Presidential Decree No. 876 (1954-03-17) +# 1961: Law No. 676 (1961-08-07) +# 1987: Law No. 3919 (1986-12-31) +# +# The Wikipedia entry also has confusing information about a change +# to UT+9 in April 1910, but then what would be the point of the later change +# to UT+9 on 1912-01-01? Omit the 1910 change for now. +# +# I guessed that time zone abbreviations through 1945 followed the same # rules as discussed under Taiwan, with nominal switches from JST to KST # when the respective cities were taken over by the Allies after WWII. +# +# For Pyongyang we have no information; guess no changes since World War II. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Seoul 8:27:52 - LMT 1890 - 8:30 - KST 1904 Dec - 9:00 - JCST 1928 - 8:30 - KST 1932 +Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 + 8:30 - KST 1912 Jan 1 9:00 - JCST 1937 Oct 1 9:00 - JST 1945 Sep 8 9:00 - KST 1954 Mar 21 - 8:00 ROK K%sT 1961 Aug 10 - 8:30 - KST 1968 Oct + 8:30 ROK K%sT 1961 Aug 10 9:00 ROK K%sT -Zone Asia/Pyongyang 8:23:00 - LMT 1890 - 8:30 - KST 1904 Dec - 9:00 - JCST 1928 - 8:30 - KST 1932 +Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1 + 8:30 - KST 1912 Jan 1 9:00 - JCST 1937 Oct 1 9:00 - JST 1945 Aug 24 - 9:00 - KST 1954 Mar 21 - 8:00 - KST 1961 Aug 10 9:00 - KST ############################################################################### @@ -1733,12 +1759,8 @@ Zone Asia/Kuwait 3:11:56 - LMT 1950 3:00 - AST # Laos -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Vientiane 6:50:24 - LMT 1906 Jun 9 # or Viangchan - 7:06:20 - SMT 1911 Mar 11 0:01 # Saigon MT? - 7:00 - ICT 1912 May - 8:00 - ICT 1931 May - 7:00 - ICT +# See Asia/Bangkok. + # Lebanon # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -2751,6 +2773,8 @@ Zone Asia/Dushanbe 4:35:12 - LMT 1924 May 2 Zone Asia/Bangkok 6:42:04 - LMT 1880 6:42:04 - BMT 1920 Apr # Bangkok Mean Time 7:00 - ICT +Link Asia/Bangkok Asia/Phnom_Penh # Cambodia +Link Asia/Bangkok Asia/Vientiane # Laos # Turkmenistan # From Shanks & Pottenger. @@ -2788,22 +2812,65 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 # Vietnam -# From Paul Eggert (2013-02-21): +# From Paul Eggert (2014-10-04): # Milne gives 7:16:56 for the meridian of Saigon in 1899, as being # used in Lower Laos, Cambodia, and Annam. But this is quite a ways # from Saigon's location. For now, ignore this and stick with Shanks -# and Pottenger. +# and Pottenger for LMT before 1906. # From Arthur David Olson (2008-03-18): # The English-language name of Vietnam's most populous city is "Ho Chi Minh # City"; use Ho_Chi_Minh below to avoid a name of more than 14 characters. -# From Shanks & Pottenger: +# From Paul Eggert (2014-10-21) after a heads-up from Trần Ngọc Quân: +# Trần Tiến Bình's authoritative book "Lịch Việt Nam: thế kỷ XX-XXI (1901-2100)" +# (Nhà xuất bản Văn Hoá - Thông Tin, Hanoi, 2005), pp 49-50, +# is quoted verbatim in: +# http://www.thoigian.com.vn/?mPage=P80D01 +# is translated by Brian Inglis in: +# http://mm.icann.org/pipermail/tz/2014-October/021654.html +# and is the basis for the information below. +# +# The 1906 transition was effective July 1 and standardized Indochina to +# Phù Liễn Observatory, legally 104 deg. 17'17" east of Paris. +# It's unclear whether this meant legal Paris Mean Time (00:09:21) or +# the Paris Meridian (2 deg. 20'14.03" E); the former yields 07:06:30.1333... +# and the latter 07:06:29.333... so either way it rounds to 07:06:30, +# which is used below even though the modern-day Phù Liễn Observatory +# is closer to 07:06:31. Abbreviate Phù Liễn Mean Time as PLMT. +# +# The following transitions occurred in Indochina in general (before 1954) +# and in South Vietnam in particular (after 1954): +# To 07:00 on 1911-05-01. +# To 08:00 on 1942-12-31 at 23:00. +# To 09:00 in 1945-03-14 at 23:00. +# To 07:00 on 1945-09-02 in Vietnam. +# To 08:00 on 1947-04-01 in French-controlled Indochina. +# To 07:00 on 1955-07-01 in South Vietnam. +# To 08:00 on 1959-12-31 at 23:00 in South Vietnam. +# To 07:00 on 1975-06-13 in South Vietnam. +# +# Trần cites the following sources; it's unclear which supplied the info above. +# +# Hoàng Xuân Hãn: "Lịch và lịch Việt Nam". Tập san Khoa học Xã hội, +# No. 9, Paris, February 1982. +# +# Lê Thành Lân: "Lịch và niên biểu lịch sử hai mươi thế kỷ (0001-2010)", +# NXB Thống kê, Hanoi, 2000. +# +# Lê Thành Lân: "Lịch hai thế kỷ (1802-2010) và các lịch vĩnh cửu", +# NXB Thuận Hoá, Huế, 1995. + # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Ho_Chi_Minh 7:06:40 - LMT 1906 Jun 9 - 7:06:20 - SMT 1911 Mar 11 0:01 # Saigon MT? - 7:00 - ICT 1912 May - 8:00 - ICT 1931 May +Zone Asia/Ho_Chi_Minh 7:06:40 - LMT 1906 Jul 1 + 7:06:30 - PLMT 1911 May 1 + 7:00 - ICT 1942 Dec 31 23:00 + 8:00 - IDT 1945 Mar 14 23:00 + 9:00 - JST 1945 Sep 2 + 7:00 - ICT 1947 Apr 1 + 8:00 - IDT 1955 Jul 1 + 7:00 - ICT 1959 Dec 31 23:00 + 8:00 - IDT 1975 Jun 13 7:00 - ICT # Yemen diff --git a/jdk/test/sun/util/calendar/zi/tzdata/australasia b/jdk/test/sun/util/calendar/zi/tzdata/australasia index 52d32904178..f2a89e8ee37 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/australasia +++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia @@ -354,20 +354,27 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # Fiji will end DST on 2014-01-19 02:00: # http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx -# From Paul Eggert (2014-01-10): -# For now, guess that Fiji springs forward the Sunday before the fourth -# Monday in October, and springs back the penultimate Sunday in January. -# This is ad hoc, but matches recent practice. +# From Ken Rylander (2014-10-20): +# DST will start Nov. 2 this year. +# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-NOVEMBER-2ND.aspx + +# From Paul Eggert (2014-10-20): +# For now, guess DST from 02:00 the first Sunday in November to +# 03:00 the first Sunday on or after January 18. Although ad hoc, it +# matches this year's plan and seems more likely to match future +# practice than guessing no DST. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S Rule Fiji 1999 2000 - Feb lastSun 3:00 0 - Rule Fiji 2009 only - Nov 29 2:00 1:00 S Rule Fiji 2010 only - Mar lastSun 3:00 0 - -Rule Fiji 2010 max - Oct Sun>=21 2:00 1:00 S +Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 S Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - -Rule Fiji 2014 max - Jan Sun>=18 2:00 0 - +Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - +Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 S +Rule Fiji 2015 max - Jan Sun>=18 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji FJ%sT # Fiji Time @@ -542,6 +549,30 @@ Zone Pacific/Palau 8:57:56 - LMT 1901 # Koror Zone Pacific/Port_Moresby 9:48:40 - LMT 1880 9:48:32 - PMMT 1895 # Port Moresby Mean Time 10:00 - PGT # Papua New Guinea Time +# +# From Paul Eggert (2014-10-13): +# Base the Bougainville entry on the Arawa-Kieta region, which appears to have +# the most people even though it was devastated in the Bougainville Civil War. +# +# Although Shanks gives 1942-03-15 / 1943-11-01 for JST, these dates +# are apparently rough guesswork from the starts of military campaigns. +# The World War II entries below are instead based on Arawa-Kieta. +# The Japanese occupied Kieta in July 1942, +# according to the Pacific War Online Encyclopedia +# http://pwencycl.kgbudge.com/B/o/Bougainville.htm +# and seem to have controlled it until their 1945-08-21 surrender. +# +# The Autonomous Region of Bougainville plans to switch from UTC+10 to UTC+11 +# on 2014-12-28 at 02:00. They call UTC+11 "Bougainville Standard Time"; +# abbreviate this as BST. See: +# http://www.bougainville24.com/bougainville-issues/bougainville-gets-own-timezone/ +# +Zone Pacific/Bougainville 10:22:16 - LMT 1880 + 9:48:32 - PMMT 1895 + 10:00 - PGT 1942 Jul + 9:00 - JST 1945 Aug 21 + 10:00 - PGT 2014 Dec 28 2:00 + 11:00 - BST # Pitcairn # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -789,19 +820,19 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2013-02-21): -# A good source for time zone historical data outside the U.S. is +# From Paul Eggert (2014-10-31): +# +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. -# -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # Another source occasionally used is Edward W. Whitman, World Time Differences, # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which @@ -826,6 +857,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # 10:00 AEST AEDT Eastern Australia # 10:00 ChST Chamorro # 10:30 LHST LHDT Lord Howe* +# 11:00 BST Bougainville* # 11:30 NZMT NZST New Zealand through 1945 # 12:00 NZST NZDT New Zealand 1946-present # 12:15 CHAST Chatham through 1945* diff --git a/jdk/test/sun/util/calendar/zi/tzdata/europe b/jdk/test/sun/util/calendar/zi/tzdata/europe index 0c5f5667da9..2ed6ad36b5d 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/europe +++ b/jdk/test/sun/util/calendar/zi/tzdata/europe @@ -29,16 +29,19 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2014-05-31): -# A good source for time zone historical data outside the U.S. is +# From Paul Eggert (2014-10-31): +# +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). @@ -91,10 +94,11 @@ # 0:00 WET WEST WEMT Western Europe # 0:19:32.13 AMT NST Amsterdam, Netherlands Summer (1835-1937)* # 0:20 NET NEST Netherlands (1937-1940)* +# 1:00 BST British Standard (1968-1971) # 1:00 CET CEST CEMT Central Europe # 1:00:14 SET Swedish (1879-1899)* # 2:00 EET EEST Eastern Europe -# 3:00 FET Further-eastern Europe* +# 3:00 FET Further-eastern Europe (2011-2014)* # 3:00 MSK MSD MSM* Moscow # From Peter Ilieve (1994-12-04), @@ -309,6 +313,14 @@ # "Timeball on the ballast office is down. Dunsink time." # -- James Joyce, Ulysses +# "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time +# was among various actions undertaken by the 'English' government that +# would 'put the whole country into the SF (Sinn Féin) camp'. She claimed +# Irish 'public feeling (was) outraged by forcing of English time on us'." +# -- Parsons M. Dublin lost its time zone - and 25 minutes - after 1916 Rising. +# Irish Times 2014-10-27. +# http://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411 + # From Joseph S. Myers (2005-01-26): # Irish laws are available online at . # These include various relating to legal time, for example: @@ -616,6 +628,7 @@ Rule Russia 1992 only - Sep lastSat 23:00 0 - Rule Russia 1993 2010 - Mar lastSun 2:00s 1:00 S Rule Russia 1993 1995 - Sep lastSun 2:00s 0 - Rule Russia 1996 2010 - Oct lastSun 2:00s 0 - +# As described below, Russia's 2014 change affects Zone data, not Rule data. # From Alexander Krivenyshev (2011-06-14): # According to Kremlin press service, Russian President Dmitry Medvedev @@ -746,6 +759,13 @@ Zone Europe/Vienna 1:05:21 - LMT 1893 Apr # http://www.belta.by/ru/all_news/society/V-Belarusi-otmenjaetsja-perexod-na-sezonnoe-vremja_i_572952.html # http://naviny.by/rubrics/society/2011/09/16/ic_articles_116_175144/ # http://news.tut.by/society/250578.html +# +# From Alexander Bokovoy (2014-10-09): +# Belarussian government decided against changing to winter time.... +# http://eng.belta.by/all_news/society/Belarus-decides-against-adjusting-time-in-Russias-wake_i_76335.html +# From Paul Eggert (2014-10-08): +# Hence Belarus can share time zone abbreviations with Moscow again. +# # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Minsk 1:50:16 - LMT 1880 1:50 - MMT 1924 May 2 # Minsk Mean Time @@ -758,7 +778,8 @@ Zone Europe/Minsk 1:50:16 - LMT 1880 2:00 - EET 1992 Mar 29 0:00s 2:00 1:00 EEST 1992 Sep 27 0:00s 2:00 Russia EE%sT 2011 Mar 27 2:00s - 3:00 - FET + 3:00 - FET 2014 Oct 26 1:00s + 3:00 - MSK # Belgium # @@ -2524,7 +2545,7 @@ Zone Asia/Novosibirsk 5:31:40 - LMT 1919 Dec 14 6:00 # The Kemerovo region will remain at UTC+7 through the 2014-10-26 change, thus # realigning itself with KRAT. -Zone Asia/Novokuznetsk 5:48:48 - NMT 1920 Jan 6 +Zone Asia/Novokuznetsk 5:48:48 - LMT 1924 May 1 6:00 - KRAT 1930 Jun 21 # Krasnoyarsk Time 7:00 Russia KRA%sT 1991 Mar 31 2:00s 6:00 Russia KRA%sT 1992 Jan 19 2:00s diff --git a/jdk/test/sun/util/calendar/zi/tzdata/leapseconds b/jdk/test/sun/util/calendar/zi/tzdata/leapseconds index d38abd6a4bd..7612f2bc9b7 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/leapseconds +++ b/jdk/test/sun/util/calendar/zi/tzdata/leapseconds @@ -33,8 +33,8 @@ # The NTP Timescale and Leap Seconds # http://www.eecis.udel.edu/~mills/leap.html -# The International Earth Rotation Service periodically uses leap seconds -# to keep UTC to within 0.9 s of UT1 +# The International Earth Rotation and Reference Systems Service +# periodically uses leap seconds to keep UTC to within 0.9 s of UT1 # (which measures the true angular orientation of the earth in space); see # Terry J Quinn, The BIPM and the accurate measure of time, # Proc IEEE 79, 7 (July 1991), 894-905 . diff --git a/jdk/test/sun/util/calendar/zi/tzdata/northamerica b/jdk/test/sun/util/calendar/zi/tzdata/northamerica index 0dc714aa92d..86c9503a4eb 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica +++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica @@ -300,6 +300,12 @@ Zone PST8PDT -8:00 US P%sT # time zone, but we do go by the Eastern time zone because so many people work # in Columbus." +# From Paul Eggert (2014-09-06): +# Monthly Notices of the Royal Astronomical Society 44, 4 (1884-02-08), 208 +# says that New York City Hall time was 3 minutes 58.4 seconds fast of +# Eastern time (i.e., -4:56:01.6) just before the 1883 switch. Round to the +# nearest second. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule NYC 1920 only - Mar lastSun 2:00 1:00 D Rule NYC 1920 only - Oct lastSun 2:00 0 S @@ -1008,19 +1014,19 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00 ################################################################################ -# From Paul Eggert (2006-03-22): -# A good source for time zone historical data outside the U.S. is +# From Paul Eggert (2014-10-31): +# +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. -# -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # # Other sources occasionally used include: # @@ -1118,17 +1124,16 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00 # An amendment to the Interpretation Act was registered on February 19/2007.... # http://action.attavik.ca/home/justice-gn/attach/2007/gaz02part2.pdf -# From Paul Eggert (2006-04-25): +# From Paul Eggert (2014-10-18): # H. David Matthews and Mary Vincent's map # "It's about TIME", _Canadian Geographic_ (September-October 1998) -# http://www.canadiangeographic.ca/Magazine/SO98/geomap.asp +# http://www.canadiangeographic.ca/Magazine/SO98/alacarte.asp # contains detailed boundaries for regions observing nonstandard # time and daylight saving time arrangements in Canada circa 1998. # -# INMS, the Institute for National Measurement Standards in Ottawa, has -# information about standard and daylight saving time zones in Canada. -# http://inms-ienm.nrc-cnrc.gc.ca/en/time_services/daylight_saving_e.php -# (updated periodically). +# National Research Council Canada maintains info about time zones and DST. +# http://www.nrc-cnrc.gc.ca/eng/services/time/time_zones.html +# http://www.nrc-cnrc.gc.ca/eng/services/time/faq/index.html#Q5 # Its unofficial information is often taken from Matthews and Vincent. # From Paul Eggert (2006-06-27): @@ -1993,10 +1998,7 @@ Zone America/Creston -7:46:04 - LMT 1884 # [Also see (2001-03-09).] # From Gwillim Law (2005-05-21): -# According to maps at -# http://inms-ienm.nrc-cnrc.gc.ca/images/time_services/TZ01SWE.jpg -# http://inms-ienm.nrc-cnrc.gc.ca/images/time_services/TZ01SSE.jpg -# (both dated 2003), and +# According to ... # http://www.canadiangeographic.ca/Magazine/SO98/geomap.asp # (from a 1998 Canadian Geographic article), the de facto and de jure time # for Southampton Island (at the north end of Hudson Bay) is UTC-5 all year @@ -2005,9 +2007,11 @@ Zone America/Creston -7:46:04 - LMT 1884 # predates the creation of Nunavut, it probably goes back many years.... # The Inuktitut name of Coral Harbour is Sallit, but it's rarely used. # -# From Paul Eggert (2005-07-26): +# From Paul Eggert (2014-10-17): # For lack of better information, assume that Southampton Island observed -# daylight saving only during wartime. +# daylight saving only during wartime. Gwillim Law's email also +# mentioned maps now maintained by National Research Council Canada; +# see above for an up-to-date link. # From Chris Walton (2007-03-01): # ... the community of Resolute (located on Cornwallis Island in @@ -3008,10 +3012,21 @@ Zone America/Tegucigalpa -5:48:52 - LMT 1921 Apr # Shanks & Pottenger give -5:07:12, but Milne records -5:07:10.41 from an # unspecified official document, and says "This time is used throughout the # island". Go with Milne. Round to the nearest second as required by zic. +# +# Shanks & Pottenger give April 28 for the 1974 spring-forward transition, but +# Lance Neita writes that Prime Minister Michael Manley decreed it January 5. +# Assume Neita meant Jan 6 02:00, the same as the US. Neita also writes that +# Manley's supporters associated this act with Manley's nickname "Joshua" +# (recall that in the Bible the sun stood still at Joshua's request), +# and with the Rod of Correction which Manley said he had received from +# Haile Selassie, Emperor of Ethiopia. See: +# Neita L. The politician in all of us. Jamaica Observer 2014-09-20 +# http://www.jamaicaobserver.com/columns/The-politician-in-all-of-us_17573647 +# # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Jamaica -5:07:11 - LMT 1890 # Kingston -5:07:11 - KMT 1912 Feb # Kingston Mean Time - -5:00 - EST 1974 Apr 28 2:00 + -5:00 - EST 1974 -5:00 US E%sT 1984 -5:00 - EST @@ -3139,13 +3154,17 @@ Zone America/Miquelon -3:44:40 - LMT 1911 May 15 # St Pierre # From Paul Eggert (2014-08-19): # The 2014-08-13 Cabinet meeting decided to stay on UTC-4 year-round. See: # http://tcweeklynews.com/daylight-savings-time-to-be-maintained-p5353-127.htm -# Model this as a switch from EST/EDT to AST on 2014-11-02 at 02:00. +# Model this as a switch from EST/EDT to AST ... +# From Chris Walton (2014-11-04): +# ... the TCI government appears to have delayed the switch to +# "permanent daylight saving time" by one year.... +# http://tcweeklynews.com/time-change-to-go-ahead-this-november-p5437-127.htm # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Grand_Turk -4:44:32 - LMT 1890 -5:07:11 - KMT 1912 Feb # Kingston Mean Time -5:00 - EST 1979 - -5:00 US E%sT 2014 Nov 2 2:00 + -5:00 US E%sT 2015 Nov Sun>=1 2:00 -4:00 - AST # British Virgin Is diff --git a/jdk/test/sun/util/calendar/zi/tzdata/southamerica b/jdk/test/sun/util/calendar/zi/tzdata/southamerica index 398ec0e4f06..0b70dea5616 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica +++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica @@ -29,23 +29,23 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2006-03-22): -# A good source for time zone historical data outside the U.S. is +# From Paul Eggert (2014-10-31): +# +# Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). -# -# For data circa 1899, a common source is: -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. -# http://www.jstor.org/stable/1774359 +# Unfortunately this book contains many errors and cites no sources. # # Gwillim Law writes that a good source # for recent time zone data is the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries -# of the IATA's data after 1990. +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. # -# Except where otherwise noted, Shanks & Pottenger is the source for -# entries through 1990, and IATA SSIM is the source for entries afterwards. +# For data circa 1899, a common source is: +# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. +# http://www.jstor.org/stable/1774359 # # Earlier editions of these tables used the North American style (e.g. ARST and # ARDT for Argentine Standard and Daylight Time), but the following quote diff --git a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab index 45351ca8486..0ef9ba869ea 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab +++ b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab @@ -330,7 +330,8 @@ PE -1203-07703 America/Lima PF -1732-14934 Pacific/Tahiti Society Islands PF -0900-13930 Pacific/Marquesas Marquesas Islands PF -2308-13457 Pacific/Gambier Gambier Islands -PG -0930+14710 Pacific/Port_Moresby +PG -0930+14710 Pacific/Port_Moresby most locations +PG -0613+15534 Pacific/Bougainville Bougainville PH +1435+12100 Asia/Manila PK +2452+06703 Asia/Karachi PL +5215+02100 Europe/Warsaw From fb6b965e8610ff30a42c1865425969499b9087fb Mon Sep 17 00:00:00 2001 From: Katja Kantserova Date: Tue, 18 Nov 2014 16:20:16 +0100 Subject: [PATCH 097/159] 6542634: TEST BUG: MISC_REGRESSION tests need to have minimum timeouts examined Reviewed-by: sla, jbachorik, egahlin --- jdk/test/ProblemList.txt | 3 + jdk/test/sun/tools/jinfo/Basic.sh | 117 ---------------- jdk/test/sun/tools/jinfo/JInfoHelper.java | 74 ++++++++++ .../jinfo/JInfoRunningProcessFlagTest.java | 128 ++++++++++++++++++ .../tools/jinfo/JInfoRunningProcessTest.java | 64 +++++++++ jdk/test/sun/tools/jinfo/JInfoSanityTest.java | 76 +++++++++++ 6 files changed, 345 insertions(+), 117 deletions(-) delete mode 100644 jdk/test/sun/tools/jinfo/Basic.sh create mode 100644 jdk/test/sun/tools/jinfo/JInfoHelper.java create mode 100644 jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java create mode 100644 jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java create mode 100644 jdk/test/sun/tools/jinfo/JInfoSanityTest.java diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 449db57f61f..d3c1c3a0c95 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -315,6 +315,9 @@ sun/tools/jstatd/TestJstatdExternalRegistry.java generic-all # 6456333 sun/tools/jps/TestJpsJarRelative.java generic-all +# 6734748 +sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all + # 8057732 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all diff --git a/jdk/test/sun/tools/jinfo/Basic.sh b/jdk/test/sun/tools/jinfo/Basic.sh deleted file mode 100644 index 445ccf333f5..00000000000 --- a/jdk/test/sun/tools/jinfo/Basic.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2006, 2012, 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 6402766 -# @summary Unit test for jinfo utility -# -# @library ../common -# @build SimpleApplication ShutdownSimpleApplication -# @run shell Basic.sh - -. ${TESTSRC}/../common/CommonSetup.sh -. ${TESTSRC}/../common/ApplicationSetup.sh - -# Start application and use PORTFILE for coordination -PORTFILE="${TESTCLASSES}"/shutdown.port -startApplication SimpleApplication "${PORTFILE}" - -# all return statuses are checked in this test -set +e -set -x - -failed=0 - -runSA=true - -if [ $isMacos = true -o $isAIX = true -o `uname -m` = ppc64 ]; then - runSA=false -fi - -if [ $isLinux = true ]; then - # Some Linux systems disable non-child ptrace (see 7050524) - ptrace_scope=`/sbin/sysctl -n kernel.yama.ptrace_scope` - if [ $? = 0 ]; then - if [ $ptrace_scope = 1 ]; then - runSA=false - fi - fi -fi - -if [ $runSA = true ]; then - # -sysprops option - ${JINFO} -J-XX:+UsePerfData -F -sysprops $appJavaPid - if [ $? != 0 ]; then failed=1; fi - - # -flags option - ${JINFO} -J-XX:+UsePerfData -F -flags $appJavaPid - if [ $? != 0 ]; then failed=1; fi - - # no option - ${JINFO} -J-XX:+UsePerfData -F $appJavaPid - if [ $? != 0 ]; then failed=1; fi -fi - -# -sysprops option -${JINFO} -J-XX:+UsePerfData -sysprops $appJavaPid -if [ $? != 0 ]; then failed=1; fi - -# -flags option -${JINFO} -J-XX:+UsePerfData -flags $appJavaPid -if [ $? != 0 ]; then failed=1; fi - -# no option -${JINFO} -J-XX:+UsePerfData $appJavaPid -if [ $? != 0 ]; then failed=1; fi - -# -flag option -${JINFO} -J-XX:+UsePerfData -flag +PrintGC $appJavaPid -if [ $? != 0 ]; then failed=1; fi - -${JINFO} -J-XX:+UsePerfData -flag -PrintGC $appJavaPid -if [ $? != 0 ]; then failed=1; fi - -${JINFO} -J-XX:+UsePerfData -flag PrintGC $appJavaPid -if [ $? != 0 ]; then failed=1; fi - -if $isSolaris; then - - ${JINFO} -J-XX:+UsePerfData -flag +ExtendedDTraceProbes $appJavaPid - if [ $? != 0 ]; then failed=1; fi - - ${JINFO} -J-XX:+UsePerfData -flag -ExtendedDTraceProbes $appJavaPid - if [ $? != 0 ]; then failed=1; fi - - ${JINFO} -J-XX:+UsePerfData -flag ExtendedDTraceProbes $appJavaPid - if [ $? != 0 ]; then failed=1; fi - -fi - -set -e - -stopApplication "${PORTFILE}" -waitForApplication - -exit $failed diff --git a/jdk/test/sun/tools/jinfo/JInfoHelper.java b/jdk/test/sun/tools/jinfo/JInfoHelper.java new file mode 100644 index 00000000000..abbc862c2c8 --- /dev/null +++ b/jdk/test/sun/tools/jinfo/JInfoHelper.java @@ -0,0 +1,74 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +import java.util.Arrays; + +import jdk.testlibrary.JDKToolLauncher; +import jdk.testlibrary.OutputAnalyzer; +import jdk.testlibrary.ProcessTools; + +/** + * The helper class for running jinfo utility. + */ +public final class JInfoHelper { + + /** + * Print configuration information for the current process + * + * @param toolArgs List of jinfo options + */ + public static OutputAnalyzer jinfo(String... toolArgs) throws Exception { + return jinfo(true, toolArgs); + } + + /** + * Print usage information + * + * @param toolArgs List of jinfo options + */ + public static OutputAnalyzer jinfoNoPid(String... toolArgs) throws Exception { + return jinfo(false, toolArgs); + } + + private static OutputAnalyzer jinfo(boolean toPid, String... toolArgs) throws Exception { + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jinfo"); + if (toolArgs != null) { + for (String toolArg : toolArgs) { + launcher.addToolArg(toolArg); + } + } + if (toPid) { + launcher.addToolArg(Integer.toString(ProcessTools.getProcessId())); + } + + ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand()); + System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", "")); + OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); + System.out.println(output.getOutput()); + + return output; + } + +} diff --git a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java new file mode 100644 index 00000000000..deb3c860d63 --- /dev/null +++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java @@ -0,0 +1,128 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +import sun.management.ManagementFactoryHelper; + +import com.sun.management.HotSpotDiagnosticMXBean; + +import jdk.testlibrary.OutputAnalyzer; +import static jdk.testlibrary.Platform.isSolaris; +import static jdk.testlibrary.Asserts.assertEquals; +import static jdk.testlibrary.Asserts.assertNotEquals; +import static jdk.testlibrary.Asserts.assertTrue; + +/** + * @test + * @summary The test sanity checks 'jinfo -flag' option. + * @library /lib/testlibrary + * @build jdk.testlibrary.* JInfoHelper + * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError JInfoRunningProcessFlagTest + */ +public class JInfoRunningProcessFlagTest { + + public static void main(String[] args) throws Exception { + testFlag(); + testFlagPlus(); + testFlagMinus(); + testFlagEqual(); + + testInvalidFlag(); + + testSolarisSpecificFlag(); + } + + private static void testFlag() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError"); + output.shouldHaveExitValue(0); + assertTrue(output.getStderr().isEmpty(), "'jinfo -flag HeapDumpOnOutOfMemoryError' stderr should be empty"); + output.shouldContain("+HeapDumpOnOutOfMemoryError"); + } + + private static void testFlagPlus() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+PrintGC"); + output.shouldHaveExitValue(0); + output = JInfoHelper.jinfo("-flag", "PrintGC"); + output.shouldHaveExitValue(0); + output.shouldContain("+PrintGC"); + verifyIsEnabled("PrintGC"); + } + + private static void testFlagMinus() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-PrintGC"); + output.shouldHaveExitValue(0); + output = JInfoHelper.jinfo("-flag", "PrintGC"); + output.shouldHaveExitValue(0); + output.shouldContain("-PrintGC"); + verifyIsDisabled("PrintGC"); + } + + private static void testFlagEqual() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfo("-flag", "PrintGC=1"); + output.shouldHaveExitValue(0); + output = JInfoHelper.jinfo("-flag", "PrintGC"); + output.shouldHaveExitValue(0); + output.shouldContain("+PrintGC"); + verifyIsEnabled("PrintGC"); + } + + private static void testInvalidFlag() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfo("-flag", "monkey"); + assertNotEquals(output.getExitValue(), 0, "A non-zero exit code should be returned for invalid flag"); + } + + private static void testSolarisSpecificFlag() throws Exception { + if (!isSolaris()) + return; + + OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+ExtendedDTraceProbes"); + output.shouldHaveExitValue(0); + output = JInfoHelper.jinfo(); + output.shouldContain("+ExtendedDTraceProbes"); + verifyIsEnabled("ExtendedDTraceProbes"); + + output = JInfoHelper.jinfo("-flag", "-ExtendedDTraceProbes"); + output.shouldHaveExitValue(0); + output = JInfoHelper.jinfo(); + output.shouldContain("-ExtendedDTraceProbes"); + verifyIsDisabled("ExtendedDTraceProbes"); + + output = JInfoHelper.jinfo("-flag", "ExtendedDTraceProbes"); + output.shouldContain("-ExtendedDTraceProbes"); + output.shouldHaveExitValue(0); + } + + private static void verifyIsEnabled(String flag) { + HotSpotDiagnosticMXBean hotspotDiagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); + String flagValue = hotspotDiagnostic.getVMOption(flag).getValue(); + assertEquals(flagValue, "true", "Expected '" + flag + "' flag be enabled"); + } + + private static void verifyIsDisabled(String flag) { + HotSpotDiagnosticMXBean hotspotDiagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); + String flagValue = hotspotDiagnostic.getVMOption(flag).getValue(); + assertEquals(flagValue, "false", "Expected '" + flag + "' flag be disabled"); + } + +} diff --git a/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java b/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java new file mode 100644 index 00000000000..e204254ab34 --- /dev/null +++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java @@ -0,0 +1,64 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +import jdk.testlibrary.OutputAnalyzer; +import static jdk.testlibrary.Asserts.assertTrue; + +/** + * @test + * @summary The test sanity checks functionality of 'jinfo', 'jinfo -sysprops' and 'jinfo -flags' + * @library /lib/testlibrary + * @build jdk.testlibrary.* JInfoHelper + * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError JInfoRunningProcessTest + */ +public class JInfoRunningProcessTest { + + public static void main(String[] args) throws Exception { + testNoOptions(); + testSysprops(); + testFlags(); + } + + private static void testNoOptions() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfo(); + output.shouldHaveExitValue(0); + assertTrue(output.getStderr().isEmpty(), "'jinfo' stderr should be empty"); + output.shouldContain("+HeapDumpOnOutOfMemoryError"); + } + + private static void testSysprops() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfo("-sysprops"); + output.shouldHaveExitValue(0); + assertTrue(output.getStderr().isEmpty(), "'jinfo -sysprops' stderr should be empty"); + } + + private static void testFlags() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfo("-flags"); + output.shouldHaveExitValue(0); + assertTrue(output.getStderr().isEmpty(), "'jinfo -flags' stderr should be empty"); + output.shouldContain("+HeapDumpOnOutOfMemoryError"); + } + +} diff --git a/jdk/test/sun/tools/jinfo/JInfoSanityTest.java b/jdk/test/sun/tools/jinfo/JInfoSanityTest.java new file mode 100644 index 00000000000..dfc1b13d1f3 --- /dev/null +++ b/jdk/test/sun/tools/jinfo/JInfoSanityTest.java @@ -0,0 +1,76 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +import static jdk.testlibrary.Asserts.assertNotEquals; +import static jdk.testlibrary.Asserts.assertTrue; +import static jdk.testlibrary.Asserts.assertFalse; +import jdk.testlibrary.OutputAnalyzer; + +/** + * @test + * @summary The test sanity checks functionality of 'jinfo -h', 'jinfo -help', + * and verifies jinfo exits abnormally if started with invalid options. + * @library /lib/testlibrary + * @build jdk.testlibrary.* JInfoHelper + * @run main JInfoSanityTest + */ +public class JInfoSanityTest { + + public static void main(String[] args) throws Exception { + test_h(); + test_help(); + testVersion(); + testUnknownHost(); + } + + private static void test_h() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfoNoPid("-h"); + output.shouldHaveExitValue(0); + assertFalse(output.getStderr().isEmpty(), "'jinfo -h' stderr should not be empty"); + assertTrue(output.getStdout().isEmpty(), "'jinfo -h' stdout should be empty"); + } + + private static void test_help() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfoNoPid("-help"); + output.shouldHaveExitValue(0); + assertFalse(output.getStderr().isEmpty(), "'jinfo -help' stderr should not be empty"); + assertTrue(output.getStdout().isEmpty(), "'jinfo -help' stdout should be empty"); + } + + private static void testVersion() throws Exception { + OutputAnalyzer output = JInfoHelper.jinfoNoPid("-version"); + output.shouldHaveExitValue(1); + assertFalse(output.getStderr().isEmpty(), "'jinfo -version' stderr should not be empty"); + assertTrue(output.getStdout().isEmpty(), "'jinfo -version' stdout should be empty"); + } + + private static void testUnknownHost() throws Exception { + String unknownHost = "Oja781nh2ev7vcvbajdg-Sda1-C"; + OutputAnalyzer output = JInfoHelper.jinfoNoPid("med@" + unknownHost); + assertNotEquals(output.getExitValue(), 0, "A non-zero exit code should be returned for invalid operation"); + output.shouldContain("UnknownHostException: " + unknownHost); + } + +} From f30ba73e1622e12ac129138a3db8b3693d034eff Mon Sep 17 00:00:00 2001 From: Sergey Gabdurakhmanov Date: Mon, 17 Nov 2014 13:11:37 +0100 Subject: [PATCH 098/159] 8048050: Agent NullPointerException when rmi.port in use Reviewed-by: jbachorik, dfuchs --- .../classes/sun/management/jmxremote/ConnectorBootstrap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java index a2f05634c62..e4d1c2f005f 100644 --- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java +++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java @@ -767,7 +767,7 @@ public final class ConnectorBootstrap { JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs); connServer.start(); } catch (IOException e) { - if (connServer == null) { + if (connServer == null || connServer.getAddress() == null) { throw new AgentConfigurationError(CONNECTOR_SERVER_IO_ERROR, e, url.toString()); } else { From e1f99ed979672150e8a9532701a7862bb106afd1 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Mon, 17 Nov 2014 15:30:22 +0300 Subject: [PATCH 099/159] 8065096: java.net.Authenticator.theAuthenticator should be properly synchronized Reviewed-by: chegar, lancea --- jdk/src/java.base/share/classes/java/net/Authenticator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/net/Authenticator.java b/jdk/src/java.base/share/classes/java/net/Authenticator.java index c88a6006b89..a83f40791d2 100644 --- a/jdk/src/java.base/share/classes/java/net/Authenticator.java +++ b/jdk/src/java.base/share/classes/java/net/Authenticator.java @@ -60,7 +60,7 @@ public abstract class Authenticator { // The system-wide authenticator object. See setDefault(). - private static Authenticator theAuthenticator; + private static volatile Authenticator theAuthenticator; private String requestingHost; private InetAddress requestingSite; From 8a5d63f3a270ebd8ba2dbf8eff38ecbb7898eb13 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Tue, 18 Nov 2014 19:17:16 +0100 Subject: [PATCH 100/159] 8064815: Zero+PPC64: Stack overflow when running Maven Reviewed-by: kvn, simonis --- hotspot/src/cpu/zero/vm/stack_zero.cpp | 4 +++- hotspot/src/cpu/zero/vm/stack_zero.inline.hpp | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hotspot/src/cpu/zero/vm/stack_zero.cpp b/hotspot/src/cpu/zero/vm/stack_zero.cpp index 33b0551b539..747199f5492 100644 --- a/hotspot/src/cpu/zero/vm/stack_zero.cpp +++ b/hotspot/src/cpu/zero/vm/stack_zero.cpp @@ -30,7 +30,9 @@ int ZeroStack::suggest_size(Thread *thread) const { assert(needs_setup(), "already set up"); - return align_size_down(abi_stack_available(thread) / 2, wordSize); + int abi_available = abi_stack_available(thread); + assert(abi_available >= 0, "available abi stack must be >= 0"); + return align_size_down(abi_available / 2, wordSize); } void ZeroStack::handle_overflow(TRAPS) { diff --git a/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp b/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp index f0387bb7bfd..0f868823f69 100644 --- a/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp +++ b/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp @@ -48,9 +48,11 @@ inline void ZeroStack::overflow_check(int required_words, TRAPS) { // to use under normal circumstances. Note that the returned // value can be negative. inline int ZeroStack::abi_stack_available(Thread *thread) const { - int stack_used = thread->stack_base() - (address) &stack_used; + guarantee(Thread::current() == thread, "should run in the same thread"); + int stack_used = thread->stack_base() - (address) &stack_used + + (StackYellowPages+StackRedPages+StackShadowPages) * os::vm_page_size(); int stack_free = thread->stack_size() - stack_used; - return stack_free - shadow_pages_size(); + return stack_free; } #endif // CPU_ZERO_VM_STACK_ZERO_INLINE_HPP From 1de18064559ef618f059a5b7c60f3fb646b5f6e9 Mon Sep 17 00:00:00 2001 From: Poonam Bajaj Date: Tue, 18 Nov 2014 10:19:04 -0800 Subject: [PATCH 101/159] 8065220: Include alternate sa.make file for MacOSX Include alternate sa.make in make/bsd/makefiles/sa.make Reviewed-by: mgronlun, egahlin, sla --- hotspot/make/bsd/makefiles/sa.make | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hotspot/make/bsd/makefiles/sa.make b/hotspot/make/bsd/makefiles/sa.make index 11503127bbb..fb3afd43dad 100644 --- a/hotspot/make/bsd/makefiles/sa.make +++ b/hotspot/make/bsd/makefiles/sa.make @@ -40,6 +40,8 @@ AGENT_DIR = $(GAMMADIR)/agent include $(GAMMADIR)/make/sa.files +-include $(HS_ALT_MAKE)/bsd/makefiles/sa.make + TOPDIR = $(shell echo `pwd`) GENERATED = $(TOPDIR)/../generated From ef64d5393d91b7577dfbed91f67ac33e5ddf5142 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Tue, 18 Nov 2014 03:38:50 -0800 Subject: [PATCH 102/159] 8064701: Some CDS optimizations should be disabled if bootclasspath is modified by JVMTI Added API to track bootclasspath modification Reviewed-by: jiangli, dholmes, minqi --- .../src/share/vm/classfile/classLoaderExt.hpp | 3 ++ hotspot/src/share/vm/prims/jvmtiEnv.cpp | 3 +- hotspot/src/share/vm/prims/whitebox.cpp | 30 +++++++++++++++++++ .../whitebox/sun/hotspot/WhiteBox.java | 4 +++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/classfile/classLoaderExt.hpp b/hotspot/src/share/vm/classfile/classLoaderExt.hpp index ee2e0ec6851..50c0ff4f118 100644 --- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp @@ -63,6 +63,9 @@ public: ClassPathEntry* new_entry) { ClassLoader::add_to_list(new_entry); } + static void append_boot_classpath(ClassPathEntry* new_entry) { + ClassLoader::add_to_list(new_entry); + } static void setup_search_paths() {} }; diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp index 5ddbf130e66..3ca776ac694 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/classLoaderExt.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "interpreter/bytecodeStream.hpp" @@ -472,7 +473,7 @@ JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) { if (TraceClassLoading) { tty->print_cr("[Opened %s]", zip_entry->name()); } - ClassLoader::add_to_list(zip_entry); + ClassLoaderExt::append_boot_classpath(zip_entry); return JVMTI_ERROR_NONE; } else { return JVMTI_ERROR_WRONG_PHASE; diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index f412484cbe0..8757dbece88 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -64,6 +64,7 @@ #endif // INCLUDE_NMT #include "compiler/compileBroker.hpp" +#include "jvmtifiles/jvmtiEnv.hpp" #include "runtime/compilationPolicy.hpp" PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC @@ -113,6 +114,31 @@ WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name)) return closure.found(); WB_END +WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) { +#if INCLUDE_JVMTI + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + const char* seg = env->GetStringUTFChars(segment, NULL); + JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION); + jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg); + assert(err == JVMTI_ERROR_NONE, "must not fail"); + env->ReleaseStringUTFChars(segment, seg); +#endif +} +WB_END + +WB_ENTRY(void, WB_AddToSystemClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) { +#if INCLUDE_JVMTI + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + const char* seg = env->GetStringUTFChars(segment, NULL); + JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION); + jvmtiError err = jvmti_env->AddToSystemClassLoaderSearch(seg); + assert(err == JVMTI_ERROR_NONE, "must not fail"); + env->ReleaseStringUTFChars(segment, seg); +#endif +} +WB_END + + WB_ENTRY(jlong, WB_GetCompressedOopsMaxHeapSize(JNIEnv* env, jobject o)) { return (jlong)Arguments::max_heap_for_compressed_oops(); } @@ -1102,6 +1128,10 @@ static JNINativeMethod methods[] = { CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;", (void*) &WB_ParseCommandLine }, + {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V", + (void*)&WB_AddToBootstrapClassLoaderSearch}, + {CC"addToSystemClassLoaderSearch", CC"(Ljava/lang/String;)V", + (void*)&WB_AddToSystemClassLoaderSearch}, {CC"getCompressedOopsMaxHeapSize", CC"()J", (void*)&WB_GetCompressedOopsMaxHeapSize}, {CC"printHeapSizes", CC"()V", (void*)&WB_PrintHeapSizes }, diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java index 1759d925731..09e3aa27c5f 100644 --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java @@ -84,6 +84,10 @@ public class WhiteBox { } private native boolean isClassAlive0(String name); + // JVMTI + public native void addToBootstrapClassLoaderSearch(String segment); + public native void addToSystemClassLoaderSearch(String segment); + // G1 public native boolean g1InConcurrentMark(); public native boolean g1IsHumongous(Object o); From 20802dbd08b1e1a217730a049aaeac9b573ff76d Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 18 Nov 2014 16:07:57 +0100 Subject: [PATCH 103/159] 8065183: Add --with-copyright-year option to configure Reviewed-by: ihse, tbell --- common/autoconf/generated-configure.sh | 18 ++++++++++++++++-- common/autoconf/jdk-options.m4 | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index ee4a8945ede..23d5bcb1829 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -1065,6 +1065,7 @@ with_milestone with_update_version with_user_release_suffix with_build_number +with_copyright_year with_boot_jdk with_add_source_root with_override_source_root @@ -1906,6 +1907,7 @@ Optional Packages: Add a custom string to the version string if build number is not set.[username_builddateb00] --with-build-number Set build number value for build [b00] + --with-copyright-year Set copyright year value for build [current year] --with-boot-jdk path to Boot JDK (used to bootstrap build) [probed] --with-add-source-root for each and every source directory, look in this additional source root for the same directory; if it @@ -4328,7 +4330,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1415179461 +DATE_WHEN_GENERATED=1416323245 ############################################################################### # @@ -20134,7 +20136,19 @@ fi - COPYRIGHT_YEAR=`date +'%Y'` + +# Check whether --with-copyright-year was given. +if test "${with_copyright_year+set}" = set; then : + withval=$with_copyright_year; +fi + + if test "x$with_copyright_year" = xyes; then + as_fn_error $? "Copyright year must have a value" "$LINENO" 5 + elif test "x$with_copyright_year" != x; then + COPYRIGHT_YEAR="$with_copyright_year" + else + COPYRIGHT_YEAR=`date +'%Y'` + fi if test "x$JDK_UPDATE_VERSION" != x; then diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4 index 3f0165e52b5..39239fa80d8 100644 --- a/common/autoconf/jdk-options.m4 +++ b/common/autoconf/jdk-options.m4 @@ -549,7 +549,15 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS], AC_SUBST(MACOSX_BUNDLE_NAME_BASE) AC_SUBST(MACOSX_BUNDLE_ID_BASE) - COPYRIGHT_YEAR=`date +'%Y'` + AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year], + [Set copyright year value for build @<:@current year@:>@])]) + if test "x$with_copyright_year" = xyes; then + AC_MSG_ERROR([Copyright year must have a value]) + elif test "x$with_copyright_year" != x; then + COPYRIGHT_YEAR="$with_copyright_year" + else + COPYRIGHT_YEAR=`date +'%Y'` + fi AC_SUBST(COPYRIGHT_YEAR) if test "x$JDK_UPDATE_VERSION" != x; then From b83ddbef42c23ca5f0782a9581639c0e915fa73b Mon Sep 17 00:00:00 2001 From: Evgeniya Stepanova Date: Wed, 19 Nov 2014 17:43:19 +0300 Subject: [PATCH 104/159] 8062537: [TESTBUG] Conflicting GC combinations in hotspot tests Reviewed-by: brutisso --- .../regalloc/C1ObjectSpillInLogicOp.java | 3 ++- hotspot/test/gc/6581734/Test6581734.java | 3 ++- hotspot/test/gc/TestSystemGC.java | 3 ++- .../arguments/TestAlignmentToUseLargePages.java | 3 ++- .../test/gc/arguments/TestG1HeapRegionSize.java | 17 ++++++----------- .../concurrentMarkSweep/DisableResizePLAB.java | 1 + hotspot/test/gc/defnew/HeapChangeLogging.java | 6 ++---- hotspot/test/gc/g1/TestHumongousShrinkHeap.java | 1 + hotspot/test/gc/g1/TestRegionAlignment.java | 3 ++- hotspot/test/gc/g1/TestShrinkAuxiliaryData.java | 13 +------------ .../test/gc/g1/TestShrinkAuxiliaryData05.java | 1 + .../test/gc/g1/TestShrinkAuxiliaryData10.java | 1 + .../test/gc/g1/TestShrinkAuxiliaryData15.java | 1 + .../test/gc/g1/TestShrinkAuxiliaryData20.java | 1 + .../test/gc/g1/TestShrinkAuxiliaryData25.java | 1 + .../test/gc/g1/TestShrinkAuxiliaryData30.java | 1 + hotspot/test/gc/g1/TestShrinkToOneRegion.java | 3 ++- .../gc/metaspace/G1AddMetaspaceDependency.java | 3 ++- .../gc/metaspace/TestMetaspacePerfCounters.java | 3 ++- .../TestPerfCountersAndMemoryPools.java | 3 ++- .../gc/parallelScavenge/TestDynShrinkHeap.java | 1 + 21 files changed, 36 insertions(+), 36 deletions(-) diff --git a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java index 17571820b3e..f8fc1879644 100644 --- a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java +++ b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java @@ -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 @@ -24,6 +24,7 @@ /* * @test * @bug 8027751 + * @requires vm.gc=="G1" | vm.gc=="null" * @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill * @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp * diff --git a/hotspot/test/gc/6581734/Test6581734.java b/hotspot/test/gc/6581734/Test6581734.java index 143340dc080..9ec55c85732 100644 --- a/hotspot/test/gc/6581734/Test6581734.java +++ b/hotspot/test/gc/6581734/Test6581734.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -24,6 +24,7 @@ /* * @test Test6581734.java * @bug 6581734 + * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" * @summary CMS Old Gen's collection usage is zero after GC which is incorrect * @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC Test6581734 * diff --git a/hotspot/test/gc/TestSystemGC.java b/hotspot/test/gc/TestSystemGC.java index b882f9fc72d..d0346595137 100644 --- a/hotspot/test/gc/TestSystemGC.java +++ b/hotspot/test/gc/TestSystemGC.java @@ -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 @@ -24,6 +24,7 @@ /* * @test TestSystemGC * @key gc + * @requires vm.gc=="null" * @summary Runs System.gc() with different flags. * @run main/othervm TestSystemGC * @run main/othervm -XX:+UseSerialGC TestSystemGC diff --git a/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java b/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java index 125c1aabd51..45d447840a1 100644 --- a/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java +++ b/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java @@ -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 @@ -28,6 +28,7 @@ * @bug 8024396 * @key gc * @key regression + * @requires vm.gc=="null" * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java index 193dacf9897..b55dc8b32d6 100644 --- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java +++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java @@ -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,11 +25,12 @@ * @test TestG1HeapRegionSize * @key gc * @bug 8021879 + * @requires vm.gc=="G1" | vm.gc=="null" * @summary Verify that the flag G1HeapRegionSize is updated properly * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576 - * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152 - * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152 - * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432 + * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152 + * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152 + * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m -XX:+UseG1GC TestG1HeapRegionSize 33554432 */ import sun.management.ManagementFactoryHelper; @@ -41,14 +42,8 @@ public class TestG1HeapRegionSize { public static void main(String[] args) { HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); - VMOption option = diagnostic.getVMOption("UseG1GC"); - if (option.getValue().equals("false")) { - System.out.println("Skipping this test. It is only a G1 test."); - return; - } - String expectedValue = getExpectedValue(args); - option = diagnostic.getVMOption("G1HeapRegionSize"); + VMOption option = diagnostic.getVMOption("G1HeapRegionSize"); if (!expectedValue.equals(option.getValue())) { throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue()); } diff --git a/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java index c504d069a72..be8ac5d958c 100644 --- a/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java +++ b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java @@ -26,6 +26,7 @@ * @key gc * @bug 8060467 * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com + * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -XX:+PrintGCDetails DisableResizePLAB */ diff --git a/hotspot/test/gc/defnew/HeapChangeLogging.java b/hotspot/test/gc/defnew/HeapChangeLogging.java index 5349e691b76..e2be82a0e4d 100644 --- a/hotspot/test/gc/defnew/HeapChangeLogging.java +++ b/hotspot/test/gc/defnew/HeapChangeLogging.java @@ -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 @@ -28,8 +28,6 @@ * @build HeapChangeLogging * @summary Allocate to get a promotion failure and verify that that heap change logging is present. * @run main HeapChangeLogging - * - * Test the output of G1SummarizeRSetStats in conjunction with G1SummarizeRSetStatsPeriod. */ import java.util.regex.Matcher; @@ -78,4 +76,4 @@ class Entry { payload = new byte[payloadSize]; this.previous = previous; } -} \ No newline at end of file +} diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java index 97d60546b25..87f805d48cf 100644 --- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java +++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java @@ -24,6 +24,7 @@ /** * @test TestHumongousShrinkHeap * @bug 8036025 8056043 + * @requires vm.gc=="G1" | vm.gc=="null" * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects * @library /testlibrary * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap diff --git a/hotspot/test/gc/g1/TestRegionAlignment.java b/hotspot/test/gc/g1/TestRegionAlignment.java index 08cf02e54c1..7c7600f8be1 100644 --- a/hotspot/test/gc/g1/TestRegionAlignment.java +++ b/hotspot/test/gc/g1/TestRegionAlignment.java @@ -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 @@ -24,6 +24,7 @@ /* * @test TestRegionAlignment.java * @bug 8013791 + * @requires vm.gc=="G1" | vm.gc=="null" * @summary Make sure that G1 ergonomics pick a heap size that is aligned with the region size * @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -XX:MaxRAM=555m TestRegionAlignment * diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java index 6a268ae8c46..8ee3aebe20f 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java @@ -69,9 +69,7 @@ public class TestShrinkAuxiliaryData { printTestInfo(maxCacheSize); vmOpts.add("-XX:G1ConcRSLogCacheSize=" + RSetCacheSize); - - vmOpts.addAll(Arrays.asList(Utils.getFilteredTestJavaOpts( - ShrinkAuxiliaryDataTest.prohibitedVmOptions))); + vmOpts.addAll(Arrays.asList(Utils.getTestJavaOpts())); // for 32 bits ObjectAlignmentInBytes is not a option if (Platform.is32bit()) { @@ -272,14 +270,5 @@ public class TestShrinkAuxiliaryData { private static final int NUM_OBJECTS_PER_REGION = 10; private static final int NUM_LINKS = 20; // how many links create for each object - private static final String[] prohibitedVmOptions = { - // remove this when @requires option will be on duty - "-XX:\\+UseParallelGC", - "-XX:\\+UseSerialGC", - "-XX:\\+UseConcMarkSweepGC", - "-XX:\\+UseParallelOldGC", - "-XX:\\+UseParNewGC", - "-Xconcgc" - }; } } diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java index 910aad696ac..f7ff497cb9b 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java @@ -26,6 +26,7 @@ * @bug 8038423 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /testlibrary/whitebox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05 * @run driver/timeout=720 TestShrinkAuxiliaryData05 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java index 5dec96d6369..0f1cf9b07e9 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java @@ -26,6 +26,7 @@ * @bug 8038423 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /testlibrary/whitebox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10 * @run driver/timeout=720 TestShrinkAuxiliaryData10 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java index 30455e4f43c..33a0ecb94dc 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java @@ -26,6 +26,7 @@ * @bug 8038423 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /testlibrary/whitebox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15 * @run driver/timeout=720 TestShrinkAuxiliaryData15 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java index bdc3996ec18..236a4f1ca6d 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java @@ -26,6 +26,7 @@ * @bug 8038423 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /testlibrary/whitebox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20 * @run driver/timeout=720 TestShrinkAuxiliaryData20 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java index 4429ee5033f..7defc9522f3 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java @@ -26,6 +26,7 @@ * @bug 8038423 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /testlibrary/whitebox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25 * @run driver/timeout=720 TestShrinkAuxiliaryData25 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java index 2ad40ccdf2b..b51ec8449d8 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java @@ -26,6 +26,7 @@ * @bug 8038423 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /testlibrary/whitebox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30 * @run driver/timeout=720 TestShrinkAuxiliaryData30 diff --git a/hotspot/test/gc/g1/TestShrinkToOneRegion.java b/hotspot/test/gc/g1/TestShrinkToOneRegion.java index 100741b6902..0821223c6c0 100644 --- a/hotspot/test/gc/g1/TestShrinkToOneRegion.java +++ b/hotspot/test/gc/g1/TestShrinkToOneRegion.java @@ -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 @@ -24,6 +24,7 @@ /* * @test TestShrinkToOneRegion.java * @bug 8013872 + * @requires vm.gc=="G1" | vm.gc=="null" * @summary Shrinking the heap down to one region used to hit an assert * @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -Xmx256m TestShrinkToOneRegion * diff --git a/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java b/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java index b8e8b1ad598..5c6256290b7 100644 --- a/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java +++ b/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java @@ -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 @@ -24,6 +24,7 @@ /* * @test G1AddMetaspaceDependency * @bug 8010196 + * @requires vm.gc=="G1" | vm.gc=="null" * @summary Checks that we don't get locking problems when adding metaspace dependencies with the G1 update buffer monitor * @run main/othervm -XX:+UseG1GC -XX:G1UpdateBufferSize=1 G1AddMetaspaceDependency */ diff --git a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java index 974066cba56..a02f5b45f58 100644 --- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java +++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java @@ -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 @@ -29,6 +29,7 @@ import static com.oracle.java.testlibrary.Asserts.*; /* @test TestMetaspacePerfCounters * @bug 8014659 + * @requires vm.gc=="null" * @library /testlibrary * @summary Tests that performance counters for metaspace and compressed class * space exists and works. diff --git a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java index ac708bf7701..4aaa8ac174b 100644 --- a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java +++ b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java @@ -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 @@ -30,6 +30,7 @@ import static com.oracle.java.testlibrary.Asserts.*; /* @test TestPerfCountersAndMemoryPools * @bug 8023476 * @library /testlibrary + * @requires vm.gc=="Serial" | vm.gc=="null" * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace * report the same data. * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools diff --git a/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java index 336f7b9939e..d029b45e0bb 100644 --- a/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java +++ b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java @@ -25,6 +25,7 @@ * @ignore 8019361 * @test TestDynShrinkHeap * @bug 8016479 + * @requires vm.gc=="Parallel" | vm.gc=="null" * @summary Verify that the heap shrinks after full GC according to the current values of the Min/MaxHeapFreeRatio flags * @library /testlibrary * @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Xmx1g -verbose:gc TestDynShrinkHeap From 71a33bf0641e4609dd5198e786f4ab95a9852fe2 Mon Sep 17 00:00:00 2001 From: Evgeniya Stepanova Date: Wed, 19 Nov 2014 17:51:06 +0300 Subject: [PATCH 105/159] 8062536: [TESTBUG] Conflicting GC combinations in jdk tests Reviewed-by: brutisso, dholmes --- .../java/lang/management/MemoryMXBean/LowMemoryTest2.sh | 4 ++-- .../MemoryMXBean/MemoryManagementConcMarkSweepGC.sh | 4 ++-- .../management/MemoryMXBean/MemoryManagementParallelGC.sh | 4 ++-- .../management/MemoryMXBean/MemoryManagementSerialGC.sh | 4 ++-- .../java/lang/management/MemoryMXBean/MemoryTestAllGC.sh | 6 ++---- jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh | 4 ++-- .../lang/management/RuntimeMXBean/TestInputArgument.sh | 7 +++---- jdk/test/java/lang/ref/EnqueuePollRace.java | 4 ++-- jdk/test/sun/tools/jps/JpsHelper.java | 2 +- 9 files changed, 18 insertions(+), 21 deletions(-) diff --git a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh index d05a75958ee..b584c085b46 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh +++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 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 4982128 # @summary Test low memory detection of non-heap memory pool -# +# @requires vm.gc=="null" # @run build LowMemoryTest2 MemoryUtil # @run shell/timeout=600 LowMemoryTest2.sh # diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh index 8db78142ef6..a80f2c417f1 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh +++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 @@ -26,7 +26,7 @@ # @bug 4530538 # @summary Run MemoryManagement test with concurrent mark sweep GC # @author Mandy Chung -# +# @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" # @run build MemoryManagement # @run shell/timeout=600 MemoryManagementConcMarkSweepGC.sh # diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh index 0435302e8e9..f315c96eb31 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh +++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 @@ -26,7 +26,7 @@ # @bug 4530538 # @summary Run MemoryManagement test with parallel GC # @author Mandy Chung -# +# @requires vm.gc=="Parallel" | vm.gc=="null" # @run build MemoryManagement # @run shell/timeout=600 MemoryManagementParallelGC.sh # diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh index e7ea40a1e8f..043323071d7 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh +++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 @@ -26,7 +26,7 @@ # @bug 4530538 # @summary Run MemoryManagement test with serial GC # @author Mandy Chung -# +# @requires vm.gc=="Serial" | vm.gc=="null" # @run build MemoryManagement # @run shell/timeout=600 MemoryManagementSerialGC.sh # diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh b/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh index be0827ae32a..6dbbc1659d9 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh +++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 @@ -26,7 +26,7 @@ # @bug 4530538 # @summary # @author Mandy Chung -# +# @requires vm.gc=="Parallel" | vm.gc=="null" # @run compile MemoryTest.java # @run shell MemoryTestAllGC.sh # @@ -52,7 +52,5 @@ runOne MemoryTest 2 # Test MemoryTest with parallel scavenger collector runOne -XX:+UseParallelGC MemoryTest 2 -# Test MemoryTest with concurrent collector -#runOne -XX:+UseConcMarkSweepGC MemoryTest 3 exit 0 diff --git a/jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh b/jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh index edf18b3ffa0..2a1ccc3be7e 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh +++ b/jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 @@ -26,7 +26,7 @@ # @bug 4530538 # @summary # @author Mandy Chung -# +# @requires vm.gc=="null" # @run compile Pending.java # @run shell PendingAllGC.sh # diff --git a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh index 5c57e4878e5..6c135415875 100644 --- a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh +++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 @@ -26,7 +26,6 @@ # @bug 4530538 # @summary # @author Mandy Chung -# # @run compile InputArgument.java # @run shell TestInputArgument.sh # @@ -48,8 +47,8 @@ runOne() runOne InputArgument -runOne -XX:+UseParallelGC -XX:+PrintGCDetails InputArgument -XX:+PrintGCDetails -runOne -XX:+UseParallelGC -XX:+PrintGCDetails InputArgument -XX:+UseParallelGC +runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+PrintGCDetails +runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+UseFastJNIAccessors runOne "-Dprops=one two three" InputArgument "-Dprops=one two three" exit 0 diff --git a/jdk/test/java/lang/ref/EnqueuePollRace.java b/jdk/test/java/lang/ref/EnqueuePollRace.java index c19a366715d..5171e138e5a 100644 --- a/jdk/test/java/lang/ref/EnqueuePollRace.java +++ b/jdk/test/java/lang/ref/EnqueuePollRace.java @@ -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 @@ * @bug 8014890 * @summary Verify that a race between ReferenceQueue.enqueue() and poll() does not occur. * @author thomas.schatzl@oracle.com - * @run main/othervm -XX:+UseSerialGC -Xmx10M EnqueuePollRace + * @run main/othervm -Xmx10M EnqueuePollRace */ import java.lang.ref.*; diff --git a/jdk/test/sun/tools/jps/JpsHelper.java b/jdk/test/sun/tools/jps/JpsHelper.java index 4e00cc95de4..407f0416c34 100644 --- a/jdk/test/sun/tools/jps/JpsHelper.java +++ b/jdk/test/sun/tools/jps/JpsHelper.java @@ -93,7 +93,7 @@ public final class JpsHelper { /** * VM arguments to start test application with */ - public static final String[] VM_ARGS = {"-Xmx512m", "-XX:+UseParallelGC"}; + public static final String[] VM_ARGS = {"-Xmx512m", "-XX:+PrintGCDetails"}; /** * VM flag to start test application with */ From ac5d9dad16074d711719b134b61ecc0d13baac76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Wed, 19 Nov 2014 16:08:01 +0100 Subject: [PATCH 106/159] 8065361: Fixup headers and definitions for INCLUDE_TRACE Reviewed-by: sla, stefank --- hotspot/src/share/vm/classfile/classLoaderData.cpp | 5 ++--- hotspot/src/share/vm/classfile/classLoaderData.hpp | 3 ++- hotspot/src/share/vm/classfile/systemDictionary.cpp | 5 ++--- .../shared/objectCountEventSender.cpp | 2 +- hotspot/src/share/vm/runtime/vmStructs.cpp | 2 +- hotspot/src/share/vm/trace/noTraceBackend.hpp | 2 +- hotspot/src/share/vm/trace/traceBackend.hpp | 10 +++------- hotspot/src/share/vm/trace/traceEvent.hpp | 6 ++---- hotspot/src/share/vm/trace/traceEventClasses.xsl | 10 +++------- hotspot/src/share/vm/trace/traceEventIds.xsl | 10 ++++------ hotspot/src/share/vm/trace/traceMacros.hpp | 6 +++--- hotspot/src/share/vm/trace/traceStream.hpp | 6 ++---- hotspot/src/share/vm/trace/traceTypes.xsl | 9 ++++----- hotspot/src/share/vm/trace/tracing.hpp | 2 +- 14 files changed, 31 insertions(+), 47 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp index ff7b3533cba..dd53dc7443c 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp @@ -65,9 +65,8 @@ #include "utilities/growableArray.hpp" #include "utilities/macros.hpp" #include "utilities/ostream.hpp" - #if INCLUDE_TRACE - #include "trace/tracing.hpp" +#include "trace/tracing.hpp" #endif ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL; @@ -978,4 +977,4 @@ void ClassLoaderDataGraph::class_unload_event(Klass* const k) { event.commit(); } -#endif /* INCLUDE_TRACE */ +#endif // INCLUDE_TRACE diff --git a/hotspot/src/share/vm/classfile/classLoaderData.hpp b/hotspot/src/share/vm/classfile/classLoaderData.hpp index 17eab14b672..a9ccaf81fe2 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp @@ -31,8 +31,9 @@ #include "memory/metaspaceCounters.hpp" #include "runtime/mutex.hpp" #include "utilities/growableArray.hpp" +#include "utilities/macros.hpp" #if INCLUDE_TRACE -# include "utilities/ticks.hpp" +#include "utilities/ticks.hpp" #endif // diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 85f90d436c2..9825c51874a 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -65,9 +65,8 @@ #include "services/threadService.hpp" #include "utilities/macros.hpp" #include "utilities/ticks.hpp" - #if INCLUDE_TRACE - #include "trace/tracing.hpp" +#include "trace/tracing.hpp" #endif Dictionary* SystemDictionary::_dictionary = NULL; @@ -2660,7 +2659,7 @@ void SystemDictionary::post_class_load_event(const Ticks& start_time, class_loader->klass() : (Klass*)NULL); event.commit(); } -#endif /* INCLUDE_TRACE */ +#endif // INCLUDE_TRACE } #ifndef PRODUCT diff --git a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp index 4e0dc6077a6..8b9d6a141f5 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp @@ -29,8 +29,8 @@ #include "memory/heapInspection.hpp" #include "trace/tracing.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" #include "utilities/ticks.hpp" - #if INCLUDE_SERVICES void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, const Ticks& timestamp) { diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 9c1cec41a39..b69ce20e8d6 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -173,7 +173,7 @@ #endif // INCLUDE_ALL_GCS #if INCLUDE_TRACE - #include "runtime/vmStructs_trace.hpp" +#include "runtime/vmStructs_trace.hpp" #endif #ifdef COMPILER2 diff --git a/hotspot/src/share/vm/trace/noTraceBackend.hpp b/hotspot/src/share/vm/trace/noTraceBackend.hpp index 52a7f2c2899..a0b1f33dd26 100644 --- a/hotspot/src/share/vm/trace/noTraceBackend.hpp +++ b/hotspot/src/share/vm/trace/noTraceBackend.hpp @@ -41,4 +41,4 @@ public: typedef NoTraceBackend Tracing; -#endif +#endif // SHARE_VM_TRACE_NOTRACEBACKEND_HPP diff --git a/hotspot/src/share/vm/trace/traceBackend.hpp b/hotspot/src/share/vm/trace/traceBackend.hpp index 471d1b00e28..c65d89e41d8 100644 --- a/hotspot/src/share/vm/trace/traceBackend.hpp +++ b/hotspot/src/share/vm/trace/traceBackend.hpp @@ -25,9 +25,7 @@ #define SHARE_VM_TRACE_TRACEBACKEND_HPP #include "utilities/macros.hpp" - #if INCLUDE_TRACE - #include "runtime/globals.hpp" #include "runtime/os.hpp" #include "trace/traceTime.hpp" @@ -58,9 +56,7 @@ public: typedef TraceBackend Tracing; -#else /* INCLUDE_TRACE */ - +#else // !INCLUDE_TRACE #include "trace/noTraceBackend.hpp" - -#endif /* INCLUDE_TRACE */ -#endif /* SHARE_VM_TRACE_TRACEBACKEND_HPP */ +#endif // INCLUDE_TRACE +#endif // SHARE_VM_TRACE_TRACEBACKEND_HPP diff --git a/hotspot/src/share/vm/trace/traceEvent.hpp b/hotspot/src/share/vm/trace/traceEvent.hpp index 33abd67d355..a0548d76513 100644 --- a/hotspot/src/share/vm/trace/traceEvent.hpp +++ b/hotspot/src/share/vm/trace/traceEvent.hpp @@ -33,7 +33,6 @@ enum EventStartTime { }; #if INCLUDE_TRACE - #include "trace/traceBackend.hpp" #include "trace/tracing.hpp" #include "tracefiles/traceEventIds.hpp" @@ -154,6 +153,5 @@ class TraceEvent : public StackObj { } }; -#endif /* INCLUDE_TRACE */ - -#endif /* SHARE_VM_TRACE_TRACEEVENT_HPP */ +#endif // INCLUDE_TRACE +#endif // SHARE_VM_TRACE_TRACEEVENT_HPP diff --git a/hotspot/src/share/vm/trace/traceEventClasses.xsl b/hotspot/src/share/vm/trace/traceEventClasses.xsl index 12496ac65e8..fe097e0b370 100644 --- a/hotspot/src/share/vm/trace/traceEventClasses.xsl +++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl @@ -41,17 +41,14 @@ #include "trace/traceEvent.hpp" #include "utilities/macros.hpp" #include "utilities/ticks.hpp" - #if INCLUDE_TRACE - - #include "trace/traceStream.hpp" #include "utilities/ostream.hpp" -#else +#else // !INCLUDE_TRACE class TraceEvent { public: @@ -66,9 +63,8 @@ public: -#endif - -#endif +#endif // INCLUDE_TRACE +#endif // TRACEFILES_TRACEEVENTCLASSES_HPP diff --git a/hotspot/src/share/vm/trace/traceEventIds.xsl b/hotspot/src/share/vm/trace/traceEventIds.xsl index 6a7e95474c0..9ee9ebdfa31 100644 --- a/hotspot/src/share/vm/trace/traceEventIds.xsl +++ b/hotspot/src/share/vm/trace/traceEventIds.xsl @@ -29,13 +29,11 @@ -#ifndef TRACEFILES_JFREVENTIDS_HPP -#define TRACEFILES_JFREVENTIDS_HPP +#ifndef TRACEFILES_TRACEEVENTIDS_HPP +#define TRACEFILES_TRACEEVENTIDS_HPP #include "utilities/macros.hpp" - #if INCLUDE_TRACE - #include "trace/traceDataTypes.hpp" /** @@ -67,8 +65,8 @@ enum TraceStructId { typedef enum TraceEventId TraceEventId; typedef enum TraceStructId TraceStructId; -#endif -#endif +#endif // INCLUDE_TRACE +#endif // TRACEFILES_TRACEEVENTIDS_HPP diff --git a/hotspot/src/share/vm/trace/traceMacros.hpp b/hotspot/src/share/vm/trace/traceMacros.hpp index 4776e13507e..371ee7f8d09 100644 --- a/hotspot/src/share/vm/trace/traceMacros.hpp +++ b/hotspot/src/share/vm/trace/traceMacros.hpp @@ -22,8 +22,8 @@ * */ -#ifndef SHARE_VM_TRACE_TRACE_MACRO_HPP -#define SHARE_VM_TRACE_TRACE_MACRO_HPP +#ifndef SHARE_VM_TRACE_TRACEMACROS_HPP +#define SHARE_VM_TRACE_TRACEMACROS_HPP #define EVENT_THREAD_EXIT(thread) #define EVENT_THREAD_DESTRUCT(thread) @@ -41,4 +41,4 @@ #define TRACE_TEMPLATES(template) #define TRACE_INTRINSICS(do_intrinsic, do_class, do_name, do_signature, do_alias) -#endif +#endif // SHARE_VM_TRACE_TRACEMACROS_HPP diff --git a/hotspot/src/share/vm/trace/traceStream.hpp b/hotspot/src/share/vm/trace/traceStream.hpp index 14bc421115c..89911ea27a0 100644 --- a/hotspot/src/share/vm/trace/traceStream.hpp +++ b/hotspot/src/share/vm/trace/traceStream.hpp @@ -26,9 +26,7 @@ #define SHARE_VM_TRACE_TRACESTREAM_HPP #include "utilities/macros.hpp" - #if INCLUDE_TRACE - #include "oops/klass.hpp" #include "oops/method.hpp" #include "oops/symbol.hpp" @@ -117,5 +115,5 @@ class TraceStream : public StackObj { } }; -#endif /* INCLUDE_TRACE */ -#endif /* SHARE_VM_TRACE_TRACESTREAM_HPP */ +#endif // INCLUDE_TRACE +#endif // SHARE_VM_TRACE_TRACESTREAM_HPP diff --git a/hotspot/src/share/vm/trace/traceTypes.xsl b/hotspot/src/share/vm/trace/traceTypes.xsl index c7f9c0a5dd1..c5720e6546f 100644 --- a/hotspot/src/share/vm/trace/traceTypes.xsl +++ b/hotspot/src/share/vm/trace/traceTypes.xsl @@ -29,15 +29,14 @@ -#ifndef TRACEFILES_JFRTYPES_HPP -#define TRACEFILES_JFRTYPES_HPP +#ifndef TRACEFILES_TRACETYPES_HPP +#define TRACEFILES_TRACETYPES_HPP #include "oops/symbol.hpp" #include "trace/traceDataTypes.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ticks.hpp" - enum JVMContentType { _not_a_content_type = (JVM_CONTENT_TYPES_START - 1), @@ -58,7 +57,7 @@ enum JVMEventRelations { }; /** - * Create typedefs for the JRA types: + * Create typedefs for the TRACE types: * typedef s8 TYPE_LONG; * typedef s4 TYPE_INTEGER; * typedef const char * TYPE_STRING; @@ -68,7 +67,7 @@ enum JVMEventRelations { typedef TYPE_; -#endif // JFRFILES_JFRTYPES_HPP +#endif // TRACEFILES_TRACETYPES_HPP diff --git a/hotspot/src/share/vm/trace/tracing.hpp b/hotspot/src/share/vm/trace/tracing.hpp index 72530e74594..e70696eb38c 100644 --- a/hotspot/src/share/vm/trace/tracing.hpp +++ b/hotspot/src/share/vm/trace/tracing.hpp @@ -28,4 +28,4 @@ #include "tracefiles/traceEventClasses.hpp" #include "tracefiles/traceEventIds.hpp" -#endif +#endif // SHARE_VM_TRACE_TRACING_HPP From 5b5a52cd58cefdb29668c35f9f1d0309ff7a3548 Mon Sep 17 00:00:00 2001 From: Andrey Zakharov Date: Wed, 19 Nov 2014 19:22:49 +0400 Subject: [PATCH 107/159] 8059661: Test SoftReference and OOM behavior Reviewed-by: tschatzl --- .../gc/TestSoftReferencesBehaviorOnOOME.java | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java new file mode 100644 index 00000000000..24f7a53612f --- /dev/null +++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java @@ -0,0 +1,146 @@ +/* + * 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 TestSoftReferencesBehaviorOnOOME + * @key gc + * @summary Tests that all SoftReferences has been cleared at time of OOM. + * @library /testlibrary + * @build TestSoftReference + * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k + * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k + * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10 + */ +import com.oracle.java.testlibrary.Utils; +import java.lang.ref.SoftReference; +import java.util.LinkedList; +import java.util.Random; + +public class TestSoftReferencesBehaviorOnOOME { + + private static final Random rndGenerator = Utils.getRandomInstance(); + + public static void main(String[] args) { + int semiRefAllocFrequency = DEFAULT_FREQUENCY; + long minSize = DEFAULT_MIN_SIZE, + maxSize = DEFAULT_MAX_SIZE; + + if ( args.length >= 3 ) { + semiRefAllocFrequency = Integer.parseInt(args[2]); + } + + if ( args.length >= 2) { + maxSize = getBytesCount(args[1]); + } + + if ( args.length >= 1) { + minSize = getBytesCount(args[0]); + } + + new TestSoftReferencesBehaviorOnOOME().softReferencesOom(minSize, maxSize, semiRefAllocFrequency); + } + + /** + * Test that all SoftReferences has been cleared at time of OOM. + */ + void softReferencesOom(long minSize, long maxSize, int semiRefAllocFrequency) { + System.out.format( "minSize = %d, maxSize = %d, freq = %d%n", minSize, maxSize, semiRefAllocFrequency ); + long counter = 0; + + long multiplier = maxSize - minSize; + LinkedList arrSoftRefs = new LinkedList(); + LinkedList arrObjects = new LinkedList(); + long numberOfNotNulledObjects = 0; + long oomSoftArraySize = 0; + + try { + while (true) { + // Keep every Xth object to make sure we hit OOM pretty fast + if (counter % semiRefAllocFrequency != 0) { + long allocationSize = ((int) (rndGenerator.nextDouble() * multiplier)) + + minSize; + arrObjects.add(new byte[(int)allocationSize]); + } else { + arrSoftRefs.add(new SoftReference(new Object())); + } + + counter++; + if (counter == Long.MAX_VALUE) { + counter = 0; + } + } + } catch (OutOfMemoryError oome) { + // Clear allocated ballast, so we don't get another OOM. + + arrObjects = null; + + // Get the number of soft refs first, so we don't trigger + // another OOM. + oomSoftArraySize = arrSoftRefs.size(); + + for (SoftReference sr : arrSoftRefs) { + Object o = sr.get(); + + if (o != null) { + numberOfNotNulledObjects++; + } + } + + // Make sure we clear all refs before we return failure + arrSoftRefs = null; + + if (numberOfNotNulledObjects > 0) { + throw new RuntimeException(numberOfNotNulledObjects + " out of " + + oomSoftArraySize + " SoftReferences was not " + + "null at time of OutOfMemoryError"); + } + } finally { + arrSoftRefs = null; + arrObjects = null; + } + } + + private static final long getBytesCount(String arg) { + String postfixes = "kMGT"; + long mod = 1; + + if (arg.trim().length() >= 2) { + mod = postfixes.indexOf( + arg.trim().charAt(arg.length() - 1) + ); + + if (mod != -1) { + mod = (long) Math.pow(1024, mod+1); + arg = arg.substring(0, arg.length() - 1); + } else { + mod = 1; // 10^0 + } + } + + return Long.parseLong(arg) * mod; + } + + private static final long DEFAULT_MIN_SIZE = 512; + private static final long DEFAULT_MAX_SIZE = 1024; + private static final int DEFAULT_FREQUENCY = 4; +} From 4151db8bfdce2b8e645e38790bcb77d86cb49e77 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 19 Nov 2014 13:02:11 -0500 Subject: [PATCH 108/159] 8042235: redefining method used by multiple MethodHandles crashes VM Note all MemberNames created on internal list for adjusting method entries. Reviewed-by: sspitsyn, dcubed, lfoltan --- .../src/share/vm/classfile/javaClasses.cpp | 30 ++- .../src/share/vm/classfile/javaClasses.hpp | 5 +- hotspot/src/share/vm/oops/instanceKlass.cpp | 29 ++- hotspot/src/share/vm/oops/instanceKlass.hpp | 3 +- hotspot/src/share/vm/prims/jvm.cpp | 34 +++- hotspot/src/share/vm/prims/methodHandles.cpp | 66 ++----- hotspot/src/share/vm/prims/methodHandles.hpp | 8 +- ...fineMethodUsedByMultipleMethodHandles.java | 174 ++++++++++++++++++ 8 files changed, 264 insertions(+), 85 deletions(-) create mode 100644 hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 754134bdafa..d900ef5e84a 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -41,6 +41,7 @@ #include "oops/method.hpp" #include "oops/symbol.hpp" #include "oops/typeArrayOop.hpp" +#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" @@ -2794,12 +2795,35 @@ Metadata* java_lang_invoke_MemberName::vmtarget(oop mname) { return (Metadata*)mname->address_field(_vmtarget_offset); } +bool java_lang_invoke_MemberName::is_method(oop mname) { + assert(is_instance(mname), "must be MemberName"); + return (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0; +} + #if INCLUDE_JVMTI // Can be executed on VM thread only -void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, Metadata* ref) { - assert((is_instance(mname) && (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0), "wrong type"); +void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, Method* old_method, + Method* new_method, bool* trace_name_printed) { + assert(is_method(mname), "wrong type"); assert(Thread::current()->is_VM_thread(), "not VM thread"); - mname->address_field_put(_vmtarget_offset, (address)ref); + + Method* target = (Method*)mname->address_field(_vmtarget_offset); + if (target == old_method) { + mname->address_field_put(_vmtarget_offset, (address)new_method); + + if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (!(*trace_name_printed)) { + // RC_TRACE_MESG macro has an embedded ResourceMark + RC_TRACE_MESG(("adjust: name=%s", + old_method->method_holder()->external_name())); + *trace_name_printed = true; + } + // RC_TRACE macro has an embedded ResourceMark + RC_TRACE(0x00400000, ("MemberName method update: %s(%s)", + new_method->name()->as_C_string(), + new_method->signature()->as_C_string())); + } + } } #endif // INCLUDE_JVMTI diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index c7890d20720..ee2c807ae12 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -1100,7 +1100,8 @@ class java_lang_invoke_MemberName: AllStatic { static Metadata* vmtarget(oop mname); static void set_vmtarget(oop mname, Metadata* target); #if INCLUDE_JVMTI - static void adjust_vmtarget(oop mname, Metadata* target); + static void adjust_vmtarget(oop mname, Method* old_method, Method* new_method, + bool* trace_name_printed); #endif // INCLUDE_JVMTI static intptr_t vmindex(oop mname); @@ -1114,6 +1115,8 @@ class java_lang_invoke_MemberName: AllStatic { return obj != NULL && is_subclass(obj->klass()); } + static bool is_method(oop obj); + // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants): enum { MN_IS_METHOD = 0x00010000, // method (not constructor) diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index ab925e46acb..e80eaece790 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -2931,28 +2931,27 @@ nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_le return NULL; } -void InstanceKlass::add_member_name(int index, Handle mem_name) { +bool InstanceKlass::add_member_name(Handle mem_name) { jweak mem_name_wref = JNIHandles::make_weak_global(mem_name); MutexLocker ml(MemberNameTable_lock); - assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds"); DEBUG_ONLY(No_Safepoint_Verifier nsv); + // Check if method has been redefined while taking out MemberNameTable_lock, if so + // return false. We cannot cache obsolete methods. They will crash when the function + // is called! + Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name()); + if (method->is_obsolete()) { + return false; + } else if (method->is_old()) { + // Replace method with redefined version + java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum())); + } + if (_member_names == NULL) { _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count()); } - _member_names->add_member_name(index, mem_name_wref); -} - -oop InstanceKlass::get_member_name(int index) { - MutexLocker ml(MemberNameTable_lock); - assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds"); - DEBUG_ONLY(No_Safepoint_Verifier nsv); - - if (_member_names == NULL) { - return NULL; - } - oop mem_name =_member_names->get_member_name(index); - return mem_name; + _member_names->add_member_name(mem_name_wref); + return true; } // ----------------------------------------------------------------------------------------------------- diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index a34a8dc5dbf..94a3c80ea98 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -1072,8 +1072,7 @@ public: // JSR-292 support MemberNameTable* member_names() { return _member_names; } void set_member_names(MemberNameTable* member_names) { _member_names = member_names; } - void add_member_name(int index, Handle member_name); - oop get_member_name(int index); + bool add_member_name(Handle member_name); public: // JVMTI support diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index e28db7c4985..b1377298550 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -567,13 +567,14 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle)) // Make shallow object copy const int size = obj->size(); - oop new_obj = NULL; + oop new_obj_oop = NULL; if (obj->is_array()) { const int length = ((arrayOop)obj())->length(); - new_obj = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL); + new_obj_oop = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL); } else { - new_obj = CollectedHeap::obj_allocate(klass, size, CHECK_NULL); + new_obj_oop = CollectedHeap::obj_allocate(klass, size, CHECK_NULL); } + // 4839641 (4840070): We must do an oop-atomic copy, because if another thread // is modifying a reference field in the clonee, a non-oop-atomic copy might // be suspended in the middle of copying the pointer and end up with parts @@ -584,24 +585,41 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle)) // The same is true of StubRoutines::object_copy and the various oop_copy // variants, and of the code generated by the inline_native_clone intrinsic. assert(MinObjAlignmentInBytes >= BytesPerLong, "objects misaligned"); - Copy::conjoint_jlongs_atomic((jlong*)obj(), (jlong*)new_obj, + Copy::conjoint_jlongs_atomic((jlong*)obj(), (jlong*)new_obj_oop, (size_t)align_object_size(size) / HeapWordsPerLong); // Clear the header - new_obj->init_mark(); + new_obj_oop->init_mark(); // Store check (mark entire object and let gc sort it out) BarrierSet* bs = Universe::heap()->barrier_set(); assert(bs->has_write_region_opt(), "Barrier set does not have write_region"); - bs->write_region(MemRegion((HeapWord*)new_obj, size)); + bs->write_region(MemRegion((HeapWord*)new_obj_oop, size)); + + Handle new_obj(THREAD, new_obj_oop); + // Special handling for MemberNames. Since they contain Method* metadata, they + // must be registered so that RedefineClasses can fix metadata contained in them. + if (java_lang_invoke_MemberName::is_instance(new_obj()) && + java_lang_invoke_MemberName::is_method(new_obj())) { + Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(new_obj()); + // MemberName may be unresolved, so doesn't need registration until resolved. + if (method != NULL) { + methodHandle m(THREAD, method); + // This can safepoint and redefine method, so need both new_obj and method + // in a handle, for two different reasons. new_obj can move, method can be + // deleted if nothing is using it on the stack. + m->method_holder()->add_member_name(new_obj()); + } + } // Caution: this involves a java upcall, so the clone should be // "gc-robust" by this stage. if (klass->has_finalizer()) { assert(obj->is_instance(), "should be instanceOop"); - new_obj = InstanceKlass::register_finalizer(instanceOop(new_obj), CHECK_NULL); + new_obj_oop = InstanceKlass::register_finalizer(instanceOop(new_obj()), CHECK_NULL); + new_obj = Handle(THREAD, new_obj_oop); } - return JNIHandles::make_local(env, oop(new_obj)); + return JNIHandles::make_local(env, new_obj()); JVM_END // java.io.File /////////////////////////////////////////////////////////////// diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp index 8013a1329a8..1b3b4fde571 100644 --- a/hotspot/src/share/vm/prims/methodHandles.cpp +++ b/hotspot/src/share/vm/prims/methodHandles.cpp @@ -29,7 +29,6 @@ #include "interpreter/oopMapCache.hpp" #include "memory/allocation.inline.hpp" #include "memory/oopFactory.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/methodHandles.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/javaCalls.hpp" @@ -276,9 +275,12 @@ oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) { // This is done eagerly, since it is readily available without // constructing any new objects. // TO DO: maybe intern mname_oop - m->method_holder()->add_member_name(m->method_idnum(), mname); - - return mname(); + if (m->method_holder()->add_member_name(mname)) { + return mname(); + } else { + // Redefinition caused this to fail. Return NULL (and an exception?) + return NULL; + } } oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool is_setter) { @@ -951,63 +953,27 @@ MemberNameTable::~MemberNameTable() { } } -void MemberNameTable::add_member_name(int index, jweak mem_name_wref) { +void MemberNameTable::add_member_name(jweak mem_name_wref) { assert_locked_or_safepoint(MemberNameTable_lock); - this->at_put_grow(index, mem_name_wref); -} - -// Return a member name oop or NULL. -oop MemberNameTable::get_member_name(int index) { - assert_locked_or_safepoint(MemberNameTable_lock); - - jweak ref = this->at(index); - oop mem_name = JNIHandles::resolve(ref); - return mem_name; + this->push(mem_name_wref); } #if INCLUDE_JVMTI -oop MemberNameTable::find_member_name_by_method(Method* old_method) { - assert_locked_or_safepoint(MemberNameTable_lock); - oop found = NULL; - int len = this->length(); - - for (int idx = 0; idx < len; idx++) { - oop mem_name = JNIHandles::resolve(this->at(idx)); - if (mem_name == NULL) { - continue; - } - Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name); - if (method == old_method) { - found = mem_name; - break; - } - } - return found; -} - -// It is called at safepoint only +// It is called at safepoint only for RedefineClasses void MemberNameTable::adjust_method_entries(Method** old_methods, Method** new_methods, int methods_length, bool *trace_name_printed) { assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint"); - // search the MemberNameTable for uses of either obsolete or EMCP methods + // For each redefined method for (int j = 0; j < methods_length; j++) { Method* old_method = old_methods[j]; Method* new_method = new_methods[j]; - oop mem_name = find_member_name_by_method(old_method); - if (mem_name != NULL) { - java_lang_invoke_MemberName::adjust_vmtarget(mem_name, new_method); - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { - if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); - *trace_name_printed = true; - } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00400000, ("MemberName method update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + // search the MemberNameTable for uses of either obsolete or EMCP methods + for (int idx = 0; idx < length(); idx++) { + oop mem_name = JNIHandles::resolve(this->at(idx)); + if (mem_name != NULL) { + java_lang_invoke_MemberName::adjust_vmtarget(mem_name, old_method, new_method, + trace_name_printed); } } } diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp index 4084d6c7d8b..ff7870e951d 100644 --- a/hotspot/src/share/vm/prims/methodHandles.hpp +++ b/hotspot/src/share/vm/prims/methodHandles.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -236,18 +236,14 @@ class MemberNameTable : public GrowableArray { public: MemberNameTable(int methods_cnt); ~MemberNameTable(); - void add_member_name(int index, jweak mem_name_ref); - oop get_member_name(int index); + void add_member_name(jweak mem_name_ref); #if INCLUDE_JVMTI - public: // RedefineClasses() API support: // If a MemberName refers to old_method then update it // to refer to new_method. void adjust_method_entries(Method** old_methods, Method** new_methods, int methods_length, bool *trace_name_printed); - private: - oop find_member_name_by_method(Method* old_method); #endif // INCLUDE_JVMTI }; diff --git a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java new file mode 100644 index 00000000000..1695c35558a --- /dev/null +++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java @@ -0,0 +1,174 @@ +/* + * 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 + * @bug 8042235 + * @summary redefining method used by multiple MethodHandles crashes VM + * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java + * @run main RedefineMethodUsedByMultipleMethodHandles + */ + +import java.io.*; +import java.lang.instrument.*; +import java.lang.invoke.*; +import java.lang.invoke.MethodHandles.Lookup; +import java.lang.management.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.security.*; +import java.util.jar.*; + +import javax.tools.*; + +import jdk.internal.org.objectweb.asm.*; + +public class RedefineMethodUsedByMultipleMethodHandles { + + static class Foo { + public static Object getName() { + return "foo"; + } + } + + public static void main(String[] args) throws Throwable { + + Lookup lookup = MethodHandles.lookup(); + Method fooMethod = Foo.class.getDeclaredMethod("getName"); + + // fooMH2 displaces fooMH1 from the MemberNamesTable + MethodHandle fooMH1 = lookup.unreflect(fooMethod); + MethodHandle fooMH2 = lookup.unreflect(fooMethod); + + System.out.println("fooMH1.invoke = " + fooMH1.invokeExact()); + System.out.println("fooMH2.invoke = " + fooMH2.invokeExact()); + + // Redefining Foo.getName() causes vmtarget to be updated + // in fooMH2 but not fooMH1 + redefineFoo(); + + // Full GC causes fooMH1.vmtarget to be deallocated + System.gc(); + + // Calling fooMH1.vmtarget crashes the VM + System.out.println("fooMH1.invoke = " + fooMH1.invokeExact()); + } + + /** + * Adds the class file bytes for {@code c} to {@code jar}. + */ + static void add(JarOutputStream jar, Class c) throws IOException { + String classAsPath = c.getName().replace('.', '/') + ".class"; + jar.putNextEntry(new JarEntry(classAsPath)); + InputStream stream = c.getClassLoader().getResourceAsStream(classAsPath); + + int b; + while ((b = stream.read()) != -1) { + jar.write(b); + } + } + + static void redefineFoo() throws Exception { + Manifest manifest = new Manifest(); + manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); + Attributes mainAttrs = manifest.getMainAttributes(); + mainAttrs.putValue("Agent-Class", FooAgent.class.getName()); + mainAttrs.putValue("Can-Redefine-Classes", "true"); + mainAttrs.putValue("Can-Retransform-Classes", "true"); + + Path jar = Files.createTempFile("myagent", ".jar"); + try { + JarOutputStream jarStream = new JarOutputStream(new FileOutputStream(jar.toFile()), manifest); + add(jarStream, FooAgent.class); + add(jarStream, FooTransformer.class); + jarStream.close(); + runAgent(jar); + } finally { + Files.deleteIfExists(jar); + } + } + + public static void runAgent(Path agent) throws Exception { + String vmName = ManagementFactory.getRuntimeMXBean().getName(); + int p = vmName.indexOf('@'); + assert p != -1 : "VM name not in @ format: " + vmName; + String pid = vmName.substring(0, p); + ClassLoader cl = ToolProvider.getSystemToolClassLoader(); + Class c = Class.forName("com.sun.tools.attach.VirtualMachine", true, cl); + Method attach = c.getDeclaredMethod("attach", String.class); + Method loadAgent = c.getDeclaredMethod("loadAgent", String.class); + Method detach = c.getDeclaredMethod("detach"); + Object vm = attach.invoke(null, pid); + loadAgent.invoke(vm, agent.toString()); + detach.invoke(vm); + } + + public static class FooAgent { + + public static void agentmain(@SuppressWarnings("unused") String args, Instrumentation inst) throws Exception { + assert inst.isRedefineClassesSupported(); + assert inst.isRetransformClassesSupported(); + inst.addTransformer(new FooTransformer(), true); + Class[] classes = inst.getAllLoadedClasses(); + for (int i = 0; i < classes.length; i++) { + Class c = classes[i]; + if (c == Foo.class) { + inst.retransformClasses(new Class[]{c}); + } + } + } + } + + static class FooTransformer implements ClassFileTransformer { + + @Override + public byte[] transform(ClassLoader cl, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException { + if (Foo.class.equals(classBeingRedefined)) { + System.out.println("redefining " + classBeingRedefined); + ClassReader cr = new ClassReader(classfileBuffer); + ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_FRAMES); + ClassVisitor adapter = new ClassVisitor(Opcodes.ASM5, cw) { + @Override + public MethodVisitor visitMethod(int access, String base, String desc, String signature, String[] exceptions) { + MethodVisitor mv = cv.visitMethod(access, base, desc, signature, exceptions); + if (mv != null) { + mv = new MethodVisitor(Opcodes.ASM5, mv) { + @Override + public void visitLdcInsn(Object cst) { + System.out.println("replacing \"" + cst + "\" with \"bar\""); + mv.visitLdcInsn("bar"); + } + }; + } + return mv; + } + }; + + cr.accept(adapter, ClassReader.SKIP_FRAMES); + cw.visitEnd(); + return cw.toByteArray(); + } + return classfileBuffer; + } + } +} From 68c088e66f03045ede67d191121ac4ce07e80103 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 19 Nov 2014 19:31:13 -0800 Subject: [PATCH 109/159] 8065346: WB_AddToBootstrapClassLoaderSearch calls JvmtiEnv::create_a_jvmti when not in _thread_in_vm state Removed ThreadToNativeFromVM and use java_lang_String::as_utf8_string instead Reviewed-by: dholmes, minqi --- hotspot/src/share/vm/prims/whitebox.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index 8757dbece88..3aa5764d628 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -116,24 +116,22 @@ WB_END WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) { #if INCLUDE_JVMTI - ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI - const char* seg = env->GetStringUTFChars(segment, NULL); + ResourceMark rm; + const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment)); JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION); jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg); assert(err == JVMTI_ERROR_NONE, "must not fail"); - env->ReleaseStringUTFChars(segment, seg); #endif } WB_END WB_ENTRY(void, WB_AddToSystemClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) { #if INCLUDE_JVMTI - ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI - const char* seg = env->GetStringUTFChars(segment, NULL); + ResourceMark rm; + const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment)); JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION); jvmtiError err = jvmti_env->AddToSystemClassLoaderSearch(seg); assert(err == JVMTI_ERROR_NONE, "must not fail"); - env->ReleaseStringUTFChars(segment, seg); #endif } WB_END From aba13c04f26058473c6077fa51a63212f2de1e14 Mon Sep 17 00:00:00 2001 From: Alexander Harlap Date: Thu, 20 Nov 2014 10:03:22 -0500 Subject: [PATCH 110/159] 8059492: Wrong spelling in assert: "Not initialied properly?" Fixed typo in metaspace assert message Reviewed-by: mgerdin --- hotspot/src/share/vm/memory/metaspace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 037267e288b..0b4d69efb83 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -1412,7 +1412,7 @@ size_t MetaspaceGC::delta_capacity_until_GC(size_t bytes) { size_t MetaspaceGC::capacity_until_GC() { size_t value = (size_t)OrderAccess::load_ptr_acquire(&_capacity_until_GC); - assert(value >= MetaspaceSize, "Not initialied properly?"); + assert(value >= MetaspaceSize, "Not initialized properly?"); return value; } From 2c4ba7c947ada018b9713e3142bdde10c820545c Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 21 Nov 2014 16:05:11 +0100 Subject: [PATCH 111/159] 8058631: Rename posix to unix in build system to match file name changes Reviewed-by: simonis, erikj, tbell --- jdk/make/CompileDemos.gmk | 8 +-- jdk/make/CreateJars.gmk | 4 +- jdk/make/Import.gmk | 4 +- jdk/make/copy/Copy-java.base.gmk | 4 +- jdk/make/copy/Copy-java.desktop.gmk | 4 +- jdk/make/gensrc/GensrcIcons.gmk | 4 +- jdk/make/gensrc/GensrcX11Wrappers.gmk | 4 +- jdk/make/launcher/Launcher-jdk.runtime.gmk | 4 +- jdk/make/launcher/LauncherCommon.gmk | 11 ++-- jdk/make/lib/Awt2dLibraries.gmk | 62 +++++++++++----------- jdk/make/lib/CoreLibraries.gmk | 12 ++--- jdk/make/lib/Lib-java.instrument.gmk | 2 +- jdk/make/lib/Lib-java.management.gmk | 2 +- jdk/make/lib/Lib-java.prefs.gmk | 2 +- jdk/make/lib/Lib-java.security.jgss.gmk | 4 +- jdk/make/lib/Lib-java.smartcardio.gmk | 8 +-- jdk/make/lib/Lib-jdk.crypto.mscapi.gmk | 2 +- jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk | 4 +- jdk/make/lib/Lib-jdk.jdi.gmk | 2 +- jdk/make/lib/Lib-jdk.jdwp.agent.gmk | 4 +- jdk/make/lib/Lib-jdk.runtime.gmk | 4 +- jdk/make/lib/Lib-jdk.sctp.gmk | 8 +-- jdk/make/lib/Lib-jdk.security.auth.gmk | 2 +- jdk/make/lib/LibCommon.gmk | 6 +-- jdk/make/lib/NetworkingLibraries.gmk | 3 +- jdk/make/lib/NioLibraries.gmk | 6 +-- jdk/make/lib/SoundLibraries.gmk | 4 +- 27 files changed, 91 insertions(+), 93 deletions(-) diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk index b82548edb7a..6052468b381 100644 --- a/jdk/make/CompileDemos.gmk +++ b/jdk/make/CompileDemos.gmk @@ -44,7 +44,7 @@ BUILD_DEMOS = DEMO_SHARE_SRC := $(JDK_TOPDIR)/src/demo/share DEMO_CLOSED_SHARE_SRC := $(JDK_TOPDIR)/src/closed/demo/share DEMO_SOLARIS_SRC := $(JDK_TOPDIR)/src/demo/solaris -DEMO_OS_API_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_API_DIR) +DEMO_OS_TYPE_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_TYPE) VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc ################################################################################################## @@ -214,13 +214,13 @@ define SetupJVMTIDemo # Param 2 = add these directories to the includes, default is agent_util # Param 3 = extra CFLAGS # Param 4 = C or C++ (defaults to C) - # Param 5 = libs for posix + # Param 5 = libs for unix # Param 6 = libs for windows # Param 7 = libs for solaris # Param 8 = libs for linux # Param 9 = extra directories with required sources BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \ - $$(wildcard $(DEMO_OS_API_SRC)/jvmti/$1) \ + $$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \ $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \ $9 BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE := \ @@ -257,7 +257,7 @@ define SetupJVMTIDemo LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \ LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \ LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \ - LDFLAGS_SUFFIX_posix := $5, \ + LDFLAGS_SUFFIX_unix := $5, \ LDFLAGS_SUFFIX_windows := $6, \ LDFLAGS_SUFFIX_solaris := $7 -lc, \ LDFLAGS_SUFFIX_linux := $8, \ diff --git a/jdk/make/CreateJars.gmk b/jdk/make/CreateJars.gmk index 568eeb2e0f3..3b7438a376a 100644 --- a/jdk/make/CreateJars.gmk +++ b/jdk/make/CreateJars.gmk @@ -656,7 +656,7 @@ endif SRC_ZIP_SRCS := $(wildcard \ $(JDK_TOPDIR)/src/*/share/classes \ $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \ - $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \ + $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \ $(LANGTOOLS_TOPDIR)/src/*/share/classes \ $(CORBA_TOPDIR)/src/*/share/classes \ $(JAXP_TOPDIR)/src/*/share/classes \ @@ -679,7 +679,7 @@ $(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \ FILES := $(wildcard \ $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \ $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*))) + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli/java_md*))) LAUNCHER_ZIP_SRC := $(COPY_LAUNCHER_SRC) diff --git a/jdk/make/Import.gmk b/jdk/make/Import.gmk index 5bf9437da7f..43c5bc57363 100644 --- a/jdk/make/Import.gmk +++ b/jdk/make/Import.gmk @@ -30,8 +30,8 @@ include MakeBase.gmk ################################################################################ -# Put the libraries here. Different locations for different target apis. -ifeq ($(OPENJDK_TARGET_OS_API), posix) +# Put the libraries here. Different locations for different target OS types. +ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR) HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR) else diff --git a/jdk/make/copy/Copy-java.base.gmk b/jdk/make/copy/Copy-java.base.gmk index fd9a0ef3afa..bcffc7d6459 100644 --- a/jdk/make/copy/Copy-java.base.gmk +++ b/jdk/make/copy/Copy-java.base.gmk @@ -83,7 +83,7 @@ endif ifeq ($(OPENJDK_TARGET_OS), macosx) JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg else - JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/conf/$(JVMCFG_ARCH)/jvm.cfg + JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg endif JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR) JVMCFG := $(JVMCFG_DIR)/jvm.cfg @@ -190,7 +190,7 @@ $(JDK_OUTPUTDIR)/lib/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net. NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/net.properties ifeq ($(OPENJDK_TARGET_OS), solaris) - $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/${OPENJDK_TARGET_OS_API_DIR}/conf/sdp/sdp.conf.template + $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template $(ECHO) $(LOG_INFO) Copying $(@F) $(call install-file) diff --git a/jdk/make/copy/Copy-java.desktop.gmk b/jdk/make/copy/Copy-java.desktop.gmk index b3fd662bf9c..c6f3e24b8f2 100644 --- a/jdk/make/copy/Copy-java.desktop.gmk +++ b/jdk/make/copy/Copy-java.desktop.gmk @@ -102,13 +102,13 @@ DESKTOP_CONF_FILES += $(PSFONTPROPFILE_TARGET_FILES) # Copy cursor.properties and cursors gif files to LIB_DST_DIR # ifneq ($(OPENJDK_TARGET_OS), macosx) - OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/conf + OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/conf else OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/conf endif CURSORS_DEST_DIR := $(LIB_DST_DIR)/images/cursors -CURSORS_OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/conf/images/cursors +CURSORS_OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/conf/images/cursors $(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties $(call install-file) diff --git a/jdk/make/gensrc/GensrcIcons.gmk b/jdk/make/gensrc/GensrcIcons.gmk index e9b32f8f0b5..6acd8b206b6 100644 --- a/jdk/make/gensrc/GensrcIcons.gmk +++ b/jdk/make/gensrc/GensrcIcons.gmk @@ -29,9 +29,9 @@ GENSRC_AWT_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/java.desktop/sun/awt/ ifdef OPENJDK - X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR) + X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE) else - X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/java.desktop/$(OPENJDK_TARGET_OS_API_DIR) + X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/java.desktop/$(OPENJDK_TARGET_OS_TYPE) endif GENSRC_AWT_ICONS_SRC += \ diff --git a/jdk/make/gensrc/GensrcX11Wrappers.gmk b/jdk/make/gensrc/GensrcX11Wrappers.gmk index b21729654f8..f5e85e616a8 100644 --- a/jdk/make/gensrc/GensrcX11Wrappers.gmk +++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk @@ -95,8 +95,8 @@ ifneq ($(COMPILE_TYPE), cross) -I$(JDK_TOPDIR)/src/java.base/share/native/include \ -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ # diff --git a/jdk/make/launcher/Launcher-jdk.runtime.gmk b/jdk/make/launcher/Launcher-jdk.runtime.gmk index cf6be2d2467..a8b21fe42e7 100644 --- a/jdk/make/launcher/Launcher-jdk.runtime.gmk +++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk @@ -42,7 +42,7 @@ UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \ $(JDK_TOPDIR)/src/jdk.runtime/share/native/unpack200 UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava ifeq ($(USE_EXTERNAL_LIBZ), true) UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB @@ -102,7 +102,7 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \ MAPFILE := $(UNPACK_MAPFILE),\ LDFLAGS := $(UNPACKEXE_ZIPOBJS), \ LDFLAGS_windows := $(CXXFLAGS_JDKEXE), \ - LDFLAGS_posix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \ + LDFLAGS_unix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \ $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_linux := -lc, \ diff --git a/jdk/make/launcher/LauncherCommon.gmk b/jdk/make/launcher/LauncherCommon.gmk index f8ff00c830d..ad344b4faa4 100644 --- a/jdk/make/launcher/LauncherCommon.gmk +++ b/jdk/make/launcher/LauncherCommon.gmk @@ -62,7 +62,7 @@ endif LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjli \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \ -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \ # GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc @@ -71,10 +71,10 @@ MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher # Until the shuffle is permanent, we can't add this in configure CFLAGS_JDKEXE := $(filter-out %javavm/export, $(CFLAGS_JDKEXE)) CFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/include + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include CXXFLAGS_JDKEXE := $(filter-out %javavm/export, $(CXXFLAGS_JDKEXE)) CXXFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/include + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest define SetupLauncher @@ -82,7 +82,7 @@ define SetupLauncher # Parameter 1 is the name of the launcher (java, javac, jar...) # Parameter 2 is extra CFLAGS # Parameter 3 is extra LDFLAGS - # Parameter 4 is extra LDFLAGS_SUFFIX_posix + # Parameter 4 is extra LDFLAGS_SUFFIX_unix # Parameter 5 is extra LDFLAGS_SUFFIX_windows # Parameter 6 is optional Windows JLI library (full path) # Parameter 7 is optional Windows resource (RC) flags @@ -187,7 +187,7 @@ define SetupLauncher $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \ MAPFILE := $$($1_MAPFILE), \ LDFLAGS_SUFFIX := $(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX), \ - LDFLAGS_SUFFIX_posix := $4, \ + LDFLAGS_SUFFIX_unix := $4, \ LDFLAGS_SUFFIX_windows := $$($1_WINDOWS_JLI_LIB) \ $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5, \ LDFLAGS_SUFFIX_linux := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \ @@ -231,4 +231,3 @@ ifdef OPENJDK else JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons" endif - diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk index 0d38b332892..68b9f69ed20 100644 --- a/jdk/make/lib/Awt2dLibraries.gmk +++ b/jdk/make/lib/Awt2dLibraries.gmk @@ -31,7 +31,7 @@ BUILD_LIBMLIB_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libmlib_image \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/medialib BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \ $(addprefix -I, $(BUILD_LIBMLIB_SRC)) \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libmlib_image + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libmlib_image BUILD_LIBMLIB_LDLIBS := BUILD_LIBMLIB_IMAGE_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmlib_image/mapfile-vers @@ -144,9 +144,9 @@ endif ################################################################################ LIBAWT_DIRS := $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ # ifeq ($(OPENJDK_TARGET_OS), aix) @@ -211,7 +211,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) # Why does libawt need java.base headers? LIBAWT_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \ @@ -298,15 +298,15 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) ifndef BUILD_HEADLESS_ONLY LIBAWT_XAWT_DIRS := \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt_xawt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/x11 \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ # LIBAWT_XAWT_EXCLUDES := medialib @@ -315,15 +315,15 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/font \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ $(LIBJAVA_HEADER_FLAGS) # @@ -514,14 +514,14 @@ DESKTOP_LIBRARIES += $(BUILD_LIBJAVAJPEG) ################################################################################ LIBFONTMANAGER_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libfontmanager \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libfontmanager + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager LIBFONTMANAGER_CFLAGS := \ $(addprefix -I, $(shell $(FIND) \ $(LIBFONTMANAGER_SRC) \ $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \ $(JDK_TOPDIR)/src/java.desktop/share/native/common \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common -type d)) \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ $(LIBJAVA_HEADER_FLAGS) \ # @@ -542,7 +542,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ X11TextRenderer.c LIBFONTMANAGER_OPTIMIZATION := HIGHEST - LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/windows + LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows else ifeq ($(OPENJDK_TARGET_OS), macosx) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ X11TextRenderer.c \ @@ -606,12 +606,12 @@ DESKTOP_LIBRARIES += $(BUILD_LIBFONTMANAGER) ################################################################################ ifeq ($(OPENJDK_TARGET_OS), windows) - LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt - LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/windows \ + LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt + LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d/windows \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ @@ -655,12 +655,12 @@ else # OPENJDK_TARGET_OS not windows ifeq ($(OPENJDK_TARGET_OS), macosx) LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjawt else - LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt + LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt endif LIBJAWT_CFLAGS := \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ $(LIBJAVA_HEADER_FLAGS) \ # @@ -724,9 +724,9 @@ ifeq ($(BUILD_HEADLESS), true) ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),) LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/x11 \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ # @@ -739,11 +739,11 @@ ifeq ($(BUILD_HEADLESS), true) -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/font \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga/ \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \ $(LIBJAVA_HEADER_FLAGS) \ # @@ -817,7 +817,7 @@ ifndef BUILD_HEADLESS_ONLY endif ifneq ($(OPENJDK_TARGET_OS), macosx) - LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsplashscreen + LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen else LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libsplashscreen endif @@ -988,7 +988,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \ -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN) \ diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk index c6328d4bd38..3642ba35493 100644 --- a/jdk/make/lib/CoreLibraries.gmk +++ b/jdk/make/lib/CoreLibraries.gmk @@ -99,7 +99,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libverify/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_posix := -ljvm -lc, \ + LDFLAGS_SUFFIX_unix := -ljvm -lc, \ LDFLAGS_SUFFIX_windows := jvm.lib, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \ @@ -160,7 +160,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_posix := -ljvm -lverify, \ + LDFLAGS_SUFFIX_unix := -ljvm -lverify, \ LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \ LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \ LDFLAGS_SUFFIX_aix := $(LIBDL) $(BUILD_LIBFDLIBM) -lm,\ @@ -216,9 +216,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \ CFLAGS := $(CFLAGS_JDKLIB) \ $(ZLIB_CPPFLAGS) \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base, \ - CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \ + CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \ REORDER := $(BUILD_LIBZIP_REORDER), \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -247,7 +247,7 @@ BASE_LIBRARIES += $(BUILD_LIBZIP) ########################################################################################## BUILD_LIBJLI_SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/native/libjli \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli LIBJLI_CFLAGS := $(CFLAGS_JDKLIB) @@ -291,7 +291,7 @@ else ifneq ($(OPENJDK_TARGET_OS), macosx) # if the architecture specific ergo file exists then # use it, else use the generic definitions from ergo.c - ifneq ($(wildcard $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/$(ERGO_ARCH_FILE)), ) + ifneq ($(wildcard $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli/$(ERGO_ARCH_FILE)), ) BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE) else # !ERGO_ARCH_FILE LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO diff --git a/jdk/make/lib/Lib-java.instrument.gmk b/jdk/make/lib/Lib-java.instrument.gmk index a54a743af39..a818f05e2c0 100644 --- a/jdk/make/lib/Lib-java.instrument.gmk +++ b/jdk/make/lib/Lib-java.instrument.gmk @@ -28,7 +28,7 @@ include LibCommon.gmk ################################################################################ LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/java.instrument/share/native/libinstrument \ - $(JDK_TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_API_DIR)/native/libinstrument \ + $(JDK_TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_TYPE)/native/libinstrument \ # LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \ $(addprefix -I, $(LIBINSTRUMENT_SRC)) \ diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk index 2cc7b850621..21b14c3750a 100644 --- a/jdk/make/lib/Lib-java.management.gmk +++ b/jdk/make/lib/Lib-java.management.gmk @@ -31,7 +31,7 @@ $(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.management.gmk)) ################################################################################ BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \ - $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_API_DIR)/native/libmanagement + $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \ $(addprefix -I,$(BUILD_LIBMANAGEMENT_SRC)) \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.management \ diff --git a/jdk/make/lib/Lib-java.prefs.gmk b/jdk/make/lib/Lib-java.prefs.gmk index c034b190f41..e99f655b07c 100644 --- a/jdk/make/lib/Lib-java.prefs.gmk +++ b/jdk/make/lib/Lib-java.prefs.gmk @@ -30,7 +30,7 @@ include LibCommon.gmk ifeq ($(OPENJDK_TARGET_OS), macosx) LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/macosx/native/libprefs else - LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_API_DIR)/native/libprefs + LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_TYPE)/native/libprefs endif $(eval $(call SetupNativeCompilation,BUILD_LIBPREFS, \ diff --git a/jdk/make/lib/Lib-java.security.jgss.gmk b/jdk/make/lib/Lib-java.security.jgss.gmk index d6f986628ae..50ff52a76fa 100644 --- a/jdk/make/lib/Lib-java.security.jgss.gmk +++ b/jdk/make/lib/Lib-java.security.jgss.gmk @@ -29,7 +29,7 @@ include LibCommon.gmk ifneq ($(OPENJDK_TARGET_OS), windows) LIBJ2GSS_SRC := $(JDK_TOPDIR)/src/java.security.jgss/share/native/libj2gss \ - $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2gss \ + $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_TYPE)/native/libj2gss \ # $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS, \ @@ -58,7 +58,7 @@ ifneq ($(BUILD_CRYPTO), no) BUILD_LIBKRB5_NAME := ifeq ($(OPENJDK_TARGET_OS), windows) BUILD_LIBKRB5_NAME := w2k_lsa_auth - BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_API_DIR)/native/libw2k_lsa_auth + BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_TYPE)/native/libw2k_lsa_auth BUILD_LIBKRB5_LIBS := advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \ gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib diff --git a/jdk/make/lib/Lib-java.smartcardio.gmk b/jdk/make/lib/Lib-java.smartcardio.gmk index 7b7be4510b7..c445dcfde38 100644 --- a/jdk/make/lib/Lib-java.smartcardio.gmk +++ b/jdk/make/lib/Lib-java.smartcardio.gmk @@ -28,9 +28,9 @@ include LibCommon.gmk ################################################################################ LIBJ2PCSC_SRC := $(JDK_TOPDIR)/src/java.smartcardio/share/native/libj2pcsc \ - $(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc + $(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc LIBJ2PCSC_CPPFLAGS := $(addprefix -I,$(LIBJ2PCSC_SRC)) \ - -I$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc/MUSCLE \ + -I$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc/MUSCLE \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.smartcardio $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \ @@ -38,13 +38,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ SRC := $(LIBJ2PCSC_SRC), \ LANG := C, \ - CFLAGS_posix := -D__sun_jdk, \ + CFLAGS_unix := -D__sun_jdk, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) $(LIBJ2PCSC_CPPFLAGS), \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pcsc/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_posix := $(LIBDL), \ + LDFLAGS_SUFFIX_unix := $(LIBDL), \ LDFLAGS_SUFFIX_windows := winscard.lib, \ LDFLAGS_SUFFIX_solaris := -lc, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ diff --git a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk index a1e5fc0b15e..899ed6ca9cb 100644 --- a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk +++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk @@ -29,7 +29,7 @@ include LibCommon.gmk ifeq ($(OPENJDK_TARGET_OS), windows) - LIBSUNMSCAPI_SRC := $(JDK_TOPDIR)/src/jdk.crypto.mscapi/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunmscapi + LIBSUNMSCAPI_SRC := $(JDK_TOPDIR)/src/jdk.crypto.mscapi/$(OPENJDK_TARGET_OS_TYPE)/native/libsunmscapi $(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI, \ LIBRARY := sunmscapi, \ diff --git a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk index fd35a9d5f9b..8135d28e18f 100644 --- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk +++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk @@ -28,7 +28,7 @@ include LibCommon.gmk ################################################################################ LIBJ2PKCS11_SRC := $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/share/native/libj2pkcs11 \ - $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pkcs11 + $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pkcs11 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \ LIBRARY := j2pkcs11, \ @@ -42,7 +42,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_posix := $(LIBDL), \ + LDFLAGS_SUFFIX_unix := $(LIBDL), \ LDFLAGS_SUFFIX_solaris := -lc, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \ diff --git a/jdk/make/lib/Lib-jdk.jdi.gmk b/jdk/make/lib/Lib-jdk.jdi.gmk index 8dc731bbf6c..8bacba8622e 100644 --- a/jdk/make/lib/Lib-jdk.jdi.gmk +++ b/jdk/make/lib/Lib-jdk.jdi.gmk @@ -30,7 +30,7 @@ include LibCommon.gmk ifeq ($(OPENJDK_TARGET_OS), windows) LIBDT_SHMEM_SRC := $(JDK_TOPDIR)/src/jdk.jdi/share/native/libdt_shmem \ - $(JDK_TOPDIR)/src/jdk.jdi/$(OPENJDK_TARGET_OS_API_DIR)/native/libdt_shmem \ + $(JDK_TOPDIR)/src/jdk.jdi/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_shmem \ # LIBDT_SHMEM_CPPFLAGS := -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \ $(addprefix -I, $(LIBDT_SHMEM_SRC)) \ diff --git a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk index 7b13248a9be..18552857109 100644 --- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk +++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk @@ -28,7 +28,7 @@ include LibCommon.gmk ################################################################################ LIBDT_SOCKET_SRC := $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libdt_socket \ - $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_API_DIR)/native/libdt_socket + $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_socket LIBDT_SOCKET_CPPFLAGS := \ $(addprefix -I, $(LIBDT_SOCKET_SRC)) \ -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \ @@ -66,7 +66,7 @@ JDWP_LIBRARIES += $(BUILD_LIBDT_SOCKET) ################################################################################ LIBJDWP_SRC := $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp \ - $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_API_DIR)/native/libjdwp + $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libjdwp LIBJDWP_CPPFLAGS := \ -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \ -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include \ diff --git a/jdk/make/lib/Lib-jdk.runtime.gmk b/jdk/make/lib/Lib-jdk.runtime.gmk index 3ffaa72570a..cee0cd7deda 100644 --- a/jdk/make/lib/Lib-jdk.runtime.gmk +++ b/jdk/make/lib/Lib-jdk.runtime.gmk @@ -45,7 +45,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \ jvm.lib $(WIN_JAVA_LIB), \ - LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \ + LDFLAGS_SUFFIX_unix := -ljvm $(LIBCXX) -ljava -lc, \ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \ @@ -61,7 +61,7 @@ UNPACK_LIBRARIES += $(BUILD_LIBUNPACK) ################################################################################ LIBJSDT_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/libjsdt \ - $(JDK_TOPDIR)/src/jdk.runtime/$(OPENJDK_TARGET_OS_API_DIR)/native/libjsdt + $(JDK_TOPDIR)/src/jdk.runtime/$(OPENJDK_TARGET_OS_TYPE)/native/libjsdt $(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \ LIBRARY := jsdt, \ diff --git a/jdk/make/lib/Lib-jdk.sctp.gmk b/jdk/make/lib/Lib-jdk.sctp.gmk index 7afd0020be7..cfc13838c53 100644 --- a/jdk/make/lib/Lib-jdk.sctp.gmk +++ b/jdk/make/lib/Lib-jdk.sctp.gmk @@ -27,7 +27,7 @@ include LibCommon.gmk ################################################################################ -ifeq ($(OPENJDK_TARGET_OS_API), posix) +ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) ifeq (, $(filter $(OPENJDK_TARGET_OS), macosx aix)) @@ -40,11 +40,11 @@ ifeq ($(OPENJDK_TARGET_OS_API), posix) $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP, \ LIBRARY := sctp, \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(JDK_TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_API_DIR)/native/libsctp, \ + SRC := $(JDK_TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_TYPE)/native/libsctp, \ LANG := C, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) \ - -I $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/ch \ + -I $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \ -I $(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \ $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)) \ $(LIBJAVA_HEADER_FLAGS) \ @@ -55,7 +55,7 @@ ifeq ($(OPENJDK_TARGET_OS_API), posix) LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_SUFFIX_linux := -lpthread $(LIBDL) -ljava -ljvm, \ - LDFLAGS_SUFFIX_posix := -lnio -lnet, \ + LDFLAGS_SUFFIX_unix := -lnio -lnet, \ LDFLAGS_SUFFIX_solaris := -lsocket -ljava -ljvm -lc, \ LDFLAGS_SUFFIX_macosx := -ljava -ljvm, \ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsctp, \ diff --git a/jdk/make/lib/Lib-jdk.security.auth.gmk b/jdk/make/lib/Lib-jdk.security.auth.gmk index 52151773886..17549a71482 100644 --- a/jdk/make/lib/Lib-jdk.security.auth.gmk +++ b/jdk/make/lib/Lib-jdk.security.auth.gmk @@ -43,7 +43,7 @@ endif $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \ LIBRARY := $(LIBJAAS_NAME), \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(JDK_TOPDIR)/src/jdk.security.auth/$(OPENJDK_TARGET_OS_API_DIR)/native/libjaas, \ + SRC := $(JDK_TOPDIR)/src/jdk.security.auth/$(OPENJDK_TARGET_OS_TYPE)/native/libjaas, \ LANG := C, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.security.auth, \ diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk index 885ba11c780..eede8fbd8de 100644 --- a/jdk/make/lib/LibCommon.gmk +++ b/jdk/make/lib/LibCommon.gmk @@ -34,8 +34,8 @@ include Tools.gmk GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc -# Put the libraries here. Different locations for different target apis. -ifeq ($(OPENJDK_TARGET_OS_API), posix) +# Put the libraries here. Different locations for different target OS types. +ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR) else INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin @@ -63,7 +63,7 @@ endif # Param 2 - library name FindSrcDirsForLib = $(call uniq, $(wildcard \ $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \ - $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_API_DIR)/native/lib$(strip $2) \ + $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \ $(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2))) ################################################################################ diff --git a/jdk/make/lib/NetworkingLibraries.gmk b/jdk/make/lib/NetworkingLibraries.gmk index a0825b06ce2..095d2773b46 100644 --- a/jdk/make/lib/NetworkingLibraries.gmk +++ b/jdk/make/lib/NetworkingLibraries.gmk @@ -24,7 +24,7 @@ # LIBNET_SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/native/libnet \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnet + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnet LIBNET_CFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \ $(LIBJAVA_HEADER_FLAGS) @@ -77,4 +77,3 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET, \ $(BUILD_LIBNET): $(BUILD_LIBJAVA) BASE_LIBRARIES += $(BUILD_LIBNET) - diff --git a/jdk/make/lib/NioLibraries.gmk b/jdk/make/lib/NioLibraries.gmk index 722115fdee5..be851af88eb 100644 --- a/jdk/make/lib/NioLibraries.gmk +++ b/jdk/make/lib/NioLibraries.gmk @@ -25,10 +25,10 @@ BUILD_LIBNIO_SRC := \ $(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio \ + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio \ $(sort $(wildcard \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/ch \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/fs \ + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \ + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/fs \ $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/ch \ $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/fs)) \ # diff --git a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk index 6348f7a7d7b..c0a1219b684 100644 --- a/jdk/make/lib/SoundLibraries.gmk +++ b/jdk/make/lib/SoundLibraries.gmk @@ -25,7 +25,7 @@ LIBJSOUND_SRC_DIRS := \ $(JDK_TOPDIR)/src/java.desktop/share/native/libjsound \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjsound \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjsound \ # LIBJSOUND_CFLAGS := \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ @@ -165,7 +165,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \ -framework CoreServices -framework AudioUnit $(LIBCXX) \ -framework CoreMIDI -framework AudioToolbox, \ LDFLAGS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \ - LDFLAGS_SUFFIX_posix := -ljava -ljvm, \ + LDFLAGS_SUFFIX_unix := -ljava -ljvm, \ LDFLAGS_SUFFIX_solaris := -lc, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \ From a6355c5d7d2c600a3486a64ad2d4180510c6dff6 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 21 Nov 2014 16:05:46 +0100 Subject: [PATCH 112/159] 8058631: Rename posix to unix in build system to match file name changes Reviewed-by: simonis, erikj, tbell --- common/autoconf/basics.m4 | 8 +- common/autoconf/flags.m4 | 2 +- common/autoconf/generated-configure.sh | 260 ++++++++++++------------- common/autoconf/platform.m4 | 62 +++--- common/autoconf/spec.gmk.in | 13 +- make/CompileJavaModules.gmk | 6 +- make/Javadoc.gmk | 3 +- make/common/Modules.gmk | 6 +- make/common/NativeCompilation.gmk | 22 +-- 9 files changed, 187 insertions(+), 195 deletions(-) diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index c175085d30d..a7cf6c816a7 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -69,7 +69,7 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH], # This will make sure the given variable points to a full and proper # path. This means: -# 1) There will be no spaces in the path. On posix platforms, +# 1) There will be no spaces in the path. On unix platforms, # spaces in the path will result in an error. On Windows, # the path will be rewritten using short-style to be space-free. # 2) The path will be absolute, and it will be in unix-style (on @@ -82,7 +82,7 @@ AC_DEFUN([BASIC_FIXUP_PATH], elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then BASIC_FIXUP_PATH_MSYS($1) else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="[$]$1" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -102,7 +102,7 @@ AC_DEFUN([BASIC_FIXUP_PATH], # This will make sure the given variable points to a executable # with a full and proper path. This means: -# 1) There will be no spaces in the path. On posix platforms, +# 1) There will be no spaces in the path. On unix platforms, # spaces in the path will result in an error. On Windows, # the path will be rewritten using short-style to be space-free. # 2) The path will be absolute, and it will be in unix-style (on @@ -118,7 +118,7 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE], elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then BASIC_FIXUP_EXECUTABLE_MSYS($1) else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="[$]$1" diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index cd2d4a38eaa..cf73e40cedb 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -668,7 +668,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \ -I${JDK_TOPDIR}/src/java.base/share/native/include \ -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \ - -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_API_DIR/native/include" + -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include" # The shared libraries are compiled using the picflag. CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 23d5bcb1829..203bff0205b 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -908,7 +908,6 @@ ZERO_ARCHDEF DEFINE_CROSS_COMPILE_ARCH LP64 OPENJDK_TARGET_OS_EXPORT_DIR -OPENJDK_TARGET_OS_API_DIR OPENJDK_TARGET_CPU_JLI_CFLAGS OPENJDK_TARGET_CPU_OSARCH OPENJDK_TARGET_CPU_ISADIR @@ -923,14 +922,14 @@ OPENJDK_TARGET_CPU_BITS OPENJDK_TARGET_CPU_ARCH OPENJDK_TARGET_CPU OPENJDK_TARGET_OS_ENV -OPENJDK_TARGET_OS_API +OPENJDK_TARGET_OS_TYPE OPENJDK_TARGET_OS OPENJDK_BUILD_CPU_ENDIAN OPENJDK_BUILD_CPU_BITS OPENJDK_BUILD_CPU_ARCH OPENJDK_BUILD_CPU OPENJDK_BUILD_OS_ENV -OPENJDK_BUILD_OS_API +OPENJDK_BUILD_OS_TYPE OPENJDK_BUILD_OS OPENJDK_BUILD_AUTOCONF_NAME OPENJDK_TARGET_AUTOCONF_NAME @@ -3414,7 +3413,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # This will make sure the given variable points to a full and proper # path. This means: -# 1) There will be no spaces in the path. On posix platforms, +# 1) There will be no spaces in the path. On unix platforms, # spaces in the path will result in an error. On Windows, # the path will be rewritten using short-style to be space-free. # 2) The path will be absolute, and it will be in unix-style (on @@ -3424,7 +3423,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # This will make sure the given variable points to a executable # with a full and proper path. This means: -# 1) There will be no spaces in the path. On posix platforms, +# 1) There will be no spaces in the path. On unix platforms, # spaces in the path will result in an error. On Windows, # the path will be rewritten using short-style to be space-free. # 2) The path will be absolute, and it will be in unix-style (on @@ -4101,7 +4100,7 @@ pkgadd_help() { # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. # Converts autoconf style OS name to OpenJDK style, into -# VAR_OS and VAR_OS_API. +# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV. # Expects $host_os $host_cpu $build_os and $build_cpu @@ -4330,7 +4329,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1416323245 +DATE_WHEN_GENERATED=1416582260 ############################################################################### # @@ -13527,38 +13526,31 @@ test -n "$target_alias" && case "$build_os" in *linux*) VAR_OS=linux - VAR_OS_API=posix - VAR_OS_ENV=linux + VAR_OS_TYPE=unix ;; *solaris*) VAR_OS=solaris - VAR_OS_API=posix - VAR_OS_ENV=solaris + VAR_OS_TYPE=unix ;; *darwin*) VAR_OS=macosx - VAR_OS_API=posix - VAR_OS_ENV=macosx + VAR_OS_TYPE=unix ;; *bsd*) VAR_OS=bsd - VAR_OS_API=posix - VAR_OS_ENV=bsd + VAR_OS_TYPE=unix ;; *cygwin*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.cygwin ;; *mingw*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.msys ;; *aix*) VAR_OS=aix - VAR_OS_API=posix - VAR_OS_ENV=aix + VAR_OS_TYPE=unix ;; *) as_fn_error $? "unsupported operating system $build_os" "$LINENO" 5 @@ -13635,8 +13627,16 @@ test -n "$target_alias" && # ..and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_BUILD_OS="$VAR_OS" - OPENJDK_BUILD_OS_API="$VAR_OS_API" - OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" + if test "x$VAR_OS_TYPE" != x; then + OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE" + else + OPENJDK_BUILD_OS_TYPE="$VAR_OS" + fi + if test "x$VAR_OS_ENV" != x; then + OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" + else + OPENJDK_BUILD_OS_ENV="$VAR_OS" + fi OPENJDK_BUILD_CPU="$VAR_CPU" OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" @@ -13659,38 +13659,31 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; } case "$host_os" in *linux*) VAR_OS=linux - VAR_OS_API=posix - VAR_OS_ENV=linux + VAR_OS_TYPE=unix ;; *solaris*) VAR_OS=solaris - VAR_OS_API=posix - VAR_OS_ENV=solaris + VAR_OS_TYPE=unix ;; *darwin*) VAR_OS=macosx - VAR_OS_API=posix - VAR_OS_ENV=macosx + VAR_OS_TYPE=unix ;; *bsd*) VAR_OS=bsd - VAR_OS_API=posix - VAR_OS_ENV=bsd + VAR_OS_TYPE=unix ;; *cygwin*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.cygwin ;; *mingw*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.msys ;; *aix*) VAR_OS=aix - VAR_OS_API=posix - VAR_OS_ENV=aix + VAR_OS_TYPE=unix ;; *) as_fn_error $? "unsupported operating system $host_os" "$LINENO" 5 @@ -13767,8 +13760,16 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; } # ... and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_TARGET_OS="$VAR_OS" - OPENJDK_TARGET_OS_API="$VAR_OS_API" - OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" + if test "x$VAR_OS_TYPE" != x; then + OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE" + else + OPENJDK_TARGET_OS_TYPE="$VAR_OS" + fi + if test "x$VAR_OS_ENV" != x; then + OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" + else + OPENJDK_TARGET_OS_ENV="$VAR_OS" + fi OPENJDK_TARGET_CPU="$VAR_CPU" OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" @@ -13936,19 +13937,10 @@ $as_echo "$COMPILE_TYPE" >&6; } fi - # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. - if test "x$OPENJDK_TARGET_OS_API" = xposix; then - OPENJDK_TARGET_OS_API_DIR="unix" - fi - if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then - OPENJDK_TARGET_OS_API_DIR="windows" - fi - - if test "x$OPENJDK_TARGET_OS" = xmacosx; then OPENJDK_TARGET_OS_EXPORT_DIR=macosx else - OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_API_DIR} + OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_TYPE} fi @@ -14198,7 +14190,7 @@ $as_echo "$as_me: Rewriting CURDIR to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$CURDIR" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -14320,7 +14312,7 @@ $as_echo "$as_me: Rewriting TOPDIR to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$TOPDIR" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -14840,7 +14832,7 @@ $as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$with_devkit" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -15314,7 +15306,7 @@ $as_echo "$as_me: Rewriting OUTPUT_ROOT to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$OUTPUT_ROOT" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -15681,7 +15673,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -16054,7 +16046,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -16424,7 +16416,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -16799,7 +16791,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -17168,7 +17160,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -20335,7 +20327,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -20667,7 +20659,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -20861,7 +20853,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21048,7 +21040,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21234,7 +21226,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21420,7 +21412,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21597,7 +21589,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21743,7 +21735,7 @@ $as_echo "$as_me: Rewriting JAVA_HOME_PROCESSED to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$JAVA_HOME_PROCESSED" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21915,7 +21907,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -22243,7 +22235,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -22458,7 +22450,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -22638,7 +22630,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -22846,7 +22838,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23026,7 +23018,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23234,7 +23226,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23414,7 +23406,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23622,7 +23614,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23802,7 +23794,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23997,7 +23989,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24175,7 +24167,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24371,7 +24363,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24549,7 +24541,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24744,7 +24736,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24922,7 +24914,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -25118,7 +25110,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -25296,7 +25288,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -25473,7 +25465,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -27514,7 +27506,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$VS_ENV_CMD" @@ -28174,7 +28166,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$CC" @@ -28631,7 +28623,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$PROPER_COMPILER_CC" @@ -29914,7 +29906,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$CXX" @@ -30371,7 +30363,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$PROPER_COMPILER_CXX" @@ -31233,7 +31225,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$CPP" @@ -31648,7 +31640,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$CXXCPP" @@ -31992,7 +31984,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$LD" @@ -32487,7 +32479,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$AS" @@ -33115,7 +33107,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$AR" @@ -33651,7 +33643,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$OBJC" @@ -34119,7 +34111,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$LIPO" @@ -34460,7 +34452,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$MT" @@ -34797,7 +34789,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$RC" @@ -35116,7 +35108,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$DUMPBIN" @@ -35631,7 +35623,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$STRIP" @@ -36099,7 +36091,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$NM" @@ -36567,7 +36559,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$GNM" @@ -37036,7 +37028,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$MCS" @@ -37616,7 +37608,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$STRIP" @@ -38194,7 +38186,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$NM" @@ -38781,7 +38773,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$OBJCOPY" @@ -39365,7 +39357,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$OBJDUMP" @@ -39858,7 +39850,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$BUILD_CC" @@ -40326,7 +40318,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$BUILD_CXX" @@ -40794,7 +40786,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$BUILD_LD" @@ -41346,7 +41338,7 @@ $as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$JT_HOME" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -41874,8 +41866,8 @@ done LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" elif test "x$COMPILE_TYPE" = xreduced; then - if test "x$OPENJDK_TARGET_OS" != xwindows; then - # Specify -m if running reduced on other Posix platforms + if test "x$OPENJDK_TARGET_OS_TYPE" = xunix; then + # Specify -m if running reduced on unix platforms # When we add flags to the "official" CFLAGS etc, we need to # keep track of these additions in ADDED_CFLAGS etc. These @@ -42767,7 +42759,7 @@ fi COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \ -I${JDK_TOPDIR}/src/java.base/share/native/include \ -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \ - -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_API_DIR/native/include" + -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include" # The shared libraries are compiled using the picflag. CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" @@ -44753,7 +44745,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -44875,7 +44867,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -45106,7 +45098,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -45228,7 +45220,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -45720,7 +45712,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -45842,7 +45834,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46048,7 +46040,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46170,7 +46162,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46367,7 +46359,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46489,7 +46481,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46686,7 +46678,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46808,7 +46800,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47006,7 +46998,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47128,7 +47120,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47327,7 +47319,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47449,7 +47441,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47644,7 +47636,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47766,7 +47758,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47961,7 +47953,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -48083,7 +48075,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -48261,7 +48253,7 @@ $as_echo "$as_me: Rewriting FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -48391,7 +48383,7 @@ $as_echo "$as_me: Rewriting FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -50290,7 +50282,7 @@ $as_echo "$as_me: Rewriting MSVCR_DLL to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$MSVCR_DLL" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 index 4eacb397cbe..27db8d047eb 100644 --- a/common/autoconf/platform.m4 +++ b/common/autoconf/platform.m4 @@ -98,44 +98,37 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. # Converts autoconf style OS name to OpenJDK style, into -# VAR_OS and VAR_OS_API. +# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV. AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS], [ case "$1" in *linux*) VAR_OS=linux - VAR_OS_API=posix - VAR_OS_ENV=linux + VAR_OS_TYPE=unix ;; *solaris*) VAR_OS=solaris - VAR_OS_API=posix - VAR_OS_ENV=solaris + VAR_OS_TYPE=unix ;; *darwin*) VAR_OS=macosx - VAR_OS_API=posix - VAR_OS_ENV=macosx + VAR_OS_TYPE=unix ;; *bsd*) VAR_OS=bsd - VAR_OS_API=posix - VAR_OS_ENV=bsd + VAR_OS_TYPE=unix ;; *cygwin*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.cygwin ;; *mingw*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.msys ;; *aix*) VAR_OS=aix - VAR_OS_API=posix - VAR_OS_ENV=aix + VAR_OS_TYPE=unix ;; *) AC_MSG_ERROR([unsupported operating system $1]) @@ -165,14 +158,22 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) # ..and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_BUILD_OS="$VAR_OS" - OPENJDK_BUILD_OS_API="$VAR_OS_API" - OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" + if test "x$VAR_OS_TYPE" != x; then + OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE" + else + OPENJDK_BUILD_OS_TYPE="$VAR_OS" + fi + if test "x$VAR_OS_ENV" != x; then + OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" + else + OPENJDK_BUILD_OS_ENV="$VAR_OS" + fi OPENJDK_BUILD_CPU="$VAR_CPU" OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN" AC_SUBST(OPENJDK_BUILD_OS) - AC_SUBST(OPENJDK_BUILD_OS_API) + AC_SUBST(OPENJDK_BUILD_OS_TYPE) AC_SUBST(OPENJDK_BUILD_OS_ENV) AC_SUBST(OPENJDK_BUILD_CPU) AC_SUBST(OPENJDK_BUILD_CPU_ARCH) @@ -187,14 +188,22 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) # ... and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_TARGET_OS="$VAR_OS" - OPENJDK_TARGET_OS_API="$VAR_OS_API" - OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" + if test "x$VAR_OS_TYPE" != x; then + OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE" + else + OPENJDK_TARGET_OS_TYPE="$VAR_OS" + fi + if test "x$VAR_OS_ENV" != x; then + OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" + else + OPENJDK_TARGET_OS_ENV="$VAR_OS" + fi OPENJDK_TARGET_CPU="$VAR_CPU" OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN" AC_SUBST(OPENJDK_TARGET_OS) - AC_SUBST(OPENJDK_TARGET_OS_API) + AC_SUBST(OPENJDK_TARGET_OS_TYPE) AC_SUBST(OPENJDK_TARGET_OS_ENV) AC_SUBST(OPENJDK_TARGET_CPU) AC_SUBST(OPENJDK_TARGET_CPU_ARCH) @@ -331,19 +340,10 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], fi AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS) - # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. - if test "x$OPENJDK_TARGET_OS_API" = xposix; then - OPENJDK_TARGET_OS_API_DIR="unix" - fi - if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then - OPENJDK_TARGET_OS_API_DIR="windows" - fi - AC_SUBST(OPENJDK_TARGET_OS_API_DIR) - if test "x$OPENJDK_TARGET_OS" = xmacosx; then OPENJDK_TARGET_OS_EXPORT_DIR=macosx else - OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_API_DIR} + OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_TYPE} fi AC_SUBST(OPENJDK_TARGET_OS_EXPORT_DIR) @@ -472,8 +472,8 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], # And -q on AIX because otherwise the compiler produces 32-bit objects by default PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS elif test "x$COMPILE_TYPE" = xreduced; then - if test "x$OPENJDK_TARGET_OS" != xwindows; then - # Specify -m if running reduced on other Posix platforms + if test "x$OPENJDK_TARGET_OS_TYPE" = xunix; then + # Specify -m if running reduced on unix platforms PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS fi fi diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index e5b43ecdafb..bcf30a98a5a 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -82,7 +82,7 @@ CONF_NAME:=@CONF_NAME@ # The built jdk will run in this target system. OPENJDK_TARGET_OS:=@OPENJDK_TARGET_OS@ -OPENJDK_TARGET_OS_API:=@OPENJDK_TARGET_OS_API@ +OPENJDK_TARGET_OS_TYPE:=@OPENJDK_TARGET_OS_TYPE@ OPENJDK_TARGET_OS_ENV:=@OPENJDK_TARGET_OS_ENV@ OPENJDK_TARGET_CPU:=@OPENJDK_TARGET_CPU@ @@ -99,13 +99,12 @@ OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@ OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@ OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@ OPENJDK_TARGET_CPU_JLI_CFLAGS:=@OPENJDK_TARGET_CPU_JLI_CFLAGS@ -OPENJDK_TARGET_OS_API_DIR:=@OPENJDK_TARGET_OS_API_DIR@ OPENJDK_TARGET_OS_EXPORT_DIR:=@OPENJDK_TARGET_OS_EXPORT_DIR@ # We are building on this build system. # When not cross-compiling, it is the same as the target. OPENJDK_BUILD_OS:=@OPENJDK_BUILD_OS@ -OPENJDK_BUILD_OS_API:=@OPENJDK_BUILD_OS_API@ +OPENJDK_BUILD_OS_TYPE:=@OPENJDK_BUILD_OS_TYPE@ OPENJDK_BUILD_OS_ENV:=@OPENJDK_BUILD_OS_ENV@ OPENJDK_BUILD_CPU:=@OPENJDK_BUILD_CPU@ @@ -351,7 +350,7 @@ OBJC:=@CCACHE@ @OBJC@ CPP:=@FIXPATH@ @CPP@ #CPPFLAGS:=@CPPFLAGS@ -# The linker can be gcc or ld on posix systems, or link.exe on windows systems. +# The linker can be gcc or ld on unix systems, or link.exe on windows systems. LD:=@FIXPATH@ @LD@ # Xcode SDK path @@ -392,7 +391,7 @@ BUILD_LD:=@FIXPATH@ @BUILD_LD@ AS:=@FIXPATH@ @AS@ -# AR is used to create a static library (is ar in posix, lib.exe in windows) +# AR is used to create a static library (is ar in unix, lib.exe in windows) AR:=@FIXPATH@ @AR@ ARFLAGS:=@ARFLAGS@ @@ -569,10 +568,10 @@ FIXPATH:=@FIXPATH@ # Where the build output is stored for your convenience. BUILD_LOG:=@BUILD_LOG@ BUILD_LOG_PREVIOUS:=@BUILD_LOG_PREVIOUS@ -# Disable the build log wrapper on sjavac+winapi until +# Disable the build log wrapper on sjavac+windows until # we have solved how to prevent the log wrapper to wait # for the background sjavac server process. -ifeq (@ENABLE_SJAVAC@X@OPENJDK_BUILD_OS_API@,yesXwinapi) +ifeq (@ENABLE_SJAVAC@X@OPENJDK_BUILD_OS@,yesXwindows) BUILD_LOG_WRAPPER:= else BUILD_LOG_WRAPPER:=@BUILD_LOG_WRAPPER@ diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index 20ae9c9f073..b8f792d3c3d 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -433,8 +433,8 @@ GENERATED_SRC_DIRS += \ # OS_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS)/classes -ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_API_DIR)) -OS_API_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS_API_DIR)/classes +ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE)) + OS_TYPE_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS_TYPE)/classes endif SHARE_SRC_DIRS += \ @@ -448,7 +448,7 @@ SHARE_SRC_DIRS += \ ALL_SRC_DIRS = \ $(GENERATED_SRC_DIRS) \ $(OS_SRC_DIRS) \ - $(OS_API_SRC_DIRS) \ + $(OS_TYPE_SRC_DIRS) \ $(SHARE_SRC_DIRS) \ # diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index 4ba011d15d8..cba9d666ad2 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -137,7 +137,8 @@ $(FULL_COMPANY_NAME) in the US and other countries. # command (newline or shell ; character) ALL_SOURCE_DIRS := $(wildcard \ $(JDK_TOPDIR)/src/*/share/classes \ - $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \ + $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \ + $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \ $(LANGTOOLS_TOPDIR)/src/*/share/classes \ $(CORBA_TOPDIR)/src/*/share/classes \ $(JAXP_TOPDIR)/src/*/share/classes \ diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index 16bb629313e..3ef5c01f4bd 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -46,8 +46,8 @@ define FindJavaModules $(filter-out $(JAVA_MODULES_FILTER), $(sort $(notdir \ $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \ $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \ - $(patsubst %,%/*/$(OPENJDK_TARGET_OS_API_DIR)/classes/*, $(ALL_TOP_SRC_DIRS)) \ - $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS)))))))))))) + $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS)) \ + $(patsubst %,%/*/$(OPENJDK_TARGET_OS_TYPE)/classes/*, $(ALL_TOP_SRC_DIRS)))))))))))) endef # Find all modules with source for the target platform. @@ -55,7 +55,7 @@ define FindAllModules $(sort $(filter-out closed demo sample, $(notdir $(patsubst %/,%, $(dir \ $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \ $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \ - $(patsubst %, %/*/$(OPENJDK_TARGET_OS_API_DIR), $(ALL_TOP_SRC_DIRS)))))))) + $(patsubst %, %/*/$(OPENJDK_TARGET_OS_TYPE), $(ALL_TOP_SRC_DIRS)))))))) endef ################################################################################ diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index fe82cd2730e..3f0e5ecd934 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -308,29 +308,29 @@ define SetupNativeCompilation $$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS)) endif - # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CFLAGS. - $1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CFLAGS_$(OPENJDK_TARGET_OS)) + # Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables for CFLAGS. + $1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_CFLAGS_$(OPENJDK_TARGET_OS)) ifneq ($(DEBUG_LEVEL),release) # Pickup extra debug dependent variables for CFLAGS $1_EXTRA_CFLAGS+=$$($1_CFLAGS_debug) - $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)_debug) + $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_TYPE)_debug) $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_debug) else $1_EXTRA_CFLAGS+=$$($1_CFLAGS_release) - $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)_release) + $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_TYPE)_release) $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_release) endif - # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CXXFLAGS. - $1_EXTRA_CXXFLAGS:=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)) + # Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables for CXXFLAGS. + $1_EXTRA_CXXFLAGS:=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)) ifneq ($(DEBUG_LEVEL),release) # Pickup extra debug dependent variables for CXXFLAGS $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_debug) - $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)_debug) + $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_TYPE)_debug) $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_debug) else $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_release) - $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)_release) + $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_TYPE)_release) $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release) endif @@ -420,10 +420,10 @@ define SetupNativeCompilation endif endif - # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables + # Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables # for LDFLAGS and LDFLAGS_SUFFIX - $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS)) - $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS)) + $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS)) + $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS)) ifneq (,$$($1_REAL_MAPFILE)) $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE)) endif From 78df8f34ba06fc61a9c54d5cd012011d7921bfa9 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 21 Nov 2014 16:11:28 +0100 Subject: [PATCH 113/159] 8065215: Print warning summary at end of configure Reviewed-by: erikj, tbell --- common/autoconf/configure.ac | 1 + common/autoconf/generated-configure.sh | 22 ++++++++++++++++++---- common/autoconf/help.m4 | 20 +++++++++++++++++--- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac index 481d328a1c4..146556f479e 100644 --- a/common/autoconf/configure.ac +++ b/common/autoconf/configure.ac @@ -275,3 +275,4 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh # Finally output some useful information to the user HELP_PRINT_SUMMARY_AND_WARNINGS CUSTOM_SUMMARY_AND_WARNINGS_HOOK +HELP_REPEAT_WARNINGS diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 203bff0205b..8b55a8f40fa 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -3971,6 +3971,8 @@ pkgadd_help() { + + # # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -4329,7 +4331,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1416582260 +DATE_WHEN_GENERATED=1416582658 ############################################################################### # @@ -52427,15 +52429,15 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh printf "====================================================\n" if test "x$no_create" != "xyes"; then if test "x$IS_RECONFIGURE" != "xyes"; then - printf "A new configuration has been successfully created in\n %s\n" "$OUTPUT_ROOT" + printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT" else - printf "The existing configuration has been successfully updated in\n %s\n" "$OUTPUT_ROOT" + printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT" fi else if test "x$IS_RECONFIGURE" != "xyes"; then printf "A configuration has been successfully checked but not created\n" else - printf "The existing configuration has been successfully checked in\n %s\n" "$OUTPUT_ROOT" + printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT" fi fi if test "x$CONFIGURE_COMMAND_LINE" != x; then @@ -52507,3 +52509,15 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh fi + +if test -e "$OUTPUT_ROOT/config.log"; then + $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1 + if test $? -eq 0; then + printf "The following warnings were produced. Repeated here for convenience:\n" + # We must quote sed expression (using []) to stop m4 from eating the []. + $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e 's/^configure:[0-9]*: //' + printf "\n" + fi +fi + + diff --git a/common/autoconf/help.m4 b/common/autoconf/help.m4 index 90882332a9d..9e7fb73d9ef 100644 --- a/common/autoconf/help.m4 +++ b/common/autoconf/help.m4 @@ -178,15 +178,15 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS], printf "====================================================\n" if test "x$no_create" != "xyes"; then if test "x$IS_RECONFIGURE" != "xyes"; then - printf "A new configuration has been successfully created in\n %s\n" "$OUTPUT_ROOT" + printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT" else - printf "The existing configuration has been successfully updated in\n %s\n" "$OUTPUT_ROOT" + printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT" fi else if test "x$IS_RECONFIGURE" != "xyes"; then printf "A configuration has been successfully checked but not created\n" else - printf "The existing configuration has been successfully checked in\n %s\n" "$OUTPUT_ROOT" + printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT" fi fi if test "x$CONFIGURE_COMMAND_LINE" != x; then @@ -257,3 +257,17 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS], printf "\n" fi ]) + +AC_DEFUN_ONCE([HELP_REPEAT_WARNINGS], +[ +if test -e "$OUTPUT_ROOT/config.log"; then + $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1 + if test $? -eq 0; then + printf "The following warnings were produced. Repeated here for convenience:\n" + # We must quote sed expression (using []) to stop m4 from eating the []. + $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ] + printf "\n" + fi +fi + +]) From c90bc5b3166aef29211e7c75b9212217b12b3d56 Mon Sep 17 00:00:00 2001 From: Staffan Friberg Date: Fri, 21 Nov 2014 09:28:53 -0800 Subject: [PATCH 114/159] 6321472: Add CRC-32C API To add CRC-32C api and implementation Reviewed-by: sherman --- .../share/classes/java/util/zip/Adler32.java | 49 ++- .../share/classes/java/util/zip/CRC32.java | 50 ++- .../share/classes/java/util/zip/CRC32C.java | 339 ++++++++++++++++++ .../share/classes/java/util/zip/Checksum.java | 86 ++++- .../classes/java/util/zip/package-info.java | 77 ++++ .../share/classes/java/util/zip/package.html | 88 ----- jdk/test/java/util/zip/ChecksumBase.java | 196 ++++++++++ jdk/test/java/util/zip/TestCRC32.java | 40 +++ jdk/test/java/util/zip/TestCRC32C.java | 40 +++ jdk/test/java/util/zip/TestChecksum.java | 66 ++++ 10 files changed, 880 insertions(+), 151 deletions(-) create mode 100644 jdk/src/java.base/share/classes/java/util/zip/CRC32C.java create mode 100644 jdk/src/java.base/share/classes/java/util/zip/package-info.java delete mode 100644 jdk/src/java.base/share/classes/java/util/zip/package.html create mode 100644 jdk/test/java/util/zip/ChecksumBase.java create mode 100644 jdk/test/java/util/zip/TestCRC32.java create mode 100644 jdk/test/java/util/zip/TestCRC32C.java create mode 100644 jdk/test/java/util/zip/TestChecksum.java diff --git a/jdk/src/java.base/share/classes/java/util/zip/Adler32.java b/jdk/src/java.base/share/classes/java/util/zip/Adler32.java index de279f98a83..6a39b7c1c1a 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/Adler32.java +++ b/jdk/src/java.base/share/classes/java/util/zip/Adler32.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -34,9 +34,8 @@ import sun.nio.ch.DirectBuffer; * can be computed much faster. * *

Passing a {@code null} argument to a method in this class will cause - * a {@link NullPointerException} to be thrown. + * a {@link NullPointerException} to be thrown.

* - * @see Checksum * @author David Connelly */ public @@ -53,9 +52,8 @@ class Adler32 implements Checksum { /** * Updates the checksum with the specified byte (the low eight * bits of the argument b). - * - * @param b the byte to update the checksum with */ + @Override public void update(int b) { adler = update(adler, b); } @@ -63,11 +61,12 @@ class Adler32 implements Checksum { /** * Updates the checksum with the specified array of bytes. * - * @throws ArrayIndexOutOfBoundsException - * if {@code off} is negative, or {@code len} is negative, - * or {@code off+len} is greater than the length of the - * array {@code b} + * @throws ArrayIndexOutOfBoundsException + * if {@code off} is negative, or {@code len} is negative, or + * {@code off+len} is negative or greater than the length of + * the array {@code b}. */ + @Override public void update(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); @@ -78,29 +77,16 @@ class Adler32 implements Checksum { adler = updateBytes(adler, b, off, len); } - /** - * Updates the checksum with the specified array of bytes. - * - * @param b the byte array to update the checksum with - */ - public void update(byte[] b) { - adler = updateBytes(adler, b, 0, b.length); - } - - /** * Updates the checksum with the bytes from the specified buffer. * - * The checksum is updated using - * buffer.{@link java.nio.Buffer#remaining() remaining()} - * bytes starting at - * buffer.{@link java.nio.Buffer#position() position()} - * Upon return, the buffer's position will be updated to its - * limit; its limit will not have been changed. + * The checksum is updated with the remaining bytes in the buffer, starting + * at the buffer's position. Upon return, the buffer's position will be + * updated to its limit; its limit will not have been changed. * - * @param buffer the ByteBuffer to update the checksum with * @since 1.8 */ + @Override public void update(ByteBuffer buffer) { int pos = buffer.position(); int limit = buffer.limit(); @@ -113,9 +99,12 @@ class Adler32 implements Checksum { } else if (buffer.hasArray()) { adler = updateBytes(adler, buffer.array(), pos + buffer.arrayOffset(), rem); } else { - byte[] b = new byte[rem]; - buffer.get(b); - adler = updateBytes(adler, b, 0, b.length); + byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + while (buffer.hasRemaining()) { + int length = Math.min(buffer.remaining(), b.length); + buffer.get(b, 0, length); + update(b, 0, length); + } } buffer.position(limit); } @@ -123,6 +112,7 @@ class Adler32 implements Checksum { /** * Resets the checksum to initial value. */ + @Override public void reset() { adler = 1; } @@ -130,6 +120,7 @@ class Adler32 implements Checksum { /** * Returns the checksum value. */ + @Override public long getValue() { return (long)adler & 0xffffffffL; } diff --git a/jdk/src/java.base/share/classes/java/util/zip/CRC32.java b/jdk/src/java.base/share/classes/java/util/zip/CRC32.java index 0f55579b589..95ead3c3533 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/CRC32.java +++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -32,9 +32,8 @@ import sun.nio.ch.DirectBuffer; * A class that can be used to compute the CRC-32 of a data stream. * *

Passing a {@code null} argument to a method in this class will cause - * a {@link NullPointerException} to be thrown. + * a {@link NullPointerException} to be thrown.

* - * @see Checksum * @author David Connelly */ public @@ -51,9 +50,8 @@ class CRC32 implements Checksum { /** * Updates the CRC-32 checksum with the specified byte (the low * eight bits of the argument b). - * - * @param b the byte to update the checksum with */ + @Override public void update(int b) { crc = update(crc, b); } @@ -61,11 +59,12 @@ class CRC32 implements Checksum { /** * Updates the CRC-32 checksum with the specified array of bytes. * - * @throws ArrayIndexOutOfBoundsException - * if {@code off} is negative, or {@code len} is negative, - * or {@code off+len} is greater than the length of the - * array {@code b} + * @throws ArrayIndexOutOfBoundsException + * if {@code off} is negative, or {@code len} is negative, or + * {@code off+len} is negative or greater than the length of + * the array {@code b}. */ + @Override public void update(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); @@ -77,27 +76,15 @@ class CRC32 implements Checksum { } /** - * Updates the CRC-32 checksum with the specified array of bytes. + * Updates the CRC-32 checksum with the bytes from the specified buffer. * - * @param b the array of bytes to update the checksum with - */ - public void update(byte[] b) { - crc = updateBytes(crc, b, 0, b.length); - } - - /** - * Updates the checksum with the bytes from the specified buffer. + * The checksum is updated with the remaining bytes in the buffer, starting + * at the buffer's position. Upon return, the buffer's position will be + * updated to its limit; its limit will not have been changed. * - * The checksum is updated using - * buffer.{@link java.nio.Buffer#remaining() remaining()} - * bytes starting at - * buffer.{@link java.nio.Buffer#position() position()} - * Upon return, the buffer's position will - * be updated to its limit; its limit will not have been changed. - * - * @param buffer the ByteBuffer to update the checksum with * @since 1.8 */ + @Override public void update(ByteBuffer buffer) { int pos = buffer.position(); int limit = buffer.limit(); @@ -110,9 +97,12 @@ class CRC32 implements Checksum { } else if (buffer.hasArray()) { crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(), rem); } else { - byte[] b = new byte[rem]; - buffer.get(b); - crc = updateBytes(crc, b, 0, b.length); + byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + while (buffer.hasRemaining()) { + int length = Math.min(buffer.remaining(), b.length); + buffer.get(b, 0, length); + update(b, 0, length); + } } buffer.position(limit); } @@ -120,6 +110,7 @@ class CRC32 implements Checksum { /** * Resets CRC-32 to initial value. */ + @Override public void reset() { crc = 0; } @@ -127,6 +118,7 @@ class CRC32 implements Checksum { /** * Returns CRC-32 value. */ + @Override public long getValue() { return (long)crc & 0xffffffffL; } diff --git a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java new file mode 100644 index 00000000000..251e3042800 --- /dev/null +++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java @@ -0,0 +1,339 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package java.util.zip; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import sun.misc.Unsafe; +import sun.nio.ch.DirectBuffer; + +/** + * A class that can be used to compute the CRC-32C of a data stream. + * + *

+ * CRC-32C is defined in RFC + * 3720: Internet Small Computer Systems Interface (iSCSI). + *

+ * + *

+ * Passing a {@code null} argument to a method in this class will cause a + * {@link NullPointerException} to be thrown. + *

+ * + * @since 1.9 + */ +public final class CRC32C implements Checksum { + + /* + * This CRC-32C implementation uses the 'slicing-by-8' algorithm described + * in the paper "A Systematic Approach to Building High Performance + * Software-Based CRC Generators" by Michael E. Kounavis and Frank L. Berry, + * Intel Research and Development + */ + + /** + * CRC-32C Polynomial + */ + private static final int CRC32C_POLY = 0x1EDC6F41; + private static final int REVERSED_CRC32C_POLY = Integer.reverse(CRC32C_POLY); + + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); + + // Lookup tables + // Lookup table for single byte calculations + private static final int[] byteTable; + // Lookup tables for bulk operations in 'slicing-by-8' algorithm + private static final int[][] byteTables = new int[8][256]; + private static final int[] byteTable0 = byteTables[0]; + private static final int[] byteTable1 = byteTables[1]; + private static final int[] byteTable2 = byteTables[2]; + private static final int[] byteTable3 = byteTables[3]; + private static final int[] byteTable4 = byteTables[4]; + private static final int[] byteTable5 = byteTables[5]; + private static final int[] byteTable6 = byteTables[6]; + private static final int[] byteTable7 = byteTables[7]; + + static { + // Generate lookup tables + // High-order polynomial term stored in LSB of r. + for (int index = 0; index < byteTables[0].length; index++) { + int r = index; + for (int i = 0; i < Byte.SIZE; i++) { + if ((r & 1) != 0) { + r = (r >>> 1) ^ REVERSED_CRC32C_POLY; + } else { + r >>>= 1; + } + } + byteTables[0][index] = r; + } + + for (int index = 0; index < byteTables[0].length; index++) { + int r = byteTables[0][index]; + + for (int k = 1; k < byteTables.length; k++) { + r = byteTables[0][r & 0xFF] ^ (r >>> 8); + byteTables[k][index] = r; + } + } + + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + byteTable = byteTables[0]; + } else { // ByteOrder.BIG_ENDIAN + byteTable = new int[byteTable0.length]; + System.arraycopy(byteTable0, 0, byteTable, 0, byteTable0.length); + for (int[] table : byteTables) { + for (int index = 0; index < table.length; index++) { + table[index] = Integer.reverseBytes(table[index]); + } + } + } + } + + /** + * Calculated CRC-32C value + */ + private int crc = 0xFFFFFFFF; + + /** + * Creates a new CRC32C object. + */ + public CRC32C() { + } + + /** + * Updates the CRC-32C checksum with the specified byte (the low eight bits + * of the argument b). + */ + @Override + public void update(int b) { + crc = (crc >>> 8) ^ byteTable[(crc ^ (b & 0xFF)) & 0xFF]; + } + + /** + * Updates the CRC-32C checksum with the specified array of bytes. + * + * @throws ArrayIndexOutOfBoundsException + * if {@code off} is negative, or {@code len} is negative, or + * {@code off+len} is negative or greater than the length of + * the array {@code b}. + */ + @Override + public void update(byte[] b, int off, int len) { + if (b == null) { + throw new NullPointerException(); + } + if (off < 0 || len < 0 || off > b.length - len) { + throw new ArrayIndexOutOfBoundsException(); + } + crc = updateBytes(crc, b, off, (off + len)); + } + + /** + * Updates the CRC-32C checksum with the bytes from the specified buffer. + * + * The checksum is updated with the remaining bytes in the buffer, starting + * at the buffer's position. Upon return, the buffer's position will be + * updated to its limit; its limit will not have been changed. + */ + @Override + public void update(ByteBuffer buffer) { + int pos = buffer.position(); + int limit = buffer.limit(); + assert (pos <= limit); + int rem = limit - pos; + if (rem <= 0) { + return; + } + + if (buffer instanceof DirectBuffer) { + crc = updateDirectByteBuffer(crc, ((DirectBuffer) buffer).address(), + pos, limit); + } else if (buffer.hasArray()) { + crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(), + limit + buffer.arrayOffset()); + } else { + byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + while (buffer.hasRemaining()) { + int length = Math.min(buffer.remaining(), b.length); + buffer.get(b, 0, length); + update(b, 0, length); + } + } + buffer.position(limit); + } + + /** + * Resets CRC-32C to initial value. + */ + @Override + public void reset() { + crc = 0xFFFFFFFF; + } + + /** + * Returns CRC-32C value. + */ + @Override + public long getValue() { + return (~crc) & 0xFFFFFFFFL; + } + + /** + * Updates the CRC-32C checksum with the specified array of bytes. + */ + private static int updateBytes(int crc, byte[] b, int off, int end) { + + // Do only byte reads for arrays so short they can't be aligned + // or if bytes are stored with a larger witdh than one byte.,% + if (end - off >= 8 && Unsafe.ARRAY_BYTE_INDEX_SCALE == 1) { + + // align on 8 bytes + int alignLength + = (8 - ((Unsafe.ARRAY_BYTE_BASE_OFFSET + off) & 0x7)) & 0x7; + for (int alignEnd = off + alignLength; off < alignEnd; off++) { + crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF]; + } + + if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { + crc = Integer.reverseBytes(crc); + } + + // slicing-by-8 + for (; off < (end - Long.BYTES); off += Long.BYTES) { + int firstHalf; + int secondHalf; + if (Unsafe.ADDRESS_SIZE == 4) { + // On 32 bit platforms read two ints instead of a single 64bit long + firstHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off); + secondHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off + + Integer.BYTES); + } else { + long value = UNSAFE.getLong(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off); + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + firstHalf = (int) value; + secondHalf = (int) (value >>> 32); + } else { // ByteOrder.BIG_ENDIAN + firstHalf = (int) (value >>> 32); + secondHalf = (int) value; + } + } + crc ^= firstHalf; + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + crc = byteTable7[crc & 0xFF] + ^ byteTable6[(crc >>> 8) & 0xFF] + ^ byteTable5[(crc >>> 16) & 0xFF] + ^ byteTable4[crc >>> 24] + ^ byteTable3[secondHalf & 0xFF] + ^ byteTable2[(secondHalf >>> 8) & 0xFF] + ^ byteTable1[(secondHalf >>> 16) & 0xFF] + ^ byteTable0[secondHalf >>> 24]; + } else { // ByteOrder.BIG_ENDIAN + crc = byteTable0[secondHalf & 0xFF] + ^ byteTable1[(secondHalf >>> 8) & 0xFF] + ^ byteTable2[(secondHalf >>> 16) & 0xFF] + ^ byteTable3[secondHalf >>> 24] + ^ byteTable4[crc & 0xFF] + ^ byteTable5[(crc >>> 8) & 0xFF] + ^ byteTable6[(crc >>> 16) & 0xFF] + ^ byteTable7[crc >>> 24]; + } + } + + if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { + crc = Integer.reverseBytes(crc); + } + } + + // Tail + for (; off < end; off++) { + crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF]; + } + + return crc; + } + + /** + * Updates the CRC-32C checksum reading from the specified address. + */ + private static int updateDirectByteBuffer(int crc, long address, + int off, int end) { + + // Do only byte reads for arrays so short they can't be aligned + if (end - off >= 8) { + + // align on 8 bytes + int alignLength = (8 - (int) ((address + off) & 0x7)) & 0x7; + for (int alignEnd = off + alignLength; off < alignEnd; off++) { + crc = (crc >>> 8) + ^ byteTable[(crc ^ UNSAFE.getByte(address + off)) & 0xFF]; + } + + if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { + crc = Integer.reverseBytes(crc); + } + + // slicing-by-8 + for (; off <= (end - Long.BYTES); off += Long.BYTES) { + // Always reading two ints as reading a long followed by + // shifting and casting was slower. + int firstHalf = UNSAFE.getInt(address + off); + int secondHalf = UNSAFE.getInt(address + off + Integer.BYTES); + crc ^= firstHalf; + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + crc = byteTable7[crc & 0xFF] + ^ byteTable6[(crc >>> 8) & 0xFF] + ^ byteTable5[(crc >>> 16) & 0xFF] + ^ byteTable4[crc >>> 24] + ^ byteTable3[secondHalf & 0xFF] + ^ byteTable2[(secondHalf >>> 8) & 0xFF] + ^ byteTable1[(secondHalf >>> 16) & 0xFF] + ^ byteTable0[secondHalf >>> 24]; + } else { // ByteOrder.BIG_ENDIAN + crc = byteTable0[secondHalf & 0xFF] + ^ byteTable1[(secondHalf >>> 8) & 0xFF] + ^ byteTable2[(secondHalf >>> 16) & 0xFF] + ^ byteTable3[secondHalf >>> 24] + ^ byteTable4[crc & 0xFF] + ^ byteTable5[(crc >>> 8) & 0xFF] + ^ byteTable6[(crc >>> 16) & 0xFF] + ^ byteTable7[crc >>> 24]; + } + } + + if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { + crc = Integer.reverseBytes(crc); + } + } + + // Tail + for (; off < end; off++) { + crc = (crc >>> 8) + ^ byteTable[(crc ^ UNSAFE.getByte(address + off)) & 0xFF]; + } + + return crc; + } +} diff --git a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java index 0369c53b0ed..121b687df0b 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java +++ b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -22,16 +22,17 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package java.util.zip; +import java.nio.ByteBuffer; + /** * An interface representing a data checksum. * - * @author David Connelly + * @author David Connelly */ -public -interface Checksum { +public interface Checksum { + /** * Updates the current checksum with the specified byte. * @@ -41,14 +42,89 @@ interface Checksum { /** * Updates the current checksum with the specified array of bytes. + * + * @implSpec This default implementation is equal to calling + * {@code update(b, 0, b.length)}. + * + * @param b the array of bytes to update the checksum with + * + * @throws NullPointerException + * if {@code b} is {@code null} + * + * @since 1.9 + */ + default public void update(byte[] b) { + update(b, 0, b.length); + } + + /** + * Updates the current checksum with the specified array of bytes. + * * @param b the byte array to update the checksum with * @param off the start offset of the data * @param len the number of bytes to use for the update */ public void update(byte[] b, int off, int len); + /** + * Updates the current checksum with the bytes from the specified buffer. + * + * The checksum is updated with the remaining bytes in the buffer, starting + * at the buffer's position. Upon return, the buffer's position will be + * updated to its limit; its limit will not have been changed. + * + * @apiNote For best performance with DirectByteBuffer and other ByteBuffer + * implementations without a backing array implementers of this interface + * should override this method. + * + * @implSpec The default implementation has the following behavior.
+ * For ByteBuffers backed by an accessible byte array. + *
{@code
+     * update(buffer.array(),
+     *        buffer.position() + buffer.arrayOffset(),
+     *        buffer.remaining());
+     * }
+ * For ByteBuffers not backed by an accessible byte array. + *
{@code
+     * byte[] b = new byte[Math.min(buffer.remaining(), 4096)];
+     * while (buffer.hasRemaining()) {
+     *     int length = Math.min(buffer.remaining(), b.length);
+     *     buffer.get(b, 0, length);
+     *     update(b, 0, length);
+     * }
+     * }
+ * + * @param buffer the ByteBuffer to update the checksum with + * + * @throws NullPointerException + * if {@code buffer} is {@code null} + * + * @since 1.9 + */ + default public void update(ByteBuffer buffer) { + int pos = buffer.position(); + int limit = buffer.limit(); + assert (pos <= limit); + int rem = limit - pos; + if (rem <= 0) { + return; + } + if (buffer.hasArray()) { + update(buffer.array(), pos + buffer.arrayOffset(), rem); + } else { + byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + while (buffer.hasRemaining()) { + int length = Math.min(buffer.remaining(), b.length); + buffer.get(b, 0, length); + update(b, 0, length); + } + } + buffer.position(limit); + } + /** * Returns the current checksum value. + * * @return the current checksum value */ public long getValue(); diff --git a/jdk/src/java.base/share/classes/java/util/zip/package-info.java b/jdk/src/java.base/share/classes/java/util/zip/package-info.java new file mode 100644 index 00000000000..a6ec2072413 --- /dev/null +++ b/jdk/src/java.base/share/classes/java/util/zip/package-info.java @@ -0,0 +1,77 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +/** + * Provides classes for reading and writing the standard ZIP and GZIP file + * formats. Also includes classes for compressing and decompressing data using + * the DEFLATE compression algorithm, which is used by the ZIP and GZIP file + * formats. Additionally, there are utility classes for computing the CRC-32, + * CRC-32C and Adler-32 checksums of arbitrary input streams. + * + *

Package Specification

+ * + * + * + * @since 1.1 + */ +package java.util.zip; diff --git a/jdk/src/java.base/share/classes/java/util/zip/package.html b/jdk/src/java.base/share/classes/java/util/zip/package.html deleted file mode 100644 index 9b80819ae3d..00000000000 --- a/jdk/src/java.base/share/classes/java/util/zip/package.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - -Provides classes for reading and writing the standard ZIP and GZIP -file formats. Also includes classes for compressing and decompressing -data using the DEFLATE compression algorithm, which is used by the -ZIP and GZIP file formats. Additionally, there are utility classes -for computing the CRC-32 and Adler-32 checksums of arbitrary -input streams. - - -

Package Specification

- - - - - - -@since 1.1 - - - - diff --git a/jdk/test/java/util/zip/ChecksumBase.java b/jdk/test/java/util/zip/ChecksumBase.java new file mode 100644 index 00000000000..5804be7151b --- /dev/null +++ b/jdk/test/java/util/zip/ChecksumBase.java @@ -0,0 +1,196 @@ +/* + * 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. + */ + +/** + * Base class for Checksum tests + */ +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.charset.StandardCharsets; +import java.util.zip.Checksum; + +public class ChecksumBase { + + private final static byte[] BYTES_123456789 = "123456789".getBytes(StandardCharsets.US_ASCII); + + public static void testAll(Checksum checksum, long expected) { + testBytes(checksum, expected); + testByteArray(checksum, expected); + testWrappedByteBuffer(checksum, expected); + testReadonlyByteBuffer(checksum, expected); + testDirectByteBuffer(checksum, expected); + testByteArrayOffset(checksum, expected); + testDirectByteBufferOffset(checksum, expected); + testLittleEndianDirectByteBufferOffset(checksum, expected); + testWrappedByteBufferOffset(checksum, expected); + testLittleEndianWrappedByteBufferOffset(checksum, expected); + testReadonlyByteBufferOffset(checksum, expected); + testLittleEndianReadonlyByteBufferOffset(checksum, expected); + } + + private static void testBytes(Checksum checksum, long expected) { + checksum.reset(); + for (byte bits : BYTES_123456789) { + checksum.update(bits); + } + checkChecksum(checksum, expected); + } + + private static void testByteArray(Checksum checksum, long expected) { + checksum.reset(); + checksum.update(BYTES_123456789); + checkChecksum(checksum, expected); + } + + private static void testWrappedByteBuffer(Checksum checksum, long expected) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.wrap(BYTES_123456789); + checksum.update(bb); + checkChecksum(checksum, expected); + } + + private static void testReadonlyByteBuffer(Checksum checksum, long expected) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.wrap(BYTES_123456789).asReadOnlyBuffer(); + checksum.update(bb); + checkChecksum(checksum, expected); + } + + private static void testDirectByteBuffer(Checksum checksum, long expected) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.allocateDirect(BYTES_123456789.length); + bb.put(BYTES_123456789); + bb.rewind(); + checksum.update(bb); + checkChecksum(checksum, expected); + } + + private static void checkChecksum(Checksum checksum, long expected) { + if (checksum.getValue() != expected) { + throw new RuntimeException("Calculated checksum result was invalid." + + " Expected " + Long.toHexString(expected) + + ", but got " + Long.toHexString(checksum.getValue()) + "."); + } + } + + private static void testByteArrayOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + checksum.update(unaligned_bytes_123456789, i, BYTES_123456789.length); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testDirectByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.allocateDirect(unaligned_bytes_123456789.length); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + bb.put(unaligned_bytes_123456789); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testLittleEndianDirectByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.allocateDirect(unaligned_bytes_123456789.length); + bb.order(ByteOrder.LITTLE_ENDIAN); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + bb.put(unaligned_bytes_123456789); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testWrappedByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testLittleEndianWrappedByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789); + bb.order(ByteOrder.LITTLE_ENDIAN); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testReadonlyByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789).asReadOnlyBuffer(); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testLittleEndianReadonlyByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789).asReadOnlyBuffer(); + bb.order(ByteOrder.LITTLE_ENDIAN); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void checkChecksumOffset(Checksum checksum, long expected, int offset) { + if (checksum.getValue() != expected) { + throw new RuntimeException("Calculated CRC32C result was invalid. Array offset " + + offset + ". Expected: " + Long.toHexString(expected) + ", Got: " + + Long.toHexString(checksum.getValue())); + } + } +} diff --git a/jdk/test/java/util/zip/TestCRC32.java b/jdk/test/java/util/zip/TestCRC32.java new file mode 100644 index 00000000000..68c15aed44b --- /dev/null +++ b/jdk/test/java/util/zip/TestCRC32.java @@ -0,0 +1,40 @@ + +import java.util.zip.CRC32; + +/* + * 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 @summary Check that CRC-32 returns the expected CRC value for the + * string 123456789 + * http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32 + * @build ChecksumBase + * @run main TestCRC32 + */ + +public class TestCRC32 { + + public static void main(String[] args) { + ChecksumBase.testAll(new CRC32(), 0xCBF43926L); + } +} diff --git a/jdk/test/java/util/zip/TestCRC32C.java b/jdk/test/java/util/zip/TestCRC32C.java new file mode 100644 index 00000000000..bb5ea0447c5 --- /dev/null +++ b/jdk/test/java/util/zip/TestCRC32C.java @@ -0,0 +1,40 @@ + +import java.util.zip.CRC32C; + +/* + * 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 @summary Check that CRC-32C returns the expected CRC value for the + * string 123456789 + * http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32c + * @build ChecksumBase + * @run main TestCRC32C + */ + +public class TestCRC32C { + + public static void main(String[] args) { + ChecksumBase.testAll(new CRC32C(), 0xE3069283L); + } +} diff --git a/jdk/test/java/util/zip/TestChecksum.java b/jdk/test/java/util/zip/TestChecksum.java new file mode 100644 index 00000000000..07be5910ead --- /dev/null +++ b/jdk/test/java/util/zip/TestChecksum.java @@ -0,0 +1,66 @@ +/* + * 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 @summary Test that default methods in Checksum works as expected + * @build ChecksumBase + * @run main TestChecksum + */ +import java.util.zip.CRC32C; +import java.util.zip.Checksum; + +public class TestChecksum { + + public static void main(String[] args) { + ChecksumBase.testAll(new MyCRC32C(), 0xE3069283L); + } + + /** + * Only implementing required methods + */ + private static class MyCRC32C implements Checksum { + + private final CRC32C crc32c = new CRC32C(); + + @Override + public void update(int b) { + crc32c.update(b); + } + + @Override + public void update(byte[] b, int off, int len) { + crc32c.update(b, off, len); + } + + @Override + public long getValue() { + return crc32c.getValue(); + } + + @Override + public void reset() { + crc32c.reset(); + } + + } +} From ca85e583e9c19d810645213b5cbb809768253bc7 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Fri, 21 Nov 2014 15:23:36 -0500 Subject: [PATCH 115/159] 8046949: Generify the javax.xml.crypto API Reviewed-by: xuelei --- .../classes/javax/xml/crypto/NodeSetData.java | 8 ++-- .../xml/crypto/dom/DOMCryptoContext.java | 6 +-- .../javax/xml/crypto/dsig/Manifest.java | 9 ++-- .../javax/xml/crypto/dsig/Reference.java | 5 +-- .../xml/crypto/dsig/SignatureProperties.java | 5 +-- .../xml/crypto/dsig/SignatureProperty.java | 5 +-- .../javax/xml/crypto/dsig/SignedInfo.java | 5 +-- .../javax/xml/crypto/dsig/XMLObject.java | 8 ++-- .../javax/xml/crypto/dsig/XMLSignature.java | 5 +-- .../xml/crypto/dsig/XMLSignatureFactory.java | 41 +++++++---------- .../xml/crypto/dsig/keyinfo/KeyInfo.java | 5 +-- .../crypto/dsig/keyinfo/KeyInfoFactory.java | 22 ++++------ .../xml/crypto/dsig/keyinfo/PGPData.java | 5 +-- .../crypto/dsig/keyinfo/RetrievalMethod.java | 5 +-- .../xml/crypto/dsig/keyinfo/X509Data.java | 5 +-- .../dsig/spec/ExcC14NParameterSpec.java | 27 ++++-------- .../dsig/spec/XPathFilter2ParameterSpec.java | 28 ++++-------- .../dsig/spec/XPathFilterParameterSpec.java | 32 +++++--------- .../javax/xml/crypto/dsig/spec/XPathType.java | 40 ++++++++--------- .../internal/dom/ApacheCanonicalizer.java | 11 ++--- .../dsig/internal/dom/ApacheNodeSetData.java | 2 +- .../dsig/internal/dom/ApacheTransform.java | 3 +- .../dsig/internal/dom/DOMExcC14NMethod.java | 3 +- .../jcp/xml/dsig/internal/dom/DOMKeyInfo.java | 13 +++--- .../dsig/internal/dom/DOMKeyInfoFactory.java | 21 ++++----- .../xml/dsig/internal/dom/DOMKeyValue.java | 1 - .../xml/dsig/internal/dom/DOMManifest.java | 14 +++--- .../jcp/xml/dsig/internal/dom/DOMPGPData.java | 34 +++++--------- .../xml/dsig/internal/dom/DOMReference.java | 36 ++++++--------- .../dsig/internal/dom/DOMRetrievalMethod.java | 19 +++----- .../internal/dom/DOMSignatureProperties.java | 19 ++++---- .../internal/dom/DOMSignatureProperty.java | 25 +++++------ .../xml/dsig/internal/dom/DOMSignedInfo.java | 19 +++----- .../xml/dsig/internal/dom/DOMSubTreeData.java | 2 +- .../jcp/xml/dsig/internal/dom/DOMUtils.java | 2 - .../xml/dsig/internal/dom/DOMX509Data.java | 4 +- .../xml/dsig/internal/dom/DOMXMLObject.java | 18 +++----- .../dsig/internal/dom/DOMXMLSignature.java | 24 +++------- .../internal/dom/DOMXMLSignatureFactory.java | 44 ++++++++----------- .../dom/DOMXPathFilter2Transform.java | 2 - .../dsig/internal/dom/DOMXPathTransform.java | 1 - .../org/jcp/xml/dsig/internal/dom/Utils.java | 4 +- .../xml/crypto/dsig/GenerationTests.java | 36 +++++++-------- .../javax/xml/crypto/dsig/KeySelectors.java | 20 +++------ .../xml/crypto/dsig/SignatureValidator.java | 15 ++++--- .../xml/crypto/dsig/X509KeySelector.java | 10 ++--- 46 files changed, 258 insertions(+), 410 deletions(-) diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java index 284753c5f78..9da53d0ea8a 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -37,9 +37,10 @@ import java.util.Iterator; * * @author Sean Mullan * @author JSR 105 Expert Group + * @param the type of nodes maintained by this set * @since 1.6 */ -public interface NodeSetData extends Data { +public interface NodeSetData extends Data, Iterable { /** * Returns a read-only iterator over the nodes contained in this @@ -52,6 +53,5 @@ public interface NodeSetData extends Data { * @return an Iterator over the nodes in this * NodeSetData in document order */ - @SuppressWarnings("rawtypes") - Iterator iterator(); + Iterator iterator(); } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java index 9da528180e4..47f006cc5f8 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -33,6 +33,7 @@ import javax.xml.crypto.XMLCryptoContext; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import org.w3c.dom.Element; /** @@ -219,8 +220,7 @@ public class DOMCryptoContext implements XMLCryptoContext { * * @return a read-only iterator over the set of mappings */ - @SuppressWarnings("rawtypes") - public Iterator iterator() { + public Iterator> iterator() { return Collections.unmodifiableMap(idMap).entrySet().iterator(); } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java index 0a34d04d425..351b3a9a674 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java @@ -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 @@ -51,8 +51,8 @@ import java.util.List; * *
  *   XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
- *   List references = Collections.singletonList(factory.newReference
- *       ("#reference-1", DigestMethod.SHA1));
+ *   Reference ref = factory.newReference("#reference-1", DigestMethod.SHA1);
+ *   List references = Collections.singletonList(ref);
  *   Manifest manifest = factory.newManifest(references, "manifest-1");
  * 
* @@ -86,6 +86,5 @@ public interface Manifest extends XMLStructure { * * @return an unmodifiable list of one or more References */ - @SuppressWarnings("rawtypes") - List getReferences(); + List getReferences(); } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java index f9df64b1b2c..6f3ce617317 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java @@ -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 @@ -85,8 +85,7 @@ public interface Reference extends URIReference, XMLStructure { * @return an unmodifiable list of Transforms * (may be empty but never null) */ - @SuppressWarnings("rawtypes") - List getTransforms(); + List getTransforms(); /** * Returns the digest method of this Reference. diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java index 1093b749373..af12e38f8c0 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -87,6 +87,5 @@ public interface SignatureProperties extends XMLStructure { * @return an unmodifiable list of one or more * SignaturePropertys */ - @SuppressWarnings("rawtypes") - List getProperties(); + List getProperties(); } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java index f83da44718c..237590125b0 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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,6 +91,5 @@ public interface SignatureProperty extends XMLStructure { * * @return an unmodifiable list of one or more XMLStructures */ - @SuppressWarnings("rawtypes") - List getContent(); + List getContent(); } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java index 3f57b46689e..85cbb347ddb 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -80,8 +80,7 @@ public interface SignedInfo extends XMLStructure { * * @return an unmodifiable list of one or more {@link Reference}s */ - @SuppressWarnings("rawtypes") - List getReferences(); + List getReferences(); /** * Returns the optional Id attribute of this diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java index e535e8fa434..572be86f207 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -64,7 +64,8 @@ import javax.xml.crypto.XMLStructure; * *
  *   XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
- *   List content = Collections.singletonList(fac.newManifest(references)));
+ *   Manifest manifest = fac.newManifest(references);
+ *   List content = Collections.singletonList(manifest);
  *   XMLObject object = factory.newXMLObject(content, "object-1", null, null);
  * 
* @@ -100,8 +101,7 @@ public interface XMLObject extends XMLStructure { * @return an unmodifiable list of XMLStructures (may be empty * but never null) */ - @SuppressWarnings("rawtypes") - List getContent(); + List getContent(); /** * Returns the Id of this XMLObject. diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java index 32c05eed10d..4909e700bcf 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java @@ -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 @@ -136,8 +136,7 @@ public interface XMLSignature extends XMLStructure { * @return an unmodifiable list of XMLObjects (may be empty * but never null) */ - @SuppressWarnings("rawtypes") - List getObjects(); + List getObjects(); /** * Returns the optional Id of this XMLSignature. diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java index 52b5198cda2..f776bf322b5 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java @@ -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 @@ -365,9 +365,8 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if any of the objects are not of * type XMLObject */ - @SuppressWarnings("rawtypes") public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki, - List objects, String id, String signatureValueId); + List objects, String id, String signatureValueId); /** * Creates a Reference with the specified URI and digest @@ -399,9 +398,8 @@ public abstract class XMLSignatureFactory { * compliant * @throws NullPointerException if dm is null */ - @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, - List transforms, String type, String id); + List transforms, String type, String id); /** * Creates a Reference with the specified parameters and @@ -430,9 +428,9 @@ public abstract class XMLSignatureFactory { * @throws NullPointerException if dm or * digestValue is null */ - @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, - List transforms, String type, String id, byte[] digestValue); + List transforms, String type, String id, + byte[] digestValue); /** * Creates a Reference with the specified parameters. @@ -473,10 +471,9 @@ public abstract class XMLSignatureFactory { * appliedTransforms or result is * null */ - @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, - List appliedTransforms, Data result, List transforms, String type, - String id); + List appliedTransforms, Data result, + List transforms, String type, String id); /** * Creates a SignedInfo with the specified canonicalization @@ -493,9 +490,8 @@ public abstract class XMLSignatureFactory { * @throws NullPointerException if any of the parameters * are null */ - @SuppressWarnings("rawtypes") public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, - SignatureMethod sm, List references); + SignatureMethod sm, List references); /** * Creates a SignedInfo with the specified parameters. @@ -512,9 +508,8 @@ public abstract class XMLSignatureFactory { * @throws NullPointerException if cm, sm, or * references are null */ - @SuppressWarnings("rawtypes") public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, - SignatureMethod sm, List references, String id); + SignatureMethod sm, List references, String id); // Object factory methods /** @@ -530,9 +525,8 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if content contains any * entries that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") - public abstract XMLObject newXMLObject(List content, String id, - String mimeType, String encoding); + public abstract XMLObject newXMLObject(List content, + String id, String mimeType, String encoding); /** * Creates a Manifest containing the specified @@ -547,8 +541,7 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if references contains any * entries that are not of type {@link Reference} */ - @SuppressWarnings("rawtypes") - public abstract Manifest newManifest(List references); + public abstract Manifest newManifest(List references); /** * Creates a Manifest containing the specified @@ -564,8 +557,8 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if references contains any * entries that are not of type {@link Reference} */ - @SuppressWarnings("rawtypes") - public abstract Manifest newManifest(List references, String id); + public abstract Manifest newManifest(List references, + String id); /** * Creates a SignatureProperty containing the specified @@ -583,9 +576,8 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if content contains any * entries that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") public abstract SignatureProperty newSignatureProperty - (List content, String target, String id); + (List content, String target, String id); /** * Creates a SignatureProperties containing the specified @@ -602,9 +594,8 @@ public abstract class XMLSignatureFactory { * @throws ClassCastException if properties contains any * entries that are not of type {@link SignatureProperty} */ - @SuppressWarnings("rawtypes") public abstract SignatureProperties newSignatureProperties - (List properties, String id); + (List properties, String id); // Algorithm factory methods /** diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java index def192a1b0e..b3e6d5e8715 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -94,8 +94,7 @@ public interface KeyInfo extends XMLStructure { * in this KeyInfo. Never returns null or an * empty list. */ - @SuppressWarnings("rawtypes") - List getContent(); + List getContent(); /** * Return the optional Id attribute of this KeyInfo, which diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java index a5e17102214..a9465f79330 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java @@ -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 @@ -305,8 +305,7 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if content contains any entries * that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") - public abstract KeyInfo newKeyInfo(List content); + public abstract KeyInfo newKeyInfo(List content); /** * Creates a KeyInfo containing the specified list of key @@ -325,8 +324,8 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if content contains any entries * that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") - public abstract KeyInfo newKeyInfo(List content, String id); + public abstract KeyInfo newKeyInfo(List content, + String id); /** * Creates a KeyName from the specified name. @@ -387,9 +386,8 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if other contains any * entries that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket, - List other); + List other); /** * Creates a PGPData from the specified PGP key material @@ -411,8 +409,8 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if other contains any * entries that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") - public abstract PGPData newPGPData(byte[] keyPacket, List other); + public abstract PGPData newPGPData(byte[] keyPacket, + List other); /** * Creates a RetrievalMethod from the specified URI. @@ -443,9 +441,8 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if transforms contains any * entries that are not of type {@link Transform} */ - @SuppressWarnings("rawtypes") public abstract RetrievalMethod newRetrievalMethod(String uri, String type, - List transforms); + List transforms); /** * Creates a X509Data containing the specified list of @@ -469,8 +466,7 @@ public abstract class KeyInfoFactory { * @throws ClassCastException if content contains any entries * that are not of one of the valid types mentioned above */ - @SuppressWarnings("rawtypes") - public abstract X509Data newX509Data(List content); + public abstract X509Data newX509Data(List content); /** * Creates an X509IssuerSerial from the specified X.500 issuer diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java index 6f9c6a31eda..00daf4d5bdf 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -112,6 +112,5 @@ public interface PGPData extends XMLStructure { * @return an unmodifiable list of XMLStructures (may be * empty, but never null) */ - @SuppressWarnings("rawtypes") - List getExternalElements(); + List getExternalElements(); } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java index 3741f348660..7a53f9e41a0 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -80,8 +80,7 @@ public interface RetrievalMethod extends URIReference, XMLStructure { * @return an unmodifiable list of Transform objects (may be * empty but never null). */ - @SuppressWarnings("rawtypes") - List getTransforms(); + List getTransforms(); /** * Returns the URI of the referenced KeyInfo information. diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java index 47efc86a116..d732b54e7af 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -109,6 +109,5 @@ public interface X509Data extends XMLStructure { * @return an unmodifiable list of the content in this X509Data * (never null or empty) */ - @SuppressWarnings("rawtypes") - List getContent(); + List getContent(); } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java index 990a3eedccd..45ff07f1335 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java @@ -59,7 +59,7 @@ import java.util.List; */ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { - private List preList; + private final List prefixList; /** * Indicates the default namespace ("#default"). @@ -71,7 +71,7 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { * list. */ public ExcC14NParameterSpec() { - preList = Collections.emptyList(); + prefixList = Collections.emptyList(); } /** @@ -86,22 +86,14 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { * @throws ClassCastException if any of the entries in the list are not * of type String */ - @SuppressWarnings("rawtypes") - public ExcC14NParameterSpec(List prefixList) { + public ExcC14NParameterSpec(List prefixList) { if (prefixList == null) { throw new NullPointerException("prefixList cannot be null"); } - List copy = new ArrayList<>((List)prefixList); - for (int i = 0, size = copy.size(); i < size; i++) { - if (!(copy.get(i) instanceof String)) { - throw new ClassCastException("not a String"); - } - } - - @SuppressWarnings("unchecked") - List temp = (List)copy; - - preList = Collections.unmodifiableList(temp); + List tempList = Collections.checkedList(new ArrayList<>(), + String.class); + tempList.addAll(prefixList); + this.prefixList = Collections.unmodifiableList(tempList); } /** @@ -114,8 +106,7 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { * @return the inclusive namespace prefix list (may be empty but never * null) */ - @SuppressWarnings("rawtypes") - public List getPrefixList() { - return preList; + public List getPrefixList() { + return prefixList; } } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java index 4f879019ed4..acaa651e597 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -59,27 +59,18 @@ public final class XPathFilter2ParameterSpec implements TransformParameterSpec { * @throws NullPointerException if xPathList is * null */ - @SuppressWarnings("rawtypes") - public XPathFilter2ParameterSpec(List xPathList) { + public XPathFilter2ParameterSpec(List xPathList) { if (xPathList == null) { throw new NullPointerException("xPathList cannot be null"); } - List xPathListCopy = new ArrayList<>((List)xPathList); - if (xPathListCopy.isEmpty()) { + List tempList = + Collections.checkedList(new ArrayList(), + XPathType.class); + tempList.addAll(xPathList); + if (tempList.isEmpty()) { throw new IllegalArgumentException("xPathList cannot be empty"); } - int size = xPathListCopy.size(); - for (int i = 0; i < size; i++) { - if (!(xPathListCopy.get(i) instanceof XPathType)) { - throw new ClassCastException - ("xPathList["+i+"] is not a valid type"); - } - } - - @SuppressWarnings("unchecked") - List temp = (List)xPathListCopy; - - this.xPathList = Collections.unmodifiableList(temp); + this.xPathList = Collections.unmodifiableList(tempList); } /** @@ -91,8 +82,7 @@ public final class XPathFilter2ParameterSpec implements TransformParameterSpec { * @return a List of XPathType objects * (never null or empty) */ - @SuppressWarnings("rawtypes") - public List getXPathList() { + public List getXPathList() { return xPathList; } } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java index c9653fc3e9c..1a0ed7e900b 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -32,7 +32,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import java.util.Map.Entry; /** * Parameters for the @@ -51,8 +50,8 @@ import java.util.Map.Entry; */ public final class XPathFilterParameterSpec implements TransformParameterSpec { - private String xPath; - private Map nsMap; + private final String xPath; + private final Map nsMap; /** * Creates an XPathFilterParameterSpec with the specified @@ -83,26 +82,16 @@ public final class XPathFilterParameterSpec implements TransformParameterSpec { * @throws ClassCastException if any of the map's keys or entries are not * of type String */ - @SuppressWarnings("rawtypes") - public XPathFilterParameterSpec(String xPath, Map namespaceMap) { + public XPathFilterParameterSpec(String xPath, Map namespaceMap) { if (xPath == null || namespaceMap == null) { throw new NullPointerException(); } this.xPath = xPath; - Map copy = new HashMap<>((Map)namespaceMap); - Iterator> entries = copy.entrySet().iterator(); - while (entries.hasNext()) { - Map.Entry me = entries.next(); - if (!(me.getKey() instanceof String) || - !(me.getValue() instanceof String)) { - throw new ClassCastException("not a String"); - } - } - - @SuppressWarnings("unchecked") - Map temp = (Map)copy; - - nsMap = Collections.unmodifiableMap(temp); + Map tempMap = Collections.checkedMap(new HashMap<>(), + String.class, + String.class); + tempMap.putAll(namespaceMap); + this.nsMap = Collections.unmodifiableMap(tempMap); } /** @@ -125,8 +114,7 @@ public final class XPathFilterParameterSpec implements TransformParameterSpec { * @return a Map of namespace prefixes to namespace URIs (may * be empty, but never null) */ - @SuppressWarnings("rawtypes") - public Map getNamespaceMap() { + public Map getNamespaceMap() { return nsMap; } } diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java index c3203f1c39c..625eaab343e 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -28,7 +28,6 @@ package javax.xml.crypto.dsig.spec; import java.util.Collections; -import java.util.Iterator; import java.util.HashMap; import java.util.Map; @@ -106,7 +105,7 @@ public class XPathType { private final String expression; private final Filter filter; - private Map nsMap; + private final Map nsMap; /** * Creates an XPathType instance with the specified XPath @@ -147,26 +146,24 @@ public class XPathType { * @throws ClassCastException if any of the map's keys or entries are * not of type String */ - @SuppressWarnings("rawtypes") - public XPathType(String expression, Filter filter, Map namespaceMap) { - this(expression, filter); + public XPathType(String expression, Filter filter, + Map namespaceMap) { + if (expression == null) { + throw new NullPointerException("expression cannot be null"); + } + if (filter == null) { + throw new NullPointerException("filter cannot be null"); + } if (namespaceMap == null) { throw new NullPointerException("namespaceMap cannot be null"); } - Map copy = new HashMap<>((Map)namespaceMap); - Iterator> entries = copy.entrySet().iterator(); - while (entries.hasNext()) { - Map.Entry me = entries.next(); - if (!(me.getKey() instanceof String) || - !(me.getValue() instanceof String)) { - throw new ClassCastException("not a String"); - } - } - - @SuppressWarnings("unchecked") - Map temp = (Map)copy; - - nsMap = Collections.unmodifiableMap(temp); + this.expression = expression; + this.filter = filter; + Map tempMap = Collections.checkedMap(new HashMap<>(), + String.class, + String.class); + tempMap.putAll(namespaceMap); + this.nsMap = Collections.unmodifiableMap(tempMap); } /** @@ -198,8 +195,7 @@ public class XPathType { * @return a Map of namespace prefixes to namespace URIs * (may be empty, but never null) */ - @SuppressWarnings("rawtypes") - public Map getNamespaceMap() { + public Map getNamespaceMap() { return nsMap; } } diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java index c1d8257bd22..f708ffc529c 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java @@ -21,7 +21,7 @@ * under the License. */ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. */ /* * $Id: ApacheCanonicalizer.java 1333869 2012-05-04 10:42:44Z coheigea $ @@ -166,11 +166,9 @@ public abstract class ApacheCanonicalizer extends TransformService { (subTree.getRoot()))); } } else if (data instanceof NodeSetData) { - NodeSetData nsd = (NodeSetData)data; - // convert Iterator to Set - @SuppressWarnings("unchecked") - Set ns = Utils.toNodeSet(nsd.iterator()); - nodeSet = ns; + NodeSetData nsd = (NodeSetData)data; + // convert Iterator to Set + nodeSet = Utils.toNodeSet(nsd.iterator()); if (log.isLoggable(java.util.logging.Level.FINE)) { log.log(java.util.logging.Level.FINE, "Canonicalizing " + nodeSet.size() + " nodes"); } @@ -236,7 +234,6 @@ public abstract class ApacheCanonicalizer extends TransformService { in = new XMLSignatureInput(subTree.getRoot()); in.setExcludeComments(subTree.excludeComments()); } else { - @SuppressWarnings("unchecked") Set nodeSet = Utils.toNodeSet(((NodeSetData)data).iterator()); in = new XMLSignatureInput(nodeSet); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java index 8cbcaba56fe..fdd35049cf8 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java @@ -39,7 +39,7 @@ import com.sun.org.apache.xml.internal.security.signature.NodeFilter; import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; import com.sun.org.apache.xml.internal.security.utils.XMLUtils; -public class ApacheNodeSetData implements ApacheData, NodeSetData { +public class ApacheNodeSetData implements ApacheData, NodeSetData { private XMLSignatureInput xi; diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java index f5cdec5d250..3cad0fd6f0c 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java @@ -21,7 +21,7 @@ * under the License. */ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. */ /* * $Id: ApacheTransform.java 1333869 2012-05-04 10:42:44Z coheigea $ @@ -175,7 +175,6 @@ public abstract class ApacheTransform extends TransformService { in = new XMLSignatureInput(subTree.getRoot()); in.setExcludeComments(subTree.excludeComments()); } else { - @SuppressWarnings("unchecked") Set nodeSet = Utils.toNodeSet(((NodeSetData)data).iterator()); in = new XMLSignatureInput(nodeSet); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java index 1af95986a61..cda4b4b14b5 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java @@ -21,7 +21,7 @@ * under the License. */ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. */ /* * $Id: DOMExcC14NMethod.java 1197150 2011-11-03 14:34:57Z coheigea $ @@ -119,7 +119,6 @@ public final class DOMExcC14NMethod extends ApacheCanonicalizer { ExcC14NParameterSpec params = (ExcC14NParameterSpec)spec; StringBuilder prefixListAttr = new StringBuilder(""); - @SuppressWarnings("unchecked") List prefixList = params.getPrefixList(); for (int i = 0, size = prefixList.size(); i < size; i++) { prefixListAttr.append(prefixList.get(i)); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java index eafbf623293..71021901802 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java @@ -68,17 +68,14 @@ public final class DOMKeyInfo extends DOMStructure implements KeyInfo { if (content == null) { throw new NullPointerException("content cannot be null"); } - this.keyInfoTypes = - Collections.unmodifiableList(new ArrayList(content)); + List tempList = + Collections.checkedList(new ArrayList(), + XMLStructure.class); + tempList.addAll(content); + this.keyInfoTypes = Collections.unmodifiableList(tempList); if (this.keyInfoTypes.isEmpty()) { throw new IllegalArgumentException("content cannot be empty"); } - for (int i = 0, size = this.keyInfoTypes.size(); i < size; i++) { - if (!(this.keyInfoTypes.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("content["+i+"] is not a valid KeyInfo type"); - } - } this.id = id; } diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java index 45b5620ed5d..7715b89ff79 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java @@ -34,6 +34,7 @@ import java.security.PublicKey; import java.util.List; import javax.xml.crypto.*; import javax.xml.crypto.dom.DOMCryptoContext; +import javax.xml.crypto.dsig.Transform; import javax.xml.crypto.dsig.keyinfo.*; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -48,13 +49,11 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory { public DOMKeyInfoFactory() { } - @SuppressWarnings("rawtypes") - public KeyInfo newKeyInfo(List content) { + public KeyInfo newKeyInfo(List content) { return newKeyInfo(content, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public KeyInfo newKeyInfo(List content, String id) { + public KeyInfo newKeyInfo(List content, String id) { return new DOMKeyInfo(content, id); } @@ -79,13 +78,13 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory { return newPGPData(keyId, null, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other) { + public PGPData newPGPData(byte[] keyId, byte[] keyPacket, + List other) { return new DOMPGPData(keyId, keyPacket, other); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public PGPData newPGPData(byte[] keyPacket, List other) { + public PGPData newPGPData(byte[] keyPacket, + List other) { return new DOMPGPData(keyPacket, other); } @@ -93,17 +92,15 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory { return newRetrievalMethod(uri, null, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public RetrievalMethod newRetrievalMethod(String uri, String type, - List transforms) { + List transforms) { if (uri == null) { throw new NullPointerException("uri must not be null"); } return new DOMRetrievalMethod(uri, type, transforms); } - @SuppressWarnings("rawtypes") - public X509Data newX509Data(List content) { + public X509Data newX509Data(List content) { return new DOMX509Data(content); } diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java index 12939570d2b..bb7a553beb3 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java @@ -33,7 +33,6 @@ import javax.xml.crypto.dom.DOMCryptoContext; import javax.xml.crypto.dsig.*; import javax.xml.crypto.dsig.keyinfo.KeyValue; -// import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessController; diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java index 54e1ac4ae89..2c86d8f65ee 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java @@ -67,18 +67,15 @@ public final class DOMManifest extends DOMStructure implements Manifest { if (references == null) { throw new NullPointerException("references cannot be null"); } - this.references = - Collections.unmodifiableList(new ArrayList(references)); + List tempList = + Collections.checkedList(new ArrayList(), + Reference.class); + tempList.addAll(references); + this.references = Collections.unmodifiableList(tempList); if (this.references.isEmpty()) { throw new IllegalArgumentException("list of references must " + "contain at least one entry"); } - for (int i = 0, size = this.references.size(); i < size; i++) { - if (!(this.references.get(i) instanceof Reference)) { - throw new ClassCastException - ("references["+i+"] is not a valid type"); - } - } this.id = id; } @@ -127,7 +124,6 @@ public final class DOMManifest extends DOMStructure implements Manifest { return id; } - @SuppressWarnings("unchecked") static List getManifestReferences(Manifest mf) { return mf.getReferences(); } diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java index a90725b2094..b845d4cb6b2 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java @@ -73,18 +73,13 @@ public final class DOMPGPData extends DOMStructure implements PGPData { if (keyPacket == null) { throw new NullPointerException("keyPacket cannot be null"); } - if (other == null || other.isEmpty()) { - this.externalElements = Collections.emptyList(); - } else { - this.externalElements = - Collections.unmodifiableList(new ArrayList(other)); - for (int i = 0, size = this.externalElements.size(); i < size; i++) { - if (!(this.externalElements.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("other["+i+"] is not a valid PGPData type"); - } - } + List tempList = + Collections.checkedList(new ArrayList(), + XMLStructure.class); + if (other != null) { + tempList.addAll(other); } + this.externalElements = Collections.unmodifiableList(tempList); this.keyPacket = keyPacket.clone(); checkKeyPacket(keyPacket); this.keyId = null; @@ -120,18 +115,13 @@ public final class DOMPGPData extends DOMStructure implements PGPData { if (keyId.length != 8) { throw new IllegalArgumentException("keyId must be 8 bytes long"); } - if (other == null || other.isEmpty()) { - this.externalElements = Collections.emptyList(); - } else { - this.externalElements = - Collections.unmodifiableList(new ArrayList(other)); - for (int i = 0, size = this.externalElements.size(); i < size; i++) { - if (!(this.externalElements.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("other["+i+"] is not a valid PGPData type"); - } - } + List tempList = + Collections.checkedList(new ArrayList(), + XMLStructure.class); + if (other != null) { + tempList.addAll(other); } + this.externalElements = Collections.unmodifiableList(tempList); this.keyId = keyId.clone(); this.keyPacket = keyPacket == null ? null : keyPacket.clone(); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java index d29782065fe..2cc0f993db5 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java @@ -147,29 +147,21 @@ public final class DOMReference extends DOMStructure if (dm == null) { throw new NullPointerException("DigestMethod must be non-null"); } - if (appliedTransforms == null) { - this.allTransforms = new ArrayList(); - } else { - this.allTransforms = new ArrayList(appliedTransforms); - for (int i = 0, size = this.allTransforms.size(); i < size; i++) { - if (!(this.allTransforms.get(i) instanceof Transform)) { - throw new ClassCastException - ("appliedTransforms["+i+"] is not a valid type"); - } - } + List tempList = + Collections.checkedList(new ArrayList(), + Transform.class); + if (appliedTransforms != null) { + tempList.addAll(appliedTransforms); } - if (transforms == null) { - this.transforms = Collections.emptyList(); - } else { - this.transforms = new ArrayList(transforms); - for (int i = 0, size = this.transforms.size(); i < size; i++) { - if (!(this.transforms.get(i) instanceof Transform)) { - throw new ClassCastException - ("transforms["+i+"] is not a valid type"); - } - } - this.allTransforms.addAll(this.transforms); + List tempList2 = + Collections.checkedList(new ArrayList(), + Transform.class); + if (transforms != null) { + tempList.addAll(transforms); + tempList2.addAll(transforms); } + this.allTransforms = Collections.unmodifiableList(tempList); + this.transforms = tempList2; this.digestMethod = dm; this.uri = uri; if ((uri != null) && (!uri.equals(""))) { @@ -642,7 +634,7 @@ public final class DOMReference extends DOMStructure if (xsi.isNodeSet()) { try { final Set s = xsi.getNodeSet(); - return new NodeSetData() { + return new NodeSetData() { public Iterator iterator() { return s.iterator(); } }; } catch (Exception e) { diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java index ca5e5a5b997..eed6fffe5a5 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java @@ -90,18 +90,13 @@ public final class DOMRetrievalMethod extends DOMStructure if (uri == null) { throw new NullPointerException("uri cannot be null"); } - if (transforms == null || transforms.isEmpty()) { - this.transforms = Collections.emptyList(); - } else { - this.transforms = Collections.unmodifiableList( - new ArrayList(transforms)); - for (int i = 0, size = this.transforms.size(); i < size; i++) { - if (!(this.transforms.get(i) instanceof Transform)) { - throw new ClassCastException - ("transforms["+i+"] is not a valid type"); - } - } + List tempList = + Collections.checkedList(new ArrayList(), + Transform.class); + if (transforms != null) { + tempList.addAll(transforms); } + this.transforms = Collections.unmodifiableList(tempList); this.uri = uri; if (!uri.equals("")) { try { @@ -244,7 +239,7 @@ public final class DOMRetrievalMethod extends DOMStructure // guard against RetrievalMethod loops if ((data instanceof NodeSetData) && Utils.secureValidation(context)) { - NodeSetData nsd = (NodeSetData)data; + NodeSetData nsd = (NodeSetData)data; Iterator i = nsd.iterator(); if (i.hasNext()) { Node root = (Node)i.next(); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java index 26389e9b7ae..0923eb41c40 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java @@ -69,18 +69,15 @@ public final class DOMSignatureProperties extends DOMStructure { if (properties == null) { throw new NullPointerException("properties cannot be null"); - } else if (properties.isEmpty()) { - throw new IllegalArgumentException("properties cannot be empty"); - } else { - this.properties = Collections.unmodifiableList( - new ArrayList(properties)); - for (int i = 0, size = this.properties.size(); i < size; i++) { - if (!(this.properties.get(i) instanceof SignatureProperty)) { - throw new ClassCastException - ("properties["+i+"] is not a valid type"); - } - } } + List tempList = + Collections.checkedList(new ArrayList(), + SignatureProperty.class); + tempList.addAll(properties); + if (tempList.isEmpty()) { + throw new IllegalArgumentException("properties cannot be empty"); + } + this.properties = Collections.unmodifiableList(tempList); this.id = id; } diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java index 11d2e679ebf..2b43dffda92 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java @@ -71,20 +71,18 @@ public final class DOMSignatureProperty extends DOMStructure { if (target == null) { throw new NullPointerException("target cannot be null"); - } else if (content == null) { - throw new NullPointerException("content cannot be null"); - } else if (content.isEmpty()) { - throw new IllegalArgumentException("content cannot be empty"); - } else { - this.content = Collections.unmodifiableList( - new ArrayList(content)); - for (int i = 0, size = this.content.size(); i < size; i++) { - if (!(this.content.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("content["+i+"] is not a valid type"); - } - } } + if (content == null) { + throw new NullPointerException("content cannot be null"); + } + List tempList = + Collections.checkedList(new ArrayList(), + XMLStructure.class); + tempList.addAll(content); + if (tempList.isEmpty()) { + throw new IllegalArgumentException("content cannot be empty"); + } + this.content = Collections.unmodifiableList(tempList); this.target = target; this.id = id; } @@ -169,7 +167,6 @@ public final class DOMSignatureProperty extends DOMStructure boolean idsEqual = (id == null ? osp.getId() == null : id.equals(osp.getId())); - @SuppressWarnings("unchecked") List ospContent = osp.getContent(); return (equalsContent(ospContent) && target.equals(osp.getTarget()) && idsEqual); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java index 71a13c3605c..c18a462fba7 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java @@ -100,19 +100,14 @@ public final class DOMSignedInfo extends DOMStructure implements SignedInfo { } this.canonicalizationMethod = cm; this.signatureMethod = sm; - this.references = Collections.unmodifiableList( - new ArrayList(references)); - if (this.references.isEmpty()) { - throw new IllegalArgumentException("list of references must " + - "contain at least one entry"); - } - for (int i = 0, size = this.references.size(); i < size; i++) { - Object obj = this.references.get(i); - if (!(obj instanceof Reference)) { - throw new ClassCastException("list of references contains " + - "an illegal type"); - } + List tempList = + Collections.checkedList(new ArrayList(), + Reference.class); + tempList.addAll(references); + if (tempList.isEmpty()) { + throw new IllegalArgumentException("references cannot be empty"); } + this.references = Collections.unmodifiableList(tempList); } /** diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java index c0ac945b893..6c43f5f6c7e 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java @@ -44,7 +44,7 @@ import org.w3c.dom.Node; * directly on the subdocument and there is no need to convert it * first to an XPath node-set. */ -public class DOMSubTreeData implements NodeSetData { +public class DOMSubTreeData implements NodeSetData { private boolean excludeComments; private Node root; diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java index 4d4a647642e..964d0d238b4 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java @@ -367,9 +367,7 @@ public class DOMUtils { private static boolean paramsEqual(XPathFilter2ParameterSpec spec1, XPathFilter2ParameterSpec spec2) { - @SuppressWarnings("unchecked") List types = spec1.getXPathList(); - @SuppressWarnings("unchecked") List otypes = spec2.getXPathList(); int size = types.size(); if (size != otypes.size()) { diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java index 72740c709bc..7c27607e236 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java @@ -135,7 +135,7 @@ public final class DOMX509Data extends DOMStructure implements X509Data { this.content = Collections.unmodifiableList(content); } - public List getContent() { + public List getContent() { return content; } @@ -265,7 +265,7 @@ public final class DOMX509Data extends DOMStructure implements X509Data { } X509Data oxd = (X509Data)o; - @SuppressWarnings("unchecked") List ocontent = oxd.getContent(); + List ocontent = oxd.getContent(); int size = content.size(); if (size != ocontent.size()) { return false; diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java index 7abd1e63523..6ce2c4ac736 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java @@ -70,18 +70,13 @@ public final class DOMXMLObject extends DOMStructure implements XMLObject { public DOMXMLObject(List content, String id, String mimeType, String encoding) { - if (content == null || content.isEmpty()) { - this.content = Collections.emptyList(); - } else { - this.content = Collections.unmodifiableList( - new ArrayList(content)); - for (int i = 0, size = this.content.size(); i < size; i++) { - if (!(this.content.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("content["+i+"] is not a valid type"); - } - } + List tempList = + Collections.checkedList(new ArrayList(), + XMLStructure.class); + if (content != null) { + tempList.addAll(content); } + this.content = Collections.unmodifiableList(tempList); this.id = id; this.mimeType = mimeType; this.encoding = encoding; @@ -204,7 +199,6 @@ public final class DOMXMLObject extends DOMStructure implements XMLObject { (mimeType == null ? oxo.getMimeType() == null : mimeType.equals(oxo.getMimeType())); - @SuppressWarnings("unchecked") List oxoContent = oxo.getContent(); return (idsEqual && encodingsEqual && mimeTypesEqual && equalsContent(oxoContent)); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java index c4478932ff1..f0a614a9714 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java @@ -109,18 +109,13 @@ public final class DOMXMLSignature extends DOMStructure this.si = si; this.id = id; this.sv = new DOMSignatureValue(signatureValueId); - if (objs == null) { - this.objects = Collections.emptyList(); - } else { - this.objects = - Collections.unmodifiableList(new ArrayList(objs)); - for (int i = 0, size = this.objects.size(); i < size; i++) { - if (!(this.objects.get(i) instanceof XMLObject)) { - throw new ClassCastException - ("objs["+i+"] is not an XMLObject"); - } - } + List tempList = + Collections.checkedList(new ArrayList(), + XMLObject.class); + if (objs != null) { + tempList.addAll(objs); } + this.objects = Collections.unmodifiableList(tempList); this.ki = ki; } @@ -270,7 +265,6 @@ public final class DOMXMLSignature extends DOMStructure } // validate all References - @SuppressWarnings("unchecked") List refs = this.si.getReferences(); boolean validateRefs = true; for (int i = 0, size = refs.size(); validateRefs && i < size; i++) { @@ -297,7 +291,6 @@ public final class DOMXMLSignature extends DOMStructure { for (int i=0, size=objects.size(); validateMans && i < size; i++) { XMLObject xo = objects.get(i); - @SuppressWarnings("unchecked") List content = xo.getContent(); int csize = content.size(); for (int j = 0; validateMans && j < csize; j++) { @@ -307,7 +300,6 @@ public final class DOMXMLSignature extends DOMStructure log.log(java.util.logging.Level.FINE, "validating manifest"); } Manifest man = (Manifest)xs; - @SuppressWarnings("unchecked") List manRefs = man.getReferences(); int rsize = manRefs.size(); for (int k = 0; validateMans && k < rsize; k++) { @@ -348,20 +340,17 @@ public final class DOMXMLSignature extends DOMStructure signatureIdMap = new HashMap(); signatureIdMap.put(id, this); signatureIdMap.put(si.getId(), si); - @SuppressWarnings("unchecked") List refs = si.getReferences(); for (Reference ref : refs) { signatureIdMap.put(ref.getId(), ref); } for (XMLObject obj : objects) { signatureIdMap.put(obj.getId(), obj); - @SuppressWarnings("unchecked") List content = obj.getContent(); for (XMLStructure xs : content) { if (xs instanceof Manifest) { Manifest man = (Manifest)xs; signatureIdMap.put(man.getId(), man); - @SuppressWarnings("unchecked") List manRefs = man.getReferences(); for (Reference ref : manRefs) { allReferences.add(ref); @@ -483,7 +472,6 @@ public final class DOMXMLSignature extends DOMStructure // reference dependencies in the XPath Transform - so be on // the safe side, and skip and do at end in the final sweep if (uri.length() == 0) { - @SuppressWarnings("unchecked") List transforms = ref.getTransforms(); for (Transform transform : transforms) { String transformAlg = transform.getAlgorithm(); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java index 0e63028c777..13e6221dd0f 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java @@ -58,9 +58,8 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory { return new DOMXMLSignature(si, ki, null, null, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki, - List objects, String id, String signatureValueId) { + List objects, String id, String signatureValueId) { return new DOMXMLSignature(si, ki, objects, id, signatureValueId); } @@ -68,16 +67,14 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory { return newReference(uri, dm, null, null, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Reference newReference(String uri, DigestMethod dm, List transforms, - String type, String id) { + public Reference newReference(String uri, DigestMethod dm, + List transforms, String type, String id) { return new DOMReference(uri, type, dm, transforms, id, getProvider()); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public Reference newReference(String uri, DigestMethod dm, - List appliedTransforms, Data result, List transforms, String type, - String id) { + List appliedTransforms, Data result, + List transforms, String type, String id) { if (appliedTransforms == null) { throw new NullPointerException("appliedTransforms cannot be null"); } @@ -91,9 +88,9 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory { (uri, type, dm, appliedTransforms, result, transforms, id, getProvider()); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Reference newReference(String uri, DigestMethod dm, List transforms, - String type, String id, byte[] digestValue) { + public Reference newReference(String uri, DigestMethod dm, + List transforms, String type, String id, + byte[] digestValue) { if (digestValue == null) { throw new NullPointerException("digestValue cannot be null"); } @@ -101,43 +98,38 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory { (uri, type, dm, null, null, transforms, id, digestValue, getProvider()); } - @SuppressWarnings("rawtypes") public SignedInfo newSignedInfo(CanonicalizationMethod cm, - SignatureMethod sm, List references) { + SignatureMethod sm, List references) { return newSignedInfo(cm, sm, references, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public SignedInfo newSignedInfo(CanonicalizationMethod cm, - SignatureMethod sm, List references, String id) { + SignatureMethod sm, List references, String id) { return new DOMSignedInfo(cm, sm, references, id); } // Object factory methods - @SuppressWarnings({ "unchecked", "rawtypes" }) - public XMLObject newXMLObject(List content, String id, String mimeType, - String encoding) { + public XMLObject newXMLObject(List content, + String id, String mimeType, String encoding) { return new DOMXMLObject(content, id, mimeType, encoding); } - @SuppressWarnings("rawtypes") - public Manifest newManifest(List references) { + public Manifest newManifest(List references) { return newManifest(references, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Manifest newManifest(List references, String id) { + public Manifest newManifest(List references, + String id) { return new DOMManifest(references, id); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public SignatureProperties newSignatureProperties(List props, String id) { + public SignatureProperties newSignatureProperties( + List props, String id) { return new DOMSignatureProperties(props, id); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public SignatureProperty newSignatureProperty - (List info, String target, String id) { + (List info, String target, String id) { return new DOMSignatureProperty(info, target, id); } diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java index 0215029b489..0fc63f35526 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java @@ -133,7 +133,6 @@ public final class DOMXPathFilter2Transform extends ApacheTransform { String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2); String qname = (prefix == null || prefix.length() == 0) ? "xmlns" : "xmlns:" + prefix; - @SuppressWarnings("unchecked") List xpathList = xp.getXPathList(); for (XPathType xpathType : xpathList) { Element elem = DOMUtils.createElement(ownerDoc, "XPath", @@ -146,7 +145,6 @@ public final class DOMXPathFilter2Transform extends ApacheTransform { Transform.XPATH2); // add namespace attributes, if necessary - @SuppressWarnings("unchecked") Set> entries = xpathType.getNamespaceMap().entrySet(); for (Map.Entry entry : entries) { diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java index e88eeb8606a..d22922bcfb3 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java @@ -99,7 +99,6 @@ public final class DOMXPathTransform extends ApacheTransform { xpathElem.appendChild(ownerDoc.createTextNode(xp.getXPath())); // add namespace attributes, if necessary - @SuppressWarnings("unchecked") Set> entries = xp.getNamespaceMap().entrySet(); for (Map.Entry entry : entries) { diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java index dd59caef60e..6aca319fb2c 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java @@ -70,10 +70,10 @@ public final class Utils { * @param i the Iterator * @return the Set of Nodes */ - static Set toNodeSet(Iterator i) { + static Set toNodeSet(Iterator i) { Set nodeSet = new HashSet(); while (i.hasNext()) { - Node n = i.next(); + Node n = (Node)i.next(); nodeSet.add(n); // insert attributes nodes to comply with XPath if (n.getNodeType() == Node.ELEMENT_NODE) { diff --git a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java index 6cc7bbb6865..29261e2f17e 100644 --- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java +++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java @@ -23,7 +23,7 @@ /** * @test - * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 + * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949 * @summary Basic unit tests for generating XML Signatures with JSR 105 * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java * X509KeySelector.java GenerationTests.java @@ -377,7 +377,7 @@ public class GenerationTests { static void test_create_signature_x509_crt_crl() throws Exception { System.out.println("* Generating signature-x509-crt-crl.xml"); - List xds = new ArrayList(); + List xds = new ArrayList<>(); CertificateFactory cf = CertificateFactory.getInstance("X.509"); xds.add(signingCert); FileInputStream fis = new FileInputStream(CRL); @@ -444,7 +444,7 @@ public class GenerationTests { SignedInfo si = fac.newSignedInfo(withoutComments, rsaSha1, refs); // create objects - List objs = new ArrayList(); + List objs = new ArrayList<>(); // Object 1 List manRefs = Collections.singletonList @@ -559,7 +559,7 @@ public class GenerationTests { System.out.println("* Generating signature.xml"); // create references - List refs = new ArrayList(); + List refs = new ArrayList<>(); // Reference 1 refs.add(fac.newReference(STYLESHEET, sha1)); @@ -610,7 +610,7 @@ public class GenerationTests { SignatureProperties.TYPE, null)); // Reference 8 - List transforms = new ArrayList(); + List transforms = new ArrayList<>(); transforms.add(fac.newTransform (Transform.ENVELOPED, (TransformParameterSpec) null)); refs.add(fac.newReference("", sha1, transforms, null, null)); @@ -685,7 +685,7 @@ public class GenerationTests { Document doc = db.newDocument(); // create objects - List objs = new ArrayList(); + List objs = new ArrayList<>(); // Object 1 objs.add(fac.newXMLObject(Collections.singletonList @@ -705,7 +705,7 @@ public class GenerationTests { (new DOMStructure(nc)), "object-3", null, null)); // Manifest - List manRefs = new ArrayList(); + List manRefs = new ArrayList<>(); // Manifest Reference 1 manRefs.add(fac.newReference(STYLESHEET, @@ -715,7 +715,7 @@ public class GenerationTests { manRefs.add(fac.newReference("#reference-1", sha1)); // Manifest Reference 3 - List manTrans = new ArrayList(); + List manTrans = new ArrayList<>(); String xslt = "" + " xds = new ArrayList(); + List xds = new ArrayList<>(); xds.add("CN=User"); xds.add(kifac.newX509IssuerSerial ("CN=User", new BigInteger("45ef2729", 16))); @@ -930,7 +930,7 @@ public class GenerationTests { static void test_create_exc_signature() throws Exception { System.out.println("* Generating exc_signature.xml"); - List refs = new ArrayList(4); + List refs = new ArrayList<>(4); // create reference 1 refs.add(fac.newReference @@ -942,7 +942,7 @@ public class GenerationTests { null, null)); // create reference 2 - List prefixList = new ArrayList(2); + List prefixList = new ArrayList<>(2); prefixList.add("bar"); prefixList.add("#default"); ExcC14NParameterSpec params = new ExcC14NParameterSpec(prefixList); @@ -963,7 +963,7 @@ public class GenerationTests { null, null)); // create reference 4 - prefixList = new ArrayList(2); + prefixList = new ArrayList<>(2); prefixList.add("bar"); prefixList.add("#default"); params = new ExcC14NParameterSpec(prefixList); @@ -982,7 +982,7 @@ public class GenerationTests { fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), refs); // create KeyInfo - List kits = new ArrayList(2); + List kits = new ArrayList<>(2); kits.add(kifac.newKeyValue(validatingKey)); KeyInfo ki = kifac.newKeyInfo(kits); @@ -1027,10 +1027,10 @@ public class GenerationTests { static void test_create_sign_spec() throws Exception { System.out.println("* Generating sign-spec.xml"); - List refs = new ArrayList(2); + List refs = new ArrayList<>(2); // create reference 1 - List types = new ArrayList(3); + List types = new ArrayList<>(3); types.add(new XPathType(" //ToBeSigned ", XPathType.Filter.INTERSECT)); types.add(new XPathType(" //NotToBeSigned ", XPathType.Filter.SUBTRACT)); @@ -1043,7 +1043,7 @@ public class GenerationTests { null, null)); // create reference 2 - List trans2 = new ArrayList(2); + List trans2 = new ArrayList<>(2); trans2.add(fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null)); XPathFilter2ParameterSpec xp2 = new XPathFilter2ParameterSpec @@ -1061,9 +1061,9 @@ public class GenerationTests { fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), refs); // create KeyInfo - List kits = new ArrayList(2); + List kits = new ArrayList<>(2); kits.add(kifac.newKeyValue(validatingKey)); - List xds = new ArrayList(2); + List xds = new ArrayList<>(2); xds.add("CN=User"); xds.add(signingCert); kits.add(kifac.newX509Data(xds)); diff --git a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java index 290c55b89da..b8f4d324893 100644 --- a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java +++ b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java @@ -101,9 +101,7 @@ class KeySelectors { throw new KeySelectorException("Null KeyInfo object!"); } // search for X509Data in keyinfo - Iterator iter = keyInfo.getContent().iterator(); - while (iter.hasNext()) { - XMLStructure kiType = (XMLStructure) iter.next(); + for (XMLStructure kiType : keyInfo.getContent()) { if (kiType instanceof X509Data) { X509Data xd = (X509Data) kiType; Object[] entries = xd.getContent().toArray(); @@ -114,10 +112,8 @@ class KeySelectors { crl = (X509CRL) entries[i]; } } - Iterator xi = xd.getContent().iterator(); boolean hasCRL = false; - while (xi.hasNext()) { - Object o = xi.next(); + for (Object o : xd.getContent()) { // skip non-X509Certificate entries if (o instanceof X509Certificate) { if ((purpose != KeySelector.Purpose.VERIFY) && @@ -152,10 +148,8 @@ class KeySelectors { throw new KeySelectorException("Null KeyInfo object!"); } SignatureMethod sm = (SignatureMethod) method; - List list = keyInfo.getContent(); - for (int i = 0; i < list.size(); i++) { - XMLStructure xmlStructure = (XMLStructure) list.get(i); + for (XMLStructure xmlStructure : keyInfo.getContent()) { if (xmlStructure instanceof KeyValue) { PublicKey pk = null; try { @@ -282,9 +276,7 @@ class KeySelectors { if (keyInfo == null) { throw new KeySelectorException("Null KeyInfo object!"); } - Iterator iter = keyInfo.getContent().iterator(); - while (iter.hasNext()) { - XMLStructure xmlStructure = (XMLStructure) iter.next(); + for (XMLStructure xmlStructure : keyInfo.getContent()) { try { if (xmlStructure instanceof KeyName) { String name = ((KeyName)xmlStructure).getName(); @@ -330,14 +322,12 @@ class KeySelectors { } } else if (xmlStructure instanceof X509Data) { List content = ((X509Data)xmlStructure).getContent(); - int size = content.size(); Vector result = null; // Lookup the public key using the information // specified in X509Data element, i.e. searching // over the collection of certificate files under // "certs" subdirectory and return those match. - for (int k = 0; k i = + signature.getSignedInfo().getReferences().iterator(); + for (int j = 0; i.hasNext(); j++) { + Reference ref = i.next(); if (!digestInputEqual(ref)) { throw new Exception ("cached data for Reference[" + j + "] is not correct"); @@ -88,10 +89,10 @@ class SignatureValidator { // check that dereferenced data does not contain comment nodes if (ref.getURI() == "") { System.out.println("checking deref data"); - NodeSetData data = (NodeSetData) ref.getDereferencedData(); - Iterator ni = data.iterator(); - while (ni.hasNext()) { - Node n = (Node) ni.next(); + @SuppressWarnings("unchecked") + NodeSetData data = + (NodeSetData)ref.getDereferencedData(); + for (Node n : data) { if (n.getNodeType() == Node.COMMENT_NODE) { throw new Exception("dereferenced data for " + " Reference[" + j + " contains comment node"); diff --git a/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java b/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java index a21e42910b4..9e3081379c0 100644 --- a/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java +++ b/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java @@ -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 @@ -139,9 +139,7 @@ class X509KeySelector extends KeySelector { } // Iterate through KeyInfo types - Iterator i = keyInfo.getContent().iterator(); - while (i.hasNext()) { - XMLStructure kiType = (XMLStructure) i.next(); + for (XMLStructure kiType : keyInfo.getContent()) { // check X509Data if (kiType instanceof X509Data) { X509Data xd = (X509Data) kiType; @@ -303,9 +301,7 @@ class X509KeySelector extends KeySelector { } Collection certs = new ArrayList<>(); - Iterator xi = xd.getContent().iterator(); - while (xi.hasNext()) { - Object o = xi.next(); + for (Object o : xd.getContent()) { // check X509IssuerSerial if (o instanceof X509IssuerSerial) { X509IssuerSerial xis = (X509IssuerSerial) o; From c6db8bd7c761bc0a6d0b3ad25bd8fffa149b0418 Mon Sep 17 00:00:00 2001 From: Olivier Lagneau Date: Fri, 21 Nov 2014 19:31:37 +0100 Subject: [PATCH 116/159] 8062037: java/lang/instrument/RetransformBigClass.sh should be quarantined Add RedefineBigClass.sh and RetransformBigClss.sh in ProblemList.txt Reviewed-by: dcubed, sspitsyn --- jdk/test/ProblemList.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 449db57f61f..03c2bdc7453 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -127,6 +127,10 @@ # 8058536 java/lang/instrument/NativeMethodPrefixAgent.java generic-all +# 8061177 +java/lang/instrument/RedefineBigClass.sh generic-all +java/lang/instrument/RetransformBigClass.sh generic-all + ############################################################################ # jdk_management From da2c303927c30e9fed1c6cd4677bd2250a1c4d38 Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Fri, 21 Nov 2014 13:32:17 -0800 Subject: [PATCH 117/159] 8056313: TEST_BUG: java/util/Timer/NameConstructors.java fails intermittently Reviewed-by: lancea, rriggs --- .../java/util/Timer/NameConstructors.java | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/jdk/test/java/util/Timer/NameConstructors.java b/jdk/test/java/util/Timer/NameConstructors.java index bc74522e473..fbf1649ef06 100644 --- a/jdk/test/java/util/Timer/NameConstructors.java +++ b/jdk/test/java/util/Timer/NameConstructors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -23,37 +23,42 @@ /* * @test - * @bug 4279061 + * @bug 4279061 8056313 * @summary Basic test for constructors with thread name */ -import java.util.*; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.LinkedTransferQueue; public class NameConstructors { private static final String NAME1 = "Norm D. Plume"; private static final String NAME2 = "Ann Onymous"; - public static void main (String[] args) throws Exception { - Random rnd = new Random(); + public static void main (String[] args) throws InterruptedException { test(new Timer(NAME1), NAME1); test(new Timer(NAME2, true), NAME2); } - private static boolean done, passed; + public static void test(Timer timer, String expected) throws InterruptedException { + try { + LinkedTransferQueue queue = new LinkedTransferQueue<>(); - public static void test(Timer timer, final String name) throws Exception { - done = passed = false; + TimerTask task = new TimerTask() { + public void run() { + queue.put(Thread.currentThread().getName()); + } + }; - TimerTask task = new TimerTask() { - public void run() { - passed = Thread.currentThread().getName().equals(name); - done = true; + timer.schedule(task, 0L); // immediately + String actual = queue.take(); + + if (!expected.equals(actual)) { + throw new AssertionError( + String.format("expected='%s', actual='%s'", expected, actual)); } - }; - timer.schedule(task, 0); // Immediate - Thread.sleep(500); - if (!(done && passed)) - throw new RuntimeException(done + " : " + passed); - timer.cancel(); + } finally { + timer.cancel(); + } } } From 5ffaffb47eeb6b58d71979b9c620da369e467260 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Fri, 21 Nov 2014 16:30:02 -0800 Subject: [PATCH 118/159] 8065159: AttributedString has quadratic resize algorithm Grow backing arrays geometrically instead of arithmetically Reviewed-by: naoto, okutsu --- .../classes/java/text/AttributedString.java | 53 ++++++++----------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/text/AttributedString.java b/jdk/src/java.base/share/classes/java/text/AttributedString.java index 2e82924510a..daceb62a70f 100644 --- a/jdk/src/java.base/share/classes/java/text/AttributedString.java +++ b/jdk/src/java.base/share/classes/java/text/AttributedString.java @@ -48,21 +48,18 @@ import java.text.AttributedCharacterIterator.Attribute; */ public class AttributedString { - - // since there are no vectors of int, we have to use arrays. - // We allocate them in chunks of 10 elements so we don't have to allocate all the time. - private static final int ARRAY_SIZE_INCREMENT = 10; - // field holding the text String text; - // fields holding run attribute information - // run attributes are organized by run - int runArraySize; // current size of the arrays - int runCount; // actual number of runs, <= runArraySize - int runStarts[]; // start index for each run - Vector runAttributes[]; // vector of attribute keys for each run - Vector runAttributeValues[]; // parallel vector of attribute values for each run + // Fields holding run attribute information. + // Run attributes are organized by run. + // Arrays are always of equal lengths (the current capacity). + // Since there are no vectors of int, we have to use arrays. + private static final int INITIAL_CAPACITY = 10; + int runCount; // actual number of runs, <= current capacity + int[] runStarts; // start index for each run + Vector[] runAttributes; // vector of attribute keys for each run + Vector[] runAttributeValues; // parallel vector of attribute values for each run /** * Constructs an AttributedString instance with the given @@ -416,18 +413,17 @@ public class AttributedString { private final void createRunAttributeDataVectors() { // use temporary variables so things remain consistent in case of an exception - int newRunStarts[] = new int[ARRAY_SIZE_INCREMENT]; + int[] newRunStarts = new int[INITIAL_CAPACITY]; @SuppressWarnings("unchecked") - Vector newRunAttributes[] = (Vector[]) new Vector[ARRAY_SIZE_INCREMENT]; + Vector[] newRunAttributes = (Vector[]) new Vector[INITIAL_CAPACITY]; @SuppressWarnings("unchecked") - Vector newRunAttributeValues[] = (Vector[]) new Vector[ARRAY_SIZE_INCREMENT]; + Vector[] newRunAttributeValues = (Vector[]) new Vector[INITIAL_CAPACITY]; runStarts = newRunStarts; runAttributes = newRunAttributes; runAttributeValues = newRunAttributeValues; - runArraySize = ARRAY_SIZE_INCREMENT; runCount = 1; // assume initial run starting at index 0 } @@ -465,25 +461,22 @@ public class AttributedString { // we'll have to break up a run // first, make sure we have enough space in our arrays - if (runCount == runArraySize) { - int newArraySize = runArraySize + ARRAY_SIZE_INCREMENT; - int newRunStarts[] = new int[newArraySize]; + int currentCapacity = runStarts.length; + if (runCount == currentCapacity) { + // We need to resize - we grow capacity by 25%. + int newCapacity = currentCapacity + (currentCapacity >> 2); - @SuppressWarnings("unchecked") - Vector newRunAttributes[] = (Vector[]) new Vector[newArraySize]; + // use temporary variables so things remain consistent in case of an exception + int[] newRunStarts = + Arrays.copyOf(runStarts, newCapacity); + Vector[] newRunAttributes = + Arrays.copyOf(runAttributes, newCapacity); + Vector[] newRunAttributeValues = + Arrays.copyOf(runAttributeValues, newCapacity); - @SuppressWarnings("unchecked") - Vector newRunAttributeValues[] = (Vector[]) new Vector[newArraySize]; - - for (int i = 0; i < runArraySize; i++) { - newRunStarts[i] = runStarts[i]; - newRunAttributes[i] = runAttributes[i]; - newRunAttributeValues[i] = runAttributeValues[i]; - } runStarts = newRunStarts; runAttributes = newRunAttributes; runAttributeValues = newRunAttributeValues; - runArraySize = newArraySize; } // make copies of the attribute information of the old run that the new one used to be part of From e3e615d6bdced6b25e009d6d3d87b4fd4a60e6d5 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Sat, 22 Nov 2014 14:56:16 +0000 Subject: [PATCH 119/159] 8065222: sun/net/www/protocol/http/B6369510.java doesn't execute as expected Changed address.getHostName() to InetAddress.getLocalHost().getHostName() in URL construction in test's doClient method Reviewed-by: chegar --- jdk/test/sun/net/www/protocol/http/B6369510.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jdk/test/sun/net/www/protocol/http/B6369510.java b/jdk/test/sun/net/www/protocol/http/B6369510.java index 6d71e819892..c8aa023c636 100644 --- a/jdk/test/sun/net/www/protocol/http/B6369510.java +++ b/jdk/test/sun/net/www/protocol/http/B6369510.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -40,7 +40,7 @@ public class B6369510 com.sun.net.httpserver.HttpServer httpServer; ExecutorService executorService; - public static void main(String[] args) + public static void main(String[] args) throws Exception { new B6369510(); } @@ -58,13 +58,15 @@ public class B6369510 void doClient() { try { InetSocketAddress address = httpServer.getAddress(); + String urlString = "http://" + InetAddress.getLocalHost().getHostName() + ":" + address.getPort() + "/test/"; + System.out.println("URL == " + urlString); // GET Request - URL url = new URL("http://" + address.getHostName() + ":" + address.getPort() + "/test/"); + URL url = new URL("http://" + InetAddress.getLocalHost().getHostName() + ":" + address.getPort() + "/test/"); HttpURLConnection uc = (HttpURLConnection)url.openConnection(); int resp = uc.getResponseCode(); if (resp != 200) - throw new RuntimeException("Failed: Response code from GET is not 200"); + throw new RuntimeException("Failed: Response code from GET is not 200 RSP == " + resp); System.out.println("Response code from GET = 200 OK"); @@ -75,12 +77,13 @@ public class B6369510 OutputStream os = uc.getOutputStream(); resp = uc.getResponseCode(); if (resp != 200) - throw new RuntimeException("Failed: Response code form POST is not 200"); + throw new RuntimeException("Failed: Response code form POST is not 200 RSP == " + resp); System.out.println("Response code from POST = 200 OK"); } catch (IOException e) { e.printStackTrace(); + throw new RuntimeException("Failed with IOException"); } finally { httpServer.stop(1); executorService.shutdown(); From c7b43102bc89a4aedd9bad7b14bb831753febb6e Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Mon, 24 Nov 2014 11:40:49 +0100 Subject: [PATCH 120/159] 8065412: generated source to compile .properties file incorreectly includes the module name in the package name Reviewed-by: tbell, mchung, ihse --- jdk/make/gensrc/GensrcProperties.gmk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jdk/make/gensrc/GensrcProperties.gmk b/jdk/make/gensrc/GensrcProperties.gmk index 0b0520c6fd9..6d7e1cc8489 100644 --- a/jdk/make/gensrc/GensrcProperties.gmk +++ b/jdk/make/gensrc/GensrcProperties.gmk @@ -58,13 +58,15 @@ define SetupCompileProperties $1_CLASS := $3 # Convert .../src//share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties - # to .../langtools/gensrc//com/sun/tools/javac/resources/javac_zh_CN.java + # to .../support/gensrc//com/sun/tools/javac/resources/javac_zh_CN.java # Strip away prefix and suffix, leaving for example only: # "/share/classes/com/sun/tools/javac/resources/javac_zh_CN" $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \ $(JDK_OUTPUTDIR)/gensrc/%, \ $$(patsubst %.properties, %.java, \ - $$(subst /share/classes,, $$($1_SRCS)))) + $$(subst /$(OPENJDK_TARGET_OS)/classes,, \ + $$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \ + $$(subst /share/classes,, $$($1_SRCS)))))) # Generate the package dirs for the to be generated java files. Sort to remove # duplicates. From 65d007d4453723bfcfe07edeb9a00a66ea869b4a Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Mon, 24 Nov 2014 11:53:47 +0100 Subject: [PATCH 121/159] 8065138: Encodings.isRecognizedEnconding sometimes fails to recognize 'UTF8' Reviewed-by: dfuchs --- make/common/JavaCompilation.gmk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 5c3ea73ca7d..1f6d5f501f5 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -400,13 +400,15 @@ define add_file_to_clean # Now we can setup the depency that will trigger the copying. $$($1_BIN)$$($2_TARGET) : $2 $(MKDIR) -p $$(@D) - $(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \ + export LC_ALL=C ; $(CAT) $$< \ + | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \ -e 's/\([^\\]\)!/\1\\!/g' -e 's/#.*/#/g' \ | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \ | $(SED) -e '/^#/d' -e '/^$$$$/d' \ -e :a -e '/\\$$$$/N; s/\\\n//; ta' \ -e 's/^[ ]*//;s/[ ]*$$$$//' \ - -e 's/\\=/=/' | LC_ALL=C $(SORT) > $$@ + -e 's/\\=/=/' \ + | $(SORT) > $$@ $(CHMOD) -f ug+w $$@ # And do not forget this target From e9f4e57a6b6aa72a533d39c2c7470663991bca1c Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 26 Nov 2014 14:59:10 +0100 Subject: [PATCH 122/159] 8065911: Introduce EvalDebugWrapper for all Setup* macros Reviewed-by: erikj --- make/common/IdlCompilation.gmk | 23 +++- make/common/JavaCompilation.gmk | 188 ++++++++++++----------------- make/common/MakeBase.gmk | 11 ++ make/common/NativeCompilation.gmk | 61 ++++++---- make/common/RMICompilation.gmk | 31 +++-- make/common/TextFileProcessing.gmk | 24 ++-- make/common/ZipArchive.gmk | 113 +++++++++++++++++ 7 files changed, 286 insertions(+), 165 deletions(-) create mode 100644 make/common/ZipArchive.gmk diff --git a/make/common/IdlCompilation.gmk b/make/common/IdlCompilation.gmk index d816f23e613..3fdf979d154 100644 --- a/make/common/IdlCompilation.gmk +++ b/make/common/IdlCompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -75,10 +75,25 @@ define add_idl_package $(RM) -rf $3/$$($4_TMPDIR) endef +# Setup make rules for creating an IDL compilation. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# IDLJ +# SRC +# BIN +# INCLUDES +# EXCLUDES +# OLDIMPLBASES +# DELETES define SetupIdlCompilation - # param 1 is for example BUILD_IDLS - # param 2,3,4,5,6,7,8 are named args. - # IDLJ,SRC,BIN,INCLUDES,EXCLUDES,OLDIMPLBASES,DELETES + $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupIdlCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupIdlCompilationInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk)) diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 1f6d5f501f5..27846c0a924 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -42,17 +42,29 @@ ifeq (,$(_MAKEBASE_GMK)) $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk) endif +# Java compilation needs SetupZipArchive if we're generating a source zip. +include ZipArchive.gmk + FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST +# Setup make rules for defining a Java compiler, which is needed to compile +# Java code. This rule generates no output. +# +# Parameter 1 is the name of the compiler definition. This name needs to be +# passed to SetupJavaCompilation. This name is used as variable prefix. +# +# Remaining parameters are named arguments. These include: +# JVM:=The jvm used to run the javac/javah command +# JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out +# FLAGS:=Flags to be supplied to javac +# SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here +# SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above. define SetupJavaCompiler - # param 1 is for example GENERATE_OLD_BYTECODE or GENERATE_NEW_JDKBYTECODE - # This is the name of the compiler setup. - # param 2-9 are named args. - # JVM:=The jvm used to run the javac/javah command - # JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out - # FLAGS:=Flags to be supplied to javac - # SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here - # SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above. + $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilerInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupJavaCompilerInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupJavaCompiler($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk)) @@ -67,25 +79,32 @@ define SetupJavaCompiler endif endef +# Setup make rules for creating a jar archive. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SRCS:=List of directories in where to find files to add to archive +# SUFFIXES:=File suffixes to include in jar +# INCLUDES:=List of directories/packages in SRCS that should be included +# EXCLUDES:=List of directories/packages in SRCS that should be excluded +# EXCLUDE_FILES:=List of files in SRCS that should be excluded +# EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match. +# JAR:=Jar file to create +# MANIFEST:=Optional manifest file template. +# JARMAIN:=Optional main class to add to manifest +# JARINDEX:=true means generate the index in the jar file. +# SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically +# added to the archive. +# EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest. +# CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable define SetupArchive - # param 1 is for example ARCHIVE_MYPACKAGE - # param 2 are the dependecies - # param 3,4,5,6,7,8,9 are named args. - # SRCS:=List of directories in where to find files to add to archive - # SUFFIXES:=File suffixes to include in jar - # INCLUDES:=List of directories/packages in SRCS that should be included - # EXCLUDES:=List of directories/packages in SRCS that should be excluded - # EXCLUDE_FILES:=List of files in SRCS that should be excluded - # EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match. - # JAR:=Jar file to create - # MANIFEST:=Optional manifest file template. - # JARMAIN:=Optional main class to add to manifest - # JARINDEX:=true means generate the index in the jar file. - # SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically - # added to the archive. - # EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest. - # CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable + $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef +define SetupArchiveInner # NOTE: $2 is dependencies, not a named argument! $(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupArchive($1),,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) @@ -287,69 +306,6 @@ define SetupArchive $1 += $$($1_JAR) endef -define SetupZipArchive - # param 1 is for example ZIP_MYSOURCE - # param 2,3,4,5,6,7,8,9 are named args. - # SRC,ZIP,INCLUDES,INCLUDE_FILES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS - $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) - $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) - $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk)) - - # To avoid running find over too large sets of files, which causes make to crash - # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set - # of directories to run find in, if available. - ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),) - $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \ - $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES)))) - else - $1_FIND_LIST := $$($1_SRC) - endif - - # Find all files in the source tree. - $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST))) - - # Filter on suffixes if set - ifneq ($$($1_SUFFIXES),) - $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS)) - endif - - ifneq ($$($1_INCLUDES),) - ifneq ($$($1_SUFFIXES),) - $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \ - $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES)))) - else - $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES))) - endif - endif - ifneq ($$($1_INCLUDE_FILES),) - $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES)) - endif - ifneq ($$($1_EXCLUDES),) - $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) - $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES))) - $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS)) - endif - - # Use a slightly shorter name for logging, but with enough path to identify this zip. - $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP)) - - # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip. - # I.e. the zip -i and -x options should match the filtering done in the makefile. - # Explicitly excluded files can be given with absolute path. The patsubst solution - # isn't perfect but the likelyhood of an absolute path to match something in a src - # dir is very small. - # If zip has nothing to do, it returns 12 and would fail the build. Check for 12 - # and only fail if it's not. - $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) - $(MKDIR) -p $$(@D) - $(ECHO) Updating $$($1_NAME) - $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true - $(TOUCH) $$@ - - # Add zip to target list - $1 += $$($1_ZIP) -endef - define add_file_to_copy # param 1 = BUILD_MYPACKAGE # parma 2 = The source file to copy. @@ -423,29 +379,39 @@ define replace_space_with_pathsep $1:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$2))) endef +# Setup make rules for compiling Java source code to class files and/or a +# resulting jar file. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC +# JVM:=path to ..bin/java +# ADD_JAVAC_FLAGS:=javac flags to append to the default ones. +# SRC:=one or more directories to search for sources +# BIN:=store classes here +# INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages. +# EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages. +# COPY:=.prp means copy all prp files to the corresponding package in BIN. +# COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo +# CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN. +# CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo +# SRCZIP:=Create a src.zip based on the found sources and copied files. +# INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file! +# EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file! +# "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found. +# JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete +# source roots from SRC. This is sometimes needed when compiling specific subsets of the source. +# HEADERS:=path to directory where all generated c-headers are written. +# DEPENDS:=Extra dependecy +# DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit. define SetupJavaCompilation - # param 1 is for example BUILD_MYPACKAGE - # param 2,3,4,5,6,7,8 are named args. - # SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC - # JVM:=path to ..bin/java - # ADD_JAVAC_FLAGS:=javac flags to append to the default ones. - # SRC:=one or more directories to search for sources - # BIN:=store classes here - # INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages. - # EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages. - # COPY:=.prp means copy all prp files to the corresponding package in BIN. - # COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo - # CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN. - # CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo - # SRCZIP:=Create a src.zip based on the found sources and copied files. - # INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file! - # EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file! - # "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found. - # JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete - # source roots from SRC. This is sometimes needed when compiling specific subsets of the source. - # HEADERS:=path to directory where all generated c-headers are written. - # DEPENDS:=Extra dependecy - # DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit. + $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupJavaCompilationInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk)) diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index b23cd83d8b0..ee02322a2d4 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -380,6 +380,17 @@ define LogSetupMacroEntry $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,$(if $($i),$(NEWLINE) $(strip [$i] $($i)))))) endef +# Support macro for all SetupFoo macros. +define EvalDebugWrapper + $(if $(DEBUG_$1), + $(info -------- <<< Begin expansion of $1) + $(info $2) + $(info -------- >>> End expansion of $1) + ) + + $2 +endef + # Make directory without forking mkdir if not needed define MakeDir ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 3f0e5ecd934..550b58e8064 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -134,32 +134,43 @@ define add_native_source endif endef +# Setup make rules for creating a native binary (a shared library or an +# executable). +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SRC one or more directory roots to scan for C/C++ files. +# LANG C or C++ +# CFLAGS the compiler flags to be used, used both for C and C++. +# CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS. +# LDFLAGS the linker flags to be used, used both for C and C++. +# LDFLAGS_SUFFIX the linker flags to be added last on the commandline +# typically the libraries linked to. +# ARFLAGS the archiver flags to be used +# OBJECT_DIR the directory where we store the object files +# LIBRARY the resulting library file +# PROGRAM the resulting exec file +# INCLUDES only pick source from these directories +# EXCLUDES do not pick source from these directories +# INCLUDE_FILES only compile exactly these files! +# EXCLUDE_FILES with these names +# EXTRA_FILES List of extra files not in any of the SRC dirs +# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run +# RC_FLAGS flags for RC. +# MAPFILE mapfile +# REORDER reorder file +# DEBUG_SYMBOLS add debug symbols (if configured on) +# CC the compiler to use, default is $(CC) +# LDEXE the linker to use for linking executables, default is $(LDEXE) +# OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST define SetupNativeCompilation - # param 1 is for example BUILD_MYPACKAGE - # param 2,3,4,5,6,7,8 are named args. - # SRC one or more directory roots to scan for C/C++ files. - # LANG C or C++ - # CFLAGS the compiler flags to be used, used both for C and C++. - # CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS. - # LDFLAGS the linker flags to be used, used both for C and C++. - # LDFLAGS_SUFFIX the linker flags to be added last on the commandline - # typically the libraries linked to. - # ARFLAGS the archiver flags to be used - # OBJECT_DIR the directory where we store the object files - # LIBRARY the resulting library file - # PROGRAM the resulting exec file - # INCLUDES only pick source from these directories - # EXCLUDES do not pick source from these directories - # INCLUDE_FILES only compile exactly these files! - # EXCLUDE_FILES with these names - # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run - # RC_FLAGS flags for RC. - # MAPFILE mapfile - # REORDER reorder file - # DEBUG_SYMBOLS add debug symbols (if configured on) - # CC the compiler to use, default is $(CC) - # LDEXE the linker to use for linking executables, default is $(LDEXE) - # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST + $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupNativeCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26))) +endef + +define SetupNativeCompilationInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26)) $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk)) diff --git a/make/common/RMICompilation.gmk b/make/common/RMICompilation.gmk index 2c87b70441b..6f4706b1a5d 100644 --- a/make/common/RMICompilation.gmk +++ b/make/common/RMICompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -23,17 +23,26 @@ # questions. # +# Setup make rules for creating an RMI compilation. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# CLASSES:=List of classes to generate stubs for +# CLASSES_DIR:=Directory where to look for classes +# STUB_CLASSES_DIR:=Directory in where to put stub classes +# RUN_V11:=Set to run rmic with -v1.1 +# RUN_V12:=Set to run rmic with -v1.2 +# RUN_IIOP:=Set to run rmic with -iiop +# RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage +# KEEP_GENERATED:=Set to keep generated sources around define SetupRMICompilation - # param 1 is a name for a variable to depend on. - # param 2 and up are named args. - # CLASSES:=List of classes to generate stubs for - # CLASSES_DIR:=Directory where to look for classes - # STUB_CLASSES_DIR:=Directory in where to put stub classes - # RUN_V11:=Set to run rmic with -v1.1 - # RUN_V12:=Set to run rmic with -v1.2 - # RUN_IIOP:=Set to run rmic with -iiop - # RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage - # KEEP_GENERATED:=Set to keep generated sources around + $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupRMICompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupRMICompilationInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk)) diff --git a/make/common/TextFileProcessing.gmk b/make/common/TextFileProcessing.gmk index f5101626b0d..714fa55a54a 100644 --- a/make/common/TextFileProcessing.gmk +++ b/make/common/TextFileProcessing.gmk @@ -23,15 +23,9 @@ # questions. # -define EvalDebugWrapper - $(if $(DEBUG_$1), - $(info -------- <<< Begin expansion of $1) - $(info $2) - $(info -------- >>> End expansion of $1) - ) - - $2 -endef +ifeq (,$(_MAKEBASE_GMK)) + $(error You must include MakeBase.gmk prior to including TextFileProcessing.gmk) +endif # Helper function for SetupTextFileProcessing; adds a rule for a single file # to be processed. @@ -52,18 +46,20 @@ define SetupSingleTextFileForProcessing $1 += $(strip $3)/$(strip $4) endef -# Setup a text file for processing, in which specified markers are replaced with -# a given text, or with the contents of a given file. +# Setup make rules for processing one or more text files, in which specified +# markers are replaced with a given text, or with the contents of a given file. # -# param 1 is the name space for this setup, e.g. BUILD_VERSION_FILE -# param 2, 3, .. etc are named args: +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: # SOURCE_DIRS one or more directory roots to search for files to process # SOURCE_FILES complete paths to one or more files to process # OUTPUT_DIR the directory where we store the processed files. # OUTPUT_FILE the name of the resulting file. Only allowed if processing a # single file. # SOURCE_BASE_DIR a common root to all SOURCE_DIRS. -# If specified, files will keep the path relative to the base in the +# If specified, files will keep the path relative to the base in the # OUTPUT_DIR. Otherwise, the hierarchy will be flattened into the OUTPUT_DIR. # INCLUDE_FILES only include files matching these patterns (used only with # SOURCE_DIRS) diff --git a/make/common/ZipArchive.gmk b/make/common/ZipArchive.gmk new file mode 100644 index 00000000000..07d8bda1e38 --- /dev/null +++ b/make/common/ZipArchive.gmk @@ -0,0 +1,113 @@ +# +# Copyright (c) 2011, 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# + +ifndef _ZIP_ARCHIVE_GMK +_ZIP_ARCHIVE_GMK := 1 + +ifeq (,$(_MAKEBASE_GMK)) + $(error You must include MakeBase.gmk prior to including ZipArchive.gmk) +endif + +# Setup make rules for creating a zip archive. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SRC +# ZIP +# INCLUDES +# INCLUDE_FILES +# EXCLUDES +# EXCLUDE_FILES +# SUFFIXES +# EXTRA_DEPS +# ZIP_OPTIONS extra options to pass to zip +define SetupZipArchive + $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update ZipArchive.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupZipArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupZipArchiveInner + $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE)) + $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) + $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk)) + + # To avoid running find over too large sets of files, which causes make to crash + # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set + # of directories to run find in, if available. + ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),) + $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \ + $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES)))) + else + $1_FIND_LIST := $$($1_SRC) + endif + + # Find all files in the source tree. + $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST))) + + # Filter on suffixes if set + ifneq ($$($1_SUFFIXES),) + $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS)) + endif + + ifneq ($$($1_INCLUDES),) + ifneq ($$($1_SUFFIXES),) + $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \ + $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES)))) + else + $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES))) + endif + endif + ifneq ($$($1_INCLUDE_FILES),) + $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES)) + endif + ifneq ($$($1_EXCLUDES),) + $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) + $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES))) + $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS)) + endif + + # Use a slightly shorter name for logging, but with enough path to identify this zip. + $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP)) + + # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip. + # I.e. the zip -i and -x options should match the filtering done in the makefile. + # Explicitly excluded files can be given with absolute path. The patsubst solution + # isn't perfect but the likelyhood of an absolute path to match something in a src + # dir is very small. + # If zip has nothing to do, it returns 12 and would fail the build. Check for 12 + # and only fail if it's not. + $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) + $(MKDIR) -p $$(@D) + $(ECHO) Updating $$($1_NAME) + $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$($1_ZIP_OPTIONS) $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true + $(TOUCH) $$@ + + # Add zip to target list + $1 += $$($1_ZIP) +endef + +endif # _ZIP_ARCHIVE_GMK From 88f336ba408a5d2462fc21285dbd77e0076a66dc Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 26 Nov 2014 15:14:14 +0100 Subject: [PATCH 123/159] 8065913: Various improvements in SetupNativeCompilation Reviewed-by: erikj --- common/autoconf/flags.m4 | 18 +-- common/autoconf/generated-configure.sh | 20 ++-- common/autoconf/spec.gmk.in | 1 + make/common/NativeCompilation.gmk | 154 ++++++++++++++++--------- 4 files changed, 121 insertions(+), 72 deletions(-) diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index cf73e40cedb..6ca045929ea 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -94,9 +94,9 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS], # On Windows, we need to set RC flags. if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - RC_FLAGS="-nologo -l 0x409 -r" + RC_FLAGS="-nologo -l0x409" if test "x$VARIANT" = xOPT; then - RC_FLAGS="$RC_FLAGS -d NDEBUG" + RC_FLAGS="$RC_FLAGS -DNDEBUG" fi # The version variables used to create RC_FLAGS may be overridden @@ -105,13 +105,13 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS], # The \$ are escaped to the shell, and the $(...) variables # are evaluated by make. RC_FLAGS="$RC_FLAGS \ - -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \ - -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \ - -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ - -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ - -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ - -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ - -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" + -D\"JDK_BUILD_ID=\$(FULL_VERSION)\" \ + -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \ + -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ + -D\"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ + -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ + -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ + -D\"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" fi AC_SUBST(RC_FLAGS) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 8b55a8f40fa..a773326eb06 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -4331,7 +4331,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1416582658 +DATE_WHEN_GENERATED=1417011146 ############################################################################### # @@ -41641,9 +41641,9 @@ $as_echo "$tool_specified" >&6; } # On Windows, we need to set RC flags. if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - RC_FLAGS="-nologo -l 0x409 -r" + RC_FLAGS="-nologo -l0x409" if test "x$VARIANT" = xOPT; then - RC_FLAGS="$RC_FLAGS -d NDEBUG" + RC_FLAGS="$RC_FLAGS -DNDEBUG" fi # The version variables used to create RC_FLAGS may be overridden @@ -41652,13 +41652,13 @@ $as_echo "$tool_specified" >&6; } # The \$ are escaped to the shell, and the $(...) variables # are evaluated by make. RC_FLAGS="$RC_FLAGS \ - -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \ - -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \ - -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ - -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ - -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ - -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ - -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" + -D\"JDK_BUILD_ID=\$(FULL_VERSION)\" \ + -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \ + -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ + -D\"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ + -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ + -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ + -D\"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" fi diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index bcf30a98a5a..ca4e1a82195 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -36,6 +36,7 @@ X:= SPACE:=$(X) $(X) COMMA:=, +DOLLAR:=$$ HASH:=\# LEFT_PAREN:=( RIGHT_PAREN:=) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 550b58e8064..ced60a15ff3 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -34,17 +34,18 @@ ifeq (,$(_MAKEBASE_GMK)) $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk) endif -ifneq ($(TOOLCHAIN_TYPE), microsoft) - COMPILING_MSG=echo $(LOG_INFO) "Compiling $(notdir $1) (for $(notdir $2))" - LINKING_MSG=echo $(LOG_INFO) "Linking $1" - LINKING_EXE_MSG=echo $(LOG_INFO) "Linking executable $1" - ARCHIVING_MSG=echo $(LOG_INFO) "Archiving $1" -else - COMPILING_MSG= - LINKING_MSG= - LINKING_EXE_MSG= - ARCHIVING_MSG= -endif +# Extensions of files handled by this macro. +NATIVE_SOURCE_EXTENSIONS := %.s %.c %.cpp %.m %.mm + +# Replaces native source extensions with the object file extension in a string. +# Param 1: the string containing source file names with extensions +# The surrounding strip is needed to keep additional whitespace out +define replace_with_obj_extension +$(strip \ + $(foreach extension, $(NATIVE_SOURCE_EXTENSIONS), \ + $(patsubst $(extension),%$(OBJ_SUFFIX),$(filter $(extension),$1))) \ +) +endef ifeq ($(OPENJDK_BUILD_OS_ENV), windows.cygwin) UNIX_PATH_PREFIX := /cygdrive @@ -52,6 +53,15 @@ else ifeq ($(OPENJDK_BUILD_OS_ENV), windows.msys) UNIX_PATH_PREFIX := endif +WINDOWS_SHOWINCLUDE_SED_PATTERN := \ + -e '/^Note: including file:/!d' \ + -e 's|Note: including file: *||' \ + -e 's|\\|/|g' \ + -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ + -e '/$(subst /,\/,$(TOPDIR))/!d' \ + -e 's|$$$$| \\|g' \ + # + define add_native_source # param 1 = BUILD_MYPACKAGE # parma 2 = the source file name (..../alfa.c or .../beta.cpp) @@ -60,7 +70,8 @@ define add_native_source # param 5 = the c compiler # param 6 = the c++ flags to the compiler # param 7 = the c++ compiler - # param 8 = the flags to the assembler + # param 8 = the objc compiler + # param 9 = the flags to the assembler ifneq (,$$(filter %.c,$2)) # Compile as a C file @@ -70,25 +81,27 @@ define add_native_source else ifneq (,$$(filter %.m,$2)) # Compile as a objective-c file $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$( $$($1_$2_DEP).exitvalue) \ - | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v "^Note: including file:" \ - && exit `cat $$($1_$2_DEP).exitvalue` + | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v -e "^Note: including file:" \ + -e "^$(notdir $2)$$$$" ; exit `cat $$($1_$2_DEP).exitvalue` $(RM) $$($1_$2_DEP).exitvalue ($(ECHO) $$@: \\ \ - && $(SED) -e '/^Note: including file:/!d' \ - -e 's|Note: including file: *||' \ - -e 's|\\|/|g' \ - -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ - -e '/$(subst /,\/,$(TOPDIR))/!d' \ - -e 's|$$$$| \\|g' \ - $$($1_$2_DEP).raw) > $$($1_$2_DEP) + && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) > $$($1_$2_DEP) endif endif endef @@ -204,7 +211,11 @@ define SetupNativeCompilationInner $$(error LIBRARY should be specified without LIBRARY_PREFIX: $(LIBRARY_PREFIX)) endif - $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_LIBRARY)$(SHARED_LIBRARY_SUFFIX) + ifeq ($$($1_SUFFIX), ) + $1_SUFFIX := $(SHARED_LIBRARY_SUFFIX) + endif + + $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_LIBRARY)$$($1_SUFFIX) $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME) $1_NOSUFFIX:=$(LIBRARY_PREFIX)$$($1_LIBRARY) endif @@ -226,7 +237,11 @@ define SetupNativeCompilationInner $$(error STATIC_LIBRARY should be specified without LIBRARY_PREFIX: $(LIBRARY_PREFIX)) endif - $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_STATIC_LIBRARY)$(STATIC_LIBRARY_SUFFIX) + ifeq ($$($1_SUFFIX), ) + $1_SUFFIX := $(STATIC_LIBRARY_SUFFIX) + endif + + $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_STATIC_LIBRARY)$$($1_SUFFIX) $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME) $1_NOSUFFIX:=$(LIBRARY_PREFIX)$$($1_STATIC_LIBRARY) endif @@ -244,7 +259,11 @@ define SetupNativeCompilationInner $$(error PROGRAM should be specified without EXE_SUFFIX: $(EXE_SUFFIX)) endif - $1_BASENAME:=$$($1_PROGRAM)$(EXE_SUFFIX) + ifeq ($$($1_SUFFIX), ) + $1_SUFFIX := $(EXE_SUFFIX) + endif + + $1_BASENAME:=$$($1_PROGRAM)$$($1_SUFFIX) $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME) $1_NOSUFFIX:=$$($1_PROGRAM) endif @@ -260,11 +279,17 @@ define SetupNativeCompilationInner ifeq ($$($1_LDEXE),) $1_LDEXE:=$(LDEXE) endif - $1_LD:=$(LD) + ifeq ($$($1_LD),) + $1_LD:=$(LD) + endif else ifeq (C++,$$($1_LANG)) - $1_LD:=$(LDCXX) - $1_LDEXE:=$(LDEXECXX) + ifeq ($$($1_LD),) + $1_LD:=$(LDCXX) + endif + ifeq ($$($1_LDEXE),) + $1_LDEXE:=$(LDEXECXX) + endif else $$(error Unknown native language $$($1_LANG) for $1) endif @@ -273,6 +298,12 @@ define SetupNativeCompilationInner ifeq ($$($1_CC),) $1_CC:=$(CC) endif + ifeq ($$($1_CXX),) + $1_CXX:=$(CXX) + endif + ifeq ($$($1_OBJC),) + $1_OBJC:=$(OBJC) + endif # Make sure the dirs exist. $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR))) @@ -286,7 +317,7 @@ define SetupNativeCompilationInner ifneq ($$($1_EXCLUDE_FILES),) $1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES)) endif - $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.s %.c %.cpp %.m,$$($1_ALL_SRCS))) + $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter $$(NATIVE_SOURCE_EXTENSIONS),$$($1_ALL_SRCS))) ifneq (,$$(strip $$($1_INCLUDE_FILES))) $1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS)) endif @@ -309,9 +340,12 @@ define SetupNativeCompilationInner $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS)) endif + $1_SRCS += $$($1_EXTRA_FILES) + # Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides # a reproducable order on the input files to the linker). - $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_OBJECT_DIR)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(patsubst %.s,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS)))))))) + $1_EXPECTED_OBJS_FILENAMES := $$(call replace_with_obj_extension, $$(notdir $$($1_SRCS))) + $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_OBJECT_DIR)/,$$($1_EXPECTED_OBJS_FILENAMES))) # Are there too many object files on disk? Perhaps because some source file was removed? $1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS))) # Clean out the superfluous object files. @@ -345,7 +379,7 @@ define SetupNativeCompilationInner $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release) endif - ifneq (,$$($1_DEBUG_SYMBOLS)) + ifeq ($$($1_DEBUG_SYMBOLS), true) ifeq ($(ENABLE_DEBUG_SYMBOLS), true) ifdef OPENJDK # Always add debug symbols @@ -390,22 +424,38 @@ define SetupNativeCompilationInner $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION)) endif - # Add sys root specific cflags last - $1_EXTRA_CFLAGS += $(SYSROOT_CFLAGS) - $1_EXTRA_CXXFLAGS += $(SYSROOT_CFLAGS) + $1_BUILD_INFO := $$($1_OBJECT_DIR)/_build-info.marker + + # Setup rule for printing progress info when compiling source files. + # This is a rough heuristic and may not always print accurate information. + $$($1_BUILD_INFO): $$($1_SRCS) + ifeq ($$(wildcard $$($1_TARGET)),) + $(ECHO) 'Creating $$($1_BASENAME) from $$(words $$?) file(s)' + else + $(ECHO) 'Updating $$($1_BASENAME) from $$(words $$?) file(s)' + endif + $(TOUCH) $$@ # Now call add_native_source for each source file we are going to compile. $$(foreach p,$$($1_SRCS), \ $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \ - $$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$$($1_CC), \ - $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$(CXX),$$($1_ASFLAGS)))) + $(SYSROOT_CFLAGS) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$$($1_CC), \ + $(SYSROOT_CFLAGS) $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$$($1_CXX),$$($1_OBJC),$$($1_ASFLAGS)))) # On windows we need to create a resource file ifeq ($(OPENJDK_TARGET_OS), windows) ifneq (,$$($1_VERSIONINFO_RESOURCE)) $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res + $1_RES_DEP:=$$($1_RES).d + -include $$($1_RES_DEP) $$($1_RES): $$($1_VERSIONINFO_RESOURCE) + $(ECHO) $(LOG_INFO) "Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET)))" $(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE) + # Windows RC compiler does not support -showIncludes, so we mis-use CL for this. + $(CC) $$($1_RC_FLAGS) -showIncludes -nologo -TC \ + $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0 + ($(ECHO) $$($1_RES): \\ \ + && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP) endif ifneq (,$$($1_MANIFEST)) $1_GEN_MANIFEST:=$$($1_OBJECT_DIR)/$$($1_PROGRAM).manifest @@ -439,12 +489,10 @@ define SetupNativeCompilationInner $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE)) endif - $1_EXTRA_LDFLAGS += $(SYSROOT_LDFLAGS) - # Need to make sure TARGET is first on list $1 := $$($1_TARGET) ifeq ($$($1_STATIC_LIBRARY),) - ifneq ($$($1_DEBUG_SYMBOLS),) + ifeq ($$($1_DEBUG_SYMBOLS), true) ifeq ($(ENABLE_DEBUG_SYMBOLS), true) ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet ifneq ($$($1_OUTPUT_DIR),$$($1_OBJECT_DIR)) @@ -523,10 +571,10 @@ define SetupNativeCompilationInner $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) - $$(call LINKING_MSG,$$($1_BASENAME)) - $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \ - $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \ - $$($1_EXTRA_LDFLAGS_SUFFIX) + $(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)" + $$($1_LD) $(SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \ + $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \ + $$($1_EXTRA_LDFLAGS_SUFFIX) # Touch target to make sure it has a later time stamp than the debug # symbol files to avoid unnecessary relinking on rebuild. ifeq ($(OPENJDK_TARGET_OS), windows) @@ -538,7 +586,7 @@ define SetupNativeCompilationInner ifneq (,$$($1_STATIC_LIBRARY)) # Generating a static library, ie object file archive. $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) - $$(call ARCHIVING_MSG,$$($1_LIBRARY)) + $(ECHO) $(LOG_INFO) "Archiving $$($1_STATIC_LIBRARY)" $(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \ $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) endif @@ -548,8 +596,8 @@ define SetupNativeCompilationInner $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) - $$(call LINKING_EXE_MSG,$$($1_BASENAME)) - $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \ + $(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)" + $$($1_LDEXE) $(SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \ $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \ $$($1_EXTRA_LDFLAGS_SUFFIX) ifneq (,$$($1_GEN_MANIFEST)) From 2f10adad63dc9cded883f68e7a242992fd3b566e Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Mon, 24 Nov 2014 14:44:10 +0100 Subject: [PATCH 124/159] 8065648: Remove the flag -fsanitize=undefined for GCC 4.9 and later Reviewed-by: erikj --- common/autoconf/flags.m4 | 23 ------- common/autoconf/generated-configure.sh | 94 +------------------------- common/autoconf/toolchain.m4 | 6 -- 3 files changed, 1 insertion(+), 122 deletions(-) diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index 6ca045929ea..90f369a12a8 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -348,10 +348,6 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION], # Add runtime stack smashing and undefined behavior checks CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" - if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then - CFLAGS_DEBUG_OPTIONS="$CFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG" - CXXFLAGS_DEBUG_OPTIONS="$CXXFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIsOR_FLAG" - fi ;; esac fi @@ -746,25 +742,6 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib" fi - if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then - # If undefined behaviour detection is enabled then we need to tell linker. - case $DEBUG_LEVEL in - release | fastdebug ) - ;; - slowdebug ) - AC_MSG_WARN([$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR]) - if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then - # enable undefined behaviour checking - LDFLAGS_JDK="$LDFLAGS_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/[ ]*\([^ ]\+\)/ -Xlinker \1/g"`" - LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/[ ]*\([^ ]\+\)/ -Xlinker \1/g"`" - fi - ;; - * ) - AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL]) - ;; - esac - fi - # Customize LDFLAGS for executables LDFLAGS_JDKEXE="${LDFLAGS_JDK}" diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index a773326eb06..94b701bea19 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -4331,7 +4331,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1417011146 +DATE_WHEN_GENERATED=1417016445 ############################################################################### # @@ -41017,74 +41017,6 @@ $as_echo "$supports" >&6; } fi - # "-fsanitize=undefined" supported for GCC 4.9 and later - CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG="-fsanitize=undefined -fsanitize-recover" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG\"" >&5 -$as_echo_n "checking if compiler supports \"$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG\"... " >&6; } - supports=yes - - saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - supports=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - CFLAGS="$saved_cflags" - - saved_cxxflags="$CXXFLAGS" - CXXFLAGS="$CXXFLAG $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG" - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - supports=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - CXXFLAGS="$saved_cxxflags" - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5 -$as_echo "$supports" >&6; } - if test "x$supports" = "xyes" ; then - HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=true - else - HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=false - fi - - # "-z relro" supported in GNU binutils 2.17 and later LINKER_RELRO_FLAG="-Xlinker -z -Xlinker relro" @@ -42428,10 +42360,6 @@ $as_echo "$ac_cv_c_bigendian" >&6; } # Add runtime stack smashing and undefined behavior checks CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" - if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then - CFLAGS_DEBUG_OPTIONS="$CFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG" - CXXFLAGS_DEBUG_OPTIONS="$CXXFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIsOR_FLAG" - fi ;; esac fi @@ -42839,26 +42767,6 @@ fi LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib" fi - if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then - # If undefined behaviour detection is enabled then we need to tell linker. - case $DEBUG_LEVEL in - release | fastdebug ) - ;; - slowdebug ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" >&5 -$as_echo "$as_me: WARNING: $HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" >&2;} - if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then - # enable undefined behaviour checking - LDFLAGS_JDK="$LDFLAGS_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/ *\(^ \+\)/ -Xlinker \1/g"`" - LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/ *\(^ \+\)/ -Xlinker \1/g"`" - fi - ;; - * ) - as_fn_error $? "Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL" "$LINENO" 5 - ;; - esac - fi - # Customize LDFLAGS for executables LDFLAGS_JDKEXE="${LDFLAGS_JDK}" diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4 index db0a253a207..9b16574848f 100644 --- a/common/autoconf/toolchain.m4 +++ b/common/autoconf/toolchain.m4 @@ -712,12 +712,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS], [HAS_CFLAG_OPTIMIZE_DEBUG=true], [HAS_CFLAG_OPTIMIZE_DEBUG=false]) - # "-fsanitize=undefined" supported for GCC 4.9 and later - CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG="-fsanitize=undefined -fsanitize-recover" - FLAGS_COMPILER_CHECK_ARGUMENTS([$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG], - [HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=true], - [HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=false]) - # "-z relro" supported in GNU binutils 2.17 and later LINKER_RELRO_FLAG="-Xlinker -z -Xlinker relro" FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_RELRO_FLAG], From 96da5b9ce34eb1bd72fbc350107719108d9a52ef Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Mon, 24 Nov 2014 17:02:37 +0100 Subject: [PATCH 125/159] 8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed Loggers which have been configured with a handler in the configuration file will be retained by the LogManager until reset() is called. A new configuration property is added to explicitely turn the fix off. Reviewed-by: mchung --- .../classes/java/util/logging/LogManager.java | 69 ++- .../ParentLoggerWithHandlerGC.java | 517 ++++++++++++++++++ 2 files changed, 580 insertions(+), 6 deletions(-) create mode 100644 jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java diff --git a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java index 45f2c054bd6..3cf6842c871 100644 --- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java +++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java @@ -31,6 +31,7 @@ import java.util.*; import java.security.*; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; +import java.util.concurrent.CopyOnWriteArrayList; import sun.misc.JavaAWTAccess; import sun.misc.SharedSecrets; @@ -100,6 +101,19 @@ import sun.misc.SharedSecrets; * Note that these Handlers may be created lazily, when they are * first used. * + *
  • A property "<logger>.handlers.ensureCloseOnReset". This defines a + * a boolean value. If "<logger>.handlers" is not defined or is empty, + * this property is ignored. Otherwise it defaults to {@code true}. When the + * value is {@code true}, the handlers associated with the logger are guaranteed + * to be closed on {@linkplain #reset} and shutdown. This can be turned off + * by explicitly setting "<logger>.handlers.ensureCloseOnReset=false" in + * the configuration. Note that turning this property off causes the risk of + * introducing a resource leak, as the logger may get garbage collected before + * {@code reset()} is called, thus preventing its handlers from being closed + * on {@code reset()}. In that case it is the responsibility of the application + * to ensure that the handlers are closed before the logger is garbage + * collected. + * *
  • A property "<logger>.useParentHandlers". This defines a boolean * value. By default every logger calls its parent in addition to * handling the logging message itself, this often result in messages @@ -169,6 +183,33 @@ public class LogManager { // True if JVM death is imminent and the exit hook has been called. private boolean deathImminent; + // This list contains the loggers for which some handlers have been + // explicitly configured in the configuration file. + // It prevents these loggers from being arbitrarily garbage collected. + private static final class CloseOnReset { + private final Logger logger; + private CloseOnReset(Logger ref) { + this.logger = Objects.requireNonNull(ref); + } + @Override + public boolean equals(Object other) { + return (other instanceof CloseOnReset) && ((CloseOnReset)other).logger == logger; + } + @Override + public int hashCode() { + return System.identityHashCode(logger); + } + public Logger get() { + return logger; + } + public static CloseOnReset create(Logger logger) { + return new CloseOnReset(logger); + } + } + private final CopyOnWriteArrayList closeOnResetLoggers = + new CopyOnWriteArrayList<>(); + + private final Map listeners = Collections.synchronizedMap(new IdentityHashMap<>()); @@ -204,7 +245,6 @@ public class LogManager { }); } - // This private class is used as a shutdown hook. // It does a "reset" to close all open handlers. private class Cleaner extends Thread { @@ -875,30 +915,39 @@ public class LogManager { @Override public Object run() { String names[] = parseClassNames(handlersPropertyName); - for (String word : names) { + final boolean ensureCloseOnReset = names.length > 0 + && getBooleanProperty(handlersPropertyName + ".ensureCloseOnReset",true); + + int count = 0; + for (String type : names) { try { - Class clz = ClassLoader.getSystemClassLoader().loadClass(word); + Class clz = ClassLoader.getSystemClassLoader().loadClass(type); Handler hdl = (Handler) clz.newInstance(); // Check if there is a property defining the // this handler's level. - String levs = getProperty(word + ".level"); + String levs = getProperty(type + ".level"); if (levs != null) { Level l = Level.findLevel(levs); if (l != null) { hdl.setLevel(l); } else { // Probably a bad level. Drop through. - System.err.println("Can't set level for " + word); + System.err.println("Can't set level for " + type); } } // Add this Handler to the logger logger.addHandler(hdl); + if (++count == 1 && ensureCloseOnReset) { + // add this logger to the closeOnResetLoggers list. + closeOnResetLoggers.addIfAbsent(CloseOnReset.create(logger)); + } } catch (Exception ex) { - System.err.println("Can't load log handler \"" + word + "\""); + System.err.println("Can't load log handler \"" + type + "\""); System.err.println("" + ex); ex.printStackTrace(); } } + return null; } }); @@ -1233,8 +1282,15 @@ public class LogManager { public void reset() throws SecurityException { checkPermission(); + List persistent; synchronized (this) { props = new Properties(); + // make sure we keep the loggers persistent until reset is done. + // Those are the loggers for which we previously created a + // handler from the configuration, and we need to prevent them + // from being gc'ed until those handlers are closed. + persistent = new ArrayList<>(closeOnResetLoggers); + closeOnResetLoggers.clear(); // Since we are doing a reset we no longer want to initialize // the global handlers, if they haven't been initialized yet. initializedGlobalHandlers = true; @@ -1249,6 +1305,7 @@ public class LogManager { } } } + persistent.clear(); } // Private method to reset an individual target logger. diff --git a/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java b/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java new file mode 100644 index 00000000000..491d7583243 --- /dev/null +++ b/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java @@ -0,0 +1,517 @@ +/* + * 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. + */ +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FilePermission; +import java.io.IOException; +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.logging.FileHandler; +import java.util.logging.Handler; +import java.util.logging.LogManager; +import java.util.logging.Logger; +import java.util.logging.LoggingPermission; + +/** + * @test + * @bug 8060132 + * @summary tests that FileHandlers configured on abstract nodes in logging.properties + * will be closed by reset(). + * @run main/othervm ParentLoggerWithHandlerGC UNSECURE + * @run main/othervm ParentLoggerWithHandlerGC SECURE + * @author danielfuchs + */ +public class ParentLoggerWithHandlerGC { + + /** + * We will test the handling of abstract logger nodes with file handlers in + * two configurations: + * UNSECURE: No security manager. + * SECURE: With the security manager present - and the required + * permissions granted. + */ + public static enum TestCase { + UNSECURE, SECURE; + public void run(Properties propertyFile) throws Exception { + System.out.println("Running test case: " + name()); + Configure.setUp(this, propertyFile); + test(this.name() + " " + propertyFile.getProperty("test.name"), propertyFile); + } + } + + + private static final String PREFIX = + "FileHandler-" + UUID.randomUUID() + ".log"; + private static final String userDir = System.getProperty("user.dir", "."); + private static final boolean userDirWritable = Files.isWritable(Paths.get(userDir)); + + static enum ConfigMode { DEFAULT, ENSURE_CLOSE_ON_RESET_TRUE, ENSURE_CLOSE_ON_RESET_FALSE } + + private static final List properties; + static { + Properties props1 = new Properties(); + props1.setProperty("test.name", "parent logger with handler"); + props1.setProperty("test.config.mode", ConfigMode.DEFAULT.name()); + props1.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); + props1.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); + props1.setProperty(FileHandler.class.getName() + ".level", "ALL"); + props1.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); + props1.setProperty("com.foo.handlers", FileHandler.class.getName()); + props1.setProperty("com.bar.level", "FINEST"); + + Properties props2 = new Properties(); + props2.setProperty("test.name", "parent logger with handler"); + props2.setProperty("test.config.mode", ConfigMode.ENSURE_CLOSE_ON_RESET_TRUE.name()); + props2.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); + props2.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); + props2.setProperty(FileHandler.class.getName() + ".level", "ALL"); + props2.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); + props2.setProperty("com.foo.handlers", FileHandler.class.getName()); + props2.setProperty("com.foo.handlers.ensureCloseOnReset", "true"); + props2.setProperty("com.bar.level", "FINEST"); + + Properties props3 = new Properties(); + props3.setProperty("test.name", "parent logger with handler"); + props3.setProperty("test.config.mode", ConfigMode.ENSURE_CLOSE_ON_RESET_FALSE.name()); + props3.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); + props3.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); + props3.setProperty(FileHandler.class.getName() + ".level", "ALL"); + props3.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); + props3.setProperty("com.foo.handlers", FileHandler.class.getName()); + props3.setProperty("com.foo.handlers.ensureCloseOnReset", "false"); + props3.setProperty("com.bar.level", "FINEST"); + + properties = Collections.unmodifiableList(Arrays.asList( + props1, props2, props3)); + } + + public static void main(String... args) throws Exception { + + + if (args == null || args.length == 0) { + args = new String[] { + TestCase.UNSECURE.name(), + TestCase.SECURE.name(), + }; + } + + try { + for (String testName : args) { + for (Properties propertyFile : properties) { + TestCase test = TestCase.valueOf(testName); + test.run(propertyFile); + } + } + } finally { + if (userDirWritable) { + Configure.doPrivileged(() -> { + // cleanup - delete files that have been created + try { + Files.list(Paths.get(userDir)) + .filter((f) -> f.toString().contains(PREFIX)) + .forEach((f) -> { + try { + System.out.println("deleting " + f); + Files.delete(f); + } catch(Throwable t) { + System.err.println("Failed to delete " + f + ": " + t); + } + }); + } catch(Throwable t) { + System.err.println("Cleanup failed to list files: " + t); + t.printStackTrace(); + } + }); + } + } + } + + static class Configure { + static Policy policy = null; + static final AtomicBoolean allowAll = new AtomicBoolean(false); + static void setUp(TestCase test, Properties propertyFile) { + switch (test) { + case SECURE: + if (policy == null && System.getSecurityManager() != null) { + throw new IllegalStateException("SecurityManager already set"); + } else if (policy == null) { + policy = new SimplePolicy(TestCase.SECURE, allowAll); + Policy.setPolicy(policy); + System.setSecurityManager(new SecurityManager()); + } + if (System.getSecurityManager() == null) { + throw new IllegalStateException("No SecurityManager."); + } + if (policy == null) { + throw new IllegalStateException("policy not configured"); + } + break; + case UNSECURE: + if (System.getSecurityManager() != null) { + throw new IllegalStateException("SecurityManager already set"); + } + break; + default: + new InternalError("No such testcase: " + test); + } + doPrivileged(() -> { + try { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + propertyFile.store(bytes, propertyFile.getProperty("test.name")); + ByteArrayInputStream bais = new ByteArrayInputStream(bytes.toByteArray()); + LogManager.getLogManager().readConfiguration(bais); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + }); + } + static void doPrivileged(Runnable run) { + allowAll.set(true); + try { + run.run(); + } finally { + allowAll.set(false); + } + } + static T callPrivileged(Callable call) throws Exception { + allowAll.set(true); + try { + return call.call(); + } finally { + allowAll.set(false); + } + } + } + + @FunctionalInterface + public static interface FileHandlerSupplier { + public FileHandler test() throws Exception; + } + + static final class TestAssertException extends RuntimeException { + TestAssertException(String msg) { + super(msg); + } + } + + private static void assertEquals(long expected, long received, String msg) { + if (expected != received) { + throw new TestAssertException("Unexpected result for " + msg + + ".\n\texpected: " + expected + + "\n\tactual: " + received); + } else { + System.out.println("Got expected " + msg + ": " + received); + } + } + + + public static void test(String name, Properties props) throws Exception { + ConfigMode configMode = ConfigMode.valueOf(props.getProperty("test.config.mode")); + System.out.println("\nTesting: " + name + " mode=" + configMode); + if (!userDirWritable) { + throw new RuntimeException("Not writable: "+userDir); + } + switch(configMode) { + case DEFAULT: + case ENSURE_CLOSE_ON_RESET_TRUE: + testCloseOnResetTrue(name, props); break; + case ENSURE_CLOSE_ON_RESET_FALSE: + testCloseOnResetFalse(name, props); break; + default: + throw new RuntimeException("Unknwown mode: " + configMode); + } + } + + + // Test a configuration which has either + // com.foo.handlers.ensureCloseOnReset=true, or where + // com.foo.handlers.ensureCloseOnReset is not specified. + public static void testCloseOnResetTrue(String name, Properties props) + throws Exception { + Logger fooChild = Logger.getLogger("com.foo.child"); + fooChild.info("hello world"); + Logger barChild = Logger.getLogger("com.bar.child"); + barChild.info("hello world"); + + ReferenceQueue queue = new ReferenceQueue(); + WeakReference fooRef = new WeakReference<>(Logger.getLogger("com.foo"), queue); + if (fooRef.get() != fooChild.getParent()) { + throw new RuntimeException("Unexpected parent logger: " + + fooChild.getParent() +"\n\texpected: " + fooRef.get()); + } + WeakReference barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue); + if (barRef.get() != barChild.getParent()) { + throw new RuntimeException("Unexpected parent logger: " + + barChild.getParent() +"\n\texpected: " + barRef.get()); + } + fooChild = barChild = null; + Reference ref2 = null; + while ((ref2 = queue.poll()) == null) { + System.gc(); + Thread.sleep(1000); + } + Throwable failed = null; + try { + do { + if (ref2 != barRef) { + throw new RuntimeException("Unexpected reference: " + + ref2 +"\n\texpected: " + barRef); + } + if (ref2.get() != null) { + throw new RuntimeException("Referent not cleared: " + + ref2.get()); + } + System.out.println("Got barRef"); + System.gc(); + Thread.sleep(1000); + } while( (ref2 = queue.poll()) != null); + System.out.println("Parent logger GCed"); + } catch(Throwable t) { + failed = t; + } finally { + final Throwable suppressed = failed; + Configure.doPrivileged(() -> LogManager.getLogManager().reset()); + Configure.doPrivileged(() -> { + try { + StringBuilder builder = new StringBuilder(); + Files.list(Paths.get(userDir)) + .filter((f) -> f.toString().contains(PREFIX)) + .filter((f) -> f.toString().endsWith(".lck")) + .forEach((f) -> { + builder.append(f.toString()).append('\n'); + }); + if (!builder.toString().isEmpty()) { + throw new RuntimeException("Lock files not cleaned:\n" + + builder.toString()); + } + } catch(RuntimeException | Error x) { + if (suppressed != null) x.addSuppressed(suppressed); + throw x; + } catch(Exception x) { + if (suppressed != null) x.addSuppressed(suppressed); + throw new RuntimeException(x); + } + }); + while ((ref2 = queue.poll()) == null) { + System.gc(); + Thread.sleep(1000); + } + if (ref2 != fooRef) { + throw new RuntimeException("Unexpected reference: " + + ref2 +"\n\texpected: " + fooRef); + } + if (ref2.get() != null) { + throw new RuntimeException("Referent not cleared: " + ref2.get()); + } + System.out.println("Got fooRef after reset()"); + + } + if (failed != null) { + // should rarely happen... + throw new RuntimeException(failed); + } + + } + + private static Handler getHandlerToClose() throws Exception { + return Configure.callPrivileged( + () -> Logger.getLogger("com.foo.child").getParent().getHandlers()[0]); + } + + // Test a configuration which has com.foo.handlers.ensureCloseOnReset=false + public static void testCloseOnResetFalse(String name, Properties props) + throws Exception { + Logger fooChild = Logger.getLogger("com.foo.child"); + fooChild.info("hello world"); + Logger barChild = Logger.getLogger("com.bar.child"); + barChild.info("hello world"); + + Handler toClose = getHandlerToClose(); + + ReferenceQueue queue = new ReferenceQueue(); + WeakReference fooRef = new WeakReference<>(Logger.getLogger("com.foo"), queue); + if (fooRef.get() != fooChild.getParent()) { + throw new RuntimeException("Unexpected parent logger: " + + fooChild.getParent() +"\n\texpected: " + fooRef.get()); + } + WeakReference barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue); + if (barRef.get() != barChild.getParent()) { + throw new RuntimeException("Unexpected parent logger: " + + barChild.getParent() +"\n\texpected: " + barRef.get()); + } + fooChild = barChild = null; + Reference ref2 = null; + Set> expectedRefs = new HashSet<>(Arrays.asList(fooRef, barRef)); + Throwable failed = null; + try { + int l=0; + while (failed == null && !expectedRefs.isEmpty()) { + int max = 60; + while ((ref2 = queue.poll()) == null) { + if (l > 0 && max-- <= 0) { + throw new RuntimeException("Logger #2 not GC'ed!" + + " max too short (max=60) or " + + "com.foo.handlers.ensureCloseOnReset=false" + + " does not work"); + } + System.gc(); + Thread.sleep(1000); + } + do { + if (!expectedRefs.contains(ref2)) { + throw new RuntimeException("Unexpected reference: " + + ref2 +"\n\texpected: " + expectedRefs); + } + if (ref2.get() != null) { + throw new RuntimeException("Referent not cleared: " + + ref2.get()); + } + expectedRefs.remove(ref2); + System.out.println("Got "+ + (ref2 == barRef ? "barRef" + : (ref2 == fooRef ? "fooRef" + : ref2.toString()))); + System.gc(); + Thread.sleep(1000); + System.out.println("Logger #" + (++l) + " GCed"); + } while( (ref2 = queue.poll()) != null); + } + } catch(Throwable t) { + failed = t; + } finally { + final Throwable suppressed = failed; + Configure.doPrivileged(() -> LogManager.getLogManager().reset()); + Configure.doPrivileged(() -> { + try { + toClose.close(); + StringBuilder builder = new StringBuilder(); + Files.list(Paths.get(userDir)) + .filter((f) -> f.toString().contains(PREFIX)) + .filter((f) -> f.toString().endsWith(".lck")) + .forEach((f) -> { + builder.append(f.toString()).append('\n'); + }); + if (!builder.toString().isEmpty()) { + throw new RuntimeException("Lock files not cleaned:\n" + builder.toString()); + } + } catch(RuntimeException | Error x) { + if (suppressed != null) x.addSuppressed(suppressed); + throw x; + } catch(Exception x) { + if (suppressed != null) x.addSuppressed(suppressed); + throw new RuntimeException(x); + } + }); + } + if (failed != null) { + // should rarely happen... + throw new RuntimeException(failed); + } + + } + + + final static class PermissionsBuilder { + final Permissions perms; + public PermissionsBuilder() { + this(new Permissions()); + } + public PermissionsBuilder(Permissions perms) { + this.perms = perms; + } + public PermissionsBuilder add(Permission p) { + perms.add(p); + return this; + } + public PermissionsBuilder addAll(PermissionCollection col) { + if (col != null) { + for (Enumeration e = col.elements(); e.hasMoreElements(); ) { + perms.add(e.nextElement()); + } + } + return this; + } + public Permissions toPermissions() { + final PermissionsBuilder builder = new PermissionsBuilder(); + builder.addAll(perms); + return builder.perms; + } + } + + public static class SimplePolicy extends Policy { + + final Permissions permissions; + final Permissions allPermissions; + final AtomicBoolean allowAll; + public SimplePolicy(TestCase test, AtomicBoolean allowAll) { + this.allowAll = allowAll; + permissions = new Permissions(); + permissions.add(new LoggingPermission("control", null)); + permissions.add(new FilePermission(PREFIX+".lck", "read,write,delete")); + permissions.add(new FilePermission(PREFIX, "read,write")); + + // these are used for configuring the test itself... + allPermissions = new Permissions(); + allPermissions.add(new java.security.AllPermission()); + + } + + @Override + public boolean implies(ProtectionDomain domain, Permission permission) { + if (allowAll.get()) return allPermissions.implies(permission); + return permissions.implies(permission); + } + + @Override + public PermissionCollection getPermissions(CodeSource codesource) { + return new PermissionsBuilder().addAll(allowAll.get() + ? allPermissions : permissions).toPermissions(); + } + + @Override + public PermissionCollection getPermissions(ProtectionDomain domain) { + return new PermissionsBuilder().addAll(allowAll.get() + ? allPermissions : permissions).toPermissions(); + } + } + +} From b1ad8012a0fa3247f39dce98df17f0b53e6791ef Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 24 Nov 2014 07:16:38 -0800 Subject: [PATCH 126/159] 8063135: Enable full LF sharing by default Reviewed-by: psandoz, shade --- .../java/lang/invoke/MethodHandle.java | 38 +-- .../java/lang/invoke/MethodHandleImpl.java | 6 +- .../java/lang/invoke/MethodHandleStatics.java | 17 +- .../java/lang/invoke/MethodHandles.java | 252 +++++++----------- .../LFCaching/LFGarbageCollectedTest.java | 2 +- .../LFCaching/LFMultiThreadCachingTest.java | 2 +- .../LFCaching/LFSingleThreadCachingTest.java | 2 +- 7 files changed, 115 insertions(+), 204 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java index 17ba24019b8..0a45d2707e9 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java @@ -867,15 +867,11 @@ assertEquals("[A, B, C]", (String) caToString2.invokeExact('A', "BC".toCharArray MethodType postSpreadType = asSpreaderChecks(arrayType, arrayLength); int arity = type().parameterCount(); int spreadArgPos = arity - arrayLength; - if (USE_LAMBDA_FORM_EDITOR) { - MethodHandle afterSpread = this.asType(postSpreadType); - BoundMethodHandle mh = afterSpread.rebind(); - LambdaForm lform = mh.editor().spreadArgumentsForm(1 + spreadArgPos, arrayType, arrayLength); - MethodType preSpreadType = postSpreadType.replaceParameterTypes(spreadArgPos, arity, arrayType); - return mh.copyWith(preSpreadType, lform); - } else { - return MethodHandleImpl.makeSpreadArguments(this, arrayType, spreadArgPos, arrayLength); - } + MethodHandle afterSpread = this.asType(postSpreadType); + BoundMethodHandle mh = afterSpread.rebind(); + LambdaForm lform = mh.editor().spreadArgumentsForm(1 + spreadArgPos, arrayType, arrayLength); + MethodType preSpreadType = postSpreadType.replaceParameterTypes(spreadArgPos, arity, arrayType); + return mh.copyWith(preSpreadType, lform); } /** @@ -996,23 +992,15 @@ assertEquals("[123]", (String) longsToString.invokeExact((long)123)); public MethodHandle asCollector(Class arrayType, int arrayLength) { asCollectorChecks(arrayType, arrayLength); int collectArgPos = type().parameterCount() - 1; - if (USE_LAMBDA_FORM_EDITOR) { - BoundMethodHandle mh = rebind(); - MethodType resultType = type().asCollectorType(arrayType, arrayLength); - MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength); - LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray); - if (lform != null) { - return mh.copyWith(resultType, lform); - } - lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType()); - return mh.copyWithExtendL(resultType, lform, newArray); - } else { - MethodHandle target = this; - if (arrayType != type().parameterType(collectArgPos)) - target = MethodHandleImpl.makePairwiseConvert(this, type().changeParameterType(collectArgPos, arrayType), true); - MethodHandle collector = MethodHandleImpl.varargsArray(arrayType, arrayLength); - return MethodHandles.collectArguments(target, collectArgPos, collector); + BoundMethodHandle mh = rebind(); + MethodType resultType = type().asCollectorType(arrayType, arrayLength); + MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength); + LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray); + if (lform != null) { + return mh.copyWith(resultType, lform); } + lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType()); + return mh.copyWithExtendL(resultType, lform, newArray); } /** diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java index 09864eb19f3..7d8c63490d5 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -191,11 +191,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; MethodType dstType = target.type(); if (srcType == dstType) return target; - if (USE_LAMBDA_FORM_EDITOR) { - return makePairwiseConvertByEditor(target, srcType, strict, monobox); - } else { - return makePairwiseConvertIndirect(target, srcType, strict, monobox); - } + return makePairwiseConvertByEditor(target, srcType, strict, monobox); } private static int countNonNull(Object[] array) { diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java index 1bd43538a91..43700b4d8db 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java @@ -45,23 +45,21 @@ import sun.misc.Unsafe; static final boolean DUMP_CLASS_FILES; static final boolean TRACE_INTERPRETER; static final boolean TRACE_METHOD_LINKAGE; - static final boolean USE_LAMBDA_FORM_EDITOR; static final int COMPILE_THRESHOLD; static final int DONT_INLINE_THRESHOLD; static final int PROFILE_LEVEL; static { - final Object[] values = new Object[8]; + final Object[] values = new Object[7]; AccessController.doPrivileged(new PrivilegedAction() { public Void run() { values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES"); values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES"); values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER"); values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE"); - values[4] = Boolean.getBoolean("java.lang.invoke.MethodHandle.USE_LF_EDITOR"); - values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30); - values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30); - values[7] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0); + values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30); + values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30); + values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0); return null; } }); @@ -69,10 +67,9 @@ import sun.misc.Unsafe; DUMP_CLASS_FILES = (Boolean) values[1]; TRACE_INTERPRETER = (Boolean) values[2]; TRACE_METHOD_LINKAGE = (Boolean) values[3]; - USE_LAMBDA_FORM_EDITOR = (Boolean) values[4]; - COMPILE_THRESHOLD = (Integer) values[5]; - DONT_INLINE_THRESHOLD = (Integer) values[6]; - PROFILE_LEVEL = (Integer) values[7]; + COMPILE_THRESHOLD = (Integer) values[4]; + DONT_INLINE_THRESHOLD = (Integer) values[5]; + PROFILE_LEVEL = (Integer) values[6]; } /** Tell if any of the debugging switches are turned on. diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index 1600658e938..0fe5a897417 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -2103,115 +2103,65 @@ assert((int)twice.invokeExact(21) == 42); reorder = reorder.clone(); // get a private copy MethodType oldType = target.type(); permuteArgumentChecks(reorder, newType, oldType); - if (USE_LAMBDA_FORM_EDITOR) { - // first detect dropped arguments and handle them separately - int[] originalReorder = reorder; - BoundMethodHandle result = target.rebind(); - LambdaForm form = result.form; - int newArity = newType.parameterCount(); - // Normalize the reordering into a real permutation, - // by removing duplicates and adding dropped elements. - // This somewhat improves lambda form caching, as well - // as simplifying the transform by breaking it up into steps. - for (int ddIdx; (ddIdx = findFirstDupOrDrop(reorder, newArity)) != 0; ) { - if (ddIdx > 0) { - // We found a duplicated entry at reorder[ddIdx]. - // Example: (x,y,z)->asList(x,y,z) - // permuted by [1*,0,1] => (a0,a1)=>asList(a1,a0,a1) - // permuted by [0,1,0*] => (a0,a1)=>asList(a0,a1,a0) - // The starred element corresponds to the argument - // deleted by the dupArgumentForm transform. - int srcPos = ddIdx, dstPos = srcPos, dupVal = reorder[srcPos]; - boolean killFirst = false; - for (int val; (val = reorder[--dstPos]) != dupVal; ) { - // Set killFirst if the dup is larger than an intervening position. - // This will remove at least one inversion from the permutation. - if (dupVal > val) killFirst = true; - } - if (!killFirst) { - srcPos = dstPos; - dstPos = ddIdx; - } - form = form.editor().dupArgumentForm(1 + srcPos, 1 + dstPos); - assert (reorder[srcPos] == reorder[dstPos]); - oldType = oldType.dropParameterTypes(dstPos, dstPos + 1); - // contract the reordering by removing the element at dstPos - int tailPos = dstPos + 1; - System.arraycopy(reorder, tailPos, reorder, dstPos, reorder.length - tailPos); - reorder = Arrays.copyOf(reorder, reorder.length - 1); - } else { - int dropVal = ~ddIdx, insPos = 0; - while (insPos < reorder.length && reorder[insPos] < dropVal) { - // Find first element of reorder larger than dropVal. - // This is where we will insert the dropVal. - insPos += 1; - } - Class ptype = newType.parameterType(dropVal); - form = form.editor().addArgumentForm(1 + insPos, BasicType.basicType(ptype)); - oldType = oldType.insertParameterTypes(insPos, ptype); - // expand the reordering by inserting an element at insPos - int tailPos = insPos + 1; - reorder = Arrays.copyOf(reorder, reorder.length + 1); - System.arraycopy(reorder, insPos, reorder, tailPos, reorder.length - tailPos); - reorder[insPos] = dropVal; + // first detect dropped arguments and handle them separately + int[] originalReorder = reorder; + BoundMethodHandle result = target.rebind(); + LambdaForm form = result.form; + int newArity = newType.parameterCount(); + // Normalize the reordering into a real permutation, + // by removing duplicates and adding dropped elements. + // This somewhat improves lambda form caching, as well + // as simplifying the transform by breaking it up into steps. + for (int ddIdx; (ddIdx = findFirstDupOrDrop(reorder, newArity)) != 0; ) { + if (ddIdx > 0) { + // We found a duplicated entry at reorder[ddIdx]. + // Example: (x,y,z)->asList(x,y,z) + // permuted by [1*,0,1] => (a0,a1)=>asList(a1,a0,a1) + // permuted by [0,1,0*] => (a0,a1)=>asList(a0,a1,a0) + // The starred element corresponds to the argument + // deleted by the dupArgumentForm transform. + int srcPos = ddIdx, dstPos = srcPos, dupVal = reorder[srcPos]; + boolean killFirst = false; + for (int val; (val = reorder[--dstPos]) != dupVal; ) { + // Set killFirst if the dup is larger than an intervening position. + // This will remove at least one inversion from the permutation. + if (dupVal > val) killFirst = true; } - assert (permuteArgumentChecks(reorder, newType, oldType)); + if (!killFirst) { + srcPos = dstPos; + dstPos = ddIdx; + } + form = form.editor().dupArgumentForm(1 + srcPos, 1 + dstPos); + assert (reorder[srcPos] == reorder[dstPos]); + oldType = oldType.dropParameterTypes(dstPos, dstPos + 1); + // contract the reordering by removing the element at dstPos + int tailPos = dstPos + 1; + System.arraycopy(reorder, tailPos, reorder, dstPos, reorder.length - tailPos); + reorder = Arrays.copyOf(reorder, reorder.length - 1); + } else { + int dropVal = ~ddIdx, insPos = 0; + while (insPos < reorder.length && reorder[insPos] < dropVal) { + // Find first element of reorder larger than dropVal. + // This is where we will insert the dropVal. + insPos += 1; + } + Class ptype = newType.parameterType(dropVal); + form = form.editor().addArgumentForm(1 + insPos, BasicType.basicType(ptype)); + oldType = oldType.insertParameterTypes(insPos, ptype); + // expand the reordering by inserting an element at insPos + int tailPos = insPos + 1; + reorder = Arrays.copyOf(reorder, reorder.length + 1); + System.arraycopy(reorder, insPos, reorder, tailPos, reorder.length - tailPos); + reorder[insPos] = dropVal; } - assert (reorder.length == newArity); // a perfect permutation - // Note: This may cache too many distinct LFs. Consider backing off to varargs code. - form = form.editor().permuteArgumentsForm(1, reorder); - if (newType == result.type() && form == result.internalForm()) - return result; - return result.copyWith(newType, form); - } else { - // first detect dropped arguments and handle them separately - MethodHandle originalTarget = target; - int newArity = newType.parameterCount(); - for (int dropIdx; (dropIdx = findFirstDrop(reorder, newArity)) >= 0; ) { - // dropIdx is missing from reorder; add it in at the end - int oldArity = reorder.length; - target = dropArguments(target, oldArity, newType.parameterType(dropIdx)); - reorder = Arrays.copyOf(reorder, oldArity + 1); - reorder[oldArity] = dropIdx; - } - assert(target == originalTarget || permuteArgumentChecks(reorder, newType, target.type())); - // Note: This may cache too many distinct LFs. Consider backing off to varargs code. - BoundMethodHandle result = target.rebind(); - LambdaForm form = result.form.permuteArguments(1, reorder, basicTypes(newType.parameterList())); - return result.copyWith(newType, form); - } - } - - /** Return the first value in [0..newArity-1] that is not present in reorder. */ - private static int findFirstDrop(int[] reorder, int newArity) { - final int BIT_LIMIT = 63; // max number of bits in bit mask - if (newArity < BIT_LIMIT) { - long mask = 0; - for (int arg : reorder) { - assert(arg < newArity); - mask |= (1L << arg); - } - if (mask == (1L << newArity) - 1) { - assert(Long.numberOfTrailingZeros(Long.lowestOneBit(~mask)) == newArity); - return -1; - } - // find first zero - long zeroBit = Long.lowestOneBit(~mask); - int zeroPos = Long.numberOfTrailingZeros(zeroBit); - assert(zeroPos < newArity); - return zeroPos; - } else { - BitSet mask = new BitSet(newArity); - for (int arg : reorder) { - assert (arg < newArity); - mask.set(arg); - } - int zeroPos = mask.nextClearBit(0); - assert(zeroPos <= newArity); - if (zeroPos == newArity) - return -1; - return zeroPos; + assert (permuteArgumentChecks(reorder, newType, oldType)); } + assert (reorder.length == newArity); // a perfect permutation + // Note: This may cache too many distinct LFs. Consider backing off to varargs code. + form = form.editor().permuteArgumentsForm(1, reorder); + if (newType == result.type() && form == result.internalForm()) + return result; + return result.copyWith(newType, form); } /** @@ -2502,13 +2452,9 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z")); if (dropped == 0) return target; BoundMethodHandle result = target.rebind(); LambdaForm lform = result.form; - if (USE_LAMBDA_FORM_EDITOR) { - int insertFormArg = 1 + pos; - for (Class ptype : valueTypes) { - lform = lform.editor().addArgumentForm(insertFormArg++, BasicType.basicType(ptype)); - } - } else { - lform = lform.addArguments(pos, valueTypes); + int insertFormArg = 1 + pos; + for (Class ptype : valueTypes) { + lform = lform.editor().addArgumentForm(insertFormArg++, BasicType.basicType(ptype)); } result = result.copyWith(newType, lform); return result; @@ -2659,18 +2605,14 @@ assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY /*non-public*/ static MethodHandle filterArgument(MethodHandle target, int pos, MethodHandle filter) { filterArgumentChecks(target, pos, filter); - if (USE_LAMBDA_FORM_EDITOR) { - MethodType targetType = target.type(); - MethodType filterType = filter.type(); - BoundMethodHandle result = target.rebind(); - Class newParamType = filterType.parameterType(0); - LambdaForm lform = result.editor().filterArgumentForm(1 + pos, BasicType.basicType(newParamType)); - MethodType newType = targetType.changeParameterType(pos, newParamType); - result = result.copyWithExtendL(newType, lform, filter); - return result; - } else { - return MethodHandleImpl.makeCollectArguments(target, filter, pos, false); - } + MethodType targetType = target.type(); + MethodType filterType = filter.type(); + BoundMethodHandle result = target.rebind(); + Class newParamType = filterType.parameterType(0); + LambdaForm lform = result.editor().filterArgumentForm(1 + pos, BasicType.basicType(newParamType)); + MethodType newType = targetType.changeParameterType(pos, newParamType); + result = result.copyWithExtendL(newType, lform, filter); + return result; } private static void filterArgumentsCheckArity(MethodHandle target, int pos, MethodHandle[] filters) { @@ -2797,21 +2739,17 @@ assertEquals("[top, [[up, down, strange], charm], bottom]", public static MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle filter) { MethodType newType = collectArgumentsChecks(target, pos, filter); - if (USE_LAMBDA_FORM_EDITOR) { - MethodType collectorType = filter.type(); - BoundMethodHandle result = target.rebind(); - LambdaForm lform; - if (collectorType.returnType().isArray() && filter.intrinsicName() == Intrinsic.NEW_ARRAY) { - lform = result.editor().collectArgumentArrayForm(1 + pos, filter); - if (lform != null) { - return result.copyWith(newType, lform); - } + MethodType collectorType = filter.type(); + BoundMethodHandle result = target.rebind(); + LambdaForm lform; + if (collectorType.returnType().isArray() && filter.intrinsicName() == Intrinsic.NEW_ARRAY) { + lform = result.editor().collectArgumentArrayForm(1 + pos, filter); + if (lform != null) { + return result.copyWith(newType, lform); } - lform = result.editor().collectArgumentsForm(1 + pos, collectorType.basicType()); - return result.copyWithExtendL(newType, lform, filter); - } else { - return MethodHandleImpl.makeCollectArguments(target, filter, pos, false); } + lform = result.editor().collectArgumentsForm(1 + pos, collectorType.basicType()); + return result.copyWithExtendL(newType, lform, filter); } private static MethodType collectArgumentsChecks(MethodHandle target, int pos, MethodHandle filter) throws RuntimeException { @@ -2890,16 +2828,12 @@ System.out.println((int) f0.invokeExact("x", "y")); // 2 MethodType targetType = target.type(); MethodType filterType = filter.type(); filterReturnValueChecks(targetType, filterType); - if (USE_LAMBDA_FORM_EDITOR) { - BoundMethodHandle result = target.rebind(); - BasicType rtype = BasicType.basicType(filterType.returnType()); - LambdaForm lform = result.editor().filterReturnForm(rtype, false); - MethodType newType = targetType.changeReturnType(filterType.returnType()); - result = result.copyWithExtendL(newType, lform, filter); - return result; - } else { - return MethodHandleImpl.makeCollectArguments(filter, target, 0, false); - } + BoundMethodHandle result = target.rebind(); + BasicType rtype = BasicType.basicType(filterType.returnType()); + LambdaForm lform = result.editor().filterReturnForm(rtype, false); + MethodType newType = targetType.changeReturnType(filterType.returnType()); + result = result.copyWithExtendL(newType, lform, filter); + return result; } private static void filterReturnValueChecks(MethodType targetType, MethodType filterType) throws RuntimeException { @@ -2993,19 +2927,15 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum")); MethodType targetType = target.type(); MethodType combinerType = combiner.type(); Class rtype = foldArgumentChecks(foldPos, targetType, combinerType); - if (USE_LAMBDA_FORM_EDITOR) { - BoundMethodHandle result = target.rebind(); - boolean dropResult = (rtype == void.class); - // Note: This may cache too many distinct LFs. Consider backing off to varargs code. - LambdaForm lform = result.editor().foldArgumentsForm(1 + foldPos, dropResult, combinerType.basicType()); - MethodType newType = targetType; - if (!dropResult) - newType = newType.dropParameterTypes(foldPos, foldPos + 1); - result = result.copyWithExtendL(newType, lform, combiner); - return result; - } else { - return MethodHandleImpl.makeCollectArguments(target, combiner, foldPos, true); - } + BoundMethodHandle result = target.rebind(); + boolean dropResult = (rtype == void.class); + // Note: This may cache too many distinct LFs. Consider backing off to varargs code. + LambdaForm lform = result.editor().foldArgumentsForm(1 + foldPos, dropResult, combinerType.basicType()); + MethodType newType = targetType; + if (!dropResult) + newType = newType.dropParameterTypes(foldPos, foldPos + 1); + result = result.copyWithExtendL(newType, lform, combiner); + return result; } private static Class foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType) { diff --git a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java index 3b9ed4dea74..451af074bdc 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java +++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java @@ -31,7 +31,7 @@ * @build TestMethods * @build LambdaFormTestCase * @build LFGarbageCollectedTest - * @run main/othervm/timeout=600 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true -DtestLimit=150 LFGarbageCollectedTest + * @run main/othervm/timeout=600 -DtestLimit=150 LFGarbageCollectedTest */ import java.lang.invoke.MethodHandle; diff --git a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java index a41647246bc..21771c1a0a0 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java +++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java @@ -31,7 +31,7 @@ * @build LambdaFormTestCase * @build LFCachingTestCase * @build LFMultiThreadCachingTest - * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFMultiThreadCachingTest + * @run main/othervm/timeout=300 LFMultiThreadCachingTest */ import java.lang.invoke.MethodHandle; diff --git a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java index 21221aa7caf..bd0ba2bde59 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java +++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java @@ -31,7 +31,7 @@ * @build LambdaFormTestCase * @build LFCachingTestCase * @build LFSingleThreadCachingTest - * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFSingleThreadCachingTest + * @run main/othervm/timeout=300 LFSingleThreadCachingTest */ import java.lang.invoke.MethodHandle; From 95ef6e0cb2b59d8f6c8736bac5217a0feb0c4d01 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 24 Nov 2014 07:19:36 -0800 Subject: [PATCH 127/159] 8059880: Get rid of LambdaForm interpretation Reviewed-by: psandoz, kvn, shade --- .../share/classes/java/lang/invoke/MethodHandleStatics.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java index 43700b4d8db..335a32289a7 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java @@ -57,7 +57,7 @@ import sun.misc.Unsafe; values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES"); values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER"); values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE"); - values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30); + values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 0); values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30); values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0); return null; From 3469175a632b593b610f3ee1f93cbc834ce92d9d Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 24 Nov 2014 18:11:25 +0000 Subject: [PATCH 128/159] 8065720: (ch) AbstractInterruptibleChannel.end sets interrupted to null Reviewed-by: psandoz, chegar --- .../java/nio/channels/spi/AbstractInterruptibleChannel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java index 5000c583cde..fccc2904c7d 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java @@ -198,7 +198,7 @@ public abstract class AbstractInterruptibleChannel blockedOn(null); Thread interrupted = this.interrupted; if (interrupted != null && interrupted == Thread.currentThread()) { - interrupted = null; + this.interrupted = null; throw new ClosedByInterruptException(); } if (!completed && !open) From 758644082bddea64c8d88287ab411bdfc1300866 Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Tue, 25 Nov 2014 14:16:55 +0400 Subject: [PATCH 129/159] 8059070: [TESTBUG] java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java failed - timeout Reviewed-by: psandoz, vlivanov --- .../lang/invoke/LFCaching/LFGarbageCollectedTest.java | 2 +- .../invoke/LFCaching/LFMultiThreadCachingTest.java | 2 +- .../invoke/LFCaching/LFSingleThreadCachingTest.java | 2 +- .../lang/invoke/LFCaching/LambdaFormTestCase.java | 11 +++++++++++ jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java | 7 +++++++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java index 451af074bdc..f0f6b034dbb 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java +++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java @@ -31,7 +31,7 @@ * @build TestMethods * @build LambdaFormTestCase * @build LFGarbageCollectedTest - * @run main/othervm/timeout=600 -DtestLimit=150 LFGarbageCollectedTest + * @run main/othervm LFGarbageCollectedTest */ import java.lang.invoke.MethodHandle; diff --git a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java index 21771c1a0a0..35c2f97d191 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java +++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java @@ -31,7 +31,7 @@ * @build LambdaFormTestCase * @build LFCachingTestCase * @build LFMultiThreadCachingTest - * @run main/othervm/timeout=300 LFMultiThreadCachingTest + * @run main/othervm LFMultiThreadCachingTest */ import java.lang.invoke.MethodHandle; diff --git a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java index bd0ba2bde59..6a44e44d8b6 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java +++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java @@ -31,7 +31,7 @@ * @build LambdaFormTestCase * @build LFCachingTestCase * @build LFSingleThreadCachingTest - * @run main/othervm/timeout=300 LFSingleThreadCachingTest + * @run main/othervm LFSingleThreadCachingTest */ import java.lang.invoke.MethodHandle; diff --git a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java index dfdcd15297f..a1821fa696f 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java +++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java @@ -27,6 +27,7 @@ import java.lang.management.ManagementFactory; import java.lang.reflect.Method; import java.util.Collection; import java.util.function.Function; +import jdk.testlibrary.Utils; /** * Lambda forms caching test case class. Contains all necessary test routines to @@ -41,6 +42,7 @@ public abstract class LambdaFormTestCase { private final static String INTERNAL_FORM_METHOD_NAME = "internalForm"; private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO = 45 / (128.0 * 1024 * 1024); + private static final long TIMEOUT = Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT); /** * Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is @@ -120,6 +122,7 @@ public abstract class LambdaFormTestCase { System.out.printf("Number of iterations is set to %d (%d cases)%n", iterations, iterations * testCaseNum); System.out.flush(); + long startTime = System.currentTimeMillis(); for (long i = 0; i < iterations; i++) { System.err.println(String.format("Iteration %d:", i)); for (TestMethods testMethod : testMethods) { @@ -137,6 +140,14 @@ public abstract class LambdaFormTestCase { } testCounter++; } + long passedTime = System.currentTimeMillis() - startTime; + long avgIterTime = passedTime / (i + 1); + long remainTime = TIMEOUT - passedTime; + if (avgIterTime > 2 * remainTime) { + System.err.printf("Stopping iterations because of lack of time.%n" + + "Increase timeout factor for more iterations.%n"); + break; + } } if (!passed) { throw new Error(String.format("%d of %d test cases FAILED! %n" diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java index e96898c8fc5..af8cc267493 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java @@ -38,6 +38,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.regex.Pattern; import java.util.regex.Matcher; +import java.util.concurrent.TimeUnit; /** * Common library for various test helper functions. @@ -69,6 +70,12 @@ public final class Utils { TIMEOUT_FACTOR = Double.parseDouble(toFactor); } + /** + * Returns the value of JTREG default test timeout in milliseconds + * converted to {@code long}. + */ + public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120); + private Utils() { // Private constructor to prevent class instantiation } From a6da554cfb11fe793e5b31ea9e25efa2a7738993 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Tue, 25 Nov 2014 18:43:44 +0000 Subject: [PATCH 130/159] 8065072: sun/net/www/http/HttpClient/StreamingRetry.java failed intermittently Reviewed-by: dfuchs --- .../sun/net/www/http/HttpClient/StreamingRetry.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java index 35dbc51d2de..d3e2b5215d0 100644 --- a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java +++ b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java @@ -37,13 +37,13 @@ import static java.lang.System.out; public class StreamingRetry implements Runnable { static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds - ServerSocket ss; + volatile ServerSocket ss; - public static void main(String[] args) throws IOException { + public static void main(String[] args) throws Exception { (new StreamingRetry()).instanceMain(); } - void instanceMain() throws IOException { + void instanceMain() throws Exception { out.println("Test with default method"); test(null); out.println("Test with POST method"); @@ -54,12 +54,13 @@ public class StreamingRetry implements Runnable { if (failed > 0) throw new RuntimeException("Some tests failed"); } - void test(String method) throws IOException { + void test(String method) throws Exception { ss = new ServerSocket(0); ss.setSoTimeout(ACCEPT_TIMEOUT); int port = ss.getLocalPort(); - (new Thread(this)).start(); + Thread otherThread = new Thread(this); + otherThread.start(); try { URL url = new URL("http://localhost:" + port + "/"); @@ -77,6 +78,7 @@ public class StreamingRetry implements Runnable { //expected.printStackTrace(); } finally { ss.close(); + otherThread.join(); } } From 137d39454df62bf1b4a3dd7cbd4b21fa1fa7c5e1 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Wed, 26 Nov 2014 08:06:58 +0100 Subject: [PATCH 131/159] 8007993: hotspot.log w/ enabled LogCompilation can be an invalid XML Open compilation log files in write-mode and close before deletion attempt. Reviewed-by: vlivanov --- hotspot/src/share/vm/compiler/compileBroker.cpp | 2 +- hotspot/src/share/vm/compiler/compileLog.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index 079d0835883..2b22da1f705 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -1807,7 +1807,7 @@ void CompileBroker::init_compiler_thread_log() { os::file_separator(), thread_id, os::current_process_id()); } - fp = fopen(file_name, "at"); + fp = fopen(file_name, "wt"); if (fp != NULL) { if (LogCompilation && Verbose) { tty->print_cr("Opening compilation log %s", file_name); diff --git a/hotspot/src/share/vm/compiler/compileLog.cpp b/hotspot/src/share/vm/compiler/compileLog.cpp index 340251f3265..88cfb1bbfb6 100644 --- a/hotspot/src/share/vm/compiler/compileLog.cpp +++ b/hotspot/src/share/vm/compiler/compileLog.cpp @@ -56,8 +56,10 @@ CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id) } CompileLog::~CompileLog() { - delete _out; + delete _out; // Close fd in fileStream::~fileStream() _out = NULL; + // Remove partial file after merging in CompileLog::finish_log_on_error + unlink(_file); FREE_C_HEAP_ARRAY(char, _identities, mtCompiler); FREE_C_HEAP_ARRAY(char, _file, mtCompiler); } @@ -278,10 +280,9 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen) } file->print_raw_cr(""); close(partial_fd); - unlink(partial_file); } CompileLog* next_log = log->_next; - delete log; + delete log; // Removes partial file log = next_log; } _first = NULL; From eafad5770a80bdfd8451f192fce41ef2d34829fb Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 26 Nov 2014 15:28:46 +0800 Subject: [PATCH 132/159] 8061253: Spec cleanup for some security-related classes Reviewed-by: mullan --- .../share/classes/java/security/KeyStore.java | 3 +- .../classes/java/security/Principal.java | 3 +- .../javax/security/auth/Destroyable.java | 4 +- .../security/auth/kerberos/EncryptionKey.java | 26 +++++++++---- .../auth/kerberos/KerberosCredMessage.java | 23 ++++++++++++ .../security/auth/kerberos/KerberosKey.java | 37 +++++++++++-------- .../auth/kerberos/KerberosPrincipal.java | 32 +++++++++------- .../auth/kerberos/KerberosTicket.java | 31 +++++++++------- .../javax/security/auth/kerberos/KeyTab.java | 29 +++++++++------ 9 files changed, 122 insertions(+), 66 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/security/KeyStore.java b/jdk/src/java.base/share/classes/java/security/KeyStore.java index 4278369e8be..53e787b7d98 100644 --- a/jdk/src/java.base/share/classes/java/security/KeyStore.java +++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java @@ -416,7 +416,8 @@ public class KeyStore { /** * Retrieves the attributes associated with an entry. - *

    + * + * @implSpec * The default implementation returns an empty {@code Set}. * * @return an unmodifiable {@code Set} of attributes, possibly empty diff --git a/jdk/src/java.base/share/classes/java/security/Principal.java b/jdk/src/java.base/share/classes/java/security/Principal.java index a538e707ee7..db1e7d5fd02 100644 --- a/jdk/src/java.base/share/classes/java/security/Principal.java +++ b/jdk/src/java.base/share/classes/java/security/Principal.java @@ -74,7 +74,8 @@ public interface Principal { /** * Returns true if the specified subject is implied by this principal. * - *

    The default implementation of this method returns true if + * @implSpec + * The default implementation of this method returns true if * {@code subject} is non-null and contains at least one principal that * is equal to this principal. * diff --git a/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java b/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java index 15b92006cdf..4d1afe56fd5 100644 --- a/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java +++ b/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java @@ -41,7 +41,7 @@ public interface Destroyable { * on this {@code Object} will result in an * {@code IllegalStateException} being thrown. * - *

    + * @implSpec * The default implementation throws {@code DestroyFailedException}. * * @exception DestroyFailedException if the destroy operation fails.

    @@ -56,7 +56,7 @@ public interface Destroyable { /** * Determine if this {@code Object} has been destroyed. * - *

    + * @implSpec * The default implementation returns false. * * @return true if this {@code Object} has been destroyed, diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java index 22730b60844..08b9179a11f 100644 --- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java +++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java @@ -158,6 +158,11 @@ public final class EncryptionKey implements SecretKey { return destroyed; } + /** + * Returns an informative textual representation of this {@code EncryptionKey}. + * + * @return an informative textual representation of this {@code EncryptionKey}. + */ @Override public String toString() { if (destroyed) { @@ -166,6 +171,11 @@ public final class EncryptionKey implements SecretKey { return "key " + key.toString(); } + /** + * Returns a hash code for this {@code EncryptionKey}. + * + * @return a hash code for this {@code EncryptionKey}. + */ @Override public int hashCode() { int result = 17; @@ -177,15 +187,17 @@ public final class EncryptionKey implements SecretKey { } /** - * Compares the specified Object with this key for equality. - * Returns true if the given object is also a + * Compares the specified object with this key for equality. + * Returns true if the given object is also an * {@code EncryptionKey} and the two - * {@code EncryptionKey} instances are equivalent. + * {@code EncryptionKey} instances are equivalent. More formally two + * {@code EncryptionKey} instances are equal if they have equal key types + * and key material. + * A destroyed {@code EncryptionKey} object is only equal to itself. * - * @param other the Object to compare to - * @return true if the specified object is equal to this EncryptionKey, - * false otherwise. NOTE: Returns false if either of the EncryptionKey - * objects has been destroyed. + * @param other the object to compare to + * @return true if the specified object is equal to this + * {@code EncryptionKey}, false otherwise. */ @Override public boolean equals(Object other) { diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java index ee2010b1531..e45ae2a4cee 100644 --- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java +++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java @@ -130,6 +130,11 @@ public final class KerberosCredMessage implements Destroyable { return destroyed; } + /** + * Returns an informative textual representation of this {@code KerberosCredMessage}. + * + * @return an informative textual representation of this {@code KerberosCredMessage}. + */ @Override public String toString() { if (destroyed) { @@ -140,6 +145,11 @@ public final class KerberosCredMessage implements Destroyable { } } + /** + * Returns a hash code for this {@code KerberosCredMessage}. + * + * @return a hash code for this {@code KerberosCredMessage}. + */ @Override public int hashCode() { if (isDestroyed()) { @@ -149,6 +159,19 @@ public final class KerberosCredMessage implements Destroyable { } } + /** + * Compares the specified object with this {@code KerberosCredMessage} + * for equality. Returns true if the given object is also a + * {@code KerberosCredMessage} and the two {@code KerberosCredMessage} + * instances are equivalent. More formally two {@code KerberosCredMessage} + * instances are equal if they have equal sender, recipient, and encoded + * KRB_CRED messages. + * A destroyed {@code KerberosCredMessage} object is only equal to itself. + * + * @param other the object to compare to + * @return true if the specified object is equal to this + * {@code KerberosCredMessage}, false otherwise. + */ @Override public boolean equals(Object other) { if (other == this) { diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java index b233052f44f..84a39e0e129 100644 --- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java +++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java @@ -61,10 +61,10 @@ import javax.security.auth.DestroyFailedException; * * It might be necessary for the application to be granted a * {@link javax.security.auth.PrivateCredentialPermission - * PrivateCredentialPermission} if it needs to access the KerberosKey + * PrivateCredentialPermission} if it needs to access the {@code KerberosKey} * instance from a Subject. This permission is not needed when the * application depends on the default JGSS Kerberos mechanism to access the - * KerberosKey. In that case, however, the application will need an + * {@code KerberosKey}. In that case, however, the application will need an * appropriate * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.

    * @@ -113,9 +113,9 @@ public class KerberosKey implements SecretKey { private transient boolean destroyed = false; /** - * Constructs a KerberosKey from the given bytes when the key type and - * key version number are known. This can be used when reading the secret - * key information from a Kerberos "keytab". + * Constructs a {@code KerberosKey} from the given bytes when the key type + * and key version number are known. This can be used when reading the + * secret key information from a Kerberos "keytab". * * @param principal the principal that this secret key belongs to * @param keyBytes the key material for the secret key @@ -133,9 +133,9 @@ public class KerberosKey implements SecretKey { } /** - * Constructs a KerberosKey from a principal's password using the specified - * algorithm name. The algorithm name (case insensitive) should be provided - * as the encryption type string defined on the IANA + * Constructs a {@code KerberosKey} from a principal's password using the + * specified algorithm name. The algorithm name (case insensitive) should + * be provided as the encryption type string defined on the IANA * Kerberos Encryption Type Numbers * page. The version number of the key generated will be 0. * @@ -261,6 +261,11 @@ public class KerberosKey implements SecretKey { return destroyed; } + /** + * Returns an informative textual representation of this {@code KerberosKey}. + * + * @return an informative textual representation of this {@code KerberosKey}. + */ public String toString() { if (destroyed) { return "Destroyed KerberosKey"; @@ -271,9 +276,9 @@ public class KerberosKey implements SecretKey { } /** - * Returns a hashcode for this KerberosKey. + * Returns a hash code for this {@code KerberosKey}. * - * @return a hashCode() for the {@code KerberosKey} + * @return a hash code for this {@code KerberosKey}. * @since 1.6 */ public int hashCode() { @@ -290,15 +295,15 @@ public class KerberosKey implements SecretKey { } /** - * Compares the specified Object with this KerberosKey for equality. - * Returns true if the given object is also a + * Compares the specified object with this {@code KerberosKey} for + * equality. Returns true if the given object is also a * {@code KerberosKey} and the two * {@code KerberosKey} instances are equivalent. + * A destroyed {@code KerberosKey} object is only equal to itself. * - * @param other the Object to compare to - * @return true if the specified object is equal to this KerberosKey, - * false otherwise. NOTE: Returns false if either of the KerberosKey - * objects has been destroyed. + * @param other the object to compare to + * @return true if the specified object is equal to this {@code KerberosKey}, + * false otherwise. * @since 1.6 */ public boolean equals(Object other) { diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java index 1c033803cc7..3a1c2c4c41b 100644 --- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java +++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java @@ -88,8 +88,8 @@ public final class KerberosPrincipal /** - * Constructs a KerberosPrincipal from the provided string input. The - * name type for this principal defaults to + * Constructs a {@code KerberosPrincipal} from the provided string input. + * The name type for this principal defaults to * {@link #KRB_NT_PRINCIPAL KRB_NT_PRINCIPAL} * This string is assumed to contain a name in the format * that is specified in Section 2.1.1. (Kerberos Principal Name Form) of @@ -127,7 +127,7 @@ public final class KerberosPrincipal } /** - * Constructs a KerberosPrincipal from the provided string and + * Constructs a {@code KerberosPrincipal} from the provided string and * name type input. The string is assumed to contain a name in the * format that is specified in Section 2.1 (Mandatory Name Forms) of * RFC 1964. @@ -137,7 +137,7 @@ public final class KerberosPrincipal * (for example, duke@FOO.COM, is a valid input string for the * name type, KRB_NT_PRINCIPAL where duke * represents a principal, and FOO.COM represents a realm). - + * *

    If the input name does not contain a realm, the default realm * is used. The default realm can be specified either in a Kerberos * configuration file or via the java.security.krb5.realm @@ -179,28 +179,28 @@ public final class KerberosPrincipal } /** - * Returns a hashcode for this principal. The hash code is defined to - * be the result of the following calculation: + * Returns a hash code for this {@code KerberosPrincipal}. The hash code + * is defined to be the result of the following calculation: *

    {@code
          *  hashCode = getName().hashCode();
          * }
    * - * @return a hashCode() for the {@code KerberosPrincipal} + * @return a hash code for this {@code KerberosPrincipal}. */ public int hashCode() { return getName().hashCode(); } /** - * Compares the specified Object with this Principal for equality. + * Compares the specified object with this principal for equality. * Returns true if the given object is also a * {@code KerberosPrincipal} and the two * {@code KerberosPrincipal} instances are equivalent. * More formally two {@code KerberosPrincipal} instances are equal * if the values returned by {@code getName()} are equal. * - * @param other the Object to compare to - * @return true if the Object passed in represents the same principal + * @param other the object to compare to + * @return true if the object passed in represents the same principal * as this one, false otherwise. */ public boolean equals(Object other) { @@ -217,11 +217,11 @@ public final class KerberosPrincipal } /** - * Save the KerberosPrincipal object to a stream + * Save the {@code KerberosPrincipal} object to a stream * * @serialData this {@code KerberosPrincipal} is serialized * by writing out the PrincipalName and the - * realm in their DER-encoded form as specified in Section 5.2.2 of + * Realm in their DER-encoded form as specified in Section 5.2.2 of * RFC4120. */ private void writeObject(ObjectOutputStream oos) @@ -268,7 +268,7 @@ public final class KerberosPrincipal } /** - * Returns the name type of the KerberosPrincipal. Valid name types + * Returns the name type of the {@code KerberosPrincipal}. Valid name types * are specified in Section 6.2 of * RFC4120. * @@ -278,7 +278,11 @@ public final class KerberosPrincipal return nameType; } - // Inherits javadocs from Object + /** + * Returns an informative textual representation of this {@code KerberosPrincipal}. + * + * @return an informative textual representation of this {@code KerberosPrincipal}. + */ public String toString() { return getName(); } diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java index 513b49c1fc0..2be499ff80b 100644 --- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java +++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java @@ -53,10 +53,10 @@ import sun.misc.HexDumpEncoder; * * It might be necessary for the application to be granted a * {@link javax.security.auth.PrivateCredentialPermission - * PrivateCredentialPermission} if it needs to access a KerberosTicket - * instance from a Subject. This permission is not needed when the + * PrivateCredentialPermission} if it needs to access a {@code KerberosTicket} + * instance from a {@code Subject}. This permission is not needed when the * application depends on the default JGSS Kerberos mechanism to access the - * KerberosTicket. In that case, however, the application will need an + * {@code KerberosTicket}. In that case, however, the application will need an * appropriate * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}. *

    @@ -193,7 +193,7 @@ public class KerberosTicket implements Destroyable, Refreshable, private transient boolean destroyed = false; /** - * Constructs a KerberosTicket using credentials information that a + * Constructs a {@code KerberosTicket} using credentials information that a * client either receives from a KDC or reads from a cache. * * @param asn1Encoding the ASN.1 encoding of the ticket as defined by @@ -565,8 +565,8 @@ public class KerberosTicket implements Destroyable, Refreshable, try { krb5Creds = new sun.security.krb5.Credentials(asn1Encoding, - client.toString(), - server.toString(), + client.getName(), + server.getName(), sessionKey.getEncoded(), sessionKey.getKeyType(), flags, @@ -644,6 +644,11 @@ public class KerberosTicket implements Destroyable, Refreshable, return destroyed; } + /** + * Returns an informative textual representation of this {@code KerberosTicket}. + * + * @return an informative textual representation of this {@code KerberosTicket}. + */ public String toString() { if (destroyed) { return "Destroyed KerberosTicket"; @@ -677,9 +682,9 @@ public class KerberosTicket implements Destroyable, Refreshable, } /** - * Returns a hashcode for this KerberosTicket. + * Returns a hash code for this {@code KerberosTicket}. * - * @return a hashCode() for the {@code KerberosTicket} + * @return a hash code for this {@code KerberosTicket}. * @since 1.6 */ public int hashCode() { @@ -714,15 +719,15 @@ public class KerberosTicket implements Destroyable, Refreshable, } /** - * Compares the specified Object with this KerberosTicket for equality. + * Compares the specified object with this {@code KerberosTicket} for equality. * Returns true if the given object is also a * {@code KerberosTicket} and the two * {@code KerberosTicket} instances are equivalent. + * A destroyed {@code KerberosTicket} object is only equal to itself. * - * @param other the Object to compare to - * @return true if the specified object is equal to this KerberosTicket, - * false otherwise. NOTE: Returns false if either of the KerberosTicket - * objects has been destroyed. + * @param other the object to compare to + * @return true if the specified object is equal to this {@code KerberosTicket}, + * false otherwise. * @since 1.6 */ public boolean equals(Object other) { diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java index db815395e3a..3b636077b08 100644 --- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java +++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java @@ -58,10 +58,10 @@ import sun.security.krb5.RealmException; *

    * It might be necessary for the application to be granted a * {@link javax.security.auth.PrivateCredentialPermission - * PrivateCredentialPermission} if it needs to access the KeyTab - * instance from a Subject. This permission is not needed when the + * PrivateCredentialPermission} if it needs to access the {@code KeyTab} + * instance from a {@code Subject}. This permission is not needed when the * application depends on the default JGSS Kerberos mechanism to access the - * KeyTab. In that case, however, the application will need an appropriate + * {@code KeyTab}. In that case, however, the application will need an appropriate * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}. *

    * The keytab file format is described at @@ -249,7 +249,7 @@ public final class KeyTab { * could potentially be expired. *

    * If there is any error (say, I/O error or format error) - * during the reading process of the KeyTab file, a saved result should be + * during the reading process of the keytab file, a saved result should be * returned. If there is no saved result (say, this is the first time this * method is called, or, all previous read attempts failed), an empty array * should be returned. This can make sure the result is not drastically @@ -316,6 +316,11 @@ public final class KeyTab { return !takeSnapshot().isMissing(); } + /** + * Returns an informative textual representation of this {@code KeyTab}. + * + * @return an informative textual representation of this {@code KeyTab}. + */ public String toString() { String s = (file == null) ? "Default keytab" : file.toString(); if (!bound) return s; @@ -324,22 +329,22 @@ public final class KeyTab { } /** - * Returns a hashcode for this KeyTab. + * Returns a hash code for this {@code KeyTab}. * - * @return a hashCode() for the {@code KeyTab} + * @return a hash code for this {@code KeyTab}. */ public int hashCode() { return Objects.hash(file, princ, bound); } /** - * Compares the specified Object with this KeyTab for equality. + * Compares the specified object with this {@code KeyTab} for equality. * Returns true if the given object is also a * {@code KeyTab} and the two * {@code KeyTab} instances are equivalent. * - * @param other the Object to compare to - * @return true if the specified object is equal to this KeyTab + * @param other the object to compare to + * @return true if the specified object is equal to this {@code KeyTab} */ public boolean equals(Object other) { if (other == this) @@ -359,9 +364,9 @@ public final class KeyTab { * Returns the service principal this {@code KeyTab} object * is bound to. Returns {@code null} if it's not bound. *

    - * Please note the deprecated constructors create a KeyTab object bound for - * some unknown principal. In this case, this method also returns null. - * User can call {@link #isBound()} to verify this case. + * Please note the deprecated constructors create a {@code KeyTab} object + * bound for some unknown principal. In this case, this method also returns + * null. User can call {@link #isBound()} to verify this case. * @return the service principal * @since 1.8 */ From 64bb4a891c9480523e1e07879909d19bd0612408 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 26 Nov 2014 15:15:27 +0100 Subject: [PATCH 133/159] 8065913: Various improvements in SetupNativeCompilation Reviewed-by: erikj --- jdk/make/launcher/Launcher-jdk.runtime.gmk | 2 +- jdk/make/lib/LibCommon.gmk | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/jdk/make/launcher/Launcher-jdk.runtime.gmk b/jdk/make/launcher/Launcher-jdk.runtime.gmk index a8b21fe42e7..af3fc299240 100644 --- a/jdk/make/launcher/Launcher-jdk.runtime.gmk +++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk @@ -77,7 +77,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) EXE_OUT_OPTION := -Fe # With the current way unpack200 is built, debug symbols aren't supported # anyway. - UNPACKEXE_DEBUG_SYMBOLS := + UNPACKEXE_DEBUG_SYMBOLS := false endif # The linker on older SuSE distros (e.g. on SLES 10) complains with: diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk index eede8fbd8de..fd6e3428715 100644 --- a/jdk/make/lib/LibCommon.gmk +++ b/jdk/make/lib/LibCommon.gmk @@ -45,15 +45,17 @@ endif # elegant solution to this. WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib -# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but -# not on other platforms. -ifeq ($(OPENJDK_TARGET_OS), windows) - DEBUG_ALL_BINARIES := true -endif - -# Build everything with debugging on OpenJDK ifdef OPENJDK + # Build everything with debugging on OpenJDK DEBUG_ALL_BINARIES := true +else + # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but + # not on other platforms. + ifeq ($(OPENJDK_TARGET_OS), windows) + DEBUG_ALL_BINARIES := true + else + DEBUG_ALL_BINARIES := false + endif endif ################################################################################ From 13f3dfa073c624e5438beefb6041965bbf952314 Mon Sep 17 00:00:00 2001 From: Amy Lu Date: Wed, 26 Nov 2014 11:12:19 -0800 Subject: [PATCH 134/159] 8060026: Update jdk/test/tools/launcher tests to eliminate dependency on sun.tools.jar.Main Reviewed-by: alanb, ksrini, psandoz --- jdk/test/tools/launcher/TestHelper.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/jdk/test/tools/launcher/TestHelper.java b/jdk/test/tools/launcher/TestHelper.java index 40737320d52..840e67ead20 100644 --- a/jdk/test/tools/launcher/TestHelper.java +++ b/jdk/test/tools/launcher/TestHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -50,6 +50,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Arrays; import javax.tools.JavaCompiler; import javax.tools.ToolProvider; @@ -333,15 +334,10 @@ public class TestHelper { } static void createJar(String... args) { - sun.tools.jar.Main jarTool = - new sun.tools.jar.Main(System.out, System.err, "JarCreator"); - if (!jarTool.run(args)) { - String message = "jar creation failed with command:"; - for (String x : args) { - message = message.concat(" " + x); - } - throw new RuntimeException(message); - } + List cmdList = new ArrayList<>(); + cmdList.add(jarCmd); + cmdList.addAll(Arrays.asList(args)); + doExec(cmdList.toArray(new String[cmdList.size()])); } static void copyStream(InputStream in, OutputStream out) throws IOException { From 6026dc63ea960a00d9c9ad85f513613b9b39ddf4 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Wed, 26 Nov 2014 20:10:48 +0100 Subject: [PATCH 135/159] 8065748: Add a test to verify that non ascii characters in Encodings.properties do not cause issues Reviewed-by: joehw --- .../jaxp/Encodings/CheckEncodingPropertiesFile.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java index e8f03021e08..88e9648f066 100644 --- a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java +++ b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8008738 + * @bug 8008738 8065138 * @summary checks that the mapping implemented by * com.sun.org.apache.xml.internal.serializer.Encodings * correctly identifies valid Charset names and @@ -64,6 +64,15 @@ public class CheckEncodingPropertiesFile { props.load(is); } + if (!props.containsKey("UTF8")) { + // If the test fails here - it may indicate that you stumbled on an + // issue similar to that fixed by JDK-8065138. + // Check that the content of the Encodings.properties included in + // the tested build image matches the content of the file in the source + // jaxp tree of the jdk forest. + throw new RuntimeException("UTF8 key missing in " + ClassLoader.getSystemResource(ENCODINGS_FILE)); + } + //printAllCharsets(); test(props); From c4ced97793697766d7c7b8eb254211a92bd523ea Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 27 Nov 2014 15:41:56 +0100 Subject: [PATCH 136/159] 8065914: Various improvements and cleanup of build system Reviewed-by: erikj --- Makefile | 15 +- common/autoconf/basics.m4 | 4 +- common/autoconf/boot-jdk.m4 | 30 +- common/autoconf/bootcycle-spec.gmk.in | 1 - common/autoconf/build-aux/config.guess | 2 +- common/autoconf/build-aux/install.sh | 10 +- common/autoconf/compare.sh.in | 1 + common/autoconf/generated-configure.sh | 2 +- common/autoconf/libraries.m4 | 2 +- common/autoconf/spec.gmk.in | 4 +- common/autoconf/toolchain_windows.m4 | 14 +- common/bin/compare.sh | 492 +++++++++++-------------- common/bin/compare_exceptions.sh.incl | 99 +++-- common/bin/logger.sh | 4 +- common/bin/shell-tracer.sh | 6 +- common/bin/test_builds.sh | 3 +- common/bin/unshuffle_patch.sh | 3 +- make/CompileJavaModules.gmk | 6 +- make/Javadoc.gmk | 2 +- make/Main.gmk | 22 +- make/MakeHelpers.gmk | 25 +- make/common/JavaCompilation.gmk | 8 +- make/common/MakeBase.gmk | 6 +- make/common/RMICompilation.gmk | 8 +- make/common/SetupJavaCompilers.gmk | 6 +- make/common/TextFileProcessing.gmk | 40 +- make/jprt.properties | 2 +- make/scripts/normalizer.pl | 28 +- make/scripts/update_copyright_year.sh | 1 - 29 files changed, 422 insertions(+), 424 deletions(-) diff --git a/Makefile b/Makefile index d4b36e4539d..d89adc033d4 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ default: # The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make. # /usr/ccs/bin/make lacks basically every other flow control mechanism. -TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 +.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 # Assume we have GNU make, but check version. ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), ) @@ -46,7 +46,17 @@ ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) else makefile_path:=$(lastword $(MAKEFILE_LIST)) endif -root_dir:=$(dir $(makefile_path)) +root_dir:=$(patsubst %/,%,$(dir $(makefile_path))) + +ifneq ($(findstring qp,$(MAKEFLAGS)),) + # When called with -qp, assume an external part (e.g. bash completion) is trying + # to understand our targets. + # Duplication of global targets, needed before ParseConfAndSpec in case we have + # no configurations. + help: + # If CONF is not set, look for all available configurations + CONF?= +endif # ... and then we can include our helper functions include $(root_dir)/make/MakeHelpers.gmk @@ -89,6 +99,7 @@ else # The wrapper target was called so we now have a single configuration. Load the spec file # and call the real Main.gmk. include $(SPEC) + include $(SRC_ROOT)/make/common/MakeBase.gmk ### Clean up from previous run # Remove any build.log from a previous run, if they exist diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index a7cf6c816a7..62d83574289 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -268,7 +268,7 @@ AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN], fi ]) -# Setup a tool for the given variable. If correctly specified by the user, +# Setup a tool for the given variable. If correctly specified by the user, # use that value, otherwise search for the tool using the supplied code snippet. # $1: variable to set # $2: code snippet to call to look for the tool @@ -546,7 +546,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], XCODEBUILD= AC_SUBST(XCODEBUILD) fi - + AC_MSG_CHECKING([for sdk name]) AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name], [use the platform SDK of the given name. @<:@macosx@:>@])], diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4 index fbfa15c7b06..6509d0bee2c 100644 --- a/common/autoconf/boot-jdk.m4 +++ b/common/autoconf/boot-jdk.m4 @@ -24,31 +24,31 @@ # ######################################################################## -# This file handles detection of the Boot JDK. The Boot JDK detection -# process has been developed as a response to solve a complex real-world -# problem. Initially, it was simple, but it has grown as platform after +# This file handles detection of the Boot JDK. The Boot JDK detection +# process has been developed as a response to solve a complex real-world +# problem. Initially, it was simple, but it has grown as platform after # platform, idiosyncracy after idiosyncracy has been supported. # # The basic idea is this: # 1) You need an acceptable *) JDK to use as a Boot JDK -# 2) There are several ways to locate a JDK, that are mostly platform +# 2) There are several ways to locate a JDK, that are mostly platform # dependent **) # 3) You can have multiple JDKs installed -# 4) If possible, configure should try to dig out an acceptable JDK +# 4) If possible, configure should try to dig out an acceptable JDK # automatically, without having to resort to command-line options # -# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with -# javac) and not a JRE, etc. +# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with +# javac) and not a JRE, etc. # -# **) On Windows we typically use a well-known path. +# **) On Windows we typically use a well-known path. # On MacOSX we typically use the tool java_home. -# On Linux we typically find javac in the $PATH, and then follow a -# chain of symlinks that often ends up in a real JDK. +# On Linux we typically find javac in the $PATH, and then follow a +# chain of symlinks that often ends up in a real JDK. # -# This leads to the code where we check in different ways to locate a -# JDK, and if one is found, check if it is acceptable. If not, we print -# our reasons for rejecting it (useful when debugging non-working -# configure situations) and continue checking the next one. +# This leads to the code where we check in different ways to locate a +# JDK, and if one is found, check if it is acceptable. If not, we print +# our reasons for rejecting it (useful when debugging non-working +# configure situations) and continue checking the next one. ######################################################################## # Execute the check given as argument, and verify the result @@ -244,7 +244,7 @@ AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS], AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK], [ # Use user overridden value if available, otherwise locate tool in the Boot JDK. - BASIC_SETUP_TOOL($1, + BASIC_SETUP_TOOL($1, [ AC_MSG_CHECKING([for $2 in Boot JDK]) $1=$BOOT_JDK/bin/$2 diff --git a/common/autoconf/bootcycle-spec.gmk.in b/common/autoconf/bootcycle-spec.gmk.in index 87e6203fc88..ba32e409ec2 100644 --- a/common/autoconf/bootcycle-spec.gmk.in +++ b/common/autoconf/bootcycle-spec.gmk.in @@ -57,4 +57,3 @@ JAR_CMD:=$(BOOT_JDK)/bin/jar NATIVE2ASCII_CMD:=$(BOOT_JDK)/bin/native2ascii JARSIGNER_CMD:=$(BOOT_JDK)/bin/jarsigner SJAVAC_SERVER_JAVA_CMD:=$(JAVA_CMD) - diff --git a/common/autoconf/build-aux/config.guess b/common/autoconf/build-aux/config.guess index 355c91e4ebb..a450a2760f6 100644 --- a/common/autoconf/build-aux/config.guess +++ b/common/autoconf/build-aux/config.guess @@ -77,7 +77,7 @@ if test $? = 0; then fi # Test and fix little endian PowerPC64. -# TODO: should be handled by autoconf-config.guess. +# TODO: should be handled by autoconf-config.guess. if [ "x$OUT" = x ]; then if [ `uname -m` = ppc64le ]; then if [ `uname -s` = Linux ]; then diff --git a/common/autoconf/build-aux/install.sh b/common/autoconf/build-aux/install.sh index 02d43282e42..98c1dc444a7 100644 --- a/common/autoconf/build-aux/install.sh +++ b/common/autoconf/build-aux/install.sh @@ -1,5 +1,5 @@ -#!/bin/sh -echo >&2 "No suitable 'install' command found.'" -echo >&2 "If automake is installed, running 'automake -fa'" -echo >&2 "(and ignoring the errors) might produce one." -exit 1 +#!/bin/sh +echo >&2 "No suitable 'install' command found.'" +echo >&2 "If automake is installed, running 'automake -fa'" +echo >&2 "(and ignoring the errors) might produce one." +exit 1 diff --git a/common/autoconf/compare.sh.in b/common/autoconf/compare.sh.in index 4c6207176c5..c96c87aee95 100644 --- a/common/autoconf/compare.sh.in +++ b/common/autoconf/compare.sh.in @@ -47,6 +47,7 @@ FIND="@FIND@" GREP="@GREP@" JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@" LDD="@LDD@" +LN="@LN@" MKDIR="@MKDIR@" NAWK="@NAWK@" NM="@GNM@" diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 94b701bea19..d950cb1558b 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -4331,7 +4331,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1417016445 +DATE_WHEN_GENERATED=1417099232 ############################################################################### # diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4 index 41cb2fb49d6..8d4e73488bc 100644 --- a/common/autoconf/libraries.m4 +++ b/common/autoconf/libraries.m4 @@ -355,7 +355,7 @@ AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE], FOUND_FREETYPE=no fi fi - + if test "x$FOUND_FREETYPE" = xyes; then # Include file found, let's continue the sanity check. AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD]) diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index ca4e1a82195..999a9b32310 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -456,7 +456,7 @@ JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@ JAVA_TOOL_FLAGS_SMALL:=@JAVA_TOOL_FLAGS_SMALL@ SJAVAC_SERVER_JAVA_FLAGS:=@SJAVAC_SERVER_JAVA_FLAGS@ -# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk +# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk # for bootcycle-images build. Make sure to keep them in sync. Do not use the *_CMD # versions of the variables directly. JAVA_CMD:=@JAVA@ @@ -713,7 +713,7 @@ JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR) # This macro is called to allow inclusion of closed source counterparts. # Unless overridden in closed sources, it expands to nothing. -# Usage: This function is called in an open makefile, with the following +# Usage: This function is called in an open makefile, with the following # arguments: # $1 the name of the repo, or empty if the top-level repo. # $2 the name of the makefile diff --git a/common/autoconf/toolchain_windows.m4 b/common/autoconf/toolchain_windows.m4 index 380f7dd4054..231d2e837f2 100644 --- a/common/autoconf/toolchain_windows.m4 +++ b/common/autoconf/toolchain_windows.m4 @@ -248,7 +248,7 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL], METHOD="$2" if test -e "$POSSIBLE_MSVCR_DLL"; then AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD]) - + # Need to check if the found msvcr is correct architecture AC_MSG_CHECKING([found msvcr100.dll architecture]) MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"` @@ -291,7 +291,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll]) fi fi - + if test "x$MSVCR_DLL" = x; then # Probe: Using well-known location from Visual Studio 10.0 if test "x$VCINSTALLDIR" != x; then @@ -311,9 +311,9 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll" TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK]) fi - + if test "x$MSVCR_DLL" = x; then - # Probe: Look in the Windows system32 directory + # Probe: Look in the Windows system32 directory CYGWIN_SYSTEMROOT="$SYSTEMROOT" BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT) POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll" @@ -333,7 +333,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS]) fi fi - + if test "x$MSVCR_DLL" = x; then # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now. # (This was the original behaviour; kept since it might turn up something) @@ -347,11 +347,11 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1` fi fi - + TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR]) fi fi - + if test "x$MSVCR_DLL" = x; then AC_MSG_CHECKING([for msvcr100.dll]) AC_MSG_RESULT([no]) diff --git a/common/bin/compare.sh b/common/bin/compare.sh index 31ec560dd16..8bd6d124cc7 100644 --- a/common/bin/compare.sh +++ b/common/bin/compare.sh @@ -22,7 +22,7 @@ # questions. # -# This script is processed by configure before it's usable. It is run from +# This script is processed by configure before it's usable. It is run from # the root of the build directory. @@ -76,10 +76,13 @@ diff_text() { TMP=1 if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then + # Filter out date string, ant version and java version differences. TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ $GREP '^[<>]' | \ $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \ - -e '/[<>] Created-By: .* (Oracle Corporation).*/d') + -e '/[<>] Created-By: .* (Oracle [Corpatin)]*/d' \ + -e '/[<>] [Corpatin]*)/d' \ + -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d') fi if test "x$SUFFIX" = "xjava"; then TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ @@ -92,7 +95,7 @@ diff_text() { -e '/\/\/ java GenerateCharacter.*/d') fi # Ignore date strings in class files. - # On Macosx the system sources for generated java classes produce different output on + # On Macosx the system sources for generated java classes produce different output on # consequtive invocations seemingly randomly. # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this. # Anonymous lambda classes get randomly assigned counters in their names. @@ -100,18 +103,18 @@ diff_text() { # To improve performance when large diffs are found, do a rough filtering of classes # elibeble for these exceptions if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \ - -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \ - -e thePoint -e aPoint -e setItemsPtr \ + -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \ + -e thePoint -e aPoint -e setItemsPtr \ -e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then $JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \ $GREP '^[<>]' | \ $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \ - -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \ - -e '/[<>].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \ - -e '/[<>].*public com\.apple\.jobjc\.Pointer].*public void setItemsPtr(com\.apple\.jobjc\.Pointer].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \ + -e '/[<>].*public com\.apple\.jobjc\.Pointer].*public void setItemsPtr(com\.apple\.jobjc\.Pointer].*lambda\$[a-zA-Z0-9]*\$[0-9]*/d') fi fi @@ -121,20 +124,19 @@ diff_text() { # Disable this exception since we aren't changing the properties cleaning method yet. # $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \ # | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \ -# | $SED -e '/^#/d' -e '/^$/d' \ +# | $SED -e '/^#/d' -e '/^$/d' \ # -e :a -e '/\\$/N; s/\\\n//; ta' \ -# -e 's/^[ \t]*//;s/[ \t]*$//' \ -# -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned +# -e 's/^[ \t]*//;s/[ \t]*$//' \ +# -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned # Filter out date string differences. TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE | \ $GREP '^[<>]' | \ $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d') fi - if test "x$SUFFIX" = "xMF"; then - # Filter out date string differences. + if test "x$SUFFIX" = "xhtml"; then TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ $GREP '^[<>]' | \ - $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d') + $SED -e '/[<>] /d' ) fi if test -n "$TMP"; then echo Files $OTHER_FILE and $THIS_FILE differ @@ -158,7 +160,7 @@ compare_dirs() { (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this) $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_this > $WORK_DIR/dirs_diff - + echo -n Directory structure... if [ -s $WORK_DIR/dirs_diff ]; then echo Differences found. @@ -192,7 +194,7 @@ compare_files() { (cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other) (cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this) - + $DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff echo -n File names... @@ -236,11 +238,11 @@ compare_permissions() { TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'` if [ "$OP" != "$TP" ] then - if [ -z "$found" ]; then echo ; found="yes"; fi - $PRINTF "\told: ${OP} new: ${TP}\t$f\n" + if [ -z "$found" ]; then echo ; found="yes"; fi + $PRINTF "\tother: ${OP} this: ${TP}\t$f\n" fi done - if [ -z "$found" ]; then + if [ -z "$found" ]; then echo "Identical!" else REGRESSIONS=true @@ -265,24 +267,22 @@ compare_file_types() { if [ ! -f ${THIS_DIR}/$f ]; then continue; fi OF=`cd ${OTHER_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'` TF=`cd ${THIS_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'` - if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]] - then - if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ] - then - # the way we produces zip-files make it so that directories are stored in old file - # but not in new (only files with full-path) - # this makes file-5.09 report them as different - continue; - fi - fi - if [ "$OF" != "$TF" ] then - if [ -z "$found" ]; then echo ; found="yes"; fi - $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n" + if [ "`echo $OF | $GREP -c 'Zip archive data'`" -gt 0 ] \ + && [ "`echo $TF | $GREP -c 'Zip archive data'`" -gt 0 ] + then + # the way we produce zip-files make it so that directories are stored in + # old file but not in new (only files with full-path) this makes file + # report them as different + continue + else + if [ -z "$found" ]; then echo ; found="yes"; fi + $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n" + fi fi done - if [ -z "$found" ]; then + if [ -z "$found" ]; then echo "Identical!" else REGRESSIONS=true @@ -296,12 +296,13 @@ compare_general_files() { THIS_DIR=$1 OTHER_DIR=$2 WORK_DIR=$3 - + GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \ ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \ - ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \ + ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" ! -name "*.cpl" \ ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \ - ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \ + ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" ! -name "*.jmod" \ + ! -name "*.obj" ! -name "*.o" ! -name "JavaControlPanelHelper" ! -name "JavaUpdater" \ | $GREP -v "./bin/" | $SORT | $FILTER) echo General files... @@ -377,7 +378,7 @@ compare_zip_file() { THIS_SUFFIX="${THIS_ZIP##*.}" OTHER_SUFFIX="${OTHER_ZIP##*.}" if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then - echo The files do not have the same suffix type! + echo "The files do not have the same suffix type! ($THIS_SUFFIX != $OTHER_SUFFIX)" return 2 fi @@ -389,7 +390,7 @@ compare_zip_file() { fi # Not quite identical, the might still contain the same data. # Unpack the jar/zip files in temp dirs - + THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR @@ -458,9 +459,9 @@ compare_zip_file() { $RM -f $WORK_DIR/$ZIP_FILE.diffs for file in $DIFFING_FILES; do - if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then + if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs - fi + fi done if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then @@ -567,6 +568,10 @@ compare_bin_file() { $MKDIR -p $FILE_WORK_DIR + # Make soft links to original files from work dir to facilitate debugging + $LN -f -s $THIS_FILE $WORK_FILE_BASE.this + $LN -f -s $OTHER_FILE $WORK_FILE_BASE.other + ORIG_THIS_FILE="$THIS_FILE" ORIG_OTHER_FILE="$OTHER_FILE" @@ -583,57 +588,58 @@ compare_bin_file() { fi if [ "$OPENJDK_TARGET_OS" = "windows" ]; then - unset _NT_SYMBOL_PATH - # On windows we need to unzip the debug symbols, if present - OTHER_FILE_BASE=${OTHER_FILE/.dll/} - OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/} - DIZ_NAME=$(basename $OTHER_FILE_BASE).diz + unset _NT_SYMBOL_PATH + # On windows we need to unzip the debug symbols, if present + OTHER_FILE_BASE=${OTHER_FILE/.dll/} + OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/} + OTHER_FILE_BASE=${OTHER_FILE_BASE/.cpl/} + DIZ_NAME=$(basename $OTHER_FILE_BASE).diz # java.exe and java.dll diz files will have the same name. Have to - # make sure java.exe gets the right one. This is only needed for - # OTHER since in the new build, all pdb files are left around. - if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then - OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz" - elif [ -f "${OTHER_FILE_BASE}.diz" ]; then - OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz - else + # make sure java.exe gets the right one. This is only needed for + # OTHER since in the new build, all pdb files are left around. + if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then + OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz" + elif [ -f "${OTHER_FILE_BASE}.diz" ]; then + OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz + else # Some files, jli.dll, appears twice in the image but only one of - # thme has a diz file next to it. - OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)" - if [ ! -f "$OTHER_DIZ_FILE" ]; then - # As a last resort, look for diz file in the whole build output - # dir. - OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)" - fi - fi - if [ -n "$OTHER_DIZ_FILE" ]; then - $MKDIR -p $FILE_WORK_DIR/other - (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE) - export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other" - fi - THIS_FILE_BASE=${THIS_FILE/.dll/} - THIS_FILE_BASE=${THIS_FILE_BASE/.exe/} - if [ -f "${THIS_FILE/.dll/}.diz" ]; then - THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz - else - THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)" - if [ ! -f "$THIS_DIZ_FILE" ]; then - # As a last resort, look for diz file in the whole build output - # dir. - THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)" - fi - fi - if [ -n "$THIS_DIZ_FILE" ]; then - $MKDIR -p $FILE_WORK_DIR/this - (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE) - export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this" - fi + # thme has a diz file next to it. + OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)" + if [ ! -f "$OTHER_DIZ_FILE" ]; then + # As a last resort, look for diz file in the whole build output + # dir. + OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)" + fi + fi + if [ -n "$OTHER_DIZ_FILE" ]; then + $MKDIR -p $FILE_WORK_DIR/other + (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE) + export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other" + fi + THIS_FILE_BASE=${THIS_FILE/.dll/} + THIS_FILE_BASE=${THIS_FILE_BASE/.exe/} + if [ -f "${THIS_FILE/.dll/}.diz" ]; then + THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz + else + THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)" + if [ ! -f "$THIS_DIZ_FILE" ]; then + # As a last resort, look for diz file in the whole build output + # dir. + THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)" + fi + fi + if [ -n "$THIS_DIZ_FILE" ]; then + $MKDIR -p $FILE_WORK_DIR/this + (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE) + export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this" + fi fi if [ -z "$SKIP_BIN_DIFF" ]; then if cmp $OTHER_FILE $THIS_FILE > /dev/null; then # The files were bytewise identical. if [ -n "$VERBOSE" ]; then - echo " : : : : : $BIN_FILE" + echo " : : : : : : $BIN_FILE" fi return 0 fi @@ -664,19 +670,19 @@ compare_bin_file() { DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE) SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM) if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \ - && [ "$DIFF_SIZE_REL" -lt 102 ]; then + && [ "$DIFF_SIZE_REL" -lt 102 ]; then SIZE_MSG="($SIZE_MSG)" DIFF_SIZE= elif [ "$OPENJDK_TARGET_OS" = "windows" ] \ - && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ - && [ "$DIFF_SIZE_NUM" = 512 ]; then - # On windows, size of binaries increase in 512 increments. + && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ + && [ "$DIFF_SIZE_NUM" = 512 ]; then + # On windows, size of binaries increase in 512 increments. SIZE_MSG="($SIZE_MSG)" DIFF_SIZE= elif [ "$OPENJDK_TARGET_OS" = "windows" ] \ - && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ - && [ "$DIFF_SIZE_NUM" = -512 ]; then - # On windows, size of binaries increase in 512 increments. + && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ + && [ "$DIFF_SIZE_NUM" = -512 ]; then + # On windows, size of binaries increase in 512 increments. SIZE_MSG="($SIZE_MSG)" DIFF_SIZE= else @@ -711,18 +717,18 @@ compare_bin_file() { if [ "$OPENJDK_TARGET_OS" = "windows" ]; then # The output from dumpbin on windows differs depending on if the debug symbol # files are still around at the location the binary is pointing too. Need - # to filter out that extra information. - $DUMPBIN -exports $OTHER_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other - $DUMPBIN -exports $THIS_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this + # to filter out that extra information. + $DUMPBIN -exports $OTHER_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other + $DUMPBIN -exports $THIS_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then # Some symbols get seemingly random 15 character prefixes. Filter them out. $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other - $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this + $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this else - $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other - $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this + $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other + $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this fi - + LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff if [ -s $WORK_FILE_BASE.symbols.diff ]; then SYM_MSG=" diff " @@ -735,7 +741,7 @@ compare_bin_file() { SYM_MSG=" $SYM_MSG " fi else - SYM_MSG="($SYM_MSG)" + SYM_MSG="($SYM_MSG)" DIFF_SYM= fi else @@ -748,48 +754,48 @@ compare_bin_file() { # Check dependencies if [ -n "$LDD_CMD" ]; then - (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq) - (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2 $WORK_FILE_BASE.deps.this.uniq) - (cd $FILE_WORK_DIR && $RM -f $NAME) - - LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff - LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq - - if [ -s $WORK_FILE_BASE.deps.diff ]; then + (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq) + (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2 $WORK_FILE_BASE.deps.this.uniq) + (cd $FILE_WORK_DIR && $RM -f $NAME) + + LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff + LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq + + if [ -s $WORK_FILE_BASE.deps.diff ]; then if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then - DEP_MSG=" diff " + DEP_MSG=" diff " else - DEP_MSG=" redun " + DEP_MSG=" redun " fi if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then - DIFF_DEP=true - if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then + DIFF_DEP=true + if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then DEP_MSG="*$DEP_MSG*" REGRESSIONS=true - else + else DEP_MSG=" $DEP_MSG " - fi + fi else - DEP_MSG="($DEP_MSG)" - DIFF_DEP= + DEP_MSG="($DEP_MSG)" + DIFF_DEP= fi - else - DEP_MSG=" " - DIFF_DEP= + else + DEP_MSG=" " + DIFF_DEP= if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then DEP_MSG=" ! " fi - fi + fi else - DEP_MSG=" - " + DEP_MSG=" - " fi - + # Compare fulldump output if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then $FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1 $FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1 LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff - + if [ -s $WORK_FILE_BASE.fulldump.diff ]; then ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}') ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE) @@ -816,14 +822,17 @@ compare_bin_file() { # Compare disassemble output if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then - if [ -z "$DIS_DIFF_FILTER" ]; then - DIS_DIFF_FILTER="$CAT" - fi - $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1 - $DIS_CMD $THIS_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this 2>&1 - + # By default we filter out differences that include references to symbols. + # To get a raw diff with the complete disassembly, set + # DIS_DIFF_FILTER="$CAT" + if [ -z "$DIS_DIFF_FILTER" ]; then + DIS_DIFF_FILTER="$GREP -v ' # .* <.*>$'" + fi + $DIS_CMD $OTHER_FILE | $GREP -v $NAME | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.other 2>&1 + $DIS_CMD $THIS_FILE | $GREP -v $NAME | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.this 2>&1 + LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff - + if [ -s $WORK_FILE_BASE.dis.diff ]; then DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}') DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE) @@ -901,7 +910,9 @@ compare_all_libs() { OTHER_DIR=$2 WORK_DIR=$3 - LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' -o -name 'JavaControlPanel' \) | $SORT | $FILTER) + LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' \ + -o -name '*.dll' -o -name '*.obj' -o -name '*.o' \ + -o -name '*.cpl' \) | $SORT | $FILTER) if [ -n "$LIBS" ]; then echo Libraries... @@ -961,7 +972,7 @@ COMPARE_ROOT=/tmp/cimages.$USER $MKDIR -p $COMPARE_ROOT if [ "$OPENJDK_TARGET_OS" = "windows" ]; then if [ "$(uname -o)" = "Cygwin" ]; then - COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT) + COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT) fi fi @@ -1085,7 +1096,7 @@ while [ -n "$1" ]; do CMP_JARS=true CMP_LIBS=true CMP_EXECS=true - + if [ -z "$FILTER" ]; then FILTER="$GREP" fi @@ -1136,17 +1147,8 @@ fi if [ "$SKIP_DEFAULT" != "true" ]; then if [ -z "$OTHER" ]; then - OTHER="$THIS/../$LEGACY_BUILD_DIR" - if [ -d "$OTHER" ]; then - OTHER="$( cd "$OTHER" && pwd )" - else - echo "Default old build directory does not exist:" - echo "$OTHER" - exit 1 - fi - echo "Comparing to default old build:" - echo "$OTHER" - echo + echo "Nothing to compare to, set with -o" + exit 1 else if [ ! -d "$OTHER" ]; then echo "Other build directory does not exist:" @@ -1160,90 +1162,47 @@ if [ "$SKIP_DEFAULT" != "true" ]; then fi - # Figure out the layout of the this build. Which kinds of images have been produced - if [ -d "$THIS/install/j2sdk-image" ]; then + # Find the common images to compare, prioritizing later build stages + if [ -d "$THIS/install/j2sdk-image" ] && [ -d "$OTHER/install/j2sdk-image" ]; then THIS_J2SDK="$THIS/install/j2sdk-image" THIS_J2RE="$THIS/install/j2re-image" - echo "Selecting install images in this build" - elif [ -d "$THIS/deploy/j2sdk-image" ]; then - THIS_J2SDK="$THIS/deploy/j2sdk-image" - THIS_J2RE="$THIS/deploy/j2re-image" - echo "Selecting deploy images in this build" - elif [ -d "$THIS/images/j2sdk-image" ]; then - THIS_J2SDK="$THIS/images/j2sdk-image" - THIS_J2RE="$THIS/images/j2re-image" - echo "Selecting jdk images in this build" - fi - - if [ -d "$THIS/images/j2sdk-overlay-image" ]; then - if [ -d "$THIS/install/j2sdk-image" ]; then - # If there is an install image, prefer that, it's also overlay - THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image" - THIS_J2RE_OVERLAY="$THIS/install/j2re-image" - echo "Selecting install overlay images in this build" - else - THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image" - THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image" - echo "Selecting jdk overlay images in this build" - fi - fi - - if [ -d "$THIS/images/j2sdk-bundle" ]; then - THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle" - THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle" - echo "Selecting bundles in this build" - fi - - # Figure out the layout of the other build (old or new, normal or overlay image) - if [ -d "$OTHER/j2sdk-image" ]; then - if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then - OTHER_J2SDK="$OTHER/j2sdk-image" - OTHER_J2RE="$OTHER/j2re-image" - echo "Selecting old-style images in other build" - else - OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image" - OTHER_J2RE_OVERLAY="$OTHER/j2re-image" - echo "Selecting overlay images in other build" - fi - elif [ -d "$OTHER/install/j2sdk-image" ]; then OTHER_J2SDK="$OTHER/install/j2sdk-image" OTHER_J2RE="$OTHER/install/j2re-image" - echo "Selecting install images in other build" - elif [ -d "$OTHER/deploy/j2sdk-image" ]; then + echo "Selecting install images for compare" + elif [ -d "$THIS/deploy/j2sdk-image" ] && [ -d "$OTHER/deploy/j2sdk-image" ]; then + THIS_J2SDK="$THIS/deploy/j2sdk-image" + THIS_J2RE="$THIS/deploy/j2re-image" OTHER_J2SDK="$OTHER/deploy/j2sdk-image" OTHER_J2RE="$OTHER/deploy/j2re-image" - echo "Selecting deploy images in other build" - elif [ -d "$OTHER/images/j2sdk-image" ]; then + echo "Selecting deploy images for compare" + elif [ -d "$THIS/images/j2sdk-image" ] && [ -d "$OTHER/images/j2sdk-image" ]; then + THIS_J2SDK="$THIS/images/j2sdk-image" + THIS_J2RE="$THIS/images/j2re-image" OTHER_J2SDK="$OTHER/images/j2sdk-image" OTHER_J2RE="$OTHER/images/j2re-image" - echo "Selecting jdk images in other build" - fi - - if [ -d "$OTHER/j2sdk-bundle" ]; then - OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle" - OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle" - echo "Selecting bundles in other build" - elif [ -d "$OTHER/images/j2sdk-bundle" ]; then - OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle" - OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle" - echo "Selecting jdk bundles in other build" - fi - - if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then - if [ -z "$THIS_J2SDK_OVERLAY" ]; then - echo "Cannot locate images for this build. Are you sure you have run 'make images'?" - exit 1 - fi - fi - - if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then - echo "OTHER build only has an overlay image while this build does not. Nothing to compare!" + echo "Selecting jdk images for compare" + else + echo "No common images found." exit 1 fi - if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then - echo "WARNING! OTHER build has bundles built while this build does not." - echo "Skipping bundle compare!" + if [ -d "$THIS/images/j2sdk-bundle" ] && [ -d "$OTHER/images/j2sdk-bundle" ]; then + THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle" + THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle" + OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle" + OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle" + echo "Also comparing macosx bundles" + fi + + if [ -d "$THIS/deploy" ] && [ -d "$OTHER/deploy" ]; then + THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/dist/installer/bundles" + OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/bundles" + echo "Also comparing deploy/bundles" + if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then + THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin" + OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin" + echo "Also comparing JavaAppletPlugin" + fi fi if [ -d "$OTHER/images" ]; then @@ -1266,22 +1225,13 @@ if [ "$SKIP_DEFAULT" != "true" ]; then THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN" fi - if [ -d "$THIS/docs" ]; then + if [ -d "$THIS/docs" ] && [ -d "$OTHER/docs" ]; then THIS_DOCS="$THIS/docs" - fi - - if [ -d "$OTHER/docs" ]; then OTHER_DOCS="$OTHER/docs" - fi - - if [ -z "$THIS_DOCS" ]; then + echo "Also comparing docs" + else echo "WARNING! Docs haven't been built and won't be compared." fi - - if [ -z "$OTHER_DOCS" ]; then - echo "WARNING! Other build doesn't contain docs, skipping doc compare." - fi - fi ########################################################################################## @@ -1293,29 +1243,18 @@ if [ "$CMP_NAMES" = "true" ]; then compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk echo -n "J2RE " compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re - + echo -n "J2SDK " compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk echo -n "J2RE " compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re fi - if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then - echo -n "J2SDK Overlay " - compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay - echo -n "J2RE Overlay " - compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay - - echo -n "J2SDK Overlay " - compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay - echo -n "J2RE Overlay " - compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay - fi if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then echo -n "J2SDK Bundle " compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle echo -n "J2RE Bundle " compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle - + echo -n "J2SDK Bundle " compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle echo -n "J2RE Bundle " @@ -1331,6 +1270,12 @@ if [ "$CMP_NAMES" = "true" ]; then compare_dirs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir compare_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_dirs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + echo -n "JavaAppletPlugin " + compare_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_PERMS" = "true" ]; then @@ -1340,21 +1285,13 @@ if [ "$CMP_PERMS" = "true" ]; then echo -n "J2RE " compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re fi - if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then - echo -n "J2SDK Overlay " - compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay - echo -n "J2RE Overlay " - compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay - fi - if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then - echo -n "J2SDK Bundle " - compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle - echo -n "J2RE Bundle " - compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle - fi if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_permissions $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_TYPES" = "true" ]; then @@ -1364,12 +1301,6 @@ if [ "$CMP_TYPES" = "true" ]; then echo -n "J2RE " compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re fi - if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then - echo -n "J2SDK Overlay " - compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay - echo -n "J2RE Overlay " - compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay - fi if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then echo -n "J2SDK Bundle " compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle @@ -1379,6 +1310,10 @@ if [ "$CMP_TYPES" = "true" ]; then if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_file_types $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_GENERAL" = "true" ]; then @@ -1388,12 +1323,6 @@ if [ "$CMP_GENERAL" = "true" ]; then echo -n "J2RE " compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re fi - if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then - echo -n "J2SDK Overlay " - compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay - echo -n "J2RE Overlay " - compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay - fi if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then echo -n "J2SDK Bundle " compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle @@ -1407,6 +1336,10 @@ if [ "$CMP_GENERAL" = "true" ]; then if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_general_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_general_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_ZIPS" = "true" ]; then @@ -1434,6 +1367,12 @@ if [ "$CMP_ZIPS" = "true" ]; then if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_all_zip_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_BUNDLE_DIR" ] && [ -n "$OTHER_DEPLOY_BUNDLE_DIR" ]; then + compare_all_zip_files $THIS_DEPLOY_BUNDLE_DIR $OTHER_DEPLOY_BUNDLE_DIR $COMPARE_ROOT/deploy-bundle + fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + compare_all_zip_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_JARS" = "true" ]; then @@ -1443,6 +1382,9 @@ if [ "$CMP_JARS" = "true" ]; then if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_all_jar_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + compare_all_jar_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_LIBS" = "true" ]; then @@ -1454,26 +1396,30 @@ if [ "$CMP_LIBS" = "true" ]; then compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re fi fi - if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then - echo -n "Bundle " - compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay - fi if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_all_libs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_EXECS" = "true" ]; then if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk - fi - if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then - echo -n "Overlay " - compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay + if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then + echo -n "J2RE " + compare_all_execs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re + fi fi if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_all_execs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi echo diff --git a/common/bin/compare_exceptions.sh.incl b/common/bin/compare_exceptions.sh.incl index cace701b788..de986ef8e59 100644 --- a/common/bin/compare_exceptions.sh.incl +++ b/common/bin/compare_exceptions.sh.incl @@ -85,6 +85,7 @@ ACCEPTED_BIN_DIFF=" ./bin/jdb ./bin/jhat ./bin/jinfo +./bin/jjs ./bin/jmap ./bin/jps ./bin/jrunscript @@ -108,6 +109,7 @@ ACCEPTED_BIN_DIFF=" ./bin/wsimport ./bin/xjc ./jre/bin/java +./jre/bin/jjs ./jre/bin/keytool ./jre/bin/orbd ./jre/bin/pack200 @@ -172,6 +174,7 @@ ACCEPTED_BIN_DIFF=" ./bin/jdb ./bin/jhat ./bin/jinfo +./bin/jjs ./bin/jmap ./bin/jps ./bin/jrunscript @@ -195,6 +198,7 @@ ACCEPTED_BIN_DIFF=" ./bin/wsimport ./bin/xjc ./jre/bin/java +./jre/bin/jjs ./jre/bin/keytool ./jre/bin/orbd ./jre/bin/pack200 @@ -910,11 +914,6 @@ ACCEPTED_JARZIP_CONTENTS=" /META-INF/INDEX.LIST " -KNOWN_BIN_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib -" - ACCEPTED_BIN_DIFF=" ./bin/appletviewer ./bin/idlj @@ -964,34 +963,82 @@ ACCEPTED_BIN_DIFF=" ./jre/bin/tnameserv ./jre/lib/libsaproc.dylib ./jre/lib/server/libjvm.dylib +./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.dylib +./demo/jvmti/gctest/lib/libgctest.dylib +./demo/jvmti/heapTracker/lib/libheapTracker.dylib +./demo/jvmti/heapViewer/lib/libheapViewer.dylib +./demo/jvmti/minst/lib/libminst.dylib +./demo/jvmti/mtrace/lib/libmtrace.dylib +./demo/jvmti/versionCheck/lib/libversionCheck.dylib +./demo/jvmti/waiters/lib/libwaiters.dylib +./Contents/Home/lib/libAppleScriptEngine.dylib +./Contents/Home/lib/libattach.dylib +./Contents/Home/lib/libawt_lwawt.dylib +./Contents/Home/lib/libdeploy.dylib +./Contents/Home/lib/libdt_socket.dylib +./Contents/Home/lib/libhprof.dylib +./Contents/Home/lib/libinstrument.dylib +./Contents/Home/lib/libjava_crw_demo.dylib +./Contents/Home/lib/libjdwp.dylib +./Contents/Home/lib/libjsdt.dylib +./Contents/Home/lib/libjsig.dylib +./Contents/Home/lib/libmanagement.dylib +./Contents/Home/lib/libnpjp2.dylib +./Contents/Home/lib/libosx.dylib +./Contents/Home/lib/libosxapp.dylib +./Contents/Home/lib/libsaproc.dylib +./Contents/Home/lib/libsplashscreen.dylib +./Contents/Home/lib/libverify.dylib +./Contents/Home/lib/server/libjsig.dylib +./Contents/Home/lib/server/libjvm.dylib +./jre/lib/libAppleScriptEngine.dylib +./jre/lib/libattach.dylib +./jre/lib/libawt_lwawt.dylib +./jre/lib/libdeploy.dylib +./jre/lib/libdt_socket.dylib +./jre/lib/libhprof.dylib +./jre/lib/libinstrument.dylib +./jre/lib/libjava_crw_demo.dylib +./jre/lib/libjdwp.dylib +./jre/lib/libjsdt.dylib +./jre/lib/libjsig.dylib +./jre/lib/libmanagement.dylib +./jre/lib/libosx.dylib +./jre/lib/libosxapp.dylib +./jre/lib/libsaproc.dylib +./jre/lib/libsplashscreen.dylib +./jre/lib/libverify.dylib +./jre/lib/server/libjvm.dylib +./lib/libAppleScriptEngine.dylib +./lib/libattach.dylib +./lib/libawt_lwawt.dylib +./lib/libdeploy.dylib +./lib/libdt_socket.dylib +./lib/libhprof.dylib +./lib/libinstrument.dylib +./lib/libjava_crw_demo.dylib +./lib/libjdwp.dylib +./lib/libjsdt.dylib +./lib/libjsig.dylib +./lib/libmanagement.dylib +./lib/libnpjp2.dylib +./lib/libosx.dylib +./lib/libosxapp.dylib +./lib/libverify.dylib ./lib/libsaproc.dylib +./lib/libsplashscreen.dylib ./lib/server/libjvm.dylib ./lib/deploy/JavaControlPanel.prefPane/Contents/MacOS/JavaControlPanel " -KNOWN_SIZE_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib -" - SORT_SYMBOLS=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib +./Contents/Home/lib/libsaproc.dylib +./jre/lib/libsaproc.dylib +./lib/libsaproc.dylib " -KNOWN_SYM_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib +ACCEPTED_SMALL_SIZE_DIFF=" +./bin/javaws +./Contents/Home/bin/_javaws " - -KNOWN_ELF_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib -" - -KNOWN_DIS_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib -" - fi diff --git a/common/bin/logger.sh b/common/bin/logger.sh index 46ab48ae47b..7fbc7816d81 100644 --- a/common/bin/logger.sh +++ b/common/bin/logger.sh @@ -22,10 +22,10 @@ # questions. # -# Usage: ./logger.sh theloggfile acommand arg1 arg2 +# Usage: ./logger.sh theloggfile acommand arg1 arg2 # # Execute acommand with args, in such a way that -# both stdout and stderr from acommand are appended to +# both stdout and stderr from acommand are appended to # theloggfile. # # Preserve stdout and stderr, so that the stdout diff --git a/common/bin/shell-tracer.sh b/common/bin/shell-tracer.sh index 27a964c977e..5c7cc449f9c 100644 --- a/common/bin/shell-tracer.sh +++ b/common/bin/shell-tracer.sh @@ -26,12 +26,12 @@ # # This shell script is supposed to be set as a replacement for SHELL in make, # causing it to be called whenever make wants to execute shell commands. -# The is suitable for passing on to the old shell, +# The is suitable for passing on to the old shell, # typically beginning with -c. # -# This script will make sure the shell command line is executed with +# This script will make sure the shell command line is executed with # OLD_SHELL -x, and it will also store a simple log of the the time it takes to -# execute the command in the OUTPUT_FILE, using the "time" utility as pointed +# execute the command in the OUTPUT_FILE, using the "time" utility as pointed # to by TIME_CMD. If TIME_CMD is "-", no timestamp will be stored. TIME_CMD="$1" diff --git a/common/bin/test_builds.sh b/common/bin/test_builds.sh index 911008020c9..674693576ab 100644 --- a/common/bin/test_builds.sh +++ b/common/bin/test_builds.sh @@ -171,7 +171,7 @@ checkErrors ) 2>&1 | tee ${t3}.build.txt checkErrors -# Compare old build to build-infra build +# Compare old build to build-infra build ( \ sh ${t0}/common/bin/compareimage.sh \ ${t3}/build/*/j2sdk-image \ @@ -181,4 +181,3 @@ checkErrors checkErrors exit 0 - diff --git a/common/bin/unshuffle_patch.sh b/common/bin/unshuffle_patch.sh index f380fb6f2f1..a61864cbd3f 100644 --- a/common/bin/unshuffle_patch.sh +++ b/common/bin/unshuffle_patch.sh @@ -80,7 +80,7 @@ for r in $repos ; do if [ $repo = "$r" ] ; then found="true" break; - fi + fi done if [ $found = "false" ] ; then echo "ERROR: Unknown repo: $repo. Should be one of [$repos]." >&2 @@ -200,4 +200,3 @@ do printf "%s\n" "$line" >> $output fi done < "$input" - diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index b8f792d3c3d..3d78cebef1e 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -321,7 +321,7 @@ jdk.compiler_COPY := javax.tools.JavaCompilerTool ################################################################################ -jdk.jcmd_COPY := _options +jdk.jcmd_COPY := _options ################################################################################ @@ -470,7 +470,7 @@ define SetupModuleCompilation $1_DEPS := $$(call FindDepsForModule, $1) $1_CLASSPATH := $$(addprefix $(JDK_OUTPUTDIR)/modules/,$$($1_DEPS)) - # When crypto classes are prebuilt, need to look for classes already in + # When crypto classes are prebuilt, need to look for classes already in # output dir. ifneq ($(BUILD_CRYPTO), true) $1_CLASSPATH += $(JDK_OUTPUTDIR)/modules/$1 @@ -495,7 +495,7 @@ define SetupModuleCompilation # Declare dependencies between java compilation of different modules. # Since not all modules have been declared yet, or might be declared - # in different invocations of this file, use the macro to find the + # in different invocations of this file, use the macro to find the # correct target file to depend on. # Only the javac compilation actually depends on other modules so limit # dependency declaration to that by using the *_COMPILE_TARGET variable. diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index cba9d666ad2..e9bd588e17b 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -481,7 +481,7 @@ $(DOCLETAPI_OPTIONS_FILE): ) >> $@ # Create a file with the package names in it -$(DOCLETAPI_PACKAGES_FILE): $(call PackageDependencies,$(DOCLETAPI_PKGS)) +$(DOCLETAPI_PACKAGES_FILE): $(call PackageDependencies,$(DOCLETAPI_PKGS)) $(prep-target) $(call PackageFilter,$(DOCLETAPI_PKGS)) diff --git a/make/Main.gmk b/make/Main.gmk index 96e322ef96d..1b0038fc969 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -43,7 +43,7 @@ include $(SRC_ROOT)/make/common/Modules.gmk include $(JDK_TOPDIR)/make/ProfileNames.gmk # Declare ALL_TARGETS as an immediate variable. This variable is a list of all -# valid top level targets. It's used to declare them all as PHONY and to +# valid top level targets. It's used to declare them all as PHONY and to # generate the -only targets. ALL_TARGETS := @@ -314,9 +314,9 @@ ALL_TARGETS += install ################################################################################ # -# Dependency declarations between targets. +# Dependency declarations between targets. # -# These are declared in two groups. First all dependencies between targets that +# These are declared in two groups. First all dependencies between targets that # have recipes above as these dependencies may be disabled. Then the aggregator # targets that do not have recipes of their own, which will never have their # dependencies disabled. @@ -324,10 +324,10 @@ ALL_TARGETS += install ################################################################################ # Targets with recipes above -# If running an *-only target, parallel execution and dependencies between -# recipe targets are disabled. This makes it possible to run a select set of +# If running an *-only target, parallel execution and dependencies between +# recipe targets are disabled. This makes it possible to run a select set of # recipe targets in order. It's the responsibility of the user to make sure -# all prerequisites are fulfilled. +# all prerequisites are fulfilled. ifneq ($(findstring -only, $(MAKECMDGOALS)), ) .NOTPARALLEL: else @@ -376,11 +376,11 @@ else # Declare dependencies from all other -lib to java.base-lib $(foreach t, $(filter-out java.base-libs, $(LIB_TARGETS)), \ $(eval $t: java.base-libs)) - # Declare the special case dependency for jdk.deploy.osx where libosx + # Declare the special case dependency for jdk.deploy.osx where libosx # links against libosxapp. jdk.deploy.osx-libs: java.desktop-libs - # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a + # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a # header file used by jdk.jdwp libs. jdk.jdwp.agent-libs: jdk.jdi-gensrc @@ -493,7 +493,7 @@ ALL_TARGETS += default all # Clean targets # ################################################################################ -# Clean targets are automatically run serially by the Makefile calling this +# Clean targets are automatically run serially by the Makefile calling this # file. CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \ @@ -529,8 +529,8 @@ ALL_TARGETS += clean dist-clean $(CLEAN_TARGETS) ################################################################################ -# Setup a rule for SPEC file that fails if executed. This check makes sure the -# configuration is up to date after changes to configure. +# Setup a rule for SPEC file that fails if executed. This check makes sure the +# configuration is up to date after changes to configure. ifeq ($(findstring reconfigure, $(MAKECMDGOALS)), ) $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*) @$(ECHO) "ERROR: $(SPEC) is not up to date." diff --git a/make/MakeHelpers.gmk b/make/MakeHelpers.gmk index 62b9add30cd..72daed14298 100644 --- a/make/MakeHelpers.gmk +++ b/make/MakeHelpers.gmk @@ -228,25 +228,26 @@ define ParseConfAndSpec # If we only have global targets, no need to bother with SPEC or CONF ifneq ($$(origin SPEC),undefined) # We have been given a SPEC, check that it works out properly - ifeq ($$(wildcard $$(SPEC)),) - $$(info Cannot locate spec.gmk, given by SPEC=$$(SPEC)) - $$(eval $$(call FatalError)) - endif ifneq ($$(origin CONF),undefined) # We also have a CONF argument. This is OK only if this is a repeated call by ourselves, # but complain if this is the top-level make call. ifeq ($$(MAKELEVEL),0) - $$(info Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.) + $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.) $$(eval $$(call FatalError)) endif endif + ifeq ($$(wildcard $$(SPEC)),) + $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).) + $$(eval $$(call FatalError)) + endif # ... OK, we're satisfied, we'll use this SPEC later on else # Find all spec.gmk files in the build output directory output_dir=$$(root_dir)/build all_spec_files=$$(wildcard $$(output_dir)/*/spec.gmk) ifeq ($$(all_spec_files),) - $$(info No configurations found for $$(root_dir)! Please run configure to create a configuration.) + $$(info Error: No configurations found for $$(root_dir).) + $$(info Please run 'bash configure' to create a configuration.) $$(eval $$(call FatalError)) endif # Extract the configuration names from the path @@ -262,15 +263,15 @@ define ParseConfAndSpec matching_confs=$$(strip $$(foreach var,$$(all_confs),$$(if $$(findstring $$(CONF),$$(var)),$$(var)))) endif ifeq ($$(matching_confs),) - $$(info No configurations found matching CONF=$$(CONF)) - $$(info Available configurations:) + $$(info Error: No configurations found matching CONF=$$(CONF).) + $$(info Available configurations in $$(output_dir):) $$(foreach var,$$(all_confs),$$(info * $$(var))) $$(eval $$(call FatalError)) else ifeq ($$(words $$(matching_confs)),1) $$(info Building '$$(matching_confs)' (matching CONF=$$(CONF))) else - $$(info Building target '$(call GetRealTarget)' in the following configurations (matching CONF=$$(CONF)):) + $$(info Building target '$(call GetRealTarget)' in these configurations (matching CONF=$$(CONF)):) $$(foreach var,$$(matching_confs),$$(info * $$(var))) endif endif @@ -280,10 +281,10 @@ define ParseConfAndSpec else # No CONF or SPEC given, check the available configurations ifneq ($$(words $$(all_spec_files)),1) - $$(info No CONF given, but more than one configuration found in $$(output_dir).) - $$(info Available configurations:) + $$(info Error: No CONF given, but more than one configuration found.) + $$(info Available configurations in $$(output_dir):) $$(foreach var,$$(all_confs),$$(info * $$(var))) - $$(info Please retry building with CONF= (or SPEC=)) + $$(info Please retry building with CONF= (or SPEC=).) $$(eval $$(call FatalError)) endif diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 27846c0a924..3c89bf7f98a 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -166,7 +166,7 @@ define SetupArchiveInner ifneq (,$2) $1_DEPS:=$2 else - # Add all source roots to the find cache since we are likely going to run find + # Add all source roots to the find cache since we are likely going to run find # on these more than once. The cache will only be updated if necessary. $$(eval $$(call FillCacheFind, $$($1_FIND_LIST))) $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \ @@ -336,7 +336,7 @@ endef # # The sed expression does this: # 1. Add a backslash before any :, = or ! that do not have a backslash already. -# 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX +# 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX # conversions. # 3. Delete all lines starting with #. # 4. Delete empty lines. @@ -345,7 +345,7 @@ endef # as sed on macosx does not understand '\t'. # 7. Replace the first \= with just =. # 8. Finally it's all sorted to create a stable output. -# +# # It is assumed that = is the character used for separating names and values. define add_file_to_clean # param 1 = BUILD_MYPACKAGE @@ -431,7 +431,7 @@ define SetupJavaCompilationInner # Make sure the dirs exist. $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory $$d))) $$(eval $$(call MakeDir,$$($1_BIN))) - # Add all source roots to the find cache since we are likely going to run find + # Add all source roots to the find cache since we are likely going to run find # on these more than once. The cache will only be updated if necessary. $$(eval $$(call FillCacheFind,$$($1_SRC))) # Find all files in the source trees. Preserve order of source roots for overrides to diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index ee02322a2d4..b45fd52d5cd 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -405,7 +405,7 @@ ifeq ($(OPENJDK_TARGET_OS),solaris) # If the source and target parent directories are the same, recursive copy doesn't work # so we fall back on regular copy, which isn't preserving symlinks. define install-file - $(MKDIR) -p $(@D) + $(MKDIR) -p '$(@D)' $(RM) '$@' if [ "$(@D)" != "$( REPLACEMENT_TEXT ; ... # -# At least one of INCLUDES or REPLACEMENTS must be present. If both are -# present, then the includes will be processed first, and replacements will be -# done on the included fragments as well. +# If both INCLUDES or REPLACEMENTS are present, then the includes will be +# processed first, and replacements will be done on the included fragments as well. +# If neither is present, the files will just be copied without modifications. # define SetupTextFileProcessing $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk)) @@ -87,10 +87,6 @@ define SetupTextFileProcessingInner $(call LogSetupMacroEntry,SetupTextFileProcessing($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk)) - ifeq ($$($1_REPLACEMENTS)$$($1_INCLUDES),) - $$(error At least one of REPLACEMENTS or INCLUDES are required for $1) - endif - ifneq ($$($1_SOURCE_FILES),) ifneq ($$($1_SOURCE_DIRS),) $$(error Cannot use both SOURCE_FILES and SOURCE_DIRS (in $1)) @@ -102,6 +98,9 @@ define SetupTextFileProcessingInner $$(error Cannot INCLUDE/EXCLUDE_FILES with SOURCE_FILES (in $1)) endif else + ifeq ($$($1_SOURCE_DIRS),) + $$(error Must specify either SOURCE_FILES or SOURCE_DIRS (in $1)) + endif # Find all files in the source trees. Sort to remove duplicates. $$(foreach src, $$($1_SOURCE_DIRS), $$(if $$(wildcard $$(src)), , \ $$(error SOURCE_DIRS contains missing directory $$(src) (in $1)))) @@ -154,7 +153,7 @@ define SetupTextFileProcessingInner $1_REPLACEMENTS += ; endif - # If we have a trailing ";", add a dummy replacement, since there is no easy + # If we have a trailing ";", add a dummy replacement, since there is no easy # way to delete the last word in make. ifeq ($$(lastword $$($1_REPLACEMENTS)), ;) $1_REPLACEMENTS += DUMMY_REPLACEMENT => DUMMY_REPLACEMENT @@ -163,11 +162,11 @@ define SetupTextFileProcessingInner # Convert the REPLACEMENTS syntax ( A => B ; C => D ; ...) to a sed command # line (-e "s/A/B/" -e "s/C/D/" ...), basically by replacing '=>' with '/' # and ';' with '/" -e "s/', and adjusting for edge cases. - $1_REPLACEMENTS_COMMAND_LINE := $(SED) -e "s$$($1_SEP)$$(subst $$(SPACE);$$(SPACE),$$($1_SEP)" \ - -e "s$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE),$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE);$$(SPACE),//" \ - -e "s$$($1_SEP),$$(strip $$($1_REPLACEMENTS)))))$$($1_SEP)" + $1_REPLACEMENTS_COMMAND_LINE := $(SED) -e 's$$($1_SEP)$$(subst $$(SPACE);$$(SPACE),$$($1_SEP)' \ + -e 's$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE),$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE);$$(SPACE),$$($1_SEP)$$($1_SEP)' \ + -e 's$$($1_SEP),$$(strip $$($1_REPLACEMENTS)))))$$($1_SEP)' else - # We don't have any replacements, just pipe the file through cat. + # We don't have any replacements, just pipe the file through cat. $1_REPLACEMENTS_COMMAND_LINE := $(CAT) endif @@ -176,8 +175,8 @@ define SetupTextFileProcessingInner # Convert an INCLUDE like this PATTERN_1 => file1 ; PATTERN_2 => file2 ; # into an awk script fragment like this: # { - # if (matches("PATTERN_1")) { include("file1") } else - # if (matches("PATTERN_2")) { include("file2") } else + # if (matches("PATTERN_1")) { include("file1") } else + # if (matches("PATTERN_2")) { include("file2") } else # print # } @@ -190,12 +189,12 @@ define SetupTextFileProcessingInner $1_INCLUDES_COMMAND_LINE := $(NAWK) '$$($1_INCLUDES_HEADER_AWK) \ { if (matches("$$($1_INCLUDES_PARTIAL_AWK)") } else print }' else - # We don't have any includes, just pipe the file through cat. + # We don't have any includes, just pipe the file through cat. $1_INCLUDES_COMMAND_LINE := $(CAT) endif # Reset target list before populating it - $1 := + $1 := ifneq ($$($1_OUTPUT_FILE),) ifneq ($$(words $$($1_SOURCE_FILES)), 1) @@ -204,7 +203,7 @@ define SetupTextFileProcessingInner # Note that $1 is space sensitive and must disobey whitespace rules $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$($1_SOURCE_FILES), \ - $$(dir $$($1_OUTPUT_FILE)), $$(notdir $$($1_OUTPUT_FILE)))) + $$(patsubst %/, %, $$(dir $$($1_OUTPUT_FILE))), $$(notdir $$($1_OUTPUT_FILE)))) else ifeq ($$($1_OUTPUT_DIR),) $$(error Neither OUTPUT_FILE nor OUTPUT_DIR was specified (in $1)) @@ -212,19 +211,20 @@ define SetupTextFileProcessingInner # Now call add_native_source for each source file we are going to process. ifeq ($$($1_SOURCE_BASE_DIR),) - # With no base dir specified, put all files in target dir, flattening any + # With no base dir specified, put all files in target dir, flattening any # hierarchies. Note that $1 is space sensitive and must disobey whitespace # rules. $$(foreach src, $$($1_SOURCE_FILES), \ $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$(src), \ - $$($1_OUTPUT_DIR), $$(notdir $$(src))))) + $$(patsubst %/, %, $$($1_OUTPUT_DIR)), $$(notdir $$(src))))) else # With a base dir, extract the relative portion of the path. Note that $1 # is space sensitive and must disobey whitespace rules, and so is the # arguments to patsubst. $$(foreach src, $$($1_SOURCE_FILES), \ $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$(src), \ - $$($1_OUTPUT_DIR), $$(patsubst $$($1_SOURCE_BASE_DIR)/%,%,$$(src))))) + $$(patsubst %/, %, $$($1_OUTPUT_DIR)), \ + $$(patsubst $$($1_SOURCE_BASE_DIR)/%,%,$$(src))))) endif endif endef diff --git a/make/jprt.properties b/make/jprt.properties index dbe27081b20..368afe4ccf6 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -154,7 +154,7 @@ my.make.rule.test.targets.default= \ ${my.test.target.set:TESTNAME=jdk_lang}, \ ${my.test.target.set:TESTNAME=jdk_math}, \ ${my.test.target.set:TESTNAME=jdk_util} - + # Default vm test targets (testset=core) my.test.targets.core= diff --git a/make/scripts/normalizer.pl b/make/scripts/normalizer.pl index 184248aa016..28aeff2bb58 100644 --- a/make/scripts/normalizer.pl +++ b/make/scripts/normalizer.pl @@ -32,7 +32,7 @@ if ($#ARGV < 0) { &usage; - + die; } @@ -99,7 +99,7 @@ sub parse_file { # Skip directories return if -d; - + # Skip SCCS files return if ($filename =~ /\/SCCS\//); @@ -121,18 +121,18 @@ sub parse_file { chdir $dirname; open(FILE, $filename) or die "Failed while open $filename: $!\n"; - + # Read file my @content; my $line; my $emptylinescount = 0; my $modified = 0; - + while ($line = ) { my $originalline = $line; # Process line - + # Remove from the end of the line spaces and return character while ($line =~ /\s$/) { chop($line); @@ -144,16 +144,16 @@ sub parse_file { $line = substr($line, 0, $i) . $tabvalues[7 - ($i % 8)] . substr($line, $i + 1); } } - + if (length($line) == 0) { $emptylinescount++; } else { while ($emptylinescount > 0) { push(@content, ""); - + $emptylinescount--; } - + push(@content, $line); } @@ -162,23 +162,23 @@ sub parse_file { } } - + $allfiles++; - + if ($emptylinescount > 0) { $modified = 1; } close(FILE); - + if ($modified != 0) { # Write file open(FILE, ">$filename") or die "Failed while open $filename: $!\n"; - + for (my $i = 0; $i <= $#content; $i++) { print FILE "$content[$i]\n"; } - + close(FILE); # Print name from current dir @@ -204,5 +204,3 @@ sub usage { print "Examples:\n"; print " normalizer.pl -e c,cpp,h,hpp .\n"; } - - diff --git a/make/scripts/update_copyright_year.sh b/make/scripts/update_copyright_year.sh index a3df5d0fdf6..948f80d6acb 100644 --- a/make/scripts/update_copyright_year.sh +++ b/make/scripts/update_copyright_year.sh @@ -196,4 +196,3 @@ fi # Cleanup rm -f -r ${tmp} exit 0 - From d291f2c3f7ed82c56dc53043471f9382eeb68988 Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Fri, 28 Nov 2014 18:31:05 +0530 Subject: [PATCH 137/159] 8066146: jdk.nashorn.api.scripting package javadoc should be included in jdk docs Reviewed-by: erikj, jlaskey, lagergren --- make/Javadoc.gmk | 56 +++++++++++++++++++++++++++++++++++ make/common/NON_CORE_PKGS.gmk | 2 ++ 2 files changed, 58 insertions(+) diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index e9bd588e17b..faa75a665f4 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -74,6 +74,7 @@ JCONSOLE_FIRST_COPYRIGHT_YEAR = 2006 SCTPAPI_FIRST_COPYRIGHT_YEAR = 2009 TRACING_FIRST_COPYRIGHT_YEAR = 2008 TREEAPI_FIRST_COPYRIGHT_YEAR = 2005 +NASHORNAPI_FIRST_COPYRIGHT_YEAR = 2014 JNLP_FIRST_COPYRIGHT_YEAR = 1998 PLUGIN2_FIRST_COPYRIGHT_YEAR = 2007 JDKNET_FIRST_COPYRIGHT_YEAR = 2014 @@ -140,6 +141,7 @@ ALL_SOURCE_DIRS := $(wildcard \ $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \ $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \ $(LANGTOOLS_TOPDIR)/src/*/share/classes \ + $(NASHORN_TOPDIR)/src/*/share/classes \ $(CORBA_TOPDIR)/src/*/share/classes \ $(JAXP_TOPDIR)/src/*/share/classes \ $(JAXWS_TOPDIR)/src/*/share/classes \ @@ -1127,6 +1129,60 @@ $(TREEAPI_PACKAGES_FILE): $(call PackageDependencies,$(TREEAPI_PKGS)) $(prep-target) $(call PackageFilter,$(TREEAPI_PKGS)) +############################################################# +# +# nashornapidocs +# + +ALL_OTHER_TARGETS += nashornapidocs + +NASHORNAPI_DOCDIR := $(JDK_API_DOCSDIR)/nashorn +NASHORNAPI2COREAPI := ../$(JDKJRE2COREAPI) +NASHORNAPI_DOCTITLE := Nashorn API +NASHORNAPI_WINDOWTITLE := Nashorn API +NASHORNAPI_HEADER := Nashorn API +NASHORNAPI_BOTTOM := $(call CommonBottom,$(NASHORNAPI_FIRST_COPYRIGHT_YEAR)) +NASHORNAPI_GROUPNAME := Packages +NASHORNAPI_REGEXP := jdk.nashorn.api.scripting.* +# NASHORNAPI_PKGS is located in NON_CORE_PKGS.gmk + +NASHORNAPI_INDEX_HTML = $(NASHORNAPI_DOCDIR)/index.html +NASHORNAPI_OPTIONS_FILE = $(DOCSTMPDIR)/nashornapi.options +NASHORNAPI_PACKAGES_FILE = $(DOCSTMPDIR)/nashornapi.packages + +nashornapidocs: $(NASHORNAPI_INDEX_HTML) + +# Set relative location to core api document root +$(NASHORNAPI_INDEX_HTML): GET2DOCSDIR=$(NASHORNAPI2COREAPI)/.. + +# Run javadoc if the index file is out of date or missing +$(NASHORNAPI_INDEX_HTML): $(NASHORNAPI_OPTIONS_FILE) $(NASHORNAPI_PACKAGES_FILE) $(COREAPI_INDEX_FILE) + $(prep-javadoc) + $(call JavadocSummary,$(NASHORNAPI_OPTIONS_FILE),$(NASHORNAPI_PACKAGES_FILE)) + $(JAVADOC_CMD) -d $(@D) \ + @$(NASHORNAPI_OPTIONS_FILE) @$(NASHORNAPI_PACKAGES_FILE) + +# Create file with javadoc options in it +$(NASHORNAPI_OPTIONS_FILE): + $(prep-target) + @($(call COMMON_JAVADOCFLAGS) ; \ + $(call COMMON_JAVADOCTAGS) ; \ + $(call OptionOnly,-Xdoclint:all) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionPair,-doctitle,$(NASHORNAPI_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(NASHORNAPI_WINDOWTITLE) $(DRAFT_WINTITLE)); \ + $(call OptionPair,-header,$(NASHORNAPI_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(NASHORNAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-group,$(NASHORNAPI_GROUPNAME),$(NASHORNAPI_REGEXP)); \ + $(call OptionTrip,-linkoffline,$(NASHORNAPI2COREAPI),$(COREAPI_DOCSDIR)/); \ + ) >> $@ + +# Create a file with the package names in it +$(NASHORNAPI_PACKAGES_FILE): $(call PackageDependencies,$(NASHORNAPI_PKGS)) + $(prep-target) + $(call PackageFilter,$(NASHORNAPI_PKGS)) + ############################################################# # # sctpdocs diff --git a/make/common/NON_CORE_PKGS.gmk b/make/common/NON_CORE_PKGS.gmk index 5978042d82f..cb3887a9d00 100644 --- a/make/common/NON_CORE_PKGS.gmk +++ b/make/common/NON_CORE_PKGS.gmk @@ -82,6 +82,8 @@ TREEAPI_PKGS = com.sun.source.doctree \ com.sun.source.util \ jdk +NASHORNAPI_PKGS = jdk.nashorn.api.scripting + SMARTCARDIO_PKGS = javax.smartcardio SCTPAPI_PKGS = com.sun.nio.sctp From f0b198804a1665117404295f0c5a2839d9766758 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 28 Nov 2014 14:58:10 +0000 Subject: [PATCH 138/159] 8062955: (fs spec) Files.setLastModifiedTime should specify SecurityException more clearly 8062949: (fs) Files.setLastModifiedTime(path, null) does not throw NPE Reviewed-by: chegar --- .../share/classes/java/nio/file/Files.java | 16 +-- .../java/nio/file/Files/FileAttributes.java | 6 - .../nio/file/Files/SetLastModifiedTime.java | 118 ++++++++++++++++++ 3 files changed, 126 insertions(+), 14 deletions(-) create mode 100644 jdk/test/java/nio/file/Files/SetLastModifiedTime.java diff --git a/jdk/src/java.base/share/classes/java/nio/file/Files.java b/jdk/src/java.base/share/classes/java/nio/file/Files.java index 18ef214e9a0..4d0119393b6 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/Files.java +++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java @@ -1778,7 +1778,7 @@ public final class Files { * @param options * options indicating how symbolic links are handled * - * @return the {@code path} parameter + * @return the given path * * @throws UnsupportedOperationException * if the attribute view is not available @@ -2019,7 +2019,7 @@ public final class Files { * @param perms * The new set of permissions * - * @return The path + * @return The given path * * @throws UnsupportedOperationException * if the associated file system does not support the {@code @@ -2102,7 +2102,7 @@ public final class Files { * @param owner * The new file owner * - * @return The path + * @return The given path * * @throws UnsupportedOperationException * if the associated file system does not support the {@code @@ -2289,14 +2289,14 @@ public final class Files { * @param time * the new last modified time * - * @return the path + * @return the given path * * @throws IOException * if an I/O error occurs * @throws SecurityException - * In the case of the default provider, the security manager's {@link - * SecurityManager#checkWrite(String) checkWrite} method is invoked - * to check write access to file + * In the case of the default provider, and a security manager is + * installed, its {@link SecurityManager#checkWrite(String) + * checkWrite} method denies write access to the file. * * @see BasicFileAttributeView#setTimes */ @@ -2304,7 +2304,7 @@ public final class Files { throws IOException { getFileAttributeView(path, BasicFileAttributeView.class) - .setTimes(time, null, null); + .setTimes(Objects.requireNonNull(time), null, null); return path; } diff --git a/jdk/test/java/nio/file/Files/FileAttributes.java b/jdk/test/java/nio/file/Files/FileAttributes.java index 8b179f8efeb..a993b81e149 100644 --- a/jdk/test/java/nio/file/Files/FileAttributes.java +++ b/jdk/test/java/nio/file/Files/FileAttributes.java @@ -52,12 +52,6 @@ public class FileAttributes { } } - // checks that two time values are within 1s of each other - static void checkNearEqual(FileTime t1, FileTime t2) { - long diff = Math.abs(t1.toMillis() - t2.toMillis()); - assertTrue(diff <= 1000); - } - // Exercise getAttribute/setAttribute/readAttributes on basic attributes static void checkBasicAttributes(Path file, BasicFileAttributes attrs) throws IOException diff --git a/jdk/test/java/nio/file/Files/SetLastModifiedTime.java b/jdk/test/java/nio/file/Files/SetLastModifiedTime.java new file mode 100644 index 00000000000..ef8cfaa0cec --- /dev/null +++ b/jdk/test/java/nio/file/Files/SetLastModifiedTime.java @@ -0,0 +1,118 @@ +/* + * 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. + */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.attribute.FileTime; + +import org.testng.annotations.Test; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; +import static org.testng.Assert.assertFalse; + +/** + * @test + * @bug 4313887 8062949 + * @library .. + * @run testng SetLastModifiedTime + * @summary Unit test for Files.setLastModifiedTime + */ + +public class SetLastModifiedTime { + + static Path testDir; + + @BeforeClass + void createTestDirectory() throws Exception { + testDir = TestUtil.createTemporaryDirectory(); + } + + @AfterClass + void removeTestDirectory() throws Exception { + TestUtil.removeAll(testDir); + } + + /** + * Exercise Files.setLastModifiedTime on the given file + */ + void test(Path path) throws Exception { + FileTime now = Files.getLastModifiedTime(path); + FileTime zero = FileTime.fromMillis(0L); + + Path result = Files.setLastModifiedTime(path, zero); + assertTrue(result == path); + assertEquals(Files.getLastModifiedTime(path), zero); + + result = Files.setLastModifiedTime(path, now); + assertTrue(result == path); + assertEquals(Files.getLastModifiedTime(path), now); + } + + @Test + public void testRegularFile() throws Exception { + Path file = Files.createFile(testDir.resolve("file")); + test(file); + } + + @Test + public void testDirectory() throws Exception { + Path dir = Files.createDirectory(testDir.resolve("dir")); + test(dir); + } + + @Test + public void testSymbolicLink() throws Exception { + if (TestUtil.supportsLinks(testDir)) { + Path target = Files.createFile(testDir.resolve("target")); + Path link = testDir.resolve("link"); + Files.createSymbolicLink(link, target); + test(link); + } + } + + @Test + public void testNulls() throws Exception { + Path path = Paths.get("foo"); + FileTime zero = FileTime.fromMillis(0L); + + try { + Files.setLastModifiedTime(null, zero); + assertTrue(false); + } catch (NullPointerException expected) { } + + try { + Files.setLastModifiedTime(path, null); + assertTrue(false); + } catch (NullPointerException expected) { } + + try { + Files.setLastModifiedTime(null, null); + assertTrue(false); + } catch (NullPointerException expected) { } + } +} + From db7c757726dddbb4342b2f2969f0b4cca12eabf6 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Sat, 29 Nov 2014 11:14:20 -0500 Subject: [PATCH 139/159] 8066188: BaseRowSet default value for escape processing is not correct Reviewed-by: alanb --- .../share/classes/javax/sql/rowset/BaseRowSet.java | 2 +- jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java index 2998715e3c8..7f65c0eed9c 100644 --- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java +++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java @@ -462,7 +462,7 @@ public abstract class BaseRowSet implements Serializable, Cloneable { * false that it is not. The default is true. * @serial */ - private boolean escapeProcessing; + private boolean escapeProcessing = true; /** * A constant indicating the isolation level of the connection diff --git a/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java b/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java index e1b5457bda8..8e92f20af33 100644 --- a/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java +++ b/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java @@ -186,11 +186,11 @@ public class BaseRowSetTests extends BaseTest { } /* - * Validate that getEscapeProcessing() returns false by default + * Validate that getEscapeProcessing() returns true by default */ @Test public void test08() throws Exception { - assertFalse(brs.getEscapeProcessing()); + assertTrue(brs.getEscapeProcessing()); } /* From 14ee08928760e5d97c574e746775d28c0ae552cb Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 1 Dec 2014 13:44:57 +0000 Subject: [PATCH 140/159] 8066196: (fs) Typo in Path::normalize, empty path only returned if path does not have a root component Reviewed-by: dfuchs --- jdk/src/java.base/share/classes/java/nio/file/Path.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/nio/file/Path.java b/jdk/src/java.base/share/classes/java/nio/file/Path.java index daa09f4cf87..9df57c120e0 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/Path.java +++ b/jdk/src/java.base/share/classes/java/nio/file/Path.java @@ -325,7 +325,7 @@ public interface Path * * @return the resulting path or this path if it does not contain * redundant name elements; an empty path is returned if this path - * does have a root component and all name elements are redundant + * does not have a root component and all name elements are redundant * * @see #getParent * @see #toRealPath From 5f72abe97e68570cff5d58fe52b4efc3d38fa250 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Mon, 1 Dec 2014 11:34:44 -0500 Subject: [PATCH 141/159] 8066261: Typo in Connection.isValid Reviewed-by: dfuchs --- jdk/src/java.sql/share/classes/java/sql/Connection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.sql/share/classes/java/sql/Connection.java b/jdk/src/java.sql/share/classes/java/sql/Connection.java index ac73fde29dd..ac5d3158b6e 100644 --- a/jdk/src/java.sql/share/classes/java/sql/Connection.java +++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java @@ -1116,7 +1116,7 @@ public interface Connection extends Wrapper, AutoCloseable { * * @return true if the connection is valid, false otherwise * @exception SQLException if the value supplied for timeout - * is less then 0 + * is less than 0 * @since 1.6 * * @see java.sql.DatabaseMetaData#getClientInfoProperties From 392436eade0b7eef17305e45fd3de51128883bd8 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Mon, 1 Dec 2014 17:20:06 +0000 Subject: [PATCH 142/159] 8066130: com.sun.net.httpserver stop() throws NullPointerException if it is not started Added null check on dispatcherThread variable in stop method Reviewed-by: chegar --- .../sun/net/httpserver/ServerImpl.java | 12 +++--- .../sun/net/httpserver/StopNoStartTest.java | 42 +++++++++++++++++++ 2 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 jdk/test/com/sun/net/httpserver/StopNoStartTest.java diff --git a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java index 5952c79ee87..24ab8b014db 100644 --- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java +++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java @@ -206,11 +206,13 @@ class ServerImpl implements TimeSource { if (timer1Enabled) { timer1.cancel(); } - try { - dispatcherThread.join(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - logger.log(Level.FINER, "ServerImpl.stop: ", e); + if (dispatcherThread != null) { + try { + dispatcherThread.join(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + logger.log(Level.FINER, "ServerImpl.stop: ", e); + } } } diff --git a/jdk/test/com/sun/net/httpserver/StopNoStartTest.java b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java new file mode 100644 index 00000000000..c10d767e7d7 --- /dev/null +++ b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java @@ -0,0 +1,42 @@ +/* + * 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 + * @bug 8066130 + * @summary Test HttpServer stop method invocation before a start has been called + */ + +import java.net.InetSocketAddress; +import com.sun.net.httpserver.HttpServer; + + +public class StopNoStartTest { + + public static void main(String[] args) throws Exception { + + InetSocketAddress serverAddr = new InetSocketAddress(0); + HttpServer server = HttpServer.create(serverAddr, 0); + server.stop(0); + } +} From 3e1d5786af201705d46af49159e3e74808e7dca9 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 1 Dec 2014 21:56:54 +0300 Subject: [PATCH 143/159] 8066191: Introduce time limited test executor Reviewed-by: vlivanov, psandoz --- .../jdk/testlibrary/TimeLimitedRunner.java | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java b/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java new file mode 100644 index 00000000000..5cc98ea8f8a --- /dev/null +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java @@ -0,0 +1,86 @@ +/* + * 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. + */ + +package jdk.testlibrary; + +import java.util.Objects; +import java.util.concurrent.Callable; + +/** + * Auxiliary class to run target w/ given timeout. + */ +public class TimeLimitedRunner implements Callable { + private final long stoptime; + private final long timeout; + private final double factor; + private final Callable target; + + /** + * @param timeout a timeout. zero means no time limitation + * @param factor a multiplier used to estimate next iteration time + * @param target a target to run + * @throws NullPointerException if target is null + * @throws IllegalArgumentException if timeout is negative or + factor isn't positive + */ + public TimeLimitedRunner(long timeout, double factor, + Callable target) { + Objects.requireNonNull(target, "target must not be null"); + if (timeout < 0) { + throw new IllegalArgumentException("timeout[" + timeout + "] < 0"); + } + if (factor <= 0d) { + throw new IllegalArgumentException("factor[" + factor + "] <= 0"); + } + this.stoptime = System.currentTimeMillis() + timeout; + this.timeout = timeout; + this.factor = factor; + this.target = target; + } + + /** + * Runs @{linkplan target} while it returns true and timeout isn't exceeded + */ + @Override + public Void call() throws Exception { + long maxDuration = 0L; + long iterStart = System.currentTimeMillis(); + if (timeout != 0 && iterStart > stoptime) { + return null; + } + while (target.call()) { + if (timeout != 0) { + long iterDuration = System.currentTimeMillis() - iterStart; + maxDuration = Math.max(maxDuration, iterDuration); + iterStart = System.currentTimeMillis(); + if (iterStart + (maxDuration * factor) > stoptime) { + System.out.println("Not enough time to continue execution. " + + "Interrupted."); + break; + } + } + } + return null; + } + +} From 7abe24d3ea017b431113c5a709f976519f7492c3 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 1 Dec 2014 21:58:46 +0300 Subject: [PATCH 144/159] 8039953: [TESTBUG] Timeout java/lang/invoke/MethodHandles/CatchExceptionTest.java Reviewed-by: vlivanov, psandoz --- .../MethodHandles/CatchExceptionTest.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java index 52c41dfd991..996ed526413 100644 --- a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java +++ b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java @@ -24,6 +24,8 @@ package test.java.lang.invoke.MethodHandles; import com.oracle.testlibrary.jsr292.Helper; import jdk.testlibrary.Asserts; +import jdk.testlibrary.TimeLimitedRunner; +import jdk.testlibrary.Utils; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -33,6 +35,7 @@ import java.util.*; import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; +import java.util.concurrent.TimeUnit; /* @test * @library /lib/testlibrary/jsr292 /lib/testlibrary/ @@ -93,14 +96,23 @@ public class CatchExceptionTest { } public static void main(String[] args) throws Throwable { + TestFactory factory = new TestFactory(); + long timeout = Helper.IS_THOROUGH ? 0L : Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT); + // substract vm init time and reserve time for vm exit + timeout *= 0.9; + TimeLimitedRunner runner = new TimeLimitedRunner(timeout, 2.0d, + () -> { + CatchExceptionTest test = factory.nextTest(); + if (test != null) { + test.runTest(); + return true; + } + return false; + }); for (CatchExceptionTest test : TestFactory.MANDATORY_TEST_CASES) { test.runTest(); } - TestFactory factory = new TestFactory(); - CatchExceptionTest test; - while ((test = factory.nextTest()) != null ) { - test.runTest(); - } + runner.call(); } private List> getThrowerParams(boolean isVararg, int argsCount) { From 3034f050f9c6a5d381c66b728796d42b9b9f127a Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Mon, 1 Dec 2014 21:02:21 +0100 Subject: [PATCH 145/159] 8065552: setAccessible(true) on fields of Class may throw a SecurityException This fix hides the new private Class.classLoader field from reflection, rather than making it not accessible. Reviewed-by: mchung, coffeys --- .../share/classes/java/lang/Class.java | 2 + .../java/lang/reflect/AccessibleObject.java | 7 - .../share/classes/sun/reflect/Reflection.java | 1 + .../ClassDeclaredFieldsTest.java | 205 ++++++++++++++++++ 4 files changed, 208 insertions(+), 7 deletions(-) create mode 100644 jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java index ee24402ec8d..25ed5c47fec 100644 --- a/jdk/src/java.base/share/classes/java/lang/Class.java +++ b/jdk/src/java.base/share/classes/java/lang/Class.java @@ -691,6 +691,8 @@ public final class Class implements java.io.Serializable, ClassLoader getClassLoader0() { return classLoader; } // Initialized in JVM not by private constructor + // This field is filtered from reflection access, i.e. getDeclaredField + // will throw NoSuchFieldException private final ClassLoader classLoader; /** diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java index 01a074f36e0..65755f09826 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java @@ -140,13 +140,6 @@ public class AccessibleObject implements AnnotatedElement { throw new SecurityException("Cannot make a java.lang.Class" + " constructor accessible"); } - } else if (obj instanceof Field && flag == true) { - Field f = (Field)obj; - if (f.getDeclaringClass() == Class.class && - f.getName().equals("classLoader")) { - throw new SecurityException("Cannot make java.lang.Class.classLoader" + - " accessible"); - } } obj.override = flag; } diff --git a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java b/jdk/src/java.base/share/classes/sun/reflect/Reflection.java index 63baa42abae..bc3e13e23cb 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java +++ b/jdk/src/java.base/share/classes/sun/reflect/Reflection.java @@ -46,6 +46,7 @@ public class Reflection { map.put(Reflection.class, new String[] {"fieldFilterMap", "methodFilterMap"}); map.put(System.class, new String[] {"security"}); + map.put(Class.class, new String[] {"classLoader"}); fieldFilterMap = map; methodFilterMap = new HashMap<>(); diff --git a/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java b/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java new file mode 100644 index 00000000000..c05e1790d59 --- /dev/null +++ b/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java @@ -0,0 +1,205 @@ +/* + * 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. + */ + +import java.lang.reflect.Field; +import java.lang.reflect.ReflectPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.concurrent.atomic.AtomicBoolean; + +/** + * @test + * @bug 8065552 + * @summary test that all fields returned by getDeclaredFields() can be + * set accessible if the right permission is granted; this test + * also verifies that Class.classLoader final private field is + * hidden from reflection access. + * @run main/othervm ClassDeclaredFieldsTest UNSECURE + * @run main/othervm ClassDeclaredFieldsTest SECURE + * + * @author danielfuchs + */ +public class ClassDeclaredFieldsTest { + + // Test with or without a security manager + public static enum TestCase { + UNSECURE, SECURE; + public void run() throws Exception { + System.out.println("Running test case: " + name()); + Configure.setUp(this); + test(this); + } + } + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws Exception { + System.out.println(System.getProperty("java.version")); + if (args == null || args.length == 0) { + args = new String[] { "SECURE" }; + } else if (args.length != 1) { + throw new IllegalArgumentException("Only one arg expected: " + + Arrays.asList(args)); + } + TestCase.valueOf(args[0]).run(); + } + + static void test(TestCase test) { + for (Field f : Class.class.getDeclaredFields()) { + f.setAccessible(true); + System.out.println("Field "+f.getName()+" is now accessible."); + if (f.getName().equals("classLoader")) { + throw new RuntimeException("Found "+f.getName()+" field!"); + } + } + try { + Class.class.getDeclaredField("classLoader"); + throw new RuntimeException("Expected NoSuchFieldException for" + + " 'classLoader' field not raised"); + } catch(NoSuchFieldException x) { + System.out.println("Got expected exception: " + x); + } + System.out.println("Passed "+test); + } + + // A helper class to configure the security manager for the test, + // and bypass it when needed. + static class Configure { + static Policy policy = null; + static final ThreadLocal allowAll = new ThreadLocal() { + @Override + protected AtomicBoolean initialValue() { + return new AtomicBoolean(false); + } + }; + static void setUp(TestCase test) { + switch (test) { + case SECURE: + if (policy == null && System.getSecurityManager() != null) { + throw new IllegalStateException("SecurityManager already set"); + } else if (policy == null) { + policy = new SimplePolicy(TestCase.SECURE, allowAll); + Policy.setPolicy(policy); + System.setSecurityManager(new SecurityManager()); + } + if (System.getSecurityManager() == null) { + throw new IllegalStateException("No SecurityManager."); + } + if (policy == null) { + throw new IllegalStateException("policy not configured"); + } + break; + case UNSECURE: + if (System.getSecurityManager() != null) { + throw new IllegalStateException("SecurityManager already set"); + } + break; + default: + throw new InternalError("No such testcase: " + test); + } + } + static void doPrivileged(Runnable run) { + allowAll.get().set(true); + try { + run.run(); + } finally { + allowAll.get().set(false); + } + } + } + + // A Helper class to build a set of permissions. + final static class PermissionsBuilder { + final Permissions perms; + public PermissionsBuilder() { + this(new Permissions()); + } + public PermissionsBuilder(Permissions perms) { + this.perms = perms; + } + public PermissionsBuilder add(Permission p) { + perms.add(p); + return this; + } + public PermissionsBuilder addAll(PermissionCollection col) { + if (col != null) { + for (Enumeration e = col.elements(); e.hasMoreElements(); ) { + perms.add(e.nextElement()); + } + } + return this; + } + public Permissions toPermissions() { + final PermissionsBuilder builder = new PermissionsBuilder(); + builder.addAll(perms); + return builder.perms; + } + } + + // Policy for the test... + public static class SimplePolicy extends Policy { + + final Permissions permissions; + final Permissions allPermissions; + final ThreadLocal allowAll; // actually: this should be in a thread locale + public SimplePolicy(TestCase test, ThreadLocal allowAll) { + this.allowAll = allowAll; + // we don't actually need any permission to create our + // FileHandlers because we're passing invalid parameters + // which will make the creation fail... + permissions = new Permissions(); + permissions.add(new RuntimePermission("accessDeclaredMembers")); + permissions.add(new ReflectPermission("suppressAccessChecks")); + + // these are used for configuring the test itself... + allPermissions = new Permissions(); + allPermissions.add(new java.security.AllPermission()); + + } + + @Override + public boolean implies(ProtectionDomain domain, Permission permission) { + if (allowAll.get().get()) return allPermissions.implies(permission); + return permissions.implies(permission); + } + + @Override + public PermissionCollection getPermissions(CodeSource codesource) { + return new PermissionsBuilder().addAll(allowAll.get().get() + ? allPermissions : permissions).toPermissions(); + } + + @Override + public PermissionCollection getPermissions(ProtectionDomain domain) { + return new PermissionsBuilder().addAll(allowAll.get().get() + ? allPermissions : permissions).toPermissions(); + } + } + +} From 2f9a2c3c320a4413ad843f0c505a75c5792ad249 Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Mon, 1 Dec 2014 17:59:39 -0800 Subject: [PATCH 146/159] 8035000: clean up ActivationLibrary.DestroyThread Reviewed-by: lancea --- .../checkActivateRef/CheckActivateRef.java | 4 +- .../checkAnnotations/CheckAnnotations.java | 4 +- .../CheckImplClassLoader.java | 4 +- .../CheckRegisterInLog.java | 4 +- .../CreatePrivateActivatable.java | 4 +- .../DownloadParameterClass.java | 4 +- .../ElucidateNoSuchMethod.java | 4 +- .../extLoadedImpl/ExtLoadedImplTest.java | 4 +- .../forceLogSnapshot/ForceLogSnapshot.java | 4 +- .../inactiveGroup/InactiveGroup.java | 4 +- .../LookupActivationSystem.java | 4 +- .../nestedActivate/NestedActivate.java | 4 +- .../NonExistentActivatable.java | 4 +- .../RestartCrashedService.java | 4 +- .../restartLatecomer/RestartLatecomer.java | 4 +- .../restartService/RestartService.java | 4 +- .../UnregisterInactive.java | 4 +- .../activateFails/ActivateFails.java | 4 +- .../DownloadActivationGroup.java | 4 +- .../activeGroup/IdempotentActiveGroup.java | 4 +- .../modifyDescriptor/ModifyDescriptor.java | 4 +- .../StubClassesPermitted.java | 4 +- .../unregisterGroup/UnregisterGroup.java | 4 +- .../CommandEnvironment/SetChildEnv.java | 4 +- .../InheritedChannelNotServerSocket.java | 4 +- .../RmidViaInheritedChannel.java | 4 +- .../AltSecurityManager.java | 7 - .../activatable/UseCustomSocketFactory.java | 4 +- .../rmi/testlibrary/ActivationLibrary.java | 64 ------ jdk/test/java/rmi/testlibrary/RMID.java | 216 +++++++++--------- 30 files changed, 160 insertions(+), 235 deletions(-) diff --git a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java index dcd5990db63..f37fdec54dc 100644 --- a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java +++ b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -262,7 +262,7 @@ public class CheckActivateRef e.getClass().getName(), e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); obj = null; } } diff --git a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java index d2a0bab342c..126fae1e521 100644 --- a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java +++ b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -130,7 +130,7 @@ public class CheckAnnotations myRMI = null; System.err.println("rmid shut down"); - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } diff --git a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java index 556e2895ca9..dc54f82459b 100644 --- a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java +++ b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, 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 @@ -112,7 +112,7 @@ public class CheckImplClassLoader { myRMI = null; System.err.println("rmid shut down"); - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); TestLibrary.unexport(group); } } diff --git a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java index c294a972d36..0d03562346c 100644 --- a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java +++ b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -164,7 +164,7 @@ public class CheckRegisterInLog throw new RuntimeException("CheckRegisterInLog got exception " + e.getMessage()); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java index 2900e80964a..414527dfa4b 100644 --- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java +++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, 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 @@ -155,7 +155,7 @@ public class CreatePrivateActivatable e.getClass().getName(), e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); obj = null; } } diff --git a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java index 64f11681341..9f236978a4a 100644 --- a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java +++ b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -138,7 +138,7 @@ public class DownloadParameterClass { } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java index 29482121ffb..0e0efb52cd5 100644 --- a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java +++ b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -135,7 +135,7 @@ public class ElucidateNoSuchMethod } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java index 3fd009b611a..c46baeaf5e7 100644 --- a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java +++ b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -69,7 +69,7 @@ public class ExtLoadedImplTest { } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java index abbaadfb9f3..55ff0cfd14e 100644 --- a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java +++ b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -248,7 +248,7 @@ public class ForceLogSnapshot } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); for (int i = 0 ; i < HOW_MANY ; i ++) { TestLibrary.unexport(unicastObjs[i]); } diff --git a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java index ad0b14e421a..145e6109df8 100644 --- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java +++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -176,7 +176,7 @@ public class InactiveGroup } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java index ce154c4ca99..df778dc8e91 100644 --- a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java +++ b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java @@ -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 @@ -118,7 +118,7 @@ public class LookupActivationSystem implements Remote, Serializable { } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java index 48e3e2d701e..507912e90b5 100644 --- a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java +++ b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -165,7 +165,7 @@ public class NestedActivate } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java index 47ddd176ef8..df8ddbef82c 100644 --- a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java +++ b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -139,7 +139,7 @@ public class NonExistentActivatable } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java index 5700f3d72f2..c3026b02c93 100644 --- a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java +++ b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -231,7 +231,7 @@ public class RestartCrashedService } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); TestLibrary.unexport(unicastObj); } } diff --git a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java index 747eee68f3a..3bbe8a60c44 100644 --- a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java +++ b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -247,7 +247,7 @@ public class RestartLatecomer } catch (Exception e) { TestLibrary.bomb(e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); TestLibrary.unexport(callbackObj); } } diff --git a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java index e1f2eb554ee..468f5b239f1 100644 --- a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java +++ b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -221,7 +221,7 @@ public class RestartService } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); TestLibrary.unexport(unicastObj); } } diff --git a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java index 455efd7d7f6..085120b159d 100644 --- a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java +++ b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -125,7 +125,7 @@ public class UnregisterInactive } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java index 6a2eba05864..6d9ccceb141 100644 --- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java +++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -163,7 +163,7 @@ public class ActivateFails } finally { obj1 = obj2 = null; - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java index f9aed42021d..2f025cf25b8 100644 --- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java +++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -156,7 +156,7 @@ public class DownloadActivationGroup } catch (Exception e) { TestLibrary.bomb(e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java index f6c08178eec..058d3c7e2d9 100644 --- a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java +++ b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -108,7 +108,7 @@ public class IdempotentActiveGroup { } catch (NoSuchObjectException unexpected) { throw new AssertionError(unexpected); } - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } diff --git a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java index ba376d1a8d9..53ff030e393 100644 --- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java +++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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,7 +250,7 @@ public class ModifyDescriptor } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java index b7890e0ebe7..f4970da26ad 100644 --- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java +++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, 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 @@ -171,7 +171,7 @@ public class StubClassesPermitted } canCreateStubs = null; - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); System.err.println("rmid shut down"); } } diff --git a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java index bc5976b74fe..94976dc0c6f 100644 --- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java +++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java @@ -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 @@ -156,7 +156,7 @@ public class UnregisterGroup extends Activatable implements ActivateMe } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } } diff --git a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java index 7b1a9688ad4..69274a0a797 100644 --- a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java +++ b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -203,7 +203,7 @@ public class SetChildEnv actsys.unregisterGroup(gid); Thread.sleep(5000); - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } public static class DebugExecWatcher diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java index 4611a83bda5..d375fc84611 100644 --- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java +++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java @@ -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 @@ -121,7 +121,7 @@ public class InheritedChannelNotServerSocket { if (obj != null) { UnicastRemoteObject.unexportObject(obj, true); } - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java index 6d81b0f1248..1f3cd6603d5 100644 --- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java +++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -119,7 +119,7 @@ public class RmidViaInheritedChannel implements Callback { if (obj != null) { UnicastRemoteObject.unexportObject(obj, true); } - ActivationLibrary.rmidCleanup(rmid); + rmid.cleanup(); } } diff --git a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java index 351042965de..ebad01300ae 100644 --- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java +++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java @@ -104,13 +104,6 @@ public class AltSecurityManager implements Runnable { utilityToStart + " to die"); if (time >= TIME_OUT) { - - // dont pollute other tests; increase the likelihood - // that rmid will go away if it did not exit already. - if (utility.equals(ACTIVATION)) { - RMID.shutdown(port); - } - TestLibrary.bomb(utilityToStart + " took too long to die..."); } else { diff --git a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java index b300e1083bb..5157f789c75 100644 --- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java +++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -57,7 +57,7 @@ public class UseCustomSocketFactory { RMID rmid = null; try { - rmid = RMID.createRMID(true); + rmid = RMID.createRMID(); rmid.addArguments(new String[] { "-C-Djava.security.policy=" + TestParams.defaultGroupPolicy + diff --git a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java index b33a3035c89..6a7a5b753d8 100644 --- a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java +++ b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java @@ -103,68 +103,4 @@ public class ActivationLibrary { } catch (NoSuchObjectException e) { } } - - /** cleanup after rmid */ - public static void rmidCleanup(RMID rmid) { - if (rmid != null) { - if (!ActivationLibrary.safeDestroy(rmid, SAFE_WAIT_TIME)) { - TestLibrary.bomb("rmid not destroyed in: " + - SAFE_WAIT_TIME + - " milliseconds"); - } - } - RMID.removeLog(); - } - - /** - * Invoke shutdown on rmid in a way that will not cause a test - * to hang. - * - * @return whether or not shutdown completed succesfully in the - * timeAllowed - */ - private static boolean safeDestroy(RMID rmid, long timeAllowed) { - DestroyThread destroyThread = new DestroyThread(rmid); - destroyThread.start(); - - try { - destroyThread.join(timeAllowed); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - } - - return destroyThread.shutdownSucceeded(); - } - - /** - * Thread class to handle the destruction of rmid - */ - private static class DestroyThread extends Thread { - private final RMID rmid; - private final int port; - private boolean succeeded = false; - - DestroyThread(RMID rmid) { - this.rmid = rmid; - this.port = rmid.getPort(); - this.setDaemon(true); - } - - public void run() { - if (RMID.lookupSystem(port) != null) { - rmid.destroy(); - synchronized (this) { - // flag that the test was able to shutdown rmid - succeeded = true; - } - mesg("finished destroying rmid"); - } else { - mesg("tried to shutdown when rmid was not running"); - } - } - - public synchronized boolean shutdownSucceeded() { - return succeeded; - } - } } diff --git a/jdk/test/java/rmi/testlibrary/RMID.java b/jdk/test/java/rmi/testlibrary/RMID.java index bdd8c829d89..29365e8125f 100644 --- a/jdk/test/java/rmi/testlibrary/RMID.java +++ b/jdk/test/java/rmi/testlibrary/RMID.java @@ -21,14 +21,11 @@ * questions. */ -/** - * - */ - import java.io.*; import java.rmi.*; import java.rmi.activation.*; import java.rmi.registry.*; +import java.util.concurrent.TimeoutException; /** * Utility class that creates an instance of rmid with a policy @@ -39,6 +36,14 @@ import java.rmi.registry.*; */ public class RMID extends JavaVM { + // TODO: adjust these based on the timeout factor + // such as jcov.sleep.multiplier; see start(long) method. + // Also consider the test.timeout.factor property (a float). + private static final long TIMEOUT_SHUTDOWN_MS = 60_000L; + private static final long TIMEOUT_DESTROY_MS = 10_000L; + private static final long STARTTIME_MS = 15_000L; + private static final long POLLTIME_MS = 100L; + private static final String SYSTEM_NAME = ActivationSystem.class.getName(); // "java.rmi.activation.ActivationSystem" @@ -140,15 +145,8 @@ public class RMID extends JavaVM { * policy file. */ public static RMID createRMID() { - return createRMID(System.out, System.err, true); - } - - public static RMID createRMID(boolean debugExec) { - return createRMID(System.out, System.err, debugExec); - } - - public static RMID createRMID(OutputStream out, OutputStream err) { - return createRMID(out, err, true); + return createRMID(System.out, System.err, true, true, + TestLibrary.getUnusedRandomPort()); } public static RMID createRMID(OutputStream out, OutputStream err, @@ -173,24 +171,24 @@ public class RMID extends JavaVM { /** - * Test RMID should be created with the createRMID method. + * Private constructor. RMID instances should be created + * using the static factory methods. */ - protected RMID(String classname, String options, String args, + private RMID(String classname, String options, String args, OutputStream out, OutputStream err, int port) { super(classname, options, args, out, err); this.port = port; } + /** + * Removes rmid's log file directory. + */ public static void removeLog() { - /* - * Remove previous log file directory before - * starting up rmid. - */ File f = new File(LOGDIR, log); if (f.exists()) { - mesg("removing rmid's old log file..."); + mesg("Removing rmid's old log file."); String[] files = f.list(); if (files != null) { @@ -199,8 +197,8 @@ public class RMID extends JavaVM { } } - if (f.delete() != true) { - mesg("\t" + " unable to delete old log file."); + if (! f.delete()) { + mesg("Warning: unable to delete old log file."); } } } @@ -215,14 +213,6 @@ public class RMID extends JavaVM { return TestLibrary.getExtraProperty("rmid.jcov.args",""); } - public void start() throws IOException { - start(10000); - } - - public void slowStart() throws IOException { - start(60000); - } - /** * Looks up the activation system in the registry on the given port, * returning its stub, or null if it's not present. This method differs from @@ -239,12 +229,24 @@ public class RMID extends JavaVM { } } + /** + * Starts rmid and waits up to the default timeout period + * to confirm that it's running. + */ + public void start() throws IOException { + start(STARTTIME_MS); + } + + /** + * Starts rmid and waits up to the given timeout period + * to confirm that it's running. + */ public void start(long waitTime) throws IOException { // if rmid is already running, then the test will fail with // a well recognized exception (port already in use...). - mesg("starting rmid on port #" + port + "..."); + mesg("Starting rmid on port " + port + "."); super.start(); int slopFactor = 1; @@ -254,20 +256,17 @@ public class RMID extends JavaVM { } catch (NumberFormatException ignore) {} waitTime = waitTime * slopFactor; - // We check several times (as many as provides passed waitTime) to - // see if Rmid is currently running. Waiting steps last 100 msecs. - final long rmidStartSleepTime = 100; + // We check several times, for a maximum of waitTime, until we have + // verified that rmid is running. do { - // Sleeping for another rmidStartSleepTime time slice. try { - Thread.sleep(Math.min(waitTime, rmidStartSleepTime)); + Thread.sleep(Math.min(waitTime, POLLTIME_MS)); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); - mesg("Thread interrupted while checking for start of Activation System. Giving up check."); - mesg("Activation System state unknown"); + mesg("Interrupted while starting activation system, giving up."); return; } - waitTime -= rmidStartSleepTime; + waitTime -= POLLTIME_MS; // Checking if rmid is present if (lookupSystem(port) != null) { @@ -279,7 +278,7 @@ public class RMID extends JavaVM { * incorrect value. */ System.setProperty("java.rmi.activation.port", Integer.toString(port)); - mesg("finished starting rmid."); + mesg("Started successfully."); return; } else { if (waitTime > 0) { @@ -287,9 +286,15 @@ public class RMID extends JavaVM { } } } while (waitTime > 0); - TestLibrary.bomb("start rmid failed... giving up", null); + TestLibrary.bomb("Failed to start rmid, giving up.", null); } + /** + * Destroys rmid and restarts it. Note that this does NOT clean up + * the log file, because it stores information about restartable + * and activatable objects that must be carried over to the new + * rmid instance. + */ public void restart() throws IOException { destroy(); start(); @@ -298,30 +303,35 @@ public class RMID extends JavaVM { /** * Ask rmid to shutdown gracefully using a remote method call. * catch any errors that might occur from rmid not being present - * at time of shutdown invocation. - * - * Shutdown does not nullify possible references to the rmid - * process object (destroy does though). + * at time of shutdown invocation. If the remote call is + * successful, wait for the process to terminate. Return true + * if the process terminated, otherwise return false. */ - public static void shutdown(int port) { + private boolean shutdown() throws InterruptedException { + mesg("shutdown()"); + ActivationSystem system = lookupSystem(port); + if (system == null) { + mesg("lookupSystem() returned null"); + return false; + } try { - ActivationSystem system = lookupSystem(port); - - if (system == null) { - TestLibrary.bomb("reference to the activation system was null"); - } - + mesg("ActivationSystem.shutdown()"); system.shutdown(); - } catch (RemoteException re) { - mesg("shutting down the activation daemon failed"); } catch (Exception e) { - mesg("caught exception trying to shutdown rmid"); - mesg(e.getMessage()); + mesg("Caught exception from ActivationSystem.shutdown():"); e.printStackTrace(); } - mesg("testlibrary finished shutting down rmid"); + try { + waitFor(TIMEOUT_SHUTDOWN_MS); + mesg("Shutdown successful."); + return true; + } catch (TimeoutException ex) { + mesg("Shutdown timed out:"); + ex.printStackTrace(); + return false; + } } /** @@ -330,60 +340,46 @@ public class RMID extends JavaVM { * if rmid is a child process of the current VM. */ public void destroy() { - // attempt graceful shutdown of the activation system - shutdown(port); - - if (vm != null) { - try { - /* Waiting for distant RMID process to shutdown. - * Waiting is bounded at a hardcoded max of 60 secs (1 min). - * Waiting by steps of 200 msecs, thus at most 300 such attempts - * for termination of distant RMID process. If process is not - * known to be terminated properly after that time, - * we give up for a gracefull termination, and thus go for - * forcibly destroying the process. - */ - boolean vmEnded = false; - int waitingTrials = 0; - final int maxTrials = 300; - final long vmProcessEndWaitInterval = 200; - int vmExitValue; - do { - try { - Thread.sleep(vmProcessEndWaitInterval); - waitingTrials++; - vmExitValue = vm.exitValue(); - mesg("rmid exited on shutdown request"); - vmEnded = true; - } catch (IllegalThreadStateException illegal) { - mesg("RMID's process still not terminated after more than " + - (waitingTrials * vmProcessEndWaitInterval) + " milliseconds"); - } - } - while (!vmEnded && - (waitingTrials < maxTrials)); - - if (waitingTrials >= maxTrials) { - mesg("RMID's process still not terminated after more than " + - (waitingTrials * vmProcessEndWaitInterval) + " milliseconds." + - "Givinp up gracefull termination..."); - mesg("destroying RMID's process using Process.destroy()"); - super.destroy(); - } - - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - mesg("Thread interrupted while checking for termination of distant rmid vm. Giving up check."); - } catch (Exception e) { - mesg("caught unexpected exception trying to destroy rmid: " + - e.getMessage()); - e.printStackTrace(); - } - - // rmid will not restart if its process is not null - vm = null; + if (vm == null) { + throw new IllegalStateException("can't wait for RMID that isn't running"); } + + // First, attempt graceful shutdown of the activation system. + try { + if (! shutdown()) { + // Graceful shutdown failed, use Process.destroy(). + mesg("Destroying RMID process."); + vm.destroy(); + try { + waitFor(TIMEOUT_DESTROY_MS); + mesg("Destroy successful."); + } catch (TimeoutException ex) { + mesg("Destroy timed out, giving up."); + ex.printStackTrace(); + } + } + } catch (InterruptedException ie) { + mesg("Shutdown/destroy interrupted, giving up."); + ie.printStackTrace(); + Thread.currentThread().interrupt(); + return; + } + + vm = null; } - public int getPort() {return port;} + /** + * Shuts down rmid and then removes its log file. + */ + public void cleanup() { + destroy(); + RMID.removeLog(); + } + + /** + * Gets the port on which this rmid is listening. + */ + public int getPort() { + return port; + } } From 56d2ce25a92347fae09657b5e413c4c1513ac337 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Tue, 2 Dec 2014 15:12:40 +0100 Subject: [PATCH 147/159] 8065998: Avoid use of _ as a one-character identifier Reviewed-by: alanb, chegar, darcy --- jdk/test/java/io/readBytes/MemoryLeak.java | 2 +- .../lang/Class/TypeCheckMicroBenchmark.java | 4 +- .../java/lang/ProcessBuilder/Zombies.java | 6 +- .../java/lang/invoke/6998541/Test6998541.java | 74 +++++++++---------- jdk/test/java/util/EnumSet/BogusEnumSet.java | 2 +- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/jdk/test/java/io/readBytes/MemoryLeak.java b/jdk/test/java/io/readBytes/MemoryLeak.java index ab099b16956..a9dd8e61209 100644 --- a/jdk/test/java/io/readBytes/MemoryLeak.java +++ b/jdk/test/java/io/readBytes/MemoryLeak.java @@ -40,7 +40,7 @@ public class MemoryLeak { try { s.read(bytes); throw new Error("expected IOException"); - } catch (IOException _) { + } catch (IOException expected) { /* OK */ } catch (OutOfMemoryError oome) { System.out.printf("Got OutOfMemoryError, i=%d%n", i); diff --git a/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java b/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java index e406c4f3060..d82de6ed185 100644 --- a/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java +++ b/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java @@ -182,7 +182,7 @@ public class TypeCheckMicroBenchmark { for (int i = 0; i < iterations; i++) { for (Object x : list.toArray()) { try { a[0] = x; } - catch (ArrayStoreException _) { + catch (ArrayStoreException unused) { throw new ClassCastException(); }}}}}, new Job("write into dynamic array") { void work() { for (int i = 0; i < iterations; i++) { @@ -190,7 +190,7 @@ public class TypeCheckMicroBenchmark { Object[] a = (Object[]) java.lang.reflect.Array.newInstance(klazz, 1); try { a[0] = x; } - catch (ArrayStoreException _) { + catch (ArrayStoreException unused) { throw new ClassCastException(); }}}}} }; diff --git a/jdk/test/java/lang/ProcessBuilder/Zombies.java b/jdk/test/java/lang/ProcessBuilder/Zombies.java index f8c3b627dd8..c417b696c2b 100644 --- a/jdk/test/java/lang/ProcessBuilder/Zombies.java +++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java @@ -47,17 +47,17 @@ public class Zombies { try { rt.exec("no-such-file"); throw new Error("expected IOException not thrown"); - } catch (IOException _) {/* OK */} + } catch (IOException expected) {/* OK */} try { rt.exec("."); throw new Error("expected IOException not thrown"); - } catch (IOException _) {/* OK */} + } catch (IOException expected) {/* OK */} try { rt.exec(TrueCommand, null, new File("no-such-dir")); throw new Error("expected IOException not thrown"); - } catch (IOException _) {/* OK */} + } catch (IOException expected) {/* OK */} rt.exec(TrueCommand).waitFor(); diff --git a/jdk/test/java/lang/invoke/6998541/Test6998541.java b/jdk/test/java/lang/invoke/6998541/Test6998541.java index e9f467be3f4..59d9d45bffb 100644 --- a/jdk/test/java/lang/invoke/6998541/Test6998541.java +++ b/jdk/test/java/lang/invoke/6998541/Test6998541.java @@ -214,13 +214,13 @@ public class Test6998541 { } private static void boolean2prim_invalid(boolean x) throws Throwable { if (DO_CASTS) return; - try { byte y = (byte) mh_bz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> byte - try { char y = (char) mh_cz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> char - try { short y = (short) mh_sz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> short - try { int y = (int) mh_iz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> int - try { long y = (long) mh_jz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> long - try { float y = (float) mh_fz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> float - try { double y = (double) mh_dz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> double + try { byte y = (byte) mh_bz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> byte + try { char y = (char) mh_cz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> char + try { short y = (short) mh_sz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> short + try { int y = (int) mh_iz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> int + try { long y = (long) mh_jz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> long + try { float y = (float) mh_fz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> float + try { double y = (double) mh_dz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> double } private static MethodHandle mh_b(Class ret) { return mh(ret, byte.class); } @@ -248,8 +248,8 @@ public class Test6998541 { } private static void byte2prim_invalid(byte x) throws Throwable { if (DO_CASTS) return; - try { char y = (char) mh_cb.invokeExact(x); fail(); } catch (ClassCastException _) {} // byte -> char - try { boolean y = (boolean) mh_zb.invokeExact(x); fail(); } catch (ClassCastException _) {} // byte -> boolean + try { char y = (char) mh_cb.invokeExact(x); fail(); } catch (ClassCastException expected) {} // byte -> char + try { boolean y = (boolean) mh_zb.invokeExact(x); fail(); } catch (ClassCastException expected) {} // byte -> boolean } private static MethodHandle mh_c(Class ret) { return mh(ret, char.class); } @@ -277,9 +277,9 @@ public class Test6998541 { } private static void char2prim_invalid(char x) throws Throwable { if (DO_CASTS) return; - try { boolean y = (boolean) mh_zc.invokeExact(x); fail(); } catch (ClassCastException _) {} // char -> boolean - try { byte y = (byte) mh_bc.invokeExact(x); fail(); } catch (ClassCastException _) {} // char -> byte - try { short y = (short) mh_sc.invokeExact(x); fail(); } catch (ClassCastException _) {} // char -> short + try { boolean y = (boolean) mh_zc.invokeExact(x); fail(); } catch (ClassCastException expected) {} // char -> boolean + try { byte y = (byte) mh_bc.invokeExact(x); fail(); } catch (ClassCastException expected) {} // char -> byte + try { short y = (short) mh_sc.invokeExact(x); fail(); } catch (ClassCastException expected) {} // char -> short } private static MethodHandle mh_s(Class ret) { return mh(ret, short.class); } @@ -307,9 +307,9 @@ public class Test6998541 { } private static void short2prim_invalid(short x) throws Throwable { if (DO_CASTS) return; - try { boolean y = (boolean) mh_zs.invokeExact(x); fail(); } catch (ClassCastException _) {} // short -> boolean - try { byte y = (byte) mh_bs.invokeExact(x); fail(); } catch (ClassCastException _) {} // short -> byte - try { char y = (char) mh_cs.invokeExact(x); fail(); } catch (ClassCastException _) {} // short -> char + try { boolean y = (boolean) mh_zs.invokeExact(x); fail(); } catch (ClassCastException expected) {} // short -> boolean + try { byte y = (byte) mh_bs.invokeExact(x); fail(); } catch (ClassCastException expected) {} // short -> byte + try { char y = (char) mh_cs.invokeExact(x); fail(); } catch (ClassCastException expected) {} // short -> char } private static MethodHandle mh_i(Class ret) { return mh(ret, int.class); } @@ -337,10 +337,10 @@ public class Test6998541 { } private static void int2prim_invalid(int x) throws Throwable { if (DO_CASTS) return; - try { boolean y = (boolean) mh_zi.invokeExact(x); fail(); } catch (ClassCastException _) {} // int -> boolean - try { byte y = (byte) mh_bi.invokeExact(x); fail(); } catch (ClassCastException _) {} // int -> byte - try { char y = (char) mh_ci.invokeExact(x); fail(); } catch (ClassCastException _) {} // int -> char - try { short y = (short) mh_si.invokeExact(x); fail(); } catch (ClassCastException _) {} // int -> short + try { boolean y = (boolean) mh_zi.invokeExact(x); fail(); } catch (ClassCastException expected) {} // int -> boolean + try { byte y = (byte) mh_bi.invokeExact(x); fail(); } catch (ClassCastException expected) {} // int -> byte + try { char y = (char) mh_ci.invokeExact(x); fail(); } catch (ClassCastException expected) {} // int -> char + try { short y = (short) mh_si.invokeExact(x); fail(); } catch (ClassCastException expected) {} // int -> short } private static MethodHandle mh_j(Class ret) { return mh(ret, long.class); } @@ -368,11 +368,11 @@ public class Test6998541 { } private static void long2prim_invalid(long x) throws Throwable { if (DO_CASTS) return; - try { boolean y = (boolean) mh_zj.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> boolean - try { byte y = (byte) mh_bj.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> byte - try { char y = (char) mh_cj.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> char - try { short y = (short) mh_sj.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> short - try { int y = (int) mh_ij.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> int + try { boolean y = (boolean) mh_zj.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> boolean + try { byte y = (byte) mh_bj.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> byte + try { char y = (char) mh_cj.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> char + try { short y = (short) mh_sj.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> short + try { int y = (int) mh_ij.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> int } private static MethodHandle mh_f(Class ret) { return mh(ret, float.class); } @@ -400,12 +400,12 @@ public class Test6998541 { } private static void float2prim_invalid(float x) throws Throwable { if (DO_CASTS) return; - try { boolean y = (boolean) mh_zf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> boolean - try { byte y = (byte) mh_bf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> byte - try { char y = (char) mh_cf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> char - try { short y = (short) mh_sf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> short - try { int y = (int) mh_if.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> int - try { long y = (long) mh_jf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> long + try { boolean y = (boolean) mh_zf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> boolean + try { byte y = (byte) mh_bf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> byte + try { char y = (char) mh_cf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> char + try { short y = (short) mh_sf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> short + try { int y = (int) mh_if.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> int + try { long y = (long) mh_jf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> long } private static MethodHandle mh_d(Class ret) { return mh(ret, double.class); } @@ -433,13 +433,13 @@ public class Test6998541 { } private static void double2prim_invalid(double x) throws Throwable { if (DO_CASTS) return; - try { boolean y = (boolean) mh_zd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> boolean - try { byte y = (byte) mh_bd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> byte - try { char y = (char) mh_cd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> char - try { short y = (short) mh_sd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> short - try { int y = (int) mh_id.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> int - try { long y = (long) mh_jd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> long - try { float y = (float) mh_fd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> float + try { boolean y = (boolean) mh_zd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> boolean + try { byte y = (byte) mh_bd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> byte + try { char y = (char) mh_cd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> char + try { short y = (short) mh_sd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> short + try { int y = (int) mh_id.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> int + try { long y = (long) mh_jd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> long + try { float y = (float) mh_fd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> float } private final static MethodHandle mh_zv = mh(boolean.class); diff --git a/jdk/test/java/util/EnumSet/BogusEnumSet.java b/jdk/test/java/util/EnumSet/BogusEnumSet.java index 1f52b90440a..9769cfebe2d 100644 --- a/jdk/test/java/util/EnumSet/BogusEnumSet.java +++ b/jdk/test/java/util/EnumSet/BogusEnumSet.java @@ -82,7 +82,7 @@ public class BogusEnumSet { System.out.println("Set size: " + es.size()); // 64 System.out.println("Set: " + es); // Throws IndexOutOfBoundsException throw new AssertionError("Expected exception InvalidObjectException not thrown"); - } catch (java.io.InvalidObjectException _) { /* OK */ } + } catch (java.io.InvalidObjectException expected) { /* OK */ } } private static Object deserialize(byte[] sf) throws Throwable { From 31af33c0e2b113578b3447ecd1f508f9185d71a4 Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Wed, 3 Dec 2014 11:38:56 +0100 Subject: [PATCH 148/159] 8065764: javax/management/monitor/CounterMonitorTest.java hangs Reviewed-by: jbachorik, dfuchs --- .../monitor/CounterMonitorTest.java | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/jdk/test/javax/management/monitor/CounterMonitorTest.java b/jdk/test/javax/management/monitor/CounterMonitorTest.java index 6c4ea1022e3..939f1ece0df 100644 --- a/jdk/test/javax/management/monitor/CounterMonitorTest.java +++ b/jdk/test/javax/management/monitor/CounterMonitorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -26,7 +26,7 @@ * @bug 4981829 * @summary Test that the counter monitor, when running in difference mode, * emits a notification every time the threshold is exceeded. - * @author Luis-Miguel Alventosa + * @author Luis-Miguel Alventosa, Shanliang JIANG * @run clean CounterMonitorTest * @run build CounterMonitorTest * @run main CounterMonitorTest @@ -50,23 +50,31 @@ public class CounterMonitorTest implements NotificationListener { private boolean notifyFlag = true; // granularity period - private int granularityperiod = 500; + private int granularityperiod = 10; - // counter values - private int[] values = new int[] {4, 6, 9, 11}; + // derived gauge + private volatile int derivedGauge = 2; // flag to notify that a message has been received private volatile boolean messageReceived = false; + private volatile Object observedValue = null; + // MBean class public class StdObservedObject implements StdObservedObjectMBean { public Object getNbObjects() { + echo(">>> StdObservedObject.getNbObjects: " + count); + synchronized(CounterMonitorTest.class) { + observedValue = count; + CounterMonitorTest.class.notifyAll(); + } return count; } public void setNbObjects(Object n) { + echo(">>> StdObservedObject.setNbObjects: " + n); count = n; } - private Object count= null; + private volatile Object count= null; } // MBean interface @@ -166,18 +174,18 @@ public class CounterMonitorTest implements NotificationListener { Attribute attrib = new Attribute("NbObjects", data); server.setAttribute(stdObsObjName, attrib); - // Wait for granularity period (multiplied by 2 for sure) - // - Thread.sleep(granularityperiod * 2); + waitObservation(data); // Loop through the values // - for (int i = 0; i < values.length; i++) { - data = new Integer(values[i]); - echo(">>> Set data = " + data.intValue()); + while (derivedGauge++ < 10) { + System.out.print(">>> Set data from " + data.intValue()); + data = new Integer(data.intValue() + derivedGauge); + echo(" to " + data.intValue()); attrib = new Attribute("NbObjects", data); server.setAttribute(stdObsObjName, attrib); + waitObservation(data); echo("\tdoWait in Counter Monitor"); doWait(); @@ -214,6 +222,20 @@ public class CounterMonitorTest implements NotificationListener { } } + private void waitObservation(Object value) { + synchronized (CounterMonitorTest.class) { + while (value != observedValue) { + try { + CounterMonitorTest.class.wait(); + } catch (InterruptedException e) { + System.err.println("Got unexpected exception: " + e); + e.printStackTrace(); + break; + } + } + } + } + /* * Print message */ From cec929efaf2cd44dcbd4f77842e87106293ebf6a Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Wed, 3 Dec 2014 12:00:26 +0100 Subject: [PATCH 149/159] 8066397: Remove network-related seed initialization code in ThreadLocal/SplittableRandom Reviewed-by: alanb, dl, chegar, rriggs, shade --- .../classes/java/util/SplittableRandom.java | 39 +++---------------- .../util/concurrent/ThreadLocalRandom.java | 31 +-------------- 2 files changed, 6 insertions(+), 64 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/SplittableRandom.java b/jdk/src/java.base/share/classes/java/util/SplittableRandom.java index 00de113a6f8..285655d40c9 100644 --- a/jdk/src/java.base/share/classes/java/util/SplittableRandom.java +++ b/jdk/src/java.base/share/classes/java/util/SplittableRandom.java @@ -25,7 +25,6 @@ package java.util; -import java.net.NetworkInterface; import java.util.concurrent.atomic.AtomicLong; import java.util.function.IntConsumer; import java.util.function.LongConsumer; @@ -140,11 +139,10 @@ public final class SplittableRandom { * other cases, this split must be performed in a thread-safe * manner, so we use an AtomicLong to represent the seed rather * than use an explicit SplittableRandom. To bootstrap the - * defaultGen, we start off using a seed based on current time and - * network interface address unless the java.util.secureRandomSeed - * property is set. This serves as a slimmed-down (and insecure) - * variant of SecureRandom that also avoids stalls that may occur - * when using /dev/random. + * defaultGen, we start off using a seed based on current time + * unless the java.util.secureRandomSeed property is set. This + * serves as a slimmed-down (and insecure) variant of SecureRandom + * that also avoids stalls that may occur when using /dev/random. * * It is a relatively simple matter to apply the basic design here * to use 128 bit seeds. However, emulating 128bit arithmetic and @@ -237,34 +235,7 @@ public final class SplittableRandom { s = (s << 8) | ((long)(seedBytes[i]) & 0xffL); return s; } - long h = 0L; - try { - Enumeration ifcs = - NetworkInterface.getNetworkInterfaces(); - boolean retry = false; // retry once if getHardwareAddress is null - while (ifcs.hasMoreElements()) { - NetworkInterface ifc = ifcs.nextElement(); - if (!ifc.isVirtual()) { // skip fake addresses - byte[] bs = ifc.getHardwareAddress(); - if (bs != null) { - int n = bs.length; - int m = Math.min(n >>> 1, 4); - for (int i = 0; i < m; ++i) - h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i]; - if (m < 4) - h = (h << 8) ^ bs[n-1-m]; - h = mix64(h); - break; - } - else if (!retry) - retry = true; - else - break; - } - } - } catch (Exception ignore) { - } - return (h ^ mix64(System.currentTimeMillis()) ^ + return (mix64(System.currentTimeMillis()) ^ mix64(System.nanoTime())); } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java index 2606bed44be..95cc6549b9f 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java @@ -36,8 +36,6 @@ package java.util.concurrent; import java.io.ObjectStreamField; -import java.net.NetworkInterface; -import java.util.Enumeration; import java.util.Random; import java.util.Spliterator; import java.util.concurrent.atomic.AtomicInteger; @@ -147,34 +145,7 @@ public class ThreadLocalRandom extends Random { s = (s << 8) | ((long)(seedBytes[i]) & 0xffL); return s; } - long h = 0L; - try { - Enumeration ifcs = - NetworkInterface.getNetworkInterfaces(); - boolean retry = false; // retry once if getHardwareAddress is null - while (ifcs.hasMoreElements()) { - NetworkInterface ifc = ifcs.nextElement(); - if (!ifc.isVirtual()) { // skip fake addresses - byte[] bs = ifc.getHardwareAddress(); - if (bs != null) { - int n = bs.length; - int m = Math.min(n >>> 1, 4); - for (int i = 0; i < m; ++i) - h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i]; - if (m < 4) - h = (h << 8) ^ bs[n-1-m]; - h = mix64(h); - break; - } - else if (!retry) - retry = true; - else - break; - } - } - } catch (Exception ignore) { - } - return (h ^ mix64(System.currentTimeMillis()) ^ + return (mix64(System.currentTimeMillis()) ^ mix64(System.nanoTime())); } From 65904e6ad16ec9506782b6f0e6cad08b7f21c629 Mon Sep 17 00:00:00 2001 From: Amy Lu Date: Wed, 3 Dec 2014 14:34:42 +0000 Subject: [PATCH 150/159] 8066131: Update java/nio/charset/Charset/NIOCharsetAvailabilityTest.java to eliminate dependency on sun.misc.Launcher Reviewed-by: alanb --- .../Charset/NIOCharsetAvailabilityTest.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java b/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java index 1e505712cda..a00cd804818 100644 --- a/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java +++ b/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java @@ -31,10 +31,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; import java.nio.charset.Charset; import java.security.AccessController; import java.security.PrivilegedAction; @@ -45,7 +41,6 @@ import java.util.Set; import java.util.Vector; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import sun.misc.Launcher; public class NIOCharsetAvailabilityTest { @@ -111,18 +106,6 @@ public class NIOCharsetAvailabilityTest { classPathSegments.insertElementAt(dir, 0); } - // add extensions from the extension class loader - ClassLoader appLoader = Launcher.getLauncher().getClassLoader(); - URLClassLoader extLoader = (URLClassLoader) appLoader.getParent(); - URL[] urls = extLoader.getURLs(); - for (int i = 0; i < urls.length; i++) { - try { - URI uri = new URI(urls[i].toString()); - classPathSegments.insertElementAt(uri.getPath(), 0); - } catch (URISyntaxException e) { - } - } - String[] classList = (String[]) java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { From dacb5a70f8f10ff3aa5ec2ce3d2c67c53d5e52f9 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Wed, 3 Dec 2014 19:49:59 +0000 Subject: [PATCH 151/159] 8066588: javax/management/remote/mandatory/connection/RMIConnector_NPETest.java fails to compile Reviewed-by: alanb, smarks --- .../remote/mandatory/connection/RMIConnector_NPETest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java index 1e246514dcd..c672296c11d 100644 --- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java +++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java @@ -61,7 +61,7 @@ public class RMIConnector_NPETest { // ignore } } - rmid.shutdown(rmidPort); + rmid.destroy(); } if (failureCause != null) { @@ -69,4 +69,4 @@ public class RMIConnector_NPETest { } } -} \ No newline at end of file +} From 7e500d532492437658e6736d6279809f3fa40406 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Wed, 3 Dec 2014 16:50:55 -0500 Subject: [PATCH 152/159] 8060068: Possible Deadlock scenario with DriverManager.loadInitialDrivers Reviewed-by: mchung, smarks, ulfzibis --- .../share/classes/java/sql/DriverManager.java | 79 +++++++++++-------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java index a9190a4851e..bd24b3dfbb1 100644 --- a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java +++ b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java @@ -29,6 +29,7 @@ import java.util.Iterator; import java.util.ServiceLoader; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.PropertyPermission; import java.util.concurrent.CopyOnWriteArrayList; import sun.reflect.CallerSensitive; import sun.reflect.Reflection; @@ -87,21 +88,13 @@ public class DriverManager { private static volatile java.io.PrintWriter logWriter = null; private static volatile java.io.PrintStream logStream = null; // Used in println() to synchronize logWriter - private final static Object logSync = new Object(); + private final static Object logSync = new Object(); + private static volatile boolean driversInitialized; + private static final String JDBC_DRIVERS_PROPERTY = "jdbc.drivers"; /* Prevent the DriverManager class from being instantiated. */ private DriverManager(){} - - /** - * Load the initial JDBC drivers by checking the System property - * jdbc.properties and then use the {@code ServiceLoader} mechanism - */ - static { - loadInitialDrivers(); - println("JDBC DriverManager initialized"); - } - /** * The SQLPermission constant that allows the * setting of the logging stream. @@ -291,12 +284,12 @@ public class DriverManager { // Walk through the loaded registeredDrivers attempting to locate someone // who understands the given URL. - for (DriverInfo aDriver : registeredDrivers) { + for (DriverInfo aDriver : getRegisteredDrivers()) { // If the caller does not have permission to load the driver then // skip it. - if(isDriverAllowed(aDriver.driver, callerClass)) { + if (isDriverAllowed(aDriver.driver, callerClass)) { try { - if(aDriver.driver.acceptsURL(url)) { + if (aDriver.driver.acceptsURL(url)) { // Success! println("getDriver returning " + aDriver.driver.getClass().getName()); return (aDriver.driver); @@ -328,7 +321,7 @@ public class DriverManager { * @exception SQLException if a database access error occurs * @exception NullPointerException if {@code driver} is null */ - public static synchronized void registerDriver(java.sql.Driver driver) + public static void registerDriver(java.sql.Driver driver) throws SQLException { registerDriver(driver, null); @@ -349,12 +342,12 @@ public class DriverManager { * @exception NullPointerException if {@code driver} is null * @since 1.8 */ - public static synchronized void registerDriver(java.sql.Driver driver, + public static void registerDriver(java.sql.Driver driver, DriverAction da) throws SQLException { /* Register the driver if it has not already been added to our list */ - if(driver != null) { + if (driver != null) { registeredDrivers.addIfAbsent(new DriverInfo(driver, da)); } else { // This is for compatibility with the original DriverManager @@ -405,12 +398,12 @@ public class DriverManager { println("DriverManager.deregisterDriver: " + driver); DriverInfo aDriver = new DriverInfo(driver, null); - if(registeredDrivers.contains(aDriver)) { + if (registeredDrivers.contains(aDriver)) { if (isDriverAllowed(driver, Reflection.getCallerClass())) { DriverInfo di = registeredDrivers.get(registeredDrivers.indexOf(aDriver)); // If a DriverAction was specified, Call it to notify the // driver that it has been deregistered - if(di.action() != null) { + if (di.action() != null) { di.action().deregister(); } registeredDrivers.remove(aDriver); @@ -440,10 +433,10 @@ public class DriverManager { Class callerClass = Reflection.getCallerClass(); // Walk through the loaded registeredDrivers. - for(DriverInfo aDriver : registeredDrivers) { + for (DriverInfo aDriver : getRegisteredDrivers()) { // If the caller does not have permission to load the driver then // skip it. - if(isDriverAllowed(aDriver.driver, callerClass)) { + if (isDriverAllowed(aDriver.driver, callerClass)) { result.addElement(aDriver.driver); } else { println(" skipping: " + aDriver.getClass().getName()); @@ -550,7 +543,7 @@ public class DriverManager { private static boolean isDriverAllowed(Driver driver, ClassLoader classLoader) { boolean result = false; - if(driver != null) { + if (driver != null) { Class aClass = null; try { aClass = Class.forName(driver.getClass().getName(), true, classLoader); @@ -564,12 +557,34 @@ public class DriverManager { return result; } - private static void loadInitialDrivers() { + /* + * Return the registered java.sql.Drivers and call loadInitialDrivers + * if needed + */ + private static CopyOnWriteArrayList getRegisteredDrivers() { + // Check to see if we need to load the initial drivers + if (!driversInitialized) { + loadInitialDrivers(); + } + return registeredDrivers; + + } + + /* + * Load the initial JDBC drivers by checking the System property + * jdbc.properties and then use the {@code ServiceLoader} mechanism + */ + private synchronized static void loadInitialDrivers() { String drivers; + + if (driversInitialized) { + return; + } + try { drivers = AccessController.doPrivileged(new PrivilegedAction() { public String run() { - return System.getProperty("jdbc.drivers"); + return System.getProperty(JDBC_DRIVERS_PROPERTY); } }); } catch (Exception ex) { @@ -625,6 +640,9 @@ public class DriverManager { println("DriverManager.Initialize: load failed: " + ex); } } + + driversInitialized = true; + println("JDBC DriverManager initialized"); } @@ -638,14 +656,11 @@ public class DriverManager { * can be loaded from here. */ ClassLoader callerCL = caller != null ? caller.getClassLoader() : null; - synchronized(DriverManager.class) { - // synchronize loading of the correct classloader. - if (callerCL == null) { - callerCL = Thread.currentThread().getContextClassLoader(); - } + if (callerCL == null) { + callerCL = Thread.currentThread().getContextClassLoader(); } - if(url == null) { + if (url == null) { throw new SQLException("The url cannot be null", "08001"); } @@ -655,10 +670,10 @@ public class DriverManager { // Remember the first exception that gets raised so we can reraise it. SQLException reason = null; - for(DriverInfo aDriver : registeredDrivers) { + for (DriverInfo aDriver : getRegisteredDrivers()) { // If the caller does not have permission to load the driver then // skip it. - if(isDriverAllowed(aDriver.driver, callerCL)) { + if (isDriverAllowed(aDriver.driver, callerCL)) { try { println(" trying " + aDriver.driver.getClass().getName()); Connection con = aDriver.driver.connect(url, info); From bf31fc249e2680f6bdc26a070d911a3961a99ad6 Mon Sep 17 00:00:00 2001 From: Zaiyao Liu Date: Thu, 4 Dec 2014 16:50:31 +0800 Subject: [PATCH 153/159] 8048619: Implement tests for converting PKCS12 keystores Reviewed-by: weijun --- .../KeyStore/PKCS12/ConvertP12Test.java | 234 ++++++++++++++++++ .../certs/convertP12/ie_jceks_chain.pfx.data | 61 +++++ .../certs/convertP12/ie_jks_chain.pfx.data | 61 +++++ .../convertP12/jdk_jceks_selfsigned.p12.data | 30 +++ .../convertP12/jdk_jceks_twoentry.p12.data | 69 ++++++ .../convertP12/jdk_jceks_twopass.p12.data | 45 ++++ .../convertP12/jdk_jks_selfsigned.p12.data | 45 ++++ .../convertP12/jdk_jks_twoentry.p12.data | 69 ++++++ .../certs/convertP12/jdk_jks_twopass.p12.data | 45 ++++ .../certs/convertP12/keystoreCA.jceks.data | 38 +++ 10 files changed, 697 insertions(+) create mode 100644 jdk/test/java/security/KeyStore/PKCS12/ConvertP12Test.java create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jceks_chain.pfx.data create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jks_chain.pfx.data create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_selfsigned.p12.data create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twoentry.p12.data create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twopass.p12.data create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_selfsigned.p12.data create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twoentry.p12.data create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twopass.p12.data create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/keystoreCA.jceks.data diff --git a/jdk/test/java/security/KeyStore/PKCS12/ConvertP12Test.java b/jdk/test/java/security/KeyStore/PKCS12/ConvertP12Test.java new file mode 100644 index 00000000000..f5334bff710 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/ConvertP12Test.java @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2008, 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. + */ + +import static java.lang.System.out; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.Key; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.Certificate; +import java.util.Arrays; +import java.util.Base64; +import java.util.Enumeration; + +/* + * @test + * @bug 8048619 + * @author Bill Situ + * @summary Test converting keystore from jceks to P12 and from P12 to other + * (jceks,jks). including following test cases: + * Read jceks key store and convert to the p12 key store, then compare entries + * in the two key stores. + * Read p12 key store and convert to the jceks key store, then compare entries + * in the two key stores. + * Read p12 key store (contains only private key and a self-signed certificate) + * and convert to the jceks key store, then compare entries of two key stores. + * Read p12 key store (contains 2 entries) and convert to the jceks key store, + * then compare entries in the two key stores. + * Read p12 key store (entry password and key store password are different) and + * convert to the jceks key store, then compare entries in the two key stores. + * Read p12 key store and convert to the jks key store, then compare entries + * in the two key stores. + * Read p12 key store (contains only private key and a self-signed certificate) + * and convert to the jks key store, then compare entries in the two key stores. + * Read p12 key store (contains 2 entries) and convert to the jks key store, + * then compare entries in the two key stores. + * Read p12 key store (entry password and key store password are different) and + * convert to the jks key store, then compare entries in the two key stores. + */ + +public class ConvertP12Test { + + private static final String SUN_JSSE = "SunJSSE"; + private static final String SUN_JCE = "SunJCE"; + private static final String SUN = "SUN"; + private static final String PKCS12 = "pkcs12"; + private static final String JCE_KS = "JceKS"; + private static final String JKS = "JKS"; + + public static void main(String args[]) throws Exception { + + ConvertP12Test jstest = new ConvertP12Test(); + + jstest.driver("JceksToP12", "keystoreCA.jceks.data", JCE_KS, SUN_JCE, + "storepass", "keypass", PKCS12, SUN_JSSE); + + jstest.driver("P12ToJceks_Chain", "ie_jceks_chain.pfx.data", PKCS12, + SUN_JSSE, "pass", "pass", JCE_KS, SUN_JCE); + + jstest.driver("P12ToJceks_SelfSigned", "jdk_jceks_selfsigned.p12.data", + PKCS12, SUN_JSSE, "pass", "pass", JCE_KS, SUN_JCE); + + jstest.driver("P12ToJceks_TwoEntry", "jdk_jceks_twoentry.p12.data", + PKCS12, SUN_JSSE, "pass", "pass", JCE_KS, SUN_JCE); + + jstest.driver("P12ToJceks_TwoPass", "jdk_jceks_twopass.p12.data", + PKCS12, SUN_JSSE, "storepass", "keypass", JCE_KS, SUN_JCE); + + jstest.driver("P12ToJks_Chain", "ie_jks_chain.pfx.data", PKCS12, + SUN_JSSE, "pass", "pass", JKS, SUN); + + jstest.driver("P12ToJks_SelfSigned", "jdk_jks_selfsigned.p12.data", + PKCS12, SUN_JSSE, "pass", "pass", JKS, SUN); + + jstest.driver("P12ToJks_TwoEntry", "jdk_jks_twoentry.p12.data", PKCS12, + SUN_JSSE, "pass", "pass", JKS, SUN); + + jstest.driver("P12ToJks_TwoPass", "jdk_jks_twopass.p12.data", PKCS12, + SUN_JSSE, "storepass", "keypass", JKS, SUN); + + } + + private void driver(String testCase, String inKeyStore, + String inKeyStoreType, String inKeyStoreTypePrv, + String inStorePass, String inKeyPass, String outKeyStoreType, + String outKeyStorePrv) throws Exception { + + String outStorePass = "pass"; + String outKeyPass = "pass"; + KeyStore inputKeyStore, outputKeyStore; + + out.println("Testing " + testCase); + String keystorePath = System.getProperty("test.src", ".") + + File.separator + "certs" + File.separator + "convertP12"; + out.println("Output KeyStore : " + inKeyStore + ".out"); + String outKeyStoreName = inKeyStore + ".out"; + try (FileOutputStream fout = new FileOutputStream(outKeyStoreName);) { + inputKeyStore = KeyStore.getInstance(inKeyStoreType, + inKeyStoreTypePrv); + + // KeyStore have encoded by Base64.getMimeEncoder().encode(),need + // decode first. + byte[] input = Files.readAllBytes(Paths.get(keystorePath, + inKeyStore)); + ByteArrayInputStream arrayIn = new ByteArrayInputStream(Base64 + .getMimeDecoder().decode(input)); + + out.println("Input KeyStore : " + inKeyStore); + + inputKeyStore.load(arrayIn, inStorePass.toCharArray()); + + outputKeyStore = KeyStore.getInstance(outKeyStoreType, + outKeyStorePrv); + outputKeyStore.load(null, null); + + run(inputKeyStore, outputKeyStore, inKeyPass, outKeyPass); + + outputKeyStore.store(fout, outStorePass.toCharArray()); + + // for P12ToJks_TwoEntry test case will test includes each other, + // others just test compareKeystore + if (testCase.contains("TwoEntry")) { + + compareKeyStore(inputKeyStore, outputKeyStore, inKeyPass, + outKeyPass, 2); + compareKeyStore(outputKeyStore, inputKeyStore, outKeyPass, + inKeyPass, 2); + } else { + compareKeyStore(inputKeyStore, outputKeyStore, inKeyPass, + outKeyPass, 1); + } + out.println("Test " + testCase + " STATUS: Pass!!"); + } catch (Exception ex) { + out.println("Test " + testCase + " STATUS: failed with exception: " + + ex.getMessage()); + throw ex; + } + } + + private void run(KeyStore inputKeyStore, KeyStore outputKeyStore, + String inKeyPass, String outKeyPass) throws Exception { + Enumeration e = inputKeyStore.aliases(); + String alias; + while (e.hasMoreElements()) { + alias = e.nextElement(); + Certificate[] certs = inputKeyStore.getCertificateChain(alias); + + boolean isCertEntry = inputKeyStore.isCertificateEntry(alias); + // Test KeyStore only contain key pair entries. + if (isCertEntry == true) { + throw new RuntimeException( + "inputKeystore should not be certEntry because test" + + " keystore only contain key pair entries" + + " for alias:" + alias); + } + + boolean isKeyEntry = inputKeyStore.isKeyEntry(alias); + Key key = null; + if (isKeyEntry) { + key = inputKeyStore.getKey(alias, inKeyPass.toCharArray()); + } else { + throw new RuntimeException("Entry type unknown for alias:" + + alias); + } + outputKeyStore.setKeyEntry(alias, key, outKeyPass.toCharArray(), + certs); + } + } + + private void compareKeyStore(KeyStore a, KeyStore b, String inKeyPass, + String outKeyPass, int keyStoreSize) throws Exception { + if (a.size() != keyStoreSize || b.size() != keyStoreSize) { + throw new RuntimeException("size not match or size not equal to " + + keyStoreSize); + } + + Enumeration eA = a.aliases(); + while (eA.hasMoreElements()) { + String aliasA = eA.nextElement(); + + if (!b.containsAlias(aliasA)) { + throw new RuntimeException("alias not match for alias:" + + aliasA); + } + + compareKeyEntry(a, b, inKeyPass, outKeyPass, aliasA); + } + } + + private void compareKeyEntry(KeyStore a, KeyStore b, String aPass, + String bPass, String alias) throws KeyStoreException, + UnrecoverableKeyException, NoSuchAlgorithmException { + Certificate[] certsA = a.getCertificateChain(alias); + Certificate[] certsB = b.getCertificateChain(alias); + + if (!Arrays.equals(certsA, certsB)) { + throw new RuntimeException("Certs don't match for alias:" + alias); + } + + Key keyA = a.getKey(alias, aPass.toCharArray()); + Key keyB = b.getKey(alias, bPass.toCharArray()); + + if (!keyA.equals(keyB)) { + throw new RuntimeException( + "Key don't match for alias:" + alias); + } + } +} diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jceks_chain.pfx.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jceks_chain.pfx.data new file mode 100644 index 00000000000..3dbe7e4fcb3 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jceks_chain.pfx.data @@ -0,0 +1,61 @@ +MIINXgIBAzCCDRoGCSqGSIb3DQEHAaCCDQsEgg0HMIINAzCCA7wGCSqGSIb3DQEHAaCCA60EggOp +MIIDpTCCA6EGCyqGSIb3DQEMCgECoIICtjCCArIwHAYKKoZIhvcNAQwBAzAOBAipOP0AVsizDgIC +B9AEggKQIP/YI9/C2WYbIWxKuqXMD8WPCvqj1fhHmZJ0epCzgEdOR7GT/h2Fy4/wxrthPkj4JqkS +akQog3pjOFtj9D8QtkOw/b761qsyj17TYlQS9C6qVhcddMA+Ca2NcDhKlYofQMNTuYPXkXlpCh5R +CNFgQ+PLVZwNZjqoitjv0RLQqBudhTmJSvfDlW2w+CpbziEeRNzn0pX0/Ts7KxykDscOmUCGHKic +b6FqHoioElcmBp7ae3zdXuvI1x/1Y435qju2yODPpMXEZbdsD5iL07RZyL2vm6lfQbLc37TszDBx +ZZJ7ja5F4V/j/6/AVLkcqfZxFOnXz5Ki9rQblYJbkkTpJAyiNqi8Gx+zgPGtLWvV6KRD0zmxo6q/ +OmdjKz4v9aG7MDSXenoy6tPAOvAQcQYaksvFZs1FjorJJpFzasfTUfy94JzrHUzRSPzNRDANHG/6 +TgxC1FMNw+iQUY9L8j4xrWsr2JN5tAgYcWz1qZrp4cx0he9cbQeqYcjv7ZvIQbIe2zxdvxh7WByy +r8hNMe3RkMOM2yuP85JuWipq+9jt4/CrimKljN1ULPw+V9FZzY8kKcEiSPD+KXdJNkrMr77/lUJz +PGNYpFBFb4natmi31ZBH2VomTeKPpeanN/ghWojft1mGd1s1nD4NelrWATMVquH2Cq6nhKLRHi4c +KbQsMo+ftLvkDHHtpYenjGHbwEFfowkwn9slsZqmPEATV6caHNITCBbhQmvvhqPDPPViV+u1M1c7 +vwf/ol7IjBlubwzBJAg6f5GW0tMNHxfg5E7O27AyREyvexk0IVakzIwUuP2anPTjPW0vyeePLtiG +TXNoUe+5UIzpshnLmSlerhVGoB+HBM1yoaaJHay7sdyQbVUxgdcwEwYJKoZIhvcNAQkVMQYEBAEA +AAAwWwYJKoZIhvcNAQkUMU4eTAB7ADcAMQA5AEIAQgA4ADkANAAtADMANQA2ADEALQA0AEMAMAA0 +AC0AOQBCADIAMAAtADMAOQBCAEMARAAzADQANwAzADUAMQAwAH0wYwYJKwYBBAGCNxEBMVYeVABN +AGkAYwByAG8AcwBvAGYAdAAgAEIAYQBzAGUAIABDAHIAeQBwAHQAbwBnAHIAYQBwAGgAaQBjACAA +UAByAG8AdgBpAGQAZQByACAAdgAxAC4AMDCCCT8GCSqGSIb3DQEHBqCCCTAwggksAgEAMIIJJQYJ +KoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIEmpyonjQeMACAgfQgIII+Pr+GLKaSN1U1soCnWsw +4kRoDxPPLNbzv/K+lsbGVk9vXjv5aBTi55FMCXvA5kGvdnQYrQ1KfIZmFVh3PnFQn/J6LVrpLbHC +/D27wvnOMausJA7uJi6wgkUCkQmXn7kesWhr+bBI9Ci7uyOUxdY53Yg43OQtZbWvQjGe6GiVRqWm +8NANuZ3c1IT2TmJw5xfvvE4tcHK0d75ApvTa43CkKmUY5A4SyNY4SUVdl9Cx50LEHcqGwV+uVGzy +kdO0+bgXI66FPKriuqPfayeTmL8T9PimwhOfY38OqtTKHwJ7E817i/B8ULpkRO67uYYJpeK4cIz1 +0rDW/JPG8BqN47Rej8rCpmY1F4hOuFzYA3PAh50YlI2wD2vSSqVPMUe/AtsL+u2Nxl/EidWp/8EL +l8rBgYJjSl+YjSRV22C/ZwDu/8oV3LeCuwL2SaO1r1tww3WuRAFcCctsemP84YI27Q8Z54P6wM8c +kjYH9F3oT9bHUAfJUm2d6d3wd+iGbrrxdkLrD5tEQB16K8RAbhPPfrM5rcRlh+Zvn068H/Kc9rEa +sfJD7ygUBZJ5MSsr4zP4koMZ0xjxAaXRUsURsF13772XL3zfTCVd5fV3wIpJsoXugZTOQ6hjAmeN +yGMZDn14GyxvwLbGFB0Yx8GAIRDxBvDXkYOqEMocmNwZo+uxPew1H4PMkWMm/yh4Y4V/H9Jmyd3v +aD2BWVyx7PIJ4cet3RdydHrKSNVBzwrO+y5HKZc7V7aRM0kZgdAJh9eDTlYk6B+ZHd1EawYRlIfl +f4JydqRkRaya7FOfQ3mLgrz6bdde720XZVWqe9bbsBucbYAJsYvklYYYutnsx1Ri9UYYAbRDy920 +Z6iO1EGF5wcUc0nifXObYJ2x0ldlQskUdThPjZBl2Mk4F9oxS6W5j2llm1hS/vGnFtykQ5NMaxzi +Jkhi1Mjm/KZJUo2xJai1gtHwBOnlocXZYqJQECabBayA7rLH3pFUhU/Wqkycz4m8dUVXLNHiMIEd +3sc0QASMF56kqXtzph2zbXBbCD8afyt8WjMzZvO4lEGNM8xi/7C6h45QsdGZgqkHrYBJbSHfrU05 +ZvNpV8YcfhkzX6gNtZU5XDDBPgkYn41sEt3aVRHvRAqc+uhczQ8svVhPUsriWnKk2bfw8iAn1xex +5huB52uVPRfuL7wJxyV1Rk8WhK10xCzFDnJtRUAJ6UtuezrMOh28NPULQnLIx1kF00+uflY5vAHM +rAf92+NqORZUflKVidqHYmF7bdeNGw3qshaK/0+3grs6rQeQAvxiTdmG+sBP9poBIeeHo2OzcACB +wTuerZiYlzL7mAUegdiPD+wOa2yfGF+WG2vM9npO+a1ZWsoWceAxpLOyubBVfLyc7lfCo7ma70Vd +Kl/o7VevEqLIz5ZkaCoupWk7nDKDMG73vGXqJwaYjd8teOw66aELd2WI4cAoFTvPayxMKHD8hf4n +78riWe2XomUzafZLoMhj5vfYsiwwL3F5O/KUtTOXNNDDVuAwByiCfN65LIjU/Dhn8t6Izkox/Tnl +9kPqNxqJAxFtARCFo9Xpgba761dTBmUF9J+Krg6B53NEv+0qvJY3w1H8Fnop9S+eEs6/4qUMmgO4 +wrm3aEaLY4XWGejuxUEQ9+3/cxK1YTJIpBeK8Q1/yPgj2mq62RRGcyDPEMbcbFcsI4MKlGggcpHV +H8hv1XPLbrMi56lax3dB/EkJzJ+5IEnYd0NkXclyQm4d7KUy6LG5I2Quwt0J50dxbqmfR0gWwGsY +nsT4Kk71NiUyU9AWl46EOZIzONN4Vnm0qq3oNJ5e8VpKTb2g80m5ouw+tPiDA/IA3Vu3VKLT589j +5IQrNYhrizZnEApqPAQwBiN6D+0BLgsNeQDUn56emMj1ETDgfjukqAQjlGUvAr/VV/+eFHvkqwJU +Hy6Xzd36Cq4/sYKYVU7OFzh6Ts9gCvblZxbFI1yNimEvwZ/bINKAemQLoji3s1UIs5X+BYqKZpI5 +nZsjbIHLafNjfPoMKUlpQa27jFc4s4GQ9WLBDRnVIuzqpdmdslxc2Q+dwzbT+zFoAAe5VzA+ABxv +cjPYCBVpys4hYH1p3uwUq/hKkR7QgPE2c25qIHl+6VVS9dgaQ4XnHtVZjFzDk8u5YNenHx8E3lx4 +Ebe3mNjsM51X16ERkGC7X+w4Ko89wvb7jnnOheC0W5ICZQgphdasjff259yEJuhfk62r6bhZH2Um +2IkUACGxKaEzh55Z5P2rcaSjAwIeWnLHDCPSOJ819/4XQEtPfbZs9eymDwNOg13kZhadSQF8+zht +0Tko/9k41bNaT2ZqogskrIF9oltpofddqOa5IcE2d13T2IuDkV8/whV87P8Dg6fmFYpFCHN7zsks +X+IHrRIt7gILXPwecu2LfUZxdH/Cr5WbfMzTnsWWSB7/Z9MLrlEISHM4zC7DlkbRSD7LyXyI4weh +HNelf0uLtYRhXku5BkJUyysIYDpSHHxsMJ04Th+RZ7s8seoLBeAn7gbsj3B/JUOxIaEx8+W3bjb1 +wq6cc+KqLnvcO2BDvH30PfeQo7YjTNr4wcEoUFZXwhTL5owVc4GKtlfl/YxBXs2E6r6l43svlay6 +vCq58xTvWzzRtzvb6oh6qnoMP2xc8YTdpKma64TBmnFOVE/eGXZxVyk19TXwrokqUliutqhM6acv +x87+Yru+uXTbUpMA0MuW0Ch6uvcwxmM1hq5vHDVBTAfGuXsdQMapKoqseFUfza7N2eSgU8oaJCGQ +rmhvDn+MNzh2VyLOnPBwJ+sUnHM7XOnz/rCD99uRhhssEwZ5Xij+FG3EeTYyntGp6Z7ODIazLHM8 +81QtQDrJg2EDJ5RZHHrPbyUQDCkGpLZNOOoJkAD7I0VZRC3jJb8lTMXdKQjCd39F842+FXTSvOv9 +lmEOFH4AEyI6CokzFQCD0TXhTaG9wtzaE2q41eEKF45J5vyQxrNabZXeovNIVZryK+N8ep28M084 +vXp7uJm0bg5NunK6vTIqsxenQZWvXay8EwYLbAm8crDxK5sbW4tZtNeVxPE6ekCbifdxdgm0671w +rt4wOzAfMAcGBSsOAwIaBBT1C0A3jyKtjUTFASRSO852mKBZQQQUqy721AxhZ26s5Tsue4OHTjEB +CxwCAgfQ \ No newline at end of file diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jks_chain.pfx.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jks_chain.pfx.data new file mode 100644 index 00000000000..3dbe7e4fcb3 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jks_chain.pfx.data @@ -0,0 +1,61 @@ +MIINXgIBAzCCDRoGCSqGSIb3DQEHAaCCDQsEgg0HMIINAzCCA7wGCSqGSIb3DQEHAaCCA60EggOp +MIIDpTCCA6EGCyqGSIb3DQEMCgECoIICtjCCArIwHAYKKoZIhvcNAQwBAzAOBAipOP0AVsizDgIC +B9AEggKQIP/YI9/C2WYbIWxKuqXMD8WPCvqj1fhHmZJ0epCzgEdOR7GT/h2Fy4/wxrthPkj4JqkS +akQog3pjOFtj9D8QtkOw/b761qsyj17TYlQS9C6qVhcddMA+Ca2NcDhKlYofQMNTuYPXkXlpCh5R +CNFgQ+PLVZwNZjqoitjv0RLQqBudhTmJSvfDlW2w+CpbziEeRNzn0pX0/Ts7KxykDscOmUCGHKic +b6FqHoioElcmBp7ae3zdXuvI1x/1Y435qju2yODPpMXEZbdsD5iL07RZyL2vm6lfQbLc37TszDBx +ZZJ7ja5F4V/j/6/AVLkcqfZxFOnXz5Ki9rQblYJbkkTpJAyiNqi8Gx+zgPGtLWvV6KRD0zmxo6q/ +OmdjKz4v9aG7MDSXenoy6tPAOvAQcQYaksvFZs1FjorJJpFzasfTUfy94JzrHUzRSPzNRDANHG/6 +TgxC1FMNw+iQUY9L8j4xrWsr2JN5tAgYcWz1qZrp4cx0he9cbQeqYcjv7ZvIQbIe2zxdvxh7WByy +r8hNMe3RkMOM2yuP85JuWipq+9jt4/CrimKljN1ULPw+V9FZzY8kKcEiSPD+KXdJNkrMr77/lUJz +PGNYpFBFb4natmi31ZBH2VomTeKPpeanN/ghWojft1mGd1s1nD4NelrWATMVquH2Cq6nhKLRHi4c +KbQsMo+ftLvkDHHtpYenjGHbwEFfowkwn9slsZqmPEATV6caHNITCBbhQmvvhqPDPPViV+u1M1c7 +vwf/ol7IjBlubwzBJAg6f5GW0tMNHxfg5E7O27AyREyvexk0IVakzIwUuP2anPTjPW0vyeePLtiG +TXNoUe+5UIzpshnLmSlerhVGoB+HBM1yoaaJHay7sdyQbVUxgdcwEwYJKoZIhvcNAQkVMQYEBAEA +AAAwWwYJKoZIhvcNAQkUMU4eTAB7ADcAMQA5AEIAQgA4ADkANAAtADMANQA2ADEALQA0AEMAMAA0 +AC0AOQBCADIAMAAtADMAOQBCAEMARAAzADQANwAzADUAMQAwAH0wYwYJKwYBBAGCNxEBMVYeVABN +AGkAYwByAG8AcwBvAGYAdAAgAEIAYQBzAGUAIABDAHIAeQBwAHQAbwBnAHIAYQBwAGgAaQBjACAA +UAByAG8AdgBpAGQAZQByACAAdgAxAC4AMDCCCT8GCSqGSIb3DQEHBqCCCTAwggksAgEAMIIJJQYJ +KoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIEmpyonjQeMACAgfQgIII+Pr+GLKaSN1U1soCnWsw +4kRoDxPPLNbzv/K+lsbGVk9vXjv5aBTi55FMCXvA5kGvdnQYrQ1KfIZmFVh3PnFQn/J6LVrpLbHC +/D27wvnOMausJA7uJi6wgkUCkQmXn7kesWhr+bBI9Ci7uyOUxdY53Yg43OQtZbWvQjGe6GiVRqWm +8NANuZ3c1IT2TmJw5xfvvE4tcHK0d75ApvTa43CkKmUY5A4SyNY4SUVdl9Cx50LEHcqGwV+uVGzy +kdO0+bgXI66FPKriuqPfayeTmL8T9PimwhOfY38OqtTKHwJ7E817i/B8ULpkRO67uYYJpeK4cIz1 +0rDW/JPG8BqN47Rej8rCpmY1F4hOuFzYA3PAh50YlI2wD2vSSqVPMUe/AtsL+u2Nxl/EidWp/8EL +l8rBgYJjSl+YjSRV22C/ZwDu/8oV3LeCuwL2SaO1r1tww3WuRAFcCctsemP84YI27Q8Z54P6wM8c +kjYH9F3oT9bHUAfJUm2d6d3wd+iGbrrxdkLrD5tEQB16K8RAbhPPfrM5rcRlh+Zvn068H/Kc9rEa +sfJD7ygUBZJ5MSsr4zP4koMZ0xjxAaXRUsURsF13772XL3zfTCVd5fV3wIpJsoXugZTOQ6hjAmeN +yGMZDn14GyxvwLbGFB0Yx8GAIRDxBvDXkYOqEMocmNwZo+uxPew1H4PMkWMm/yh4Y4V/H9Jmyd3v +aD2BWVyx7PIJ4cet3RdydHrKSNVBzwrO+y5HKZc7V7aRM0kZgdAJh9eDTlYk6B+ZHd1EawYRlIfl +f4JydqRkRaya7FOfQ3mLgrz6bdde720XZVWqe9bbsBucbYAJsYvklYYYutnsx1Ri9UYYAbRDy920 +Z6iO1EGF5wcUc0nifXObYJ2x0ldlQskUdThPjZBl2Mk4F9oxS6W5j2llm1hS/vGnFtykQ5NMaxzi +Jkhi1Mjm/KZJUo2xJai1gtHwBOnlocXZYqJQECabBayA7rLH3pFUhU/Wqkycz4m8dUVXLNHiMIEd +3sc0QASMF56kqXtzph2zbXBbCD8afyt8WjMzZvO4lEGNM8xi/7C6h45QsdGZgqkHrYBJbSHfrU05 +ZvNpV8YcfhkzX6gNtZU5XDDBPgkYn41sEt3aVRHvRAqc+uhczQ8svVhPUsriWnKk2bfw8iAn1xex +5huB52uVPRfuL7wJxyV1Rk8WhK10xCzFDnJtRUAJ6UtuezrMOh28NPULQnLIx1kF00+uflY5vAHM +rAf92+NqORZUflKVidqHYmF7bdeNGw3qshaK/0+3grs6rQeQAvxiTdmG+sBP9poBIeeHo2OzcACB +wTuerZiYlzL7mAUegdiPD+wOa2yfGF+WG2vM9npO+a1ZWsoWceAxpLOyubBVfLyc7lfCo7ma70Vd +Kl/o7VevEqLIz5ZkaCoupWk7nDKDMG73vGXqJwaYjd8teOw66aELd2WI4cAoFTvPayxMKHD8hf4n +78riWe2XomUzafZLoMhj5vfYsiwwL3F5O/KUtTOXNNDDVuAwByiCfN65LIjU/Dhn8t6Izkox/Tnl +9kPqNxqJAxFtARCFo9Xpgba761dTBmUF9J+Krg6B53NEv+0qvJY3w1H8Fnop9S+eEs6/4qUMmgO4 +wrm3aEaLY4XWGejuxUEQ9+3/cxK1YTJIpBeK8Q1/yPgj2mq62RRGcyDPEMbcbFcsI4MKlGggcpHV +H8hv1XPLbrMi56lax3dB/EkJzJ+5IEnYd0NkXclyQm4d7KUy6LG5I2Quwt0J50dxbqmfR0gWwGsY +nsT4Kk71NiUyU9AWl46EOZIzONN4Vnm0qq3oNJ5e8VpKTb2g80m5ouw+tPiDA/IA3Vu3VKLT589j +5IQrNYhrizZnEApqPAQwBiN6D+0BLgsNeQDUn56emMj1ETDgfjukqAQjlGUvAr/VV/+eFHvkqwJU +Hy6Xzd36Cq4/sYKYVU7OFzh6Ts9gCvblZxbFI1yNimEvwZ/bINKAemQLoji3s1UIs5X+BYqKZpI5 +nZsjbIHLafNjfPoMKUlpQa27jFc4s4GQ9WLBDRnVIuzqpdmdslxc2Q+dwzbT+zFoAAe5VzA+ABxv +cjPYCBVpys4hYH1p3uwUq/hKkR7QgPE2c25qIHl+6VVS9dgaQ4XnHtVZjFzDk8u5YNenHx8E3lx4 +Ebe3mNjsM51X16ERkGC7X+w4Ko89wvb7jnnOheC0W5ICZQgphdasjff259yEJuhfk62r6bhZH2Um +2IkUACGxKaEzh55Z5P2rcaSjAwIeWnLHDCPSOJ819/4XQEtPfbZs9eymDwNOg13kZhadSQF8+zht +0Tko/9k41bNaT2ZqogskrIF9oltpofddqOa5IcE2d13T2IuDkV8/whV87P8Dg6fmFYpFCHN7zsks +X+IHrRIt7gILXPwecu2LfUZxdH/Cr5WbfMzTnsWWSB7/Z9MLrlEISHM4zC7DlkbRSD7LyXyI4weh +HNelf0uLtYRhXku5BkJUyysIYDpSHHxsMJ04Th+RZ7s8seoLBeAn7gbsj3B/JUOxIaEx8+W3bjb1 +wq6cc+KqLnvcO2BDvH30PfeQo7YjTNr4wcEoUFZXwhTL5owVc4GKtlfl/YxBXs2E6r6l43svlay6 +vCq58xTvWzzRtzvb6oh6qnoMP2xc8YTdpKma64TBmnFOVE/eGXZxVyk19TXwrokqUliutqhM6acv +x87+Yru+uXTbUpMA0MuW0Ch6uvcwxmM1hq5vHDVBTAfGuXsdQMapKoqseFUfza7N2eSgU8oaJCGQ +rmhvDn+MNzh2VyLOnPBwJ+sUnHM7XOnz/rCD99uRhhssEwZ5Xij+FG3EeTYyntGp6Z7ODIazLHM8 +81QtQDrJg2EDJ5RZHHrPbyUQDCkGpLZNOOoJkAD7I0VZRC3jJb8lTMXdKQjCd39F842+FXTSvOv9 +lmEOFH4AEyI6CokzFQCD0TXhTaG9wtzaE2q41eEKF45J5vyQxrNabZXeovNIVZryK+N8ep28M084 +vXp7uJm0bg5NunK6vTIqsxenQZWvXay8EwYLbAm8crDxK5sbW4tZtNeVxPE6ekCbifdxdgm0671w +rt4wOzAfMAcGBSsOAwIaBBT1C0A3jyKtjUTFASRSO852mKBZQQQUqy721AxhZ26s5Tsue4OHTjEB +CxwCAgfQ \ No newline at end of file diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_selfsigned.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_selfsigned.p12.data new file mode 100644 index 00000000000..e64b3b4dff8 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_selfsigned.p12.data @@ -0,0 +1,30 @@ +MIIGqgIBAzCCBmQGCSqGSIb3DQEHAaCCBlUEggZRMIIGTTCCAwsGCSqGSIb3DQEHBqCCAvwwggL4 +AgEAMIIC8QYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUUP4hegRsRe3D47D9wFdtUJPjXWoC +AgQAgIICuFyN2uPW1mb8YCey7P23VZcfAkgCViro1vkX2cMaqEQSUe182bGeGjCDMUM1ld8XYqCO +kMMuCeff20A9En52Wpm0zhuvcaaKxFR9Mn9X2/bNJr0Oig+P7SGTO/gDI+Z7RkhjJWra6V2Pipf2 +dDBYB5dTqiSsdBEZfxPUvXr9NXfYqM+sLwv6ewTVcS9dcK39fKVPBgDS8g3KGaoFSoQkEOMm62wA +Yh8dbkJ2VFphCCKNYtLW0Z2dIRjhfLHpfiin48cyscsHNF/Q5PwqZRCQ8hLgvDdeAglueAkufgRy +dKEKfOsdBKpUcVbnKE1zcWg/EK5oNadC14BlBFitVtL9bSgvxURV+ht+jdQKSfsvIVseW8TiqFLF +RAtxB+Ve0CdWGhcdlDSt7QAxlr8pXrvHwOqlBDv31uueivLI20sfXrvxhSRm5mfUuYZQGith2VGy +4nGDbHGN/Wp2gRS/FZR8mvKgQVZOshBKKaYxmOBxAtAPnkpKdcHhZ3ZMmTuQ4gWIDcQG4QkCTtpu +kcnEdPT8MturNaN+PHTG0La0zlX92+kqj5rnpNzBfsBNILkCTqs6Y5Ltknt+wmYQokMhoLPKVMl1 +uuV2PyQioC6v7fold64k9RK2t9aiCgK/NOVaG7imS/1LhFTYeoMiji/pkxb4dL7rSkOUup+v7e9D +ltP8hf2rLRz/QjQcps5+9wnkLPf/af/zffYZqnrb4JhBzya6Y837ctq9G9ZwBhQR0eOKuQsoDE62 +FMBTmvztspjdc2r7I+7/bcZoxDA1GVq6x+ILvsHxPkYbpK+YimtDzdFmly4QZ5t4ePBN6JoSkQnt +M2SW3A24K5xY8fBppPnFbfIhitReM24sVFW5K1bx8UmnyY47vYaQNFQy7fw1q3IaizXTguB93Dgq +M8h4ZUUBQqIX88H792fjYoemXzCCAzoGCSqGSIb3DQEHAaCCAysEggMnMIIDIzCCAx8GCyqGSIb3 +DQEMCgECoIICsjCCAq4wKAYKKoZIhvcNAQwBAzAaBBTCjW7ZwDP3oZ7PWO/Y+KkqVWjAZgICBAAE +ggKAYqCnxT6KcqqKgzicaVUOn4xxf3jyOTpLwmExI6pPXE7Q6/8iCnikVuVYgb4PynUlxeI8TGqr +N9rQXZF0c3JJ/jDULWpW7xUqw6DjWUyO964+eEd8FJK8IpOaCVk96tCSVFVIqHCJbeQwuSsa9Hcq +kLY6xtkGbgCJxYmXGsd+KsasrkybJakFQO1Di0iCzABpoLF80/OYoZJsoFZp4mhKuERoa0zW3K9G +fZXzrcFN2vcYRZdi6RT2/R9sxUMA1bOdiP4pKvEiT1QrFfjoz0a4tRbL6JEYuPVq4+xKF63p/edl +zFTmrz2nqwC4L1VTpl4kgfIqeaw8vhPYGp7hV/Ve8h0tQDElH/oCsdpaZIPMnzwpKjpyPUpZDhjA +aF1I0CtYz9Tx7Wcslaz6Lq9WQGDNUWggxorkoQRQVs14Jmnhy71qA8mY3CZIzpFffl5CGfhyGIcb +om1vSkZnOK5afCudxUXowZBVpys7MotOLjXOO3QjMnmkuTMIeD5gCZx5jek1t/wMyrI7PZdHrZRE +EJfUlRSRq6ffeePLgJHR0f+EkODSnlk1/lRXj4qooG1AlKlLNJxxSWqBcOBGriopGnCdVj9cQkL+ +c0SbEOD1nXoduV6GwYlRvzjyF661z1HdbyiaBL50Hj0sbhSRn/wuTZE9Z2aEwLFoMtZaGTYtjbMi +ttB5y7PeGZVA718C4CPynyCQNI7tsKwPLuAYTI5z6P6I59YzjcoiQMTxML5W7R2ZXASqZB0vraP9 +rOm3URCG/bzjQKIeAiX9I5VMvvq0pRuCVBaqR0KlDPy+WZoVwkWQRnNzXj87x9T3phLRkFwxSpSs +VlvGCExDnw4INW2u2ZkDqTFaMDMGCSqGSIb3DQEJFDEmHiQAcABrAGMAcwAxADIAdABlAHMAdABl +AG4AZAB1AHMAZQByADEwIwYJKoZIhvcNAQkVMRYEFOYIZ9PqvN6hlfl6g8GMzQo7XZj3MD0wITAJ +BgUrDgMCGgUABBQtKrQijA4rEmoRg0DR9g4gUVdjzgQULlm+rQqDvJ7th6v7HBOlOlMwoJECAgQA \ No newline at end of file diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twoentry.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twoentry.p12.data new file mode 100644 index 00000000000..9d58b00fc26 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twoentry.p12.data @@ -0,0 +1,69 @@ +MIIPUQIBAzCCDwsGCSqGSIb3DQEHAaCCDvwEgg74MIIO9DCCBoMGCSqGSIb3DQEHBqCCBnQwggZw +AgEAMIIGaQYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUaHSG4jhu/7OMwM9JSl+8BZkXS30C +AgQAgIIGMJfHzGw/x2vtIsN91neZbEGRQyrmItZnrHIjaNtTaJDyxrd5Qp0aGxNrVzUZxxBlqntn +sVzTKvtH5YsRBJjKrx+kX39Avmh8UWDKi+iPIwjpqdIrk5D9DEg+zjn7OFwL5kS/wwErTFbes/t/ +fobuWxJZjEqzbQNimbkdh05jCQTCHozz+VoBvkeEyssmZGrghgi5iLBH9Yrlb85YsQSfcO91Dl2/ +LmtnCaMKDQ81cwofRyptbihVelIRSUxLkskOiogscBzJM68ihvNSsd8QaeS0WPbfw7Tic3nVLpUd +wxcaVud8b4OAxxyGL8rRnWzlAsZy5udKv/790DyaOmqlA3n4wAayJII8pRtKhXsHhoA5I8+quJS4 +t/Uq/n35lWpczI/5mKWAXEC+LdScVyGC+vXxhcfB+EO5UgfLnus524UbwBA9MLV6jlByUZO8Vj6t +cPcnRaKfxlMcfOPGLuzLJh7/NwOGnSZTtdHqEwQkV7GPV3qgZxHX2r+LWIQ1ZNuoCBBgF+neL9MN +J/wKwXQQtfyRIPA1do8HM1SpujvTlG/ABOiTr0ZDuRW+AkMC4acxbV7G2Cllx84dRJiIQlTUgJy8 +NYMJGAGH5gpJezdNQD6wimRiEGIs1yIne2Wc9dPE9y1zKjpbeeXoeepWGM2rYZMJVJSufq0rRKr/ +3C5+TyBu0zLigiMrNAhqakPLV4ma3ktpgtigcLAa1eS2USpy/eJboGbRqUFobFYuQk9td4yfdmJM +0sIpeRomy3SWypnJ79NOewgOJKba4Ye65kVHNz2jAFL5R4z7ll4Iqn5h/ylIi6RqMMMWf0hBr9yD +bV5qjuwZGltv1zqTJ8cPjUWMk+UmbZXcsA9W7CnVdGPoWYCT0SW7IkUYQSs0QW7VTReA16KDSoEL +3ZRIGl7KeDqGVm6ZH8zIE0lOVFY0R/2XuIcPc2DNV3UWs0Puous+j5kQgPjF1YD1r9VT6DeMPECZ +HzBJl6a4yvKjm8hXyCnYPnxbeAZJUXOmka/ST1KVUHM499/Lii8/emHTFC/28WkiaLHOUtCegJgx +Kp/eq4RAqYbHe5oUdS9xBaxZX97T0o10udqT6BKep6K/rBKHJxXp3SMuCtBIrcswlojIMc2p9fwF +WVKSZz0zT8rhyepHI5j+IJoTauGYRD46AqSA+6EXWm0bO0oEtBuFCOVeBZJrJMseNxVLfGJOZYtZ ++9ixo9m1+WBV1kGxp1RAnTWAidd15G5sxZ9qhKK9iO63hiWFGmuOiWUb2kUpBOjtM/IRDhU/Q7y5 +gvbnhVbTZR7hr+gWyIkpfOBQG42SMwTuqImGpY4yFc7H6NZSYead6Fp4GfUmLLlDG72d6Ue4N+c8 +K3DTZYL47LFdXyvMNSuumRQLx+MGQ+DYzZ56uoM9R7B+34Joe8BeJa7bg0vA3Mj9CbZ3+yvYk8TL +UU60BRda1AHwiSoRrLqgeJBZh+cyQB7e7EPcTO//iTPpFVJ8yst9IGn34AndyYULaPpnljMCiUhu +X+zVATaxDMGwc++/95VHdeGRLhb+C5qeSqcPrIdV8XKCd53lgrAoZD1a9nym/mkCLQd+zjm+IE5y +pnxccn/LoFrBm8yf0A35rm+A4Gl8gPSq2GYwu7zfEjXFiAlYrCsc5trQ9YNSGOzbD2BMAn5xxrob +pQliw72xBt43e/VYCWwnLpgKqOfPfX18moDRK/kGeMPe/xtZ4rOiXbm9SEuT0pIFIaoMmilEuEI1 +bP2QC/GN1DgBMlV+FRAhWJ+X/NjHjB/TKBMsESyp3ShhCOum112eqoOxk0O4Ob6LVA6Ay6YPtoVX +WhFjebHif5UtTtqd0u9jIU0J9UURkViLEzYN7/3FLIrlmntW35KhEYwCW8FhuXfFfbMHunw+zNoj +ioaJtktg4TqRAXEFrSLIFy3VrsMCnNol100/EU+fqLtJfB9tvAx5pjYzUa2mfFiaoSliBRYHFy/N +BzaXJ2DpFSd+RRbUsrLju3+vljTqtFEkhHFhMG4lgYxTAscqcoUAYfecGGhqL/wYDzh8V1WBDBGq +9UsABqQd4EoqUX01/Driawft4mozRmxtWnTmrvXSRPT4CJp7zCZeQMPrlMKS6+gXDU5MljCCCGkG +CSqGSIb3DQEHAaCCCFoEgghWMIIIUjCCBUcGCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcN +AQwBAzAaBBQ4eGcrDBrmIvtj/pYR8qK0Qn77ggICBAAEggTIttxjYbbyyDe0ikO7pUOYY2lCBLGX +Z3Mx54Jg9fYmSCGv7aWubwkixV+tlfWjRfGrpaMLNfJXzcbkvso/H0Fyk1oVWLkhT9DrPWRjMYWn +aZo91EKMvuu77RPzXuEVzNc5dSj01qEURgokH7WUh7Hrsp6Ssuuud+d6a6tCAwiCjLKZQiLuZ1h/ +uGalDjtM2yJVo2bZWt6puFt/H8AMLdf8HCREQ0Cddg2PG4EyQiUuzIQEk6IddPKhguWR350YCeoU +Ywx4vU6eVFYZY0DX889rXDi++b975GKoWGd74Kkt+CXrOIuXHCzmeILFouc1Uh/wwIYkgT0ClDnQ +749jKxcFG9tMkqE46POK8BLiy9V2FioKviumdiHVAMOah/sH7Ykf9QY1Qr//fHmaWRz1j966jaow +L9pdQ4v98qRSa7EUJ70AD/wK5Xajtyh6QnzW/OPq9HGIBhcy+PjP95S0MV5TG7OIXBVwgw86wp0E +ycpc2Yr0LmNQP4PJGaN0ECQm5/n886tmyv6KAMlxrzziasYymUNhY4ima12rjVN9wcNxq8Sghq4k +minW3dO4mAfU9gbvZJ1RqPFswBFm5n24zJKjzrO2qlu7tLx6Vkck3vJI3UuGWWxUBsVoHd5m1ZZP +5qrJHeEXvQuxXlyKaY7cNhk0yR7EDYC5SpUroTvVzWe1xYpoQ3ZyDKxCQ23l6jaovHJ3kQz450z0 +W59wD1078JlpTwYHsx4TBilabTcZku02uz8PZrFdPl2uJgtkgY0YyrQfYDK88+BvGWl23mbpRCbb +9pO4dxFW0lqJ112EOXECbDmkCvh43NWvr0VqsJUM3xWsKKb9xpaNLSpcK32/BL+ZTQg7ec5/xx4Y +FN4yHTd6YSDzKYHQI252CMImL0HIAC7qOOCftRDEswv6xKIn6TEykCyr08RcTsnjfjzH7HIsjhxa +anv+xXosLZfCN9/RiRXfUb2ayRF2fdQsTNepp3ECiZlhMxfKO7aSwXnQzFyB+F8axEOFBLMEmJxC +7ugz5qDqUOqiR1UNQfpz8fWXGZ4e+GLr3PblVR+CyGCDibZedaeDVXGG3yx2/V7DsYUehJSDz2DB +C8KwWMHetjDlAOXbaKcZ1QhS7upnZhTCwF90JllIZtfKPS4VP9uyFecMc0Ocoq1zdB954nzX2Iyy +t4l8+WWHH1Zb4EY6eLNNy1/wUvngGXqyrUDAocZKk/G8Hy7UPXrSWo9hGRiAm86WeokJjMKHgOH9 +lFg7/B1YHl2rW+E1JCAu2xAEJM9HB2+x8OFL/VBoxQLHr/flgGwCkOD62Oy/psUSL0ZQ+hM7qElW +y3+KlS01t4icC99/r4oyA9poAx0EVfSvffi3Nb3Et2ryYRG7kmjMoxvDVpmrAKopnePSE+GAjEbG +FIOli1ewzkOjcLZrdfTpONWfUKJB3Y6AOi7aV4N+wlrMrgAtlHSuDZ4csr1SnHctqpas37CkMg23 +KCILn2XktsGXN5AyCmPcmZI48w+8uO4OTxOdK2qIbXrlNaL1bFlHTt9riehDyHD+5LR4zB4XL080 +IA9XkbyR5OxdWlcShjPboOvGxMZeoTwmTYE23kCgh0zx0jLhb3bo3jnu6K76h3oPaRikYA5KBob3 +L51vXtrFMTowEwYJKoZIhvcNAQkUMQYeBABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbi +ylxISkcqQqH6MIIDAwYLKoZIhvcNAQwKAQKgggKyMIICrjAoBgoqhkiG9w0BDAEDMBoEFAZ8kRRQ +C5cLg1CRiF+Lgzkl9aD/AgIEAASCAoA2KwrF2adzCcInax9pPRso6j4h2KcNgrdsxCWhz+DWBRCw +pOD6uitzCdyeLEMXN95Roqf/XxHZ6n/VKov0U8vgvKEU4RSeHsUQ6DqjrL7HpEhbM/lhfHj0vaWc +tQQCTslHdwl4hWajN44Yv79zMHjA75/n4JAOvtnsyQrF0+44/yA5lFYLZyY4ndbyqzAPo0ZQD6PO +bT8uyH/KbUAi5Etri47ibD1++EDltb45ctO8xA0rFIV25tL/AOG/YajgLC/7QBLTNgvMZ7F2rV9y +qYmNCTdIDzaUIWg4+0qidqVeCPbrHHkqhti4LwOIQhBXesSTuBl1xafwzDeFQpADUe5Hc4+TtJGj +gUT2gBR9dGJI6Wj5MRM/WGT/78UgbpYxG1Q7cZ6quILuzZjWQD+guHSCrhIK42dulowx1aTaela/ +XYcR+cRiQtLcmr/0FHfr99d0hJ2BSQIp9IhCsAkU+W7Py39jTcgU/HepzvpsLuPOxI+JL1Rb0llq ++uKaw9jCAy8yIGgplEXg5mhSPXXSDO8k+9CL5rpJvUjQSnLrhLKo2i22p/LIEK6S2uVnD6EdRMYo +J/Vpx2ujqkPZfM/xsbAh04frXLGa2uAISDig+DH1RWlB5jNLRVbfgZA5/PjZyt6gz4lJigpXAVv1 +Z13EbEKrbv+CIUJOC+spz8YMH/37YkTW382gWrZkBgmQvZ6Gu5EeeFOIxXRNPseHyg+aY5vjQVyg +V9RAg2sUDwh4u8JANq45dKEFUZfD8EqhVKyd4DuJ38AkxM5SQblQ8eygx0/bAVYzwN8ZRwxDB7Ii +VD+LPthBp147NBgBw0ssNJYQ4GB4gBc7x3UXnyau5aDO9n6KMT4wFwYJKoZIhvcNAQkUMQoeCAB1 +AHMAZQByMCMGCSqGSIb3DQEJFTEWBBTuNf6QntPPWXHkQhWW+uEJ8d85XTA9MCEwCQYFKw4DAhoF +AAQUk5iGX7naSu9IN6Kw+sU5Gk319ygEFAwa1WFGcSE0mhaX1jNiYWZtqQnSAgIEAA== \ No newline at end of file diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twopass.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twopass.p12.data new file mode 100644 index 00000000000..e26169fa7e9 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twopass.p12.data @@ -0,0 +1,45 @@ +MIIJzgIBAzCCCYgGCSqGSIb3DQEHAaCCCXkEggl1MIIJcTCCA/MGCSqGSIb3DQEHBqCCA+QwggPg +AgEAMIID2QYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUt/45tX+NVmWByhUTxlYXZtkG23wC +AgQAgIIDoHK05qRAikt4Qf2pBGjBl1KH28QZEqGHygCfUpdGyou10RMbkeJ254HBhdRGQrkhLva9 +RPC2TDQuFY3RWqy/we6TvhWyq6T2rW7wPysAL7Me9sJLVvekpWXOpLz0iye+/4qaJZCFsftnUKMA +FttOkAfVr5DvfZjJYCF4AXnlFi2s5Vz0cSEyiOarrnXpGv0cnhVBkWUu09Afhvk9WnLoggYUIBeg +w5d/RRj7qM5db1GzYAO+ZXaMGwoASbnZMjFv/drJFqvifToOkn3DHX+nGF55ra5JNBbzOckGplWH +HCqqirmbguGLGf1RLoPcphWC12jQgEOnvoc+u+lC0+R967wFWhgGmC49UuCUVJSlkEl8hqwCYYb/ +T5pGW5K9sMHzzlPFMbCN3YlG9F9Upb9jFduOXXDi2SddyX3kFTRc5Q1CRea1fSm7mFdKIPr4W99j +hWT4RJTVZzbsWTh/kNUSNgP+cgKGxthqaLvgiMnOeoT3uldQ3thvSrzJKrZWi0ykk8/sV4hpMwbn +k3N24yDZB+FL1Buw+MmJ5PQdCxEoZa/Q6JahqWP/Kz/LSjOOgk4WdrJGx4cUwnrqCIgnHK+FAVD6 +ibdW2LG5w67FjMIGPS0nuFyZ/pwKO2jbgRU3CpB2XVwBhUZmHXgaJH7A68jGYSaJWc5ViGcJyeRU +S06FeViECnRu71P32NelWArbZ0XlKXKAwHse+kWUi8xuttgXas2KQ8Nz5sRjv78vqpC9tjDSkGUk +uLhJwRagJHLXltOYbXgH3CAhXhk6yTo45ytgwOV9GWs6RCOVZaMM942yMwQ2RR33MsF+N1NFI5bQ +5PYkGy0zGsvjqlT9iNE+u9ZcUMKp5EHI2BLrs6+41gYaaMTddB/bfyTcf0XIhAqeiOlz53YgbolO +i6DudU4lWyvz01T7zcl+J95s03qf7yaCGkAhetNg19ETxmxQSF5yBLZPns0CA9M1RzeM7qelj7by +3OqF8lxl6H//ZBuPxRNNuub7PwctPULDieYNWZA8kAn22utOVlCBsZHZ/CTUQCRM/gVm3QQjSUMw +oyK4Ijf2LywzHVuyCkPXAKSHrxyk8ecTwSWDmzER5uqgevBK47oOXy+nuxkC9tkeLg4ZqeWrRUGS +p8iIDNTaIrlVJ5g6s7hOgHDsPFh2sw5tGg4QkWw9SWcKkySCg7jg2Nh+0dTMzTG+yFBx4qbG5D9t +P4rtstIGeyZvjEW4DEiS0WCZe6SFcFgwggV2BgkqhkiG9w0BBwGgggVnBIIFYzCCBV8wggVbBgsq +hkiG9w0BDAoBAqCCBPowggT2MCgGCiqGSIb3DQEMAQMwGgQUadAw0f3PDGS5mrzMd1JZRDeJ10AC +AgQABIIEyLWepBjU2whnDqOcH8u6Cc/+RAjsz/laSR9SkSOsd1Kn13DEFvfTiwcvkphQyOFK3w/L +cv/ZocA9Br5FQdMcgmUladwokZP/0f9TR3iacf7GVAI7J3DEXiN9fRpljG/oU/+YoHEjo1i8rqEK +U1AhJ/+t8ABZfrK8nnu6mD0vJDdgslQeky5bqzYHyvf4C1YKYXZIhG6Xcl1aCR3NAZxmhlBeYZeW +0doiPeHj0GImWoA4ExMrNkNTDwcDXEpPzpdSWuM4DuoaWFrcFJG9PFFrN3/Rs1gu1UP+ZtkGoBNA ++RxehNGCLMFuPgFvnQYRvnYhuYTB/mvbkOyfUSiRr3CpdblH2nmdsQBwUUOh7Vp7uv8pJwoFui4A +09T7AG4sK1YwUU/d80cZoNh52LdEBddNWrVINPxi4Pb5id0bvvr/CbjZCPwPqrFw6wNAmWolDac6 +kibaFQku3aWX3W6zW+J+zM2TCpMIGcWsiMNgBsrHL54FET2QUk5E406AGiNrMTMB3yHDV+C94KU/ +LPSEzuTUXmpWQcYrjr02afkmkwgSysQq3IQA8LuMzapGf7fuA/RxSILuPcWw7lCWy4HmVn4uiKLo +tGyxfWrnXZG/9tMCnm2hxpbmP2BYbYck/vgDCxDhOmptHM7wUjs3ujhFmwp5x0A9BAU8WKuJFdPC +aZ8hjkgvPaVwtFhEScELSQh6iwfHftAS0jb1NfvsaPou3a4KQ63pvMuF4Qx7b5Cq4L2aBqhvgRqp +kinAJfAVr4vRuI199KnADlH9YGmOdrOVJ07ru9dtisH4t+zo7j8lqqcqhUstjUVcmFf6LlYPKsOG +yPsaMTg3DfIYhpWlV2rd9DXBBzNgz4KW6CEujxCSBLP3VSQQgA5xRBROPw/uBq6isBBkuWZZy9z3 +GS0J/YtZY99Q9BfK7n+vythB3aciecySnoWYS1UB6m2b+F4xMmab2P8GhzzFsyUmAzNy1mQHGdYe +eHBKA1CunIvICiv95XRAplBSIh3KHEeaCwbKVhNJYmf/xTmRBiTtVEgLKpxSQMVh+Lax6rmvVMcu +cb3klVE1n9DILVAkuW3uxScLDS1wQyGWdGu1/2vU3yojus/kw868+gMzvszc704XDviwgQblYe27 +eOdpRB8oOK63o/dY5cDSdEYhjYEVlOZ3eriZ/FYW5WHAbR7PuM1EYfVUy/5XGLylDutaA/0klfu4 +Lhs4Sptdt7DifBI6R1LAcXu7REbu/r+Xhxnj6ik27oMitYO2PG3slnBEzj37Hc9EOGvBbuB3Fn28 +oRs6tAFilysj8hrJnHVFbA9OiNa8sdFj797n4lvlYv2ZMMUvJpg0hjInkTG0vkRhQbzszd0URUK0 +hpGVADFlwsfAWKoNAO2YoBmNIILSs8Sgogf5yuRvZBZPKRxQffGp9UjRpe2TiM2EZfHhgruyvnR4 +GfZfY3oHCtWA3DmQZYfQtwqeo4N4gA0Kwr34VGSFDMJxmEIuwWZYRL1sZXyGUZjZWYhtrp25vUn5 +uXrzhsi4IuDbAV5QlBi3NAC1uRfcZrn9OhGT/Q7LK8M4z2WL7gui5ULq+a4OvDFdcLdej/obWRip +X20CW/bWzctM2dLUFWwP0xdv9wHAMDpnrOHVWF5gRaWjFjFOMCcGCSqGSIb3DQEJFDEaHhgAcABr +AGMAcwAxADIAdABlAHMAdABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbiylxISkcqQqH6 +MD0wITAJBgUrDgMCGgUABBReCaXcoIK8JTMwigEZzYPfmYG2TwQUZCjIEn2XZ9poivqAwEKWWmB6 +1QoCAgQA \ No newline at end of file diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_selfsigned.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_selfsigned.p12.data new file mode 100644 index 00000000000..362a88ef4e1 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_selfsigned.p12.data @@ -0,0 +1,45 @@ +MIIJzgIBAzCCCYgGCSqGSIb3DQEHAaCCCXkEggl1MIIJcTCCA/MGCSqGSIb3DQEHBqCCA+QwggPg +AgEAMIID2QYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUdVPZ1PqmiHSzutary6nkrMZutmAC +AgQAgIIDoEk+DNlnRZfSrsiS+4naiYEBlkWcbxVIxDlsUhkj/GzhyAl/NzgHT31YhGBPADFWxLsf +dMykYBWbnErvqAb2Ej/2q3l+gXehZ8PxjeXYwQ7uuXunwxrq8AayX5ofZyKw8RwDRsUYvIm89CRN +FWIwXThrRWHAMaQ+ySINhspOeq2liuracnzzeG4EoZyE4bmONMMbsOJOTOnQZsc3Hw+SC7+vIV/x +QnQQHY9bhsG8nxBfLLxd+JKerXRAeobkeufYHm/Q0iFpRtVad0FkMyWViyBjlEaTUyCXvZ1f27Ub +hzPPdMj9mew6flpJorqemMKFaIMiBFgNvT69BNto9n2tgoU2mGkM0r9pqT51F/TsdbVouhmcqi+9 +NWjJVO2bTvh3s/Q3I5Y5zFt0JaqznVVUMQMfR97RNdBWJmdWjTFaDmQwau2zaKboeDsDpgl7cpko +t57ifS5+1XSy7Vwh3H+eTaIrmMeNPpnAFbfUMIx2MHMqzG3tQg4zXn6L0+os2BkyLvjllxWZ8ElG +tNz0xJMde8afhnRRwLO489Pv5ZM6IW+SLVVuNHMICpALQUxKHHrVy75YbqGoD/cmfvHgGcTZBAL+ +TCCtppdexzH4k4cB1/o+rI0ksKyhIPpNoLRnrKZTxEJ8MWYXvPkXJhgaz27fxAdVX/tkaSDSgz8M +tp9WgUUx3oet3vjLsMUQguUTdYfB0nSpZ33F5ZNXysxLsUYH+zYwcCyQi2s5/CI0tO/SA6onQOFP +Pt5ESInsucCJgTGAmY31r23BgvUGV0PCbj8oePAErgb9se5TqPyRMeDa7iPhB44Pm93bxr5BS3ua +zTBzbgsPQNAmlNAg9LKWj+a7NU5s6Rv2y3pAH1y9YPih9nlGOoeTlAn7J2Um4zfrCP2GWpR09ODt +ZqElzhbES+3sr15G8u86G0n9j9m1NI8+SlSKj8cvsTfM5DAOGWyJ91YF+GtVg3kGQCHA9J6i6FTt +dPdO5eVoKLck61vGHd3n6xkmZtkTI4Rxr1rJvNFzwjiFadIKAy7PffLVlqUucgHW1kF9poTBg3h3 +2Ia489bsahYdg77xEzuIvVIziOyqdYDpOSq7BKCHaVnglRBStPUMh9uA6xZOFOgbJPGNfJMy4LdL +PbHVXTZ40iqgq1tLBl/8y+HUsFqanBpiuEa6taZ1Da2AYp+Nij8/x/DL+7/P9h0r0ehFvY6DUjcR +pFLIchLAG1HeqK9yt5ivQJG+f35oU5cwggV2BgkqhkiG9w0BBwGgggVnBIIFYzCCBV8wggVbBgsq +hkiG9w0BDAoBAqCCBPowggT2MCgGCiqGSIb3DQEMAQMwGgQUUF+8eSim66TyIYKiuOA1HaaiWxsC +AgQABIIEyHbI0EKVq0rIxePLGQ1E8v8mMIFS1DdygYqZk1DGnROuF7tvDJLZypL56RQ7WSgFHG36 +z7nUteL1VL/eDtVNgPQYE5wM1M9wlMFJjPeIe67DcnHq/1DXPMHF0bCeuPRNxvh5qYQ5Spk962pN +JHhxoxZgU8Po2uWC2+YfAbOV3se4BlAWQtxRE5dklsTr2BuydagNzC71crRDqIrhP5DzrzaXVkWJ +MJq7iqfX/C7Zwc2Sm10/dCaS+7O11I5cz96ChUJv2CDT6lMvQ/QHvSd4+igKGUemYQgi5LpFUFG8 +0iqUxhJ5BWHT7A/a9L2TXzxg8PfBlUbSRAejG5Bg9IFuec/0GIvPV9UtnXU+vDQI/3XMZG38uQLC +Ro+eIClTYUG0mw84XxfiYNNkIbT1CTDNNpXV07sEm+YzSEhmHjuc3y61WkBlCvbyxDEZDTEM2YuO +ZdxUnuy7QdI/87uvyyI3TSWSmKYdPqcjvJ1puhfvg0cDJTDArDTuqM7RilH6Wig/tRQSxFxVBKo3 +Pok6ZZSeXyyTm6S//mEdU2GRFh6PXj0Tw5XRa3KfgxMXL7lbHcOsP/qk8dGBiIA/LaodPFLfcWQR +aSerAlzmFpXt7+Tm2v4HKTF+C9iPv2bj4RmINQ4PtAgpPfbIv7PCksyVlUWzi8l6FZwn6CDO347f +yXxaZIeAtMUn6IxmPMm2JZyJE1iJqrj6YVhGbRxAdAQ8I+vSLQ7upcju1Gysv8w3jO/MoJzsRkV5 +3GYbq06rkG2gAmk1A0fjAP9oVLvyMYXRcrKd/4aKdK4xJkUAxB+UlPp998ESqqZ9hWfU6YM3TCig +7rp79lHJW3aM31uljLjWtWbJ/+Xr/H7Vu24PDjuN8SQL+IMWSP3yaApHSQ7YGNXmtoDID/Wc8PHT +T/1LL84MGmwIp6bXbvkDgEWB8nO7mm2V9y5GozOzgk5fQlH+1/6WjZG6iD/knTkMDXv86m4P/23/ +YfUM3CbWVcstp2NjV1Kdc5ouylhrBe74ZIS7Wup53w6nLJ3LYi2uidyO2p/dxbT6QeE09Prrh0lo +2gkOPh32F0utu6Ugo6Q3DiriOpY97wpPJnBIVTeg6Er1A03lbtoqTMqIjLmQoWu01POZuTcyrG2w +JE356t2ULKtwpUUc7Sf7tho2DC4GR1bqF0xT4Hv47pD3RaAx4WRRRVE68EgtzrIlsY26nayH5iDA +ncm0+i3k7DHLXm6EhcoIgjvEwEehN9Boc2BbuGrduI5/LN8vUtKhVloejh8Hr8X5z9qvHsUq3Thj +9VcLBp2HOgnwBrVodhrowE0W2fZ4+OA7GfWw+lVFuCZW4C/V3Ubj6iyh6V/Y8wofZlM1Y0H5tKE3 +0fUio/bUxwyRM9OZBin5j528FRvCZH7PsAjqxztW/VRJ9TDP0+gFFdJMhAfiekXqpSpRjPhTaSnw ++0srFo9NGWMsYq5DsfKHbaoilaXu5TUp31+GlvohouLe0ETzOQApknHKYpnBtLy5E+WzjKv8DCLX +Hs7VpbSIDtzEK1l2F1T+4HVDBD2snXp1F37ytZpn6J5Fuze8LrJcLXjahLUGwXcBDB+LbVYuMJCH +yN9zYhSEv4PbiRq8GoqCW+Cw9R3eW87jRdPwWFewx+5MLzFOMCcGCSqGSIb3DQEJFDEaHhgAcABr +AGMAcwAxADIAdABlAHMAdABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbiylxISkcqQqH6 +MD0wITAJBgUrDgMCGgUABBTTmQMHbBSL6ICCYs/pyZ2E/j2QsQQUKqdbNdUe1p8Hmn8PmLHFQxRr +xp4CAgQA \ No newline at end of file diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twoentry.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twoentry.p12.data new file mode 100644 index 00000000000..9d58b00fc26 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twoentry.p12.data @@ -0,0 +1,69 @@ +MIIPUQIBAzCCDwsGCSqGSIb3DQEHAaCCDvwEgg74MIIO9DCCBoMGCSqGSIb3DQEHBqCCBnQwggZw +AgEAMIIGaQYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUaHSG4jhu/7OMwM9JSl+8BZkXS30C +AgQAgIIGMJfHzGw/x2vtIsN91neZbEGRQyrmItZnrHIjaNtTaJDyxrd5Qp0aGxNrVzUZxxBlqntn +sVzTKvtH5YsRBJjKrx+kX39Avmh8UWDKi+iPIwjpqdIrk5D9DEg+zjn7OFwL5kS/wwErTFbes/t/ +fobuWxJZjEqzbQNimbkdh05jCQTCHozz+VoBvkeEyssmZGrghgi5iLBH9Yrlb85YsQSfcO91Dl2/ +LmtnCaMKDQ81cwofRyptbihVelIRSUxLkskOiogscBzJM68ihvNSsd8QaeS0WPbfw7Tic3nVLpUd +wxcaVud8b4OAxxyGL8rRnWzlAsZy5udKv/790DyaOmqlA3n4wAayJII8pRtKhXsHhoA5I8+quJS4 +t/Uq/n35lWpczI/5mKWAXEC+LdScVyGC+vXxhcfB+EO5UgfLnus524UbwBA9MLV6jlByUZO8Vj6t +cPcnRaKfxlMcfOPGLuzLJh7/NwOGnSZTtdHqEwQkV7GPV3qgZxHX2r+LWIQ1ZNuoCBBgF+neL9MN +J/wKwXQQtfyRIPA1do8HM1SpujvTlG/ABOiTr0ZDuRW+AkMC4acxbV7G2Cllx84dRJiIQlTUgJy8 +NYMJGAGH5gpJezdNQD6wimRiEGIs1yIne2Wc9dPE9y1zKjpbeeXoeepWGM2rYZMJVJSufq0rRKr/ +3C5+TyBu0zLigiMrNAhqakPLV4ma3ktpgtigcLAa1eS2USpy/eJboGbRqUFobFYuQk9td4yfdmJM +0sIpeRomy3SWypnJ79NOewgOJKba4Ye65kVHNz2jAFL5R4z7ll4Iqn5h/ylIi6RqMMMWf0hBr9yD +bV5qjuwZGltv1zqTJ8cPjUWMk+UmbZXcsA9W7CnVdGPoWYCT0SW7IkUYQSs0QW7VTReA16KDSoEL +3ZRIGl7KeDqGVm6ZH8zIE0lOVFY0R/2XuIcPc2DNV3UWs0Puous+j5kQgPjF1YD1r9VT6DeMPECZ +HzBJl6a4yvKjm8hXyCnYPnxbeAZJUXOmka/ST1KVUHM499/Lii8/emHTFC/28WkiaLHOUtCegJgx +Kp/eq4RAqYbHe5oUdS9xBaxZX97T0o10udqT6BKep6K/rBKHJxXp3SMuCtBIrcswlojIMc2p9fwF +WVKSZz0zT8rhyepHI5j+IJoTauGYRD46AqSA+6EXWm0bO0oEtBuFCOVeBZJrJMseNxVLfGJOZYtZ ++9ixo9m1+WBV1kGxp1RAnTWAidd15G5sxZ9qhKK9iO63hiWFGmuOiWUb2kUpBOjtM/IRDhU/Q7y5 +gvbnhVbTZR7hr+gWyIkpfOBQG42SMwTuqImGpY4yFc7H6NZSYead6Fp4GfUmLLlDG72d6Ue4N+c8 +K3DTZYL47LFdXyvMNSuumRQLx+MGQ+DYzZ56uoM9R7B+34Joe8BeJa7bg0vA3Mj9CbZ3+yvYk8TL +UU60BRda1AHwiSoRrLqgeJBZh+cyQB7e7EPcTO//iTPpFVJ8yst9IGn34AndyYULaPpnljMCiUhu +X+zVATaxDMGwc++/95VHdeGRLhb+C5qeSqcPrIdV8XKCd53lgrAoZD1a9nym/mkCLQd+zjm+IE5y +pnxccn/LoFrBm8yf0A35rm+A4Gl8gPSq2GYwu7zfEjXFiAlYrCsc5trQ9YNSGOzbD2BMAn5xxrob +pQliw72xBt43e/VYCWwnLpgKqOfPfX18moDRK/kGeMPe/xtZ4rOiXbm9SEuT0pIFIaoMmilEuEI1 +bP2QC/GN1DgBMlV+FRAhWJ+X/NjHjB/TKBMsESyp3ShhCOum112eqoOxk0O4Ob6LVA6Ay6YPtoVX +WhFjebHif5UtTtqd0u9jIU0J9UURkViLEzYN7/3FLIrlmntW35KhEYwCW8FhuXfFfbMHunw+zNoj +ioaJtktg4TqRAXEFrSLIFy3VrsMCnNol100/EU+fqLtJfB9tvAx5pjYzUa2mfFiaoSliBRYHFy/N +BzaXJ2DpFSd+RRbUsrLju3+vljTqtFEkhHFhMG4lgYxTAscqcoUAYfecGGhqL/wYDzh8V1WBDBGq +9UsABqQd4EoqUX01/Driawft4mozRmxtWnTmrvXSRPT4CJp7zCZeQMPrlMKS6+gXDU5MljCCCGkG +CSqGSIb3DQEHAaCCCFoEgghWMIIIUjCCBUcGCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcN +AQwBAzAaBBQ4eGcrDBrmIvtj/pYR8qK0Qn77ggICBAAEggTIttxjYbbyyDe0ikO7pUOYY2lCBLGX +Z3Mx54Jg9fYmSCGv7aWubwkixV+tlfWjRfGrpaMLNfJXzcbkvso/H0Fyk1oVWLkhT9DrPWRjMYWn +aZo91EKMvuu77RPzXuEVzNc5dSj01qEURgokH7WUh7Hrsp6Ssuuud+d6a6tCAwiCjLKZQiLuZ1h/ +uGalDjtM2yJVo2bZWt6puFt/H8AMLdf8HCREQ0Cddg2PG4EyQiUuzIQEk6IddPKhguWR350YCeoU +Ywx4vU6eVFYZY0DX889rXDi++b975GKoWGd74Kkt+CXrOIuXHCzmeILFouc1Uh/wwIYkgT0ClDnQ +749jKxcFG9tMkqE46POK8BLiy9V2FioKviumdiHVAMOah/sH7Ykf9QY1Qr//fHmaWRz1j966jaow +L9pdQ4v98qRSa7EUJ70AD/wK5Xajtyh6QnzW/OPq9HGIBhcy+PjP95S0MV5TG7OIXBVwgw86wp0E +ycpc2Yr0LmNQP4PJGaN0ECQm5/n886tmyv6KAMlxrzziasYymUNhY4ima12rjVN9wcNxq8Sghq4k +minW3dO4mAfU9gbvZJ1RqPFswBFm5n24zJKjzrO2qlu7tLx6Vkck3vJI3UuGWWxUBsVoHd5m1ZZP +5qrJHeEXvQuxXlyKaY7cNhk0yR7EDYC5SpUroTvVzWe1xYpoQ3ZyDKxCQ23l6jaovHJ3kQz450z0 +W59wD1078JlpTwYHsx4TBilabTcZku02uz8PZrFdPl2uJgtkgY0YyrQfYDK88+BvGWl23mbpRCbb +9pO4dxFW0lqJ112EOXECbDmkCvh43NWvr0VqsJUM3xWsKKb9xpaNLSpcK32/BL+ZTQg7ec5/xx4Y +FN4yHTd6YSDzKYHQI252CMImL0HIAC7qOOCftRDEswv6xKIn6TEykCyr08RcTsnjfjzH7HIsjhxa +anv+xXosLZfCN9/RiRXfUb2ayRF2fdQsTNepp3ECiZlhMxfKO7aSwXnQzFyB+F8axEOFBLMEmJxC +7ugz5qDqUOqiR1UNQfpz8fWXGZ4e+GLr3PblVR+CyGCDibZedaeDVXGG3yx2/V7DsYUehJSDz2DB +C8KwWMHetjDlAOXbaKcZ1QhS7upnZhTCwF90JllIZtfKPS4VP9uyFecMc0Ocoq1zdB954nzX2Iyy +t4l8+WWHH1Zb4EY6eLNNy1/wUvngGXqyrUDAocZKk/G8Hy7UPXrSWo9hGRiAm86WeokJjMKHgOH9 +lFg7/B1YHl2rW+E1JCAu2xAEJM9HB2+x8OFL/VBoxQLHr/flgGwCkOD62Oy/psUSL0ZQ+hM7qElW +y3+KlS01t4icC99/r4oyA9poAx0EVfSvffi3Nb3Et2ryYRG7kmjMoxvDVpmrAKopnePSE+GAjEbG +FIOli1ewzkOjcLZrdfTpONWfUKJB3Y6AOi7aV4N+wlrMrgAtlHSuDZ4csr1SnHctqpas37CkMg23 +KCILn2XktsGXN5AyCmPcmZI48w+8uO4OTxOdK2qIbXrlNaL1bFlHTt9riehDyHD+5LR4zB4XL080 +IA9XkbyR5OxdWlcShjPboOvGxMZeoTwmTYE23kCgh0zx0jLhb3bo3jnu6K76h3oPaRikYA5KBob3 +L51vXtrFMTowEwYJKoZIhvcNAQkUMQYeBABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbi +ylxISkcqQqH6MIIDAwYLKoZIhvcNAQwKAQKgggKyMIICrjAoBgoqhkiG9w0BDAEDMBoEFAZ8kRRQ +C5cLg1CRiF+Lgzkl9aD/AgIEAASCAoA2KwrF2adzCcInax9pPRso6j4h2KcNgrdsxCWhz+DWBRCw +pOD6uitzCdyeLEMXN95Roqf/XxHZ6n/VKov0U8vgvKEU4RSeHsUQ6DqjrL7HpEhbM/lhfHj0vaWc +tQQCTslHdwl4hWajN44Yv79zMHjA75/n4JAOvtnsyQrF0+44/yA5lFYLZyY4ndbyqzAPo0ZQD6PO +bT8uyH/KbUAi5Etri47ibD1++EDltb45ctO8xA0rFIV25tL/AOG/YajgLC/7QBLTNgvMZ7F2rV9y +qYmNCTdIDzaUIWg4+0qidqVeCPbrHHkqhti4LwOIQhBXesSTuBl1xafwzDeFQpADUe5Hc4+TtJGj +gUT2gBR9dGJI6Wj5MRM/WGT/78UgbpYxG1Q7cZ6quILuzZjWQD+guHSCrhIK42dulowx1aTaela/ +XYcR+cRiQtLcmr/0FHfr99d0hJ2BSQIp9IhCsAkU+W7Py39jTcgU/HepzvpsLuPOxI+JL1Rb0llq ++uKaw9jCAy8yIGgplEXg5mhSPXXSDO8k+9CL5rpJvUjQSnLrhLKo2i22p/LIEK6S2uVnD6EdRMYo +J/Vpx2ujqkPZfM/xsbAh04frXLGa2uAISDig+DH1RWlB5jNLRVbfgZA5/PjZyt6gz4lJigpXAVv1 +Z13EbEKrbv+CIUJOC+spz8YMH/37YkTW382gWrZkBgmQvZ6Gu5EeeFOIxXRNPseHyg+aY5vjQVyg +V9RAg2sUDwh4u8JANq45dKEFUZfD8EqhVKyd4DuJ38AkxM5SQblQ8eygx0/bAVYzwN8ZRwxDB7Ii +VD+LPthBp147NBgBw0ssNJYQ4GB4gBc7x3UXnyau5aDO9n6KMT4wFwYJKoZIhvcNAQkUMQoeCAB1 +AHMAZQByMCMGCSqGSIb3DQEJFTEWBBTuNf6QntPPWXHkQhWW+uEJ8d85XTA9MCEwCQYFKw4DAhoF +AAQUk5iGX7naSu9IN6Kw+sU5Gk319ygEFAwa1WFGcSE0mhaX1jNiYWZtqQnSAgIEAA== \ No newline at end of file diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twopass.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twopass.p12.data new file mode 100644 index 00000000000..e26169fa7e9 --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twopass.p12.data @@ -0,0 +1,45 @@ +MIIJzgIBAzCCCYgGCSqGSIb3DQEHAaCCCXkEggl1MIIJcTCCA/MGCSqGSIb3DQEHBqCCA+QwggPg +AgEAMIID2QYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUt/45tX+NVmWByhUTxlYXZtkG23wC +AgQAgIIDoHK05qRAikt4Qf2pBGjBl1KH28QZEqGHygCfUpdGyou10RMbkeJ254HBhdRGQrkhLva9 +RPC2TDQuFY3RWqy/we6TvhWyq6T2rW7wPysAL7Me9sJLVvekpWXOpLz0iye+/4qaJZCFsftnUKMA +FttOkAfVr5DvfZjJYCF4AXnlFi2s5Vz0cSEyiOarrnXpGv0cnhVBkWUu09Afhvk9WnLoggYUIBeg +w5d/RRj7qM5db1GzYAO+ZXaMGwoASbnZMjFv/drJFqvifToOkn3DHX+nGF55ra5JNBbzOckGplWH +HCqqirmbguGLGf1RLoPcphWC12jQgEOnvoc+u+lC0+R967wFWhgGmC49UuCUVJSlkEl8hqwCYYb/ +T5pGW5K9sMHzzlPFMbCN3YlG9F9Upb9jFduOXXDi2SddyX3kFTRc5Q1CRea1fSm7mFdKIPr4W99j +hWT4RJTVZzbsWTh/kNUSNgP+cgKGxthqaLvgiMnOeoT3uldQ3thvSrzJKrZWi0ykk8/sV4hpMwbn +k3N24yDZB+FL1Buw+MmJ5PQdCxEoZa/Q6JahqWP/Kz/LSjOOgk4WdrJGx4cUwnrqCIgnHK+FAVD6 +ibdW2LG5w67FjMIGPS0nuFyZ/pwKO2jbgRU3CpB2XVwBhUZmHXgaJH7A68jGYSaJWc5ViGcJyeRU +S06FeViECnRu71P32NelWArbZ0XlKXKAwHse+kWUi8xuttgXas2KQ8Nz5sRjv78vqpC9tjDSkGUk +uLhJwRagJHLXltOYbXgH3CAhXhk6yTo45ytgwOV9GWs6RCOVZaMM942yMwQ2RR33MsF+N1NFI5bQ +5PYkGy0zGsvjqlT9iNE+u9ZcUMKp5EHI2BLrs6+41gYaaMTddB/bfyTcf0XIhAqeiOlz53YgbolO +i6DudU4lWyvz01T7zcl+J95s03qf7yaCGkAhetNg19ETxmxQSF5yBLZPns0CA9M1RzeM7qelj7by +3OqF8lxl6H//ZBuPxRNNuub7PwctPULDieYNWZA8kAn22utOVlCBsZHZ/CTUQCRM/gVm3QQjSUMw +oyK4Ijf2LywzHVuyCkPXAKSHrxyk8ecTwSWDmzER5uqgevBK47oOXy+nuxkC9tkeLg4ZqeWrRUGS +p8iIDNTaIrlVJ5g6s7hOgHDsPFh2sw5tGg4QkWw9SWcKkySCg7jg2Nh+0dTMzTG+yFBx4qbG5D9t +P4rtstIGeyZvjEW4DEiS0WCZe6SFcFgwggV2BgkqhkiG9w0BBwGgggVnBIIFYzCCBV8wggVbBgsq +hkiG9w0BDAoBAqCCBPowggT2MCgGCiqGSIb3DQEMAQMwGgQUadAw0f3PDGS5mrzMd1JZRDeJ10AC +AgQABIIEyLWepBjU2whnDqOcH8u6Cc/+RAjsz/laSR9SkSOsd1Kn13DEFvfTiwcvkphQyOFK3w/L +cv/ZocA9Br5FQdMcgmUladwokZP/0f9TR3iacf7GVAI7J3DEXiN9fRpljG/oU/+YoHEjo1i8rqEK +U1AhJ/+t8ABZfrK8nnu6mD0vJDdgslQeky5bqzYHyvf4C1YKYXZIhG6Xcl1aCR3NAZxmhlBeYZeW +0doiPeHj0GImWoA4ExMrNkNTDwcDXEpPzpdSWuM4DuoaWFrcFJG9PFFrN3/Rs1gu1UP+ZtkGoBNA ++RxehNGCLMFuPgFvnQYRvnYhuYTB/mvbkOyfUSiRr3CpdblH2nmdsQBwUUOh7Vp7uv8pJwoFui4A +09T7AG4sK1YwUU/d80cZoNh52LdEBddNWrVINPxi4Pb5id0bvvr/CbjZCPwPqrFw6wNAmWolDac6 +kibaFQku3aWX3W6zW+J+zM2TCpMIGcWsiMNgBsrHL54FET2QUk5E406AGiNrMTMB3yHDV+C94KU/ +LPSEzuTUXmpWQcYrjr02afkmkwgSysQq3IQA8LuMzapGf7fuA/RxSILuPcWw7lCWy4HmVn4uiKLo +tGyxfWrnXZG/9tMCnm2hxpbmP2BYbYck/vgDCxDhOmptHM7wUjs3ujhFmwp5x0A9BAU8WKuJFdPC +aZ8hjkgvPaVwtFhEScELSQh6iwfHftAS0jb1NfvsaPou3a4KQ63pvMuF4Qx7b5Cq4L2aBqhvgRqp +kinAJfAVr4vRuI199KnADlH9YGmOdrOVJ07ru9dtisH4t+zo7j8lqqcqhUstjUVcmFf6LlYPKsOG +yPsaMTg3DfIYhpWlV2rd9DXBBzNgz4KW6CEujxCSBLP3VSQQgA5xRBROPw/uBq6isBBkuWZZy9z3 +GS0J/YtZY99Q9BfK7n+vythB3aciecySnoWYS1UB6m2b+F4xMmab2P8GhzzFsyUmAzNy1mQHGdYe +eHBKA1CunIvICiv95XRAplBSIh3KHEeaCwbKVhNJYmf/xTmRBiTtVEgLKpxSQMVh+Lax6rmvVMcu +cb3klVE1n9DILVAkuW3uxScLDS1wQyGWdGu1/2vU3yojus/kw868+gMzvszc704XDviwgQblYe27 +eOdpRB8oOK63o/dY5cDSdEYhjYEVlOZ3eriZ/FYW5WHAbR7PuM1EYfVUy/5XGLylDutaA/0klfu4 +Lhs4Sptdt7DifBI6R1LAcXu7REbu/r+Xhxnj6ik27oMitYO2PG3slnBEzj37Hc9EOGvBbuB3Fn28 +oRs6tAFilysj8hrJnHVFbA9OiNa8sdFj797n4lvlYv2ZMMUvJpg0hjInkTG0vkRhQbzszd0URUK0 +hpGVADFlwsfAWKoNAO2YoBmNIILSs8Sgogf5yuRvZBZPKRxQffGp9UjRpe2TiM2EZfHhgruyvnR4 +GfZfY3oHCtWA3DmQZYfQtwqeo4N4gA0Kwr34VGSFDMJxmEIuwWZYRL1sZXyGUZjZWYhtrp25vUn5 +uXrzhsi4IuDbAV5QlBi3NAC1uRfcZrn9OhGT/Q7LK8M4z2WL7gui5ULq+a4OvDFdcLdej/obWRip +X20CW/bWzctM2dLUFWwP0xdv9wHAMDpnrOHVWF5gRaWjFjFOMCcGCSqGSIb3DQEJFDEaHhgAcABr +AGMAcwAxADIAdABlAHMAdABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbiylxISkcqQqH6 +MD0wITAJBgUrDgMCGgUABBReCaXcoIK8JTMwigEZzYPfmYG2TwQUZCjIEn2XZ9poivqAwEKWWmB6 +1QoCAgQA \ No newline at end of file diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/keystoreCA.jceks.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/keystoreCA.jceks.data new file mode 100644 index 00000000000..be06f6abfae --- /dev/null +++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/keystoreCA.jceks.data @@ -0,0 +1,38 @@ +zs7OzgAAAAIAAAABAAAAAQAMcGtjczEydGVzdGNhAAAA9w1c8TsAAATsMIIE6DAaBgkrBgEEASoC +EwEwDQQIENnMq+mjV/MCARQEggTIxcLo7BUq16C/xG5KhlyvHkNqvHIFDcCXcwSA6L+1OD8jZztH ++/0Xjv24+gCvto+XPzkKaYkCN35SI9D+y461jqUStnjbgWiHnXnhe/V1IDfkY93cV1zLOWwaNXvM +UPMY5IEbFKowrh3Yrr0ljh57hXifgj63520l7ZV2sbVqwH+1ttBOyNuMB45AvZMX9+qZDucu/I32 +mdzvYoxBPQSwYyt0XMleEMxgSdum0WbhBcjZmcAHjsrLhrNK6wAEjM+6s/wpbJgU4SNIQ4rDVLT6 +SMf+xBz6YxzLiNBWEoga/aQK8WzCF00YQOrCRHpLu1DRSvCofmdttO9FW+OSLKTePV2xQavdu5GD +Kpyog1BaQlkt/QFqx6xMw7Sf4cJV7PPd2rsqM/xiAbYFcGjw/hlk9pGoHcbGT92bUum+F1KvMdZj +LZo4Mzo0CEYpp9MmSt/q5dGbCxQlUVKgLg16P+jQ5TvLyIyd4rFG9yaqYQ3Q0Um7rRfFQ1+/aAZE +OJNNFp9Oxv7eBAwbW5DdriWXNtxo3yIRbjQhn2wa5Lyv9cVcUQ9OVKU6Exu2BWjuMmjr4mM11MAX +rmzZcslK2iX89phOOMk/ZG4BRb4lD+RTeSHVJrORd+eaZFXhXYx96a74vJI1tAcjgT75T6Dmq4da +uC39W13zhWOsOQnO0jdZQ+DkiE7XQ2+ZoB+nMmIWHyGokg1fS1AB6v7Os6pyPKKTEqXWM73L8bg6 +rTtCYQS1/NaSoAofOsbg7UWV/EQnShu2eHE91V509lY+l8p/TWddv4IVOBKHranSuRhJ56cD5xs0 +9IksUK2LXdMJl949bU4NsnrmUohkjxeOZpgDrvM2U2TBaJ9lO973ScAUJ0kqU11Q94LU2TQ4JP9d +2sWkq47wGE0yrx/ze2Vi1C+HD1esqKpw142cIzslmzzwLKZfauxT4XLprATrKYVBsA173Tbg1eUK +17Og5p1p6qEqwI1dvD1NHhj5WuLztP/zhQhnMlPNukVo/+ue6od3wby9jeMBHIIQDjHXGX38APJI +GHBxAhvOJeCKs3+JPnfuJYNshl9535oex5R1/K7pTCiOTdsjw9OQe+2xMFZX1ctaywWxQi4Bal7C +hha6xREcyr/M2ffpn+Vcvp4U7NYOh86KEwSJxyrltAb7BKT7RYTcWLIKsh+OBBQIUbfYQXL8tMKt +c8uNM9xLYFeHBAvgl09rpci14HsFfMD4atCYIremxSHO2whOwvOUVtBqX/NuKzxm9+Mbu7GDuJ/j +tC2+0lcxytTibjK0+5PYNAoFp4jsX1qQ+Fxe6NN5b/71QjBTUFuXNFzWBgWdnzYW2Q5r4Fpt+GFv +XUWBbxrkqUiHWOvlUaullgpN8I7JbOB4WwOD0r3EsTxO1OBSkZizFUH44oIaiVQfXXVMRxnVVQLC +MKGGR4p0OmH9I0PXldqQPMtVKTDxgryNgXQoKFB83IPOcH7akfgh3W3zFYjohm7DvKXa9ydGaTDV +1jmCHtjjhPvz7Qv4rY1Gtr/FcPADFkCpN44d29RQ3D3ThxJoP1wsMzYeLMkS3G4zomWHOXO34XA5 +08BZtij4gv553TrFu0tktdgpF7FRlUOOBXL3dXKFvzRQ3E5/WwuxEAr/Y3CZiVmgAAAAAQAFWC41 +MDkAAAMbMIIDFzCCAf8CBD8+0BswDQYJKoZIhvcNAQEFBQAwUDELMAkGA1UEBhMCVVMxETAPBgNV +BAoTCEphdmFTb2Z0MRUwEwYDVQQLEwxTZWN1cml0eSBTUUUxFzAVBgNVBAMTDlBLQ1MxMiBUZXN0 +IENBMB4XDTAzMDgxNzAwNDUxNVoXDTEzMDgxNDAwNDUxNVowUDELMAkGA1UEBhMCVVMxETAPBgNV +BAoTCEphdmFTb2Z0MRUwEwYDVQQLEwxTZWN1cml0eSBTUUUxFzAVBgNVBAMTDlBLQ1MxMiBUZXN0 +IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsFJYAnaFn02/LypHxXyGxS/WKC5e +7PzEpjXzQ4pqWEDBr8U+GmOB+4oB755HkEpXBB6J34mlfRpN5RjUnegD/cK1qW2o//7rIkt8XwKy +fHAdzAo5M0k75mJMlpp1uhDwY9BOUVAH9HB26Rv5cdTeTGP1Bp6KOry7pI9z5YgYsNgsZ7aKZgzX +cakSxP+Kh9BnpWNN9J5JxbsxY0nkEEPyIPCD7kn4TYDAdmfCt/zkJz49mdP3BWaQtvZSM9yFSb3K +P9Xf6bj2DLT3M8AdRDi2yWpd7K68rSgFbz21Sa7mCr/35hgQogrVeSUtlKkyREG+rDRT0VncXL8R +uZPQOw2oAwIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQBmyf+CNJK0YsQ9ckYhXDBiafOF3n9MAG4I +821xWdCWnQ2YUIlybCpW6jEkL+jFtfDCt1EYaGvWPMHR181YONJUf4MVtaE4ynq1pvDLLJ/1i+VM +8zCc3lfm9mQDnqap0MBRVJzD3uHceCxG2bZTH2W4N16MEWU6ANmRJEXJfRWB1rPbb0lQMIEx8CJE +IPxVPYg3enRjxx0Ciq3wfEKmhKCRyLE8tcR40aFkLReumxSI85fXsXEtIOD1A6+OKC32fYzSvwNK +hIdVt/9sIgMOgVQbEXM0rAJgayfPulQyB19OZWUUg+zVMDjgudV6cWRRz/V+0U7Ajq3IZOsE5PtU +FgNW1MI40XfEdWafFXeJ+yQTHPyoNdk= \ No newline at end of file From ea89dad13c66dd74e24676324470354914e080c7 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Thu, 4 Dec 2014 07:15:37 -0800 Subject: [PATCH 154/159] 8057020: LambdaForm caches should support eviction Reviewed-by: psandoz, jrose, shade --- .../classes/java/lang/invoke/LambdaForm.java | 2 +- .../java/lang/invoke/LambdaFormBuffer.java | 15 +++--- .../java/lang/invoke/LambdaFormEditor.java | 52 +++++++++++++++---- .../java/lang/invoke/MethodTypeForm.java | 43 +++++++++------ .../invoke/LFCaching/LFCachingTestCase.java | 17 +++--- .../invoke/LFCaching/LambdaFormTestCase.java | 20 ++++++- 6 files changed, 106 insertions(+), 43 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java index e1791719c0d..2129f8618bd 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java @@ -125,7 +125,7 @@ class LambdaForm { MemberName vmentry; // low-level behavior, or null if not yet prepared private boolean isCompiled; - Object transformCache; // managed by LambdaFormEditor + volatile Object transformCache; // managed by LambdaFormEditor public static final int VOID_RESULT = -1, LAST_RESULT = -2; diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java index 872a2a59921..cdc88be3250 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java @@ -46,19 +46,16 @@ final class LambdaFormBuffer { private static final int F_TRANS = 0x10, F_OWNED = 0x03; LambdaFormBuffer(LambdaForm lf) { - this(lf.arity, lf.names, lf.result); + this.arity = lf.arity; + setNames(lf.names); + int result = lf.result; + if (result == LAST_RESULT) result = length - 1; + if (result >= 0 && lf.names[result].type != V_TYPE) + resultName = lf.names[result]; debugName = lf.debugName; assert(lf.nameRefsAreLegal()); } - private LambdaFormBuffer(int arity, Name[] names, int result) { - this.arity = arity; - setNames(names); - if (result == LAST_RESULT) result = length - 1; - if (result >= 0 && names[result].type != V_TYPE) - resultName = names[result]; - } - private LambdaForm lambdaForm() { assert(!inTrans()); // need endEdit call to tidy things up return new LambdaForm(debugName, arity, nameArray(), resultIndex()); diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java index 1c29d73b4cc..1c23e94995a 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java @@ -25,6 +25,7 @@ package java.lang.invoke; +import java.lang.ref.SoftReference; import java.util.Arrays; import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.LambdaForm.BasicType.*; @@ -58,10 +59,9 @@ class LambdaFormEditor { * The sequence is unterminated, ending with an indefinite number of zero bytes. * Sequences that are simple (short enough and with small enough values) pack into a 64-bit long. */ - private static final class Transform { + private static final class Transform extends SoftReference { final long packedBytes; final byte[] fullBytes; - final LambdaForm result; // result of transform, or null, if there is none available private enum Kind { NO_KIND, // necessary because ordinal must be greater than zero @@ -140,9 +140,9 @@ class LambdaFormEditor { Kind kind() { return Kind.values()[byteAt(0)]; } private Transform(long packedBytes, byte[] fullBytes, LambdaForm result) { + super(result); this.packedBytes = packedBytes; this.fullBytes = fullBytes; - this.result = result; } private Transform(long packedBytes) { this(packedBytes, null, null); @@ -243,6 +243,7 @@ class LambdaFormEditor { buf.append("unpacked"); buf.append(Arrays.toString(fullBytes)); } + LambdaForm result = get(); if (result != null) { buf.append(" result="); buf.append(result); @@ -253,7 +254,7 @@ class LambdaFormEditor { /** Find a previously cached transform equivalent to the given one, and return its result. */ private LambdaForm getInCache(Transform key) { - assert(key.result == null); + assert(key.get() == null); // The transformCache is one of null, Transform, Transform[], or ConcurrentHashMap. Object c = lambdaForm.transformCache; Transform k = null; @@ -276,7 +277,7 @@ class LambdaFormEditor { } } assert(k == null || key.equals(k)); - return k == null ? null : k.result; + return (k != null) ? k.get() : null; } /** Arbitrary but reasonable limits on Transform[] size for cache. */ @@ -293,7 +294,17 @@ class LambdaFormEditor { @SuppressWarnings("unchecked") ConcurrentHashMap m = (ConcurrentHashMap) c; Transform k = m.putIfAbsent(key, key); - return k != null ? k.result : form; + if (k == null) return form; + LambdaForm result = k.get(); + if (result != null) { + return result; + } else { + if (m.replace(key, k, key)) { + return form; + } else { + continue; + } + } } assert(pass == 0); synchronized (lambdaForm) { @@ -308,17 +319,27 @@ class LambdaFormEditor { if (c instanceof Transform) { Transform k = (Transform)c; if (k.equals(key)) { - return k.result; + LambdaForm result = k.get(); + if (result == null) { + lambdaForm.transformCache = key; + return form; + } else { + return result; + } + } else if (k.get() == null) { // overwrite stale entry + lambdaForm.transformCache = key; + return form; } // expand one-element cache to small array ta = new Transform[MIN_CACHE_ARRAY_SIZE]; ta[0] = k; - lambdaForm.transformCache = c = ta; + lambdaForm.transformCache = ta; } else { // it is already expanded ta = (Transform[])c; } int len = ta.length; + int stale = -1; int i; for (i = 0; i < len; i++) { Transform k = ta[i]; @@ -326,10 +347,18 @@ class LambdaFormEditor { break; } if (k.equals(key)) { - return k.result; + LambdaForm result = k.get(); + if (result == null) { + ta[i] = key; + return form; + } else { + return result; + } + } else if (stale < 0 && k.get() == null) { + stale = i; // remember 1st stale entry index } } - if (i < len) { + if (i < len || stale >= 0) { // just fall through to cache update } else if (len < MAX_CACHE_ARRAY_SIZE) { len = Math.min(len * 2, MAX_CACHE_ARRAY_SIZE); @@ -344,7 +373,8 @@ class LambdaFormEditor { // The second iteration will update for this query, concurrently. continue; } - ta[i] = key; + int idx = (stale >= 0) ? stale : i; + ta[idx] = key; return form; } } diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java index 6733e29ef93..bcf16dba9db 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java @@ -26,9 +26,8 @@ package java.lang.invoke; import sun.invoke.util.Wrapper; +import java.lang.ref.SoftReference; import static java.lang.invoke.MethodHandleStatics.*; -import static java.lang.invoke.MethodHandleNatives.Constants.*; - import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; /** * Shared information for a group of method types, which differ @@ -51,7 +50,7 @@ final class MethodTypeForm { final MethodType basicType; // the canonical erasure, with primitives simplified // Cached adapter information: - @Stable final MethodHandle[] methodHandles; + @Stable final SoftReference[] methodHandles; // Indexes into methodHandles: static final int MH_BASIC_INV = 0, // cached instance of MH.invokeBasic @@ -60,7 +59,7 @@ final class MethodTypeForm { MH_LIMIT = 3; // Cached lambda form information, for basic types only: - final @Stable LambdaForm[] lambdaForms; + final @Stable SoftReference[] lambdaForms; // Indexes into lambdaForms: static final int LF_INVVIRTUAL = 0, // DMH invokeVirtual @@ -108,26 +107,40 @@ final class MethodTypeForm { public MethodHandle cachedMethodHandle(int which) { assert(assertIsBasicType()); - return methodHandles[which]; + SoftReference entry = methodHandles[which]; + return (entry != null) ? entry.get() : null; } synchronized public MethodHandle setCachedMethodHandle(int which, MethodHandle mh) { // Simulate a CAS, to avoid racy duplication of results. - MethodHandle prev = methodHandles[which]; - if (prev != null) return prev; - return methodHandles[which] = mh; + SoftReference entry = methodHandles[which]; + if (entry != null) { + MethodHandle prev = entry.get(); + if (prev != null) { + return prev; + } + } + methodHandles[which] = new SoftReference<>(mh); + return mh; } public LambdaForm cachedLambdaForm(int which) { assert(assertIsBasicType()); - return lambdaForms[which]; + SoftReference entry = lambdaForms[which]; + return (entry != null) ? entry.get() : null; } synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) { // Simulate a CAS, to avoid racy duplication of results. - LambdaForm prev = lambdaForms[which]; - if (prev != null) return prev; - return lambdaForms[which] = form; + SoftReference entry = lambdaForms[which]; + if (entry != null) { + LambdaForm prev = entry.get(); + if (prev != null) { + return prev; + } + } + lambdaForms[which] = new SoftReference<>(form); + return form; } /** @@ -135,6 +148,7 @@ final class MethodTypeForm { * This MTF will stand for that type and all un-erased variations. * Eagerly compute some basic properties of the type, common to all variations. */ + @SuppressWarnings({"rawtypes", "unchecked"}) protected MethodTypeForm(MethodType erasedType) { this.erasedType = erasedType; @@ -234,8 +248,8 @@ final class MethodTypeForm { // Initialize caches, but only for basic types assert(basicType == erasedType); - this.lambdaForms = new LambdaForm[LF_LIMIT]; - this.methodHandles = new MethodHandle[MH_LIMIT]; + this.lambdaForms = new SoftReference[LF_LIMIT]; + this.methodHandles = new SoftReference[MH_LIMIT]; } private static long pack(int a, int b, int c, int d) { @@ -409,5 +423,4 @@ final class MethodTypeForm { public String toString() { return "Form"+erasedType; } - } diff --git a/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java b/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java index 30ba39ac2e0..50a57e40c67 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java +++ b/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java @@ -63,12 +63,17 @@ public abstract class LFCachingTestCase extends LambdaFormTestCase { } if (lambdaForm0 != lambdaForm1) { - System.err.println("Lambda form 0 toString is:"); - System.err.println(lambdaForm0); - System.err.println("Lambda form 1 toString is:"); - System.err.println(lambdaForm1); - throw new AssertionError("Error: Lambda forms of the two method handles" - + " are not the same. LF cahing does not work"); + // Since LambdaForm caches are based on SoftReferences, GC can cause element eviction. + if (noGCHappened()) { + System.err.println("Lambda form 0 toString is:"); + System.err.println(lambdaForm0); + System.err.println("Lambda form 1 toString is:"); + System.err.println(lambdaForm1); + throw new AssertionError("Error: Lambda forms of the two method handles" + + " are not the same. LF cahing does not work"); + } else { + System.err.println("LambdaForms differ, but there was a GC in between. Ignore the failure."); + } } } catch (IllegalAccessException | IllegalArgumentException | SecurityException | InvocationTargetException ex) { diff --git a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java index a1821fa696f..94722cf72df 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java +++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java @@ -23,9 +23,12 @@ import com.oracle.testlibrary.jsr292.Helper; import com.sun.management.HotSpotDiagnosticMXBean; + +import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; import java.lang.reflect.Method; import java.util.Collection; +import java.util.List; import java.util.function.Function; import jdk.testlibrary.Utils; @@ -49,6 +52,11 @@ public abstract class LambdaFormTestCase { * used to get a lambda form from a method handle. */ protected final static Method INTERNAL_FORM; + private static final List gcInfo; + + private static long gcCount() { + return gcInfo.stream().mapToLong(GarbageCollectorMXBean::getCollectionCount).sum(); + } static { try { @@ -58,10 +66,15 @@ public abstract class LambdaFormTestCase { } catch (Exception ex) { throw new Error("Unexpected exception: ", ex); } + + gcInfo = ManagementFactory.getGarbageCollectorMXBeans(); + if (gcInfo.size() == 0) { + throw new Error("No GarbageCollectorMXBeans found."); + } } private final TestMethods testMethod; - + private long gcCountAtStart; /** * Test case constructor. Generates test cases with random method types for * given methods form {@code j.l.i.MethodHandles} class. @@ -71,12 +84,17 @@ public abstract class LambdaFormTestCase { */ protected LambdaFormTestCase(TestMethods testMethod) { this.testMethod = testMethod; + this.gcCountAtStart = gcCount(); } public TestMethods getTestMethod() { return testMethod; } + protected boolean noGCHappened() { + return gcCount() == gcCountAtStart; + } + /** * Routine that executes a test case. */ From a7f3e3cfde56649370c6148061822c6f981c57f1 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 4 Dec 2014 12:58:11 -0800 Subject: [PATCH 155/159] Added tag jdk9-b41 for changeset adc258b13e2c --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index c82cee08402..3bd77e9484b 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -283,3 +283,4 @@ c173ba994245380fb11ef077d1e59823386840eb jdk9-b35 d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38 512dbbeb1730edcebfec873fc3f1455660b32000 jdk9-b39 cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40 +67395f7ca2db3b52e3a62a84888487de5cb9210a jdk9-b41 From 7ef6f7a8689f1343635778c2f0e9be9b927d6ba5 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 4 Dec 2014 12:58:13 -0800 Subject: [PATCH 156/159] Added tag jdk9-b41 for changeset 47f369e3c69c --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index acafa28f373..159c2223842 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -443,3 +443,4 @@ b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37 c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38 9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39 6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40 +1d29b13e8a515a7ea3b882f140576d5d675bc11f jdk9-b41 From c64dd540f965dbc602e157328474643e0b65f7f7 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 4 Dec 2014 12:58:17 -0800 Subject: [PATCH 157/159] Added tag jdk9-b41 for changeset 729f9700483a --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 06eb73ce7da..ce5d84d50b5 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -283,3 +283,4 @@ cdcf2e599e42935c2d1d19a24bb19e808aeb43b5 jdk9-b36 d2d745313c81d1fc01f426983b9f784ab1f750e8 jdk9-b38 ca6edf957fe1c6ea818530b503578e872cea7239 jdk9-b39 f1ed1540da70a066527fd043413107e47721edbf jdk9-b40 +e336cbd8b15e959e70ed02f0f5e93fa76ebd4c07 jdk9-b41 From 4edac8c9d28e82272c29946d8ac1a7acff3a84f1 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 4 Dec 2014 12:59:43 -0800 Subject: [PATCH 158/159] 8066617: Suppress deprecation warnings in java.base module Reviewed-by: lancea --- .../classes/com/sun/crypto/provider/PBES2Parameters.java | 3 +++ .../share/classes/com/sun/crypto/provider/RSACipher.java | 2 ++ .../com/sun/crypto/provider/TlsKeyMaterialGenerator.java | 3 +++ .../com/sun/crypto/provider/TlsMasterSecretGenerator.java | 5 ++++- .../classes/com/sun/crypto/provider/TlsPrfGenerator.java | 2 ++ .../crypto/provider/TlsRsaPremasterSecretGenerator.java | 2 ++ .../share/classes/com/sun/net/ssl/SSLSecurity.java | 8 ++++++++ .../www/protocol/https/DelegateHttpsURLConnection.java | 5 ++++- .../www/protocol/https/HttpsURLConnectionOldImpl.java | 1 + .../java.base/share/classes/java/util/jar/Attributes.java | 3 +++ .../java.base/share/classes/java/util/jar/Manifest.java | 1 + jdk/src/java.base/share/classes/java/util/zip/CRC32C.java | 1 + .../share/classes/sun/net/idn/UCharacterDirection.java | 1 + .../share/classes/sun/security/ssl/HandshakeMessage.java | 1 + .../share/classes/sun/security/ssl/Handshaker.java | 2 ++ .../classes/sun/security/ssl/RSAClientKeyExchange.java | 2 ++ .../share/classes/sun/security/ssl/RSASignature.java | 3 +++ .../sun/text/normalizer/RuleCharacterIterator.java | 1 + .../share/classes/sun/text/normalizer/UnicodeSet.java | 1 + 19 files changed, 45 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java index fd6abe3f0bd..946df0c3bc3 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java @@ -253,6 +253,7 @@ abstract class PBES2Parameters extends AlgorithmParametersSpi { this.cipherParam = ((PBEParameterSpec)paramSpec).getParameterSpec(); } + @SuppressWarnings("deprecation") protected void engineInit(byte[] encoded) throws IOException { @@ -290,6 +291,7 @@ abstract class PBES2Parameters extends AlgorithmParametersSpi { .append(kdfAlgo).append("And").append(cipherAlgo).toString(); } + @SuppressWarnings("deprecation") private String parseKDF(DerValue keyDerivationFunc) throws IOException { String kdfAlgo = null; @@ -351,6 +353,7 @@ abstract class PBES2Parameters extends AlgorithmParametersSpi { return kdfAlgo; } + @SuppressWarnings("deprecation") private String parseES(DerValue encryptionScheme) throws IOException { String cipherAlgo = null; diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java index d1d8cf3ef23..0ce3358aaad 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java @@ -243,6 +243,7 @@ public final class RSACipher extends CipherSpi { } // initialize this cipher + @SuppressWarnings("deprecation") private void init(int opmode, Key key, SecureRandom random, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException { @@ -424,6 +425,7 @@ public final class RSACipher extends CipherSpi { } // see JCE spec + @SuppressWarnings("deprecation") protected Key engineUnwrap(byte[] wrappedKey, String algorithm, int type) throws InvalidKeyException, NoSuchAlgorithmException { if (wrappedKey.length > buffer.length) { diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java index 61990d3bf2b..bd08e710bee 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java @@ -46,6 +46,7 @@ public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi { private final static String MSG = "TlsKeyMaterialGenerator must be " + "initialized using a TlsKeyMaterialParameterSpec"; + @SuppressWarnings("deprecation") private TlsKeyMaterialParameterSpec spec; private int protocolVersion; @@ -57,6 +58,7 @@ public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi { throw new InvalidParameterException(MSG); } + @SuppressWarnings("deprecation") protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsKeyMaterialParameterSpec == false) { @@ -91,6 +93,7 @@ public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi { } } + @SuppressWarnings("deprecation") private SecretKey engineGenerateKey0() throws GeneralSecurityException { byte[] masterSecret = spec.getMasterSecret().getEncoded(); diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java index 0efa0aef9bf..b0527026757 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java @@ -46,6 +46,7 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi { private final static String MSG = "TlsMasterSecretGenerator must be " + "initialized using a TlsMasterSecretParameterSpec"; + @SuppressWarnings("deprecation") private TlsMasterSecretParameterSpec spec; private int protocolVersion; @@ -57,6 +58,7 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi { throw new InvalidParameterException(MSG); } + @SuppressWarnings("deprecation") protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsMasterSecretParameterSpec == false) { @@ -139,7 +141,8 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi { } } - private static final class TlsMasterSecretKey implements TlsMasterSecret { + @SuppressWarnings("deprecation") + private static final class TlsMasterSecretKey implements TlsMasterSecret { private static final long serialVersionUID = 1019571680375368880L; private byte[] key; diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java index f09b7d875de..0461523dec3 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java @@ -112,6 +112,7 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi { private final static String MSG = "TlsPrfGenerator must be " + "initialized using a TlsPrfParameterSpec"; + @SuppressWarnings("deprecation") private TlsPrfParameterSpec spec; public TlsPrfGenerator() { @@ -121,6 +122,7 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi { throw new InvalidParameterException(MSG); } + @SuppressWarnings("deprecation") protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java index 2a25cb64d5c..c4fc8364584 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java @@ -44,6 +44,7 @@ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi { private final static String MSG = "TlsRsaPremasterSecretGenerator must be " + "initialized using a TlsRsaPremasterSecretParameterSpec"; + @SuppressWarnings("deprecation") private TlsRsaPremasterSecretParameterSpec spec; private SecureRandom random; @@ -54,6 +55,7 @@ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi { throw new InvalidParameterException(MSG); } + @SuppressWarnings("deprecation") protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) { diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java index dd7320b394c..664b53e0489 100644 --- a/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java +++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java @@ -276,6 +276,7 @@ final class SSLSecurity { * object. This also mean that anything going down into the SPI * needs to be wrapped, as well as anything coming back up. */ +@SuppressWarnings("deprecation") final class SSLContextSpiWrapper extends SSLContextSpi { private javax.net.ssl.SSLContext theSSLContext; @@ -285,6 +286,7 @@ final class SSLContextSpiWrapper extends SSLContextSpi { theSSLContext = javax.net.ssl.SSLContext.getInstance(algName, prov); } + @SuppressWarnings("deprecation") protected void engineInit(KeyManager[] kma, TrustManager[] tma, SecureRandom sr) throws KeyManagementException { @@ -387,6 +389,7 @@ final class SSLContextSpiWrapper extends SSLContextSpi { } +@SuppressWarnings("deprecation") final class TrustManagerFactorySpiWrapper extends TrustManagerFactorySpi { private javax.net.ssl.TrustManagerFactory theTrustManagerFactory; @@ -438,6 +441,7 @@ final class TrustManagerFactorySpiWrapper extends TrustManagerFactorySpi { } +@SuppressWarnings("deprecation") final class KeyManagerFactorySpiWrapper extends KeyManagerFactorySpi { private javax.net.ssl.KeyManagerFactory theKeyManagerFactory; @@ -493,6 +497,7 @@ final class KeyManagerFactorySpiWrapper extends KeyManagerFactorySpi { // ================================= +@SuppressWarnings("deprecation") final class X509KeyManagerJavaxWrapper implements javax.net.ssl.X509KeyManager { @@ -590,6 +595,7 @@ final class X509KeyManagerJavaxWrapper implements } } +@SuppressWarnings("deprecation") final class X509TrustManagerJavaxWrapper implements javax.net.ssl.X509TrustManager { @@ -622,6 +628,7 @@ final class X509TrustManagerJavaxWrapper implements } } +@SuppressWarnings("deprecation") final class X509KeyManagerComSunWrapper implements X509KeyManager { private javax.net.ssl.X509KeyManager theX509KeyManager; @@ -657,6 +664,7 @@ final class X509KeyManagerComSunWrapper implements X509KeyManager { } } +@SuppressWarnings("deprecation") final class X509TrustManagerComSunWrapper implements X509TrustManager { private javax.net.ssl.X509TrustManager theX509TrustManager; diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java index a068367f343..3c05c37a037 100644 --- a/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java +++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java @@ -53,6 +53,7 @@ import sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection; * com.sun.net.ssl.HttpURLConnection is used in the com.sun version. * */ +@SuppressWarnings("deprecation") // HttpsURLConnection is deprecated public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnection { // we need a reference to the HttpsURLConnection to get @@ -62,6 +63,7 @@ public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnecti // this is for ResponseCache.put(URI, URLConnection) // second parameter needs to be cast to javax.net.ssl.HttpsURLConnection // instead of AbstractDelegateHttpsURLConnection + public com.sun.net.ssl.HttpsURLConnection httpsURLConnection; DelegateHttpsURLConnection(URL url, @@ -98,9 +100,10 @@ public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnecti } class VerifierWrapper implements javax.net.ssl.HostnameVerifier { - + @SuppressWarnings("deprecation") private com.sun.net.ssl.HostnameVerifier verifier; + @SuppressWarnings("deprecation") VerifierWrapper(com.sun.net.ssl.HostnameVerifier verifier) { this.verifier = verifier; } diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java index 07237569fbe..fba0b3befce 100644 --- a/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java +++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java @@ -64,6 +64,7 @@ import sun.net.www.http.HttpClient; // For both copies of the file, uncomment one line and comment the other // public class HttpsURLConnectionImpl // extends javax.net.ssl.HttpsURLConnection { +@SuppressWarnings("deprecation") // HttpsURLConnection is deprecated public class HttpsURLConnectionOldImpl extends com.sun.net.ssl.HttpsURLConnection { diff --git a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java index 3140deef6a9..655f5df9e78 100644 --- a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java +++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java @@ -298,6 +298,7 @@ public class Attributes implements Map, Cloneable { * Writes the current attributes to the specified data output stream. * XXX Need to handle UTF8 values and break up lines longer than 72 bytes */ + @SuppressWarnings("deprecation") void write(DataOutputStream os) throws IOException { for (Entry e : entrySet()) { StringBuffer buffer = new StringBuffer( @@ -325,6 +326,7 @@ public class Attributes implements Map, Cloneable { * * XXX Need to handle UTF8 values and break up lines longer than 72 bytes */ + @SuppressWarnings("deprecation") void writeMain(DataOutputStream out) throws IOException { // write out the *-Version header first, if it exists @@ -367,6 +369,7 @@ public class Attributes implements Map, Cloneable { * Reads attributes from the specified input stream. * XXX Need to handle UTF8 values. */ + @SuppressWarnings("deprecation") void read(Manifest.FastInputStream is, byte[] lbuf) throws IOException { String name = null, value = null; byte[] lastline = null; diff --git a/jdk/src/java.base/share/classes/java/util/jar/Manifest.java b/jdk/src/java.base/share/classes/java/util/jar/Manifest.java index 75a7512945e..90c9e99595f 100644 --- a/jdk/src/java.base/share/classes/java/util/jar/Manifest.java +++ b/jdk/src/java.base/share/classes/java/util/jar/Manifest.java @@ -143,6 +143,7 @@ public class Manifest implements Cloneable { * @exception IOException if an I/O error has occurred * @see #getMainAttributes */ + @SuppressWarnings("deprecation") public void write(OutputStream out) throws IOException { DataOutputStream dos = new DataOutputStream(out); // Write out the main attributes for the manifest diff --git a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java index 251e3042800..f7e9773e0ea 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java +++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java @@ -204,6 +204,7 @@ public final class CRC32C implements Checksum { /** * Updates the CRC-32C checksum with the specified array of bytes. */ + @SuppressWarnings("deprecation") // Unsafe.{getInt, getLong} private static int updateBytes(int crc, byte[] b, int off, int end) { // Do only byte reads for arrays so short they can't be aligned diff --git a/jdk/src/java.base/share/classes/sun/net/idn/UCharacterDirection.java b/jdk/src/java.base/share/classes/sun/net/idn/UCharacterDirection.java index 4b55bab7618..957cfdbed81 100644 --- a/jdk/src/java.base/share/classes/sun/net/idn/UCharacterDirection.java +++ b/jdk/src/java.base/share/classes/sun/net/idn/UCharacterDirection.java @@ -46,6 +46,7 @@ package sun.net.idn; * @stable ICU 2.1 */ +@SuppressWarnings("deprecation") final class UCharacterDirection implements UCharacterEnums.ECharacterDirection { // private constructor ========================================= diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java index f9926b3ab66..c7257e52e9c 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java @@ -1963,6 +1963,7 @@ static final class Finished extends HandshakeMessage { * algorithm. If we ever run across a different * length, this call will need to be updated. */ + @SuppressWarnings("deprecation") TlsPrfParameterSpec spec = new TlsPrfParameterSpec( masterKey, tlsLabel, seed, 12, prfHashAlg, prfHashLength, prfBlockSize); diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java index 80c2a518c1b..12d3247cf44 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java @@ -1122,6 +1122,7 @@ abstract class Handshaker { int prfHashLength = prf.getPRFHashLength(); int prfBlockSize = prf.getPRFBlockSize(); + @SuppressWarnings("deprecation") TlsMasterSecretParameterSpec spec = new TlsMasterSecretParameterSpec( preMasterSecret, protocolVersion.major, protocolVersion.minor, clnt_random.random_bytes, svr_random.random_bytes, @@ -1156,6 +1157,7 @@ abstract class Handshaker { * a premaster secret and started a new session) as well as on the * "fast handshake" (where we just resumed a pre-existing session). */ + @SuppressWarnings("deprecation") void calculateConnectionKeys(SecretKey masterKey) { /* * For both the read and write sides of the protocol, we use the diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java index c1c53def81e..a647cfda785 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java @@ -63,6 +63,7 @@ final class RSAClientKeyExchange extends HandshakeMessage { * it, using its RSA private key. Result is the same size as the * server's public key, and uses PKCS #1 block format 02. */ + @SuppressWarnings("deprecation") RSAClientKeyExchange(ProtocolVersion protocolVersion, ProtocolVersion maxVersion, SecureRandom generator, PublicKey publicKey) throws IOException { @@ -92,6 +93,7 @@ final class RSAClientKeyExchange extends HandshakeMessage { * Server gets the PKCS #1 (block format 02) data, decrypts * it with its private key. */ + @SuppressWarnings("deprecation") RSAClientKeyExchange(ProtocolVersion currentVersion, ProtocolVersion maxVersion, SecureRandom generator, HandshakeInStream input, diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/RSASignature.java b/jdk/src/java.base/share/classes/sun/security/ssl/RSASignature.java index 94a1e8ecede..5c37e57bdde 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/RSASignature.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSASignature.java @@ -83,6 +83,7 @@ public final class RSASignature extends SignatureSpi { /** * Set the MD5 and SHA hashes to the provided objects. */ + @SuppressWarnings("deprecation") static void setHashes(Signature sig, MessageDigest md5, MessageDigest sha) { sig.setParameter("hashes", new MessageDigest[] {md5, sha}); } @@ -183,6 +184,7 @@ public final class RSASignature extends SignatureSpi { } @Override + @SuppressWarnings("deprecation") protected void engineSetParameter(String param, Object value) throws InvalidParameterException { if (param.equals("hashes") == false) { @@ -199,6 +201,7 @@ public final class RSASignature extends SignatureSpi { } @Override + @SuppressWarnings("deprecation") protected Object engineGetParameter(String param) throws InvalidParameterException { throw new InvalidParameterException("Parameters not supported"); diff --git a/jdk/src/java.base/share/classes/sun/text/normalizer/RuleCharacterIterator.java b/jdk/src/java.base/share/classes/sun/text/normalizer/RuleCharacterIterator.java index e0ea1b12513..029ceecb5e5 100644 --- a/jdk/src/java.base/share/classes/sun/text/normalizer/RuleCharacterIterator.java +++ b/jdk/src/java.base/share/classes/sun/text/normalizer/RuleCharacterIterator.java @@ -54,6 +54,7 @@ import java.text.ParsePosition; * @author Alan Liu * @since ICU 2.8 */ +@SuppressWarnings("deprecation") public class RuleCharacterIterator { // TODO: Ideas for later. (Do not implement if not needed, lest the diff --git a/jdk/src/java.base/share/classes/sun/text/normalizer/UnicodeSet.java b/jdk/src/java.base/share/classes/sun/text/normalizer/UnicodeSet.java index 0243fe3f6f6..a1784652be8 100644 --- a/jdk/src/java.base/share/classes/sun/text/normalizer/UnicodeSet.java +++ b/jdk/src/java.base/share/classes/sun/text/normalizer/UnicodeSet.java @@ -273,6 +273,7 @@ import java.util.TreeSet; * @stable ICU 2.0 * @see UnicodeSetIterator */ +@SuppressWarnings("deprecation") public class UnicodeSet implements UnicodeMatcher { private static final int LOW = 0x000000; // LOW <= all valid values. ZERO for codepoints From 61cf03f4f1e93e1a3066fc7571a089e900a6443a Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 4 Dec 2014 15:04:11 -0800 Subject: [PATCH 159/159] 8066632: Suppress deprecation warnings in java.rmi module Reviewed-by: rriggs --- .../java.rmi/share/classes/java/rmi/server/RemoteObject.java | 3 ++- .../java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java | 3 ++- .../share/classes/sun/rmi/server/MarshalOutputStream.java | 3 ++- .../share/classes/sun/rmi/transport/proxy/HttpInputStream.java | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java b/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java index c504692f1bf..86967ebd8da 100644 --- a/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java +++ b/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -94,6 +94,7 @@ public abstract class RemoteObject implements Remote, java.io.Serializable { * remote object could not be found. * @since 1.2 */ + @SuppressWarnings("deprecation") public static Remote toStub(Remote obj) throws NoSuchObjectException { if (obj instanceof RemoteStub || (obj != null && diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java b/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java index f8280552071..37451a36eaf 100644 --- a/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java +++ b/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -336,6 +336,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer * Main program to start a registry.
    * The port number can be specified on the command line. */ + @SuppressWarnings("deprecation") public static void main(String args[]) { // Create and install the security manager if one is not installed diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java b/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java index 699f1107259..33d216b09a2 100644 --- a/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java +++ b/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -76,6 +76,7 @@ public class MarshalOutputStream extends ObjectOutputStream * Checks for objects that are instances of java.rmi.Remote * that need to be serialized as proxy objects. */ + @SuppressWarnings("deprecation") protected final Object replaceObject(Object obj) throws IOException { if ((obj instanceof Remote) && !(obj instanceof RemoteStub)) { Target target = ObjectTable.getTarget((Remote) obj); diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/transport/proxy/HttpInputStream.java b/jdk/src/java.rmi/share/classes/sun/rmi/transport/proxy/HttpInputStream.java index 3a35bb02b25..4b5cad95044 100644 --- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/proxy/HttpInputStream.java +++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/proxy/HttpInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -45,6 +45,7 @@ class HttpInputStream extends FilterInputStream { * Create new filter on a given input stream. * @param in the InputStream to filter from */ + @SuppressWarnings("deprecation") public HttpInputStream(InputStream in) throws IOException { super(in);